|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.apama.correlator.memstore.AbstractStoreFactory
public abstract class AbstractStoreFactory
Factory object for creating store objects, and holding the configuration properties requried to do so.
Implementing classes have a public no-args constructor. Typically configuration properties will be
specified using bean-style setPropName(value) methods which can be set easily from the Spring
configuration file.
Implementors should create a subclass of AbstractStoreFactory, ensure it has a public no-args constructor, create
Java bean-style setter and getter methods for all required configuration properties,
and provide an implementation of createStore()
that makes use of these properties, in addition to the
standard properties defined on this factory: getClusterName()
, getLogLevel()
and
getBackupCopies()
.
Implementors are encouraged to do as much validation as possible of the configuration in the
afterPropertiesSet()
method. This method will be called by Spring during Correlator startup,
after setters have been invoked, for all properties in the configuration file. CreateStore will never be called
before this has happened.
Thread-safety: after initialization of properties this object will be accessed by only one thread at a time
so there is no need for implementors to add additional synchronization.
Constructor Summary | |
---|---|
AbstractStoreFactory()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Validates the configuration properties at the end of the initialization process. |
abstract AbstractStore |
createStore()
Prepares and returns a new store object using this factory's configuration and storeName. |
void |
destroy()
Performs final cleanup of the Called once during clean Correlator shutdown. |
int |
getBackupCopies()
Retrieve the number of additional redundant nodes that will hold a backup copy of data. |
java.lang.String |
getClusterName()
The provider specific clusterName which groups same named distributed stores together for communication and data sharing. |
int |
getInitialMinClusterSize()
Retrieve the number of nodes required to join the cluster before the Distributed MemoryStore will send the Finished event. |
java.lang.String |
getLogLevel()
Get the log level that should be used (if possible) for the 3rd party provider's logging. |
boolean |
getRowChangedOldValueRequired()
Retrieve whether subscribers should receive old values in RowChanged events. |
java.lang.String |
getStoreName()
The unique storeName for this factory, specified by the id attribute in the configuration. |
void |
initializeProviderSystemProperty(java.lang.String propertyName,
java.lang.String value)
Helper method for setting the value of a JVM-wide system property which is required by this store. |
void |
setBackupCopies(int backupCopies)
The number of additional redundant nodes that should hold a backup copy of each key/value data element. |
void |
setBeanName(java.lang.String storeName)
Called by Spring to initialize the storeName using the id attribute in its configuration. |
void |
setClusterName(java.lang.String clusterName)
A provider-specific string used to group together distributed store nodes that communicate with each other and share data. |
void |
setInitialMinClusterSize(int initialMinClusterSize)
The minimum number of nodes that are required to join the cluster before the Distributed MemoryStore will send the Finished event. |
void |
setLogLevel(java.lang.String providerLogLevel)
The Apama log level at which this provider should log its own messages (not all providers will support this). |
void |
setRowChangedOldValueRequired(boolean oldValueRequired)
Set whether subscribers should receive old values in RowChanged events. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractStoreFactory()
Method Detail |
---|
public abstract AbstractStore createStore() throws DistMemStoreProviderException
getClusterName()
, getLogLevel()
and getBackupCopies()
.
Implementors may choose to put most of the initialization logic into the createStore method, or alternatively
to simply pass this store factory to a constructor of the provider AbstractStore class which can extract the
required information.
Logging should usually be written to the main Correlator log (using log4j or Logger
)
or else to a separate file, rather than to standard out/err.
DistMemStoreProviderException
- Exception type to be thrown for bad configuration or connection
problems (i.e. anything that does not indicate an internal error).initializeProviderSystemProperty(String, String): For providers that need system properties to be set
on the JVM (e.g. for logging configuration), this method should be used
,
afterPropertiesSet(): Validation of the configuration should be performed mostly in afterPropertiesSet
rather than createStore.
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public final java.lang.String getStoreName()
public final void setBeanName(java.lang.String storeName)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
storeName
- Set the bean name to that of the storeNamepublic java.lang.String getClusterName()
afterPropertiesSet()
AbstractStoreFactory implementations are responsible for calling this method in their createStore implementation
and applying the specified value to the distributed cache.
public void setClusterName(java.lang.String clusterName)
clusterName
- Set the clusterName to thispublic java.lang.String getLogLevel()
Logger
public void setLogLevel(java.lang.String providerLogLevel)
providerLogLevel
- Set the log level to thisLogger.setThreshold(String)
public int getBackupCopies()
afterPropertiesSet()
AbstractStoreFactory implementations are responsible for calling this method in their createStore implementation
and applying the specified value to the distributed cache.
public void setBackupCopies(int backupCopies)
backupCopies
- Set the number of backup copies required to thispublic int getInitialMinClusterSize()
public void setInitialMinClusterSize(int initialMinClusterSize)
initialMinClusterSize
- Set the initial minimum cluster size to thispublic void setRowChangedOldValueRequired(boolean oldValueRequired)
public boolean getRowChangedOldValueRequired()
public void initializeProviderSystemProperty(java.lang.String propertyName, java.lang.String value)
propertyName
- the property to setvalue
- the value to set the property to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |