com.neeve.ods
Class StoreDescriptor

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.ods.OdsObject
          extended by com.neeve.ods.StoreDescriptor

public final class StoreDescriptor
extends OdsObject

Describes a data store.

This class contains information used to describe a data store. It is intended for use by a user when establishing store bindings.

Threading:
This class is not thread safe.

Field Summary
static String PROPNAME_ADDRESS
           
static String PROPNAME_PROVIDER_NAME
           
 
Method Summary
static StoreDescriptor create(String name)
          Create a default store descriptor.
 void delete()
          Delete a store descriptor from the default configuration repository.
 void delete(IConfigRepository repo)
          Delete a store descriptor from the configuration repository.
static boolean exists(IConfigRepository repo, String name)
          Checks if a store is configured in a configuration repository
static boolean exists(String name)
          Checks if a store is configured in the default configuration repository
 IStoreCheckpointingController.Type getCheckpointingType()
          Indicates the type of checkpointing strategy being used.
 long getCheckpointMaxInterval()
          Gets the max time interval (in millis) that can occur before triggering a new checkpoint
 int getCheckpointThreshold()
          Gets the number of store operations that can occur before triggering a new checkpoint based on getCheckpointingType()
 boolean getFailOnMultiplePrimaries()
          Get if a store will fail if it detects multiple primaries.
 int getInterClusterReplicationQuorum()
          Get a store's inter-cluster replication quorum.
 String getInterClusterReplicator()
          Get the name of a store's inter-cluster replicator (ICR).
 int getMaxInterClusterReplicationSyncBacklog()
          Get a store's max inter-cluster replication sync backlog.
 int getMaxPersistSyncBacklog()
          Get a store's max persist sync backlog.
 String getName()
          Get the name of the store that this descriptor describes.
 int getPersistenceQuorum()
          Get a store's persistence quorum.
 String getPersister()
          Get the name of a store's persister.
 Properties getProviderConfig()
          Get the provider configuration property table
static StoreDescriptor load(IConfigRepository repo, String name)
          Create a store descriptor from a configuration respository.
 Properties load(Properties props)
          Load a store descriptor's properties from a property table.
static StoreDescriptor load(String name)
          Create a store descriptor from the default configuration respository.
static Set<StoreDescriptor> loadAll()
          Create store descriptors for all stores configured in the default configuration repository.
static Set<StoreDescriptor> loadAll(IConfigRepository repo)
          Create store descriptors for all stores in a configuration repository.
 void save()
          Save a store descriptor to the default configuration repository.
 void save(IConfigRepository repo)
          Save a store descriptor to a configuration repository.
 Properties save(Properties props)
          Save a store descriptor to a property table.
 void setCheckpointingType(IStoreCheckpointingController.Type val)
          Indicates the checkpointing strategy/type to be used.
 void setCheckpointMaxInterval(long checkpointMaxInterval)
          Sets the max time interval (in millis) that can occur before triggering a new checkpoint.
 void setCheckpointThreshold(int checkpointThreshold)
          Sets the number of store operations that can occur before triggering a new checkpoint.
 StoreDescriptor setFailOnMultiplePrimaries(boolean val)
          Set whether a store should fail on detecting multiple primaries.
 StoreDescriptor setInterClusterReplicationQuorum(int quorum)
          Set a store's inter-cluster replication (IRCE) quorum.
 StoreDescriptor setInterClusterReplicator(String icrName)
          Set the name of a store's inter-cluster replicator (ICR).
 StoreDescriptor setMaxInterClusterReplicationSyncBacklog(int backlog)
          Set a store's max inter-cluster replication (ICR) sync backlog.
 StoreDescriptor setMaxPersistSyncBacklog(int backlog)
          Set a store's max persist sync backlog.
 StoreDescriptor setPersistenceQuorum(int quorum)
          Set a store's persistence quorum.
 StoreDescriptor setPersister(String persisterName)
          Set the name of a store's persister.
 StoreDescriptor setProviderConfig(Properties props)
          Set the configuration for the provider specific portion of the store binding that this descriptor describes.
 StoreDescriptor setProviderConfig(String descriptorStr)
          Set a provider configuration from a descriptor string
 String toString()
          Returns a string representation of this object
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPNAME_PROVIDER_NAME

public static final String PROPNAME_PROVIDER_NAME
See Also:
Constant Field Values

PROPNAME_ADDRESS

public static final String PROPNAME_ADDRESS
See Also:
Constant Field Values
Method Detail

getName

public final String getName()
Get the name of the store that this descriptor describes.


setPersister

public final StoreDescriptor setPersister(String persisterName)
Set the name of a store's persister.

Parameters:
persisterName - The name of the persister. A persister of this name should exist in the default repository at runtime from where the ODS store using this descriptor will load the persister descriptor.

getPersister

public final String getPersister()
Get the name of a store's persister.


setPersistenceQuorum

public final StoreDescriptor setPersistenceQuorum(int quorum)
Set a store's persistence quorum.

Parameters:
quorum - The quorum to set. Must be >= 1.

This method set's a store's persistence quorum. The persistence quorum is the minimum number of store members running in a cluster that determines whether persister commits are executed synchronously or not. If the number of members is greater or equal to the quorum, then persistence commits are always performed synchronously. Otherwise, they are persisted asynchronously.

The default persistence quorum is 2.


getPersistenceQuorum

public final int getPersistenceQuorum()
Get a store's persistence quorum.


setMaxPersistSyncBacklog

public final StoreDescriptor setMaxPersistSyncBacklog(int backlog)
Set a store's max persist sync backlog.

Parameters:
backlog - The backlog in seconds.

The default max persist sync backlog is 0 (i.e force sync is off).


getMaxPersistSyncBacklog

public final int getMaxPersistSyncBacklog()
Get a store's max persist sync backlog.


setInterClusterReplicator

public final StoreDescriptor setInterClusterReplicator(String icrName)
Set the name of a store's inter-cluster replicator (ICR).

Parameters:
icrName - The name of the replicator. An ICR of this name should exist in the default repository at runtime from where the ODS store using this descriptor will load the ICR's descriptor.

getInterClusterReplicator

public final String getInterClusterReplicator()
Get the name of a store's inter-cluster replicator (ICR).


setInterClusterReplicationQuorum

public final StoreDescriptor setInterClusterReplicationQuorum(int quorum)
Set a store's inter-cluster replication (IRCE) quorum.

Parameters:
quorum - The quorum to set. Must be >= 1.

This method set's a store's ICR quorum. The ICR quorum is the minimum number of store members running in a cluster that determines whether ICR send commits are executed synchronously or not. If the number of members is greater or equal to the quorum, then ICR commits are always performed synchronously. Otherwise, they are performed asynchronously.

The default ICR quorum is 2.


getInterClusterReplicationQuorum

public final int getInterClusterReplicationQuorum()
Get a store's inter-cluster replication quorum.


setMaxInterClusterReplicationSyncBacklog

public final StoreDescriptor setMaxInterClusterReplicationSyncBacklog(int backlog)
Set a store's max inter-cluster replication (ICR) sync backlog.

Parameters:
backlog - The backlog in seconds.

The default max ICR sync backlog is 0 (i.e force sync is off).


getMaxInterClusterReplicationSyncBacklog

public final int getMaxInterClusterReplicationSyncBacklog()
Get a store's max inter-cluster replication sync backlog.


setFailOnMultiplePrimaries

public final StoreDescriptor setFailOnMultiplePrimaries(boolean val)
Set whether a store should fail on detecting multiple primaries.

Parameters:
val - The value to set.

The default policy is to not not fail on detecting multiple primaries. This means that, if multiple primaries are detected, the primaries will not join the same cluster.

Note: This feature is not currently available. As of now, a primary store member will fail if it detects another primary in its environment trying to join its cluster.


getFailOnMultiplePrimaries

public final boolean getFailOnMultiplePrimaries()
Get if a store will fail if it detects multiple primaries.


setCheckpointingType

public final void setCheckpointingType(IStoreCheckpointingController.Type val)
Indicates the checkpointing strategy/type to be used.

Note: This feature is currently under development and is meant only for use with state replication

Parameters:
val - the type of checkpointing strategy to use

getCheckpointingType

public final IStoreCheckpointingController.Type getCheckpointingType()
Indicates the type of checkpointing strategy being used.

Note: This feature is currently under development and is meant only for use with state replication

Returns:
IStoreCheckpointingController.Type the type of checkpointing strategy being used.

getCheckpointThreshold

public int getCheckpointThreshold()
Gets the number of store operations that can occur before triggering a new checkpoint based on getCheckpointingType()

Returns:
The number of store operations that can occur before a checkpoint is triggered.

setCheckpointThreshold

public void setCheckpointThreshold(int checkpointThreshold)
Sets the number of store operations that can occur before triggering a new checkpoint. The type of store operations to be counted are determined by the checkpointingType set for the store using setCheckpointingType(com.neeve.ods.IStoreCheckpointingController.Type)

Parameters:
checkpointThreshold - The number of store operations that can occur before a checkpoint is triggered.

getCheckpointMaxInterval

public long getCheckpointMaxInterval()
Gets the max time interval (in millis) that can occur before triggering a new checkpoint

Returns:
The max time interval that can pass before a checkpoint is triggered.

setCheckpointMaxInterval

public void setCheckpointMaxInterval(long checkpointMaxInterval)
Sets the max time interval (in millis) that can occur before triggering a new checkpoint.

Parameters:
checkpointMaxInterval - The the max time interval (in millis) that can occur before triggering a new checkpoint.

setProviderConfig

public final StoreDescriptor setProviderConfig(Properties props)
Set the configuration for the provider specific portion of the store binding that this descriptor describes.

Parameters:
props - The properties table that describes the provider configuration. This parameter cannot be null.
Returns:
Returns this object for invocation chaining.

This method sets the configuration for the provider specific portion of a store binding using a property table.


setProviderConfig

public final StoreDescriptor setProviderConfig(String descriptorStr)
Set a provider configuration from a descriptor string

Parameters:
descriptorStr - The descriptor string
Throws:
IllegalArgumentException - Thrown if the descriptor string is null or has invalid format.

Note: Using this method to set provider configuration will clear exsiting provider config properties set by an earlier call to this method or by directly setting the properties in the provider config property table returned by getProviderConfig()


getProviderConfig

public final Properties getProviderConfig()
Get the provider configuration property table


save

public final Properties save(Properties props)
Save a store descriptor to a property table.

Parameters:
props - The property table.
Throws:
IllegalArgumentException - If the properties are null
Threading:
This method is notsafe for concurrent access by multiple threads.

load

public final Properties load(Properties props)
Load a store descriptor's properties from a property table.

Parameters:
props - The property table.
Throws:
IllegalArgumentException - If the properties are null
Threading:
This method is notsafe for concurrent access by multiple threads.

save

public final void save(IConfigRepository repo)
                throws OdsException
Save a store descriptor to a configuration repository.

Parameters:
repo - The root directory of the configuration respository.
Throws:
OdsException - Thrown in case an error in encountered during the saving of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a store descriptor to a configuration repository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered by this class.


save

public final void save()
                throws OdsException
Save a store descriptor to the default configuration repository.

Throws:
OdsException
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a store descriptor to the default configuration respository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered in this class.


delete

public final void delete(IConfigRepository repo)
                  throws OdsException
Delete a store descriptor from the configuration repository.

Parameters:
repo - The configuration respository to delete the descriptor from.
Throws:
OdsException - Thrown in case an error in encountered during the deletion of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method deletes a store descriptor from a configuration repository.


delete

public final void delete()
                  throws OdsException
Delete a store descriptor from the default configuration repository.

Throws:
OdsException - Thrown in case an error in encountered during the deletion of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method permanently deletes a store descriptor from the default configuration repository.


create

public static StoreDescriptor create(String name)
Create a default store descriptor.

Parameters:
name - The name of the store whose descriptor is to be prepared.
Threading:
This method is safe for concurrent access by multiple threads.

exists

public static boolean exists(IConfigRepository repo,
                             String name)
Checks if a store is configured in a configuration repository

Parameters:
repo - The configuration respository to check in.
name - The name of the store to check for.
Threading:
This method is safe for concurrent access by multiple threads.

exists

public static boolean exists(String name)
Checks if a store is configured in the default configuration repository

Parameters:
name - The name of the store to check for.
Threading:
This method is safe for concurrent access by multiple threads.

load

public static StoreDescriptor load(IConfigRepository repo,
                                   String name)
                            throws OdsException
Create a store descriptor from a configuration respository.

Parameters:
repo - The configuration repository from where to load the descriptor.
name - The name of the store whose descriptor is to be prepared.
Throws:
OdsException
Threading:
This method is safe for concurrent access by multiple threads.

load

public static StoreDescriptor load(String name)
                            throws OdsException
Create a store descriptor from the default configuration respository.

Parameters:
name - The name of the store whose descriptor is to be prepared.
Throws:
OdsException
Threading:
This method is safe for concurrent access by multiple threads.

loadAll

public static Set<StoreDescriptor> loadAll(IConfigRepository repo)
                                    throws OdsException
Create store descriptors for all stores in a configuration repository.

Parameters:
repo - The configuration respository from where to create the stores.
Returns:
Returns the set of store descriptors.

This method creates and initializes store descriptors for each of the stores configured in a configuration repository.

Throws:
OdsException
Threading:
This method is safe for concurrent access by multiple threads.

loadAll

public static Set<StoreDescriptor> loadAll()
                                    throws OdsException
Create store descriptors for all stores configured in the default configuration repository.

Returns:
Returns the set of store descriptors.

This method creates and initializes stores descriptors for all the stores configured in the default configuration repository.

Throws:
OdsException
Threading:
This method is safe for concurrent access by multiple threads.

toString

public final String toString()
Returns a string representation of this object

Overrides:
toString in class Object


Copyright © 2015 Neeve Research, LLC. All Rights Reserved.