org.sandev.basics.DataManager
Class DataManagerNode

java.lang.Object
  extended byorg.sandev.basics.DataManager.DataManagerNodeDecl
      extended byorg.sandev.basics.DataManager.DataManagerNodeBase
          extended byorg.sandev.basics.DataManager.DataManagerNode
All Implemented Interfaces:
Controllable, IDLookup, Loggable, Messageable

public class DataManagerNode
extends DataManagerNodeBase
implements IDLookup

Implementation of the DataManagerNode


Field Summary
protected  Converter converter
          Our structure recovery object instance
protected  DataManagerInfo dminfo
          The DataManagerInfo instance we are using.
protected  Persister persister
          Our worker object instance
protected  StringPersistConverter strPerstConv
          Our StringPersistConverter instance for field translation
protected  UniqueIDManager uidmgr
          The uniqueID management we are using
 
Fields inherited from class org.sandev.basics.DataManager.DataManagerNodeBase
ctrlwrappers, helperNodes, incomingSyncSandMessage, LOGDEBUG, LOGERROR, LOGFATAL, logger, LOGINFO, logLevel, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGWARN, messager, nodeInstance, outgoingAsyncSandUpdateMessage, parent, sandNodeErrorMessage, sandNodeState, SANDNODESTATE_FAILED, SANDNODESTATE_FAILING, SANDNODESTATE_RESUMING, SANDNODESTATE_RUNNING, SANDNODESTATE_STARTING, SANDNODESTATE_STOPPED, SANDNODESTATE_STOPPING, SANDNODESTATE_SUSPENDED, SANDNODESTATE_SUSPENDING, SANDNODESTATE_UNDEFINED, sandRoot, UPDATETIMEBATCHOVERRIDE_OFF, UPDATETIMEBATCHOVERRIDE_ON
 
Fields inherited from class org.sandev.basics.DataManager.DataManagerNodeDecl
maxQueryReturn, maxQueryReturnSizeKb, persisterDataSource, updateTimeBatchOverride
 
Fields inherited from interface org.sandev.basics.nodecommon.Controllable
OPERATION_FAIL, OPERATION_RESUME, OPERATION_SHUTDOWN, OPERATION_STARTUP, OPERATION_STR_FAIL, OPERATION_STR_RESUME, OPERATION_STR_SHUTDOWN, OPERATION_STR_STARTUP, OPERATION_STR_SUSPEND, OPERATION_STR_UNDEFINED, OPERATION_STRINGS, OPERATION_SUSPEND, OPERATION_UNDEFINED, SHUTDOWN_ERROR_RESTART_GLOBAL, SHUTDOWN_ERROR_RESTART_LOCAL, SHUTDOWN_ERROR_TERMINATE, SHUTDOWN_NORMAL, STATE_FAILED, STATE_FAILING, STATE_RESUMING, STATE_RUNNING, STATE_STARTING, STATE_STOPPED, STATE_STOPPING, STATE_STR_FAILED, STATE_STR_FAILING, STATE_STR_RESUMING, STATE_STR_RUNNING, STATE_STR_STARTING, STATE_STR_STOPPED, STATE_STR_STOPPING, STATE_STR_SUSPENDED, STATE_STR_SUSPENDING, STATE_STR_UNDEFINED, STATE_STRINGS, STATE_SUSPENDED, STATE_SUSPENDING, STATE_UNDEFINED
 
Constructor Summary
DataManagerNode()
           
 
Method Summary
 Converter getConverter()
          accessor for converter
 java.lang.String getConverterClass()
          Return the classname of the Converter we are using.
 java.lang.String getDataSource()
          Return the name of the data source for the Persister to use.
 java.lang.String getGeneratorInfo()
          Return a summary of the build settings in effect when persistency was generated.
 java.lang.String getImportExportSource()
          Return the name of the import export source.
 SandPersistMessage getInstance(java.lang.String classname, long id, AuthUser user)
          Call through to Persister implementation.
 Persister getPersister()
          accessor for persister
 java.lang.String getPersisterClass()
          Return the classname of the Persister we are using.
 StringPersistConverter getStrPerstConv()
          accessor for strPerstConv
 java.lang.String getStrPerstConvClass()
          Return the classname of the StringPersistConverter we are using.
 UniqueIDManager getUniqueIDManager()
          accessor for uidmgr
 java.lang.String getUniqueIDManagerClass()
          Return the classname of the UniqueIDManager we are using.
protected  void initPersister()
          Init our Persister instance, or throw if it cannot be initialized.
protected  void initRetry(int seconds, int tries)
          Retry the Persister initialization until it works, or throw.
protected  Converter loadConverter(java.lang.String convClassName)
          Get an instance of the specified Converter class to use.
protected  void loadDataManagerInfo()
          Load the appropriate DataManagerInfo for our deployment.
protected  Persister loadPersister(java.lang.String pclassname)
          Get an instance of the specified persister class to use.
protected  StringPersistConverter loadStrPerstConv(java.lang.String convClassName)
          Get an instance of the specified StringPersistConverter class to use.
protected  UniqueIDManager loadUniqueIDManager(java.lang.String mgrclassname)
          Get an instance of the specified persister class to use.
protected  SandMessage onReceive(SandMessage msg)
          Process the incoming query or update.
protected  void onStartup()
          Load our Persister and check everything is ready to roll.
protected  void retryPersisterInit(int seconds, int attempts)
          Retry initializing our Persister for the given number of tries waiting the given number of seconds between tries.
 void setConverter(Converter c)
          mutator for converter
 void setPersister(Persister p)
          mutator for persister
 void setStrPerstConv(StringPersistConverter spc)
          mutator for strPerstConv
 void setUniqueIDManager(UniqueIDManager mgr)
          mutator for uidmgr
static void verifyRecordStatus(SandQueryMessage msg)
          If recordStatus was not specified, then add a positive match for recordStatus ACTIVE.
 
Methods inherited from class org.sandev.basics.DataManager.DataManagerNodeBase
addWrapper, deliver, fieldHasFlag, getHelperNodes, getIDCache, getIncomingSyncSandMessage, getIncomingSyncSandMessageDefaultValue, getIncomingSyncSandMessageFieldPrintValue, getIncomingSyncSandMessageFlag, getIncomingSyncSandMessageInvalidValue, getIncomingSyncSandMessageMetatype, getIncomingSyncSandMessagePrintValue, getIncomingSyncSandMessageRange, getIncomingSyncSandMessageValidityCheck, getLogger, getLoggerDefaultValue, getLoggerFieldPrintValue, getLoggerFlag, getLoggerInvalidValue, getLoggerMetatype, getLoggerPrintValue, getLoggerRange, getLoggerValidityCheck, getLogLevel, getLogLevelActualVals, getLogLevelDefaultValue, getLogLevelEnumSummary, getLogLevelFieldPrintValue, getLogLevelFlag, getLogLevelInvalidValue, getLogLevelKeyVals, getLogLevelMetatype, getLogLevelPrintVals, getLogLevelPrintValue, getLogLevelRange, getLogLevelValidityCheck, getMaxQueryReturn, getMaxQueryReturnDefaultValue, getMaxQueryReturnFieldPrintValue, getMaxQueryReturnFlag, getMaxQueryReturnInvalidValue, getMaxQueryReturnMetatype, getMaxQueryReturnPrintValue, getMaxQueryReturnRange, getMaxQueryReturnSizeKb, getMaxQueryReturnSizeKbDefaultValue, getMaxQueryReturnSizeKbFieldPrintValue, getMaxQueryReturnSizeKbFlag, getMaxQueryReturnSizeKbInvalidValue, getMaxQueryReturnSizeKbMetatype, getMaxQueryReturnSizeKbPrintValue, getMaxQueryReturnSizeKbRange, getMaxQueryReturnSizeKbValidityCheck, getMaxQueryReturnValidityCheck, getMessager, getMessagerDefaultValue, getMessagerFieldPrintValue, getMessagerFlag, getMessagerInvalidValue, getMessagerMetatype, getMessagerPrintValue, getMessagerRange, getMessagerValidityCheck, getNodeInstance, getNodeInstanceDefaultValue, getNodeInstanceFieldPrintValue, getNodeInstanceFlag, getNodeInstanceInvalidValue, getNodeInstanceMetatype, getNodeInstanceName, getNodeInstancePrintValue, getNodeInstanceRange, getNodeInstanceValidityCheck, getOutgoingAsyncSandUpdateMessage, getOutgoingAsyncSandUpdateMessageDefaultValue, getOutgoingAsyncSandUpdateMessageFieldPrintValue, getOutgoingAsyncSandUpdateMessageFlag, getOutgoingAsyncSandUpdateMessageInvalidValue, getOutgoingAsyncSandUpdateMessageMetatype, getOutgoingAsyncSandUpdateMessagePrintValue, getOutgoingAsyncSandUpdateMessageRange, getOutgoingAsyncSandUpdateMessageValidityCheck, getParent, getPersisterDataSource, getPersisterDataSourceDefaultValue, getPersisterDataSourceFieldPrintValue, getPersisterDataSourceFlag, getPersisterDataSourceInvalidValue, getPersisterDataSourceLengthMax, getPersisterDataSourceLengthNorm, getPersisterDataSourceMetatype, getPersisterDataSourcePrintValue, getPersisterDataSourceRange, getPersisterDataSourceValidityCheck, getSandNodeErrorMessage, getSandNodeErrorMessageDefaultValue, getSandNodeErrorMessageFieldPrintValue, getSandNodeErrorMessageFlag, getSandNodeErrorMessageInvalidValue, getSandNodeErrorMessageLengthMax, getSandNodeErrorMessageLengthNorm, getSandNodeErrorMessageMetatype, getSandNodeErrorMessagePrintValue, getSandNodeErrorMessageRange, getSandNodeErrorMessageValidityCheck, getSandNodeState, getSandNodeStateActualVals, getSandNodeStateDefaultValue, getSandNodeStateEnumSummary, getSandNodeStateFieldPrintValue, getSandNodeStateFlag, getSandNodeStateInvalidValue, getSandNodeStateKeyVals, getSandNodeStateMetatype, getSandNodeStatePrintVals, getSandNodeStatePrintValue, getSandNodeStateRange, getSandNodeStateValidityCheck, getSandRoot, getServername, getUpdateTimeBatchOverride, getUpdateTimeBatchOverrideActualVals, getUpdateTimeBatchOverrideDefaultValue, getUpdateTimeBatchOverrideEnumSummary, getUpdateTimeBatchOverrideFieldPrintValue, getUpdateTimeBatchOverrideFlag, getUpdateTimeBatchOverrideInvalidValue, getUpdateTimeBatchOverrideKeyVals, getUpdateTimeBatchOverrideMetatype, getUpdateTimeBatchOverridePrintVals, getUpdateTimeBatchOverridePrintValue, getUpdateTimeBatchOverrideRange, getUpdateTimeBatchOverrideValidityCheck, init, isUpdateTimeBatchOverrideOff, isUpdateTimeBatchOverrideOn, log, log, logLevelActual2Print, logLevelLabelToValue, logLevelPrint2Actual, logLevelPrint2Key, logLevelValueToLabel, notifyStateChange, onFailure, onRestart, onResume, onShutdown, onSuspend, receive, restart, resume, sandNodeStateActual2Print, sandNodeStateLabelToValue, sandNodeStatePrint2Actual, sandNodeStatePrint2Key, sandNodeStateValueToLabel, send, setHelperNodes, setIncomingSyncSandMessage, setIncomingSyncSandMessage, setLogger, setLogger, setLogLevel, setMaxQueryReturn, setMaxQueryReturnSizeKb, setMessager, setMessager, setNodeInstance, setNodeInstance, setOutgoingAsyncSandUpdateMessage, setOutgoingAsyncSandUpdateMessage, setParent, setPersisterDataSource, setPersisterDataSource, setSandNodeErrorMessage, setSandNodeErrorMessage, setSandNodeState, setSandRoot, setUpdateTimeBatchOverride, setupSecureReceive, setupSubscriptions, shutdown, startup, suspend, systemwideShutdown, updateTimeBatchOverrideActual2Print, updateTimeBatchOverrideLabelToValue, updateTimeBatchOverridePrint2Actual, updateTimeBatchOverridePrint2Key, updateTimeBatchOverrideValueToLabel, validTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

persister

protected Persister persister
Our worker object instance


uidmgr

protected UniqueIDManager uidmgr
The uniqueID management we are using


converter

protected Converter converter
Our structure recovery object instance


strPerstConv

protected StringPersistConverter strPerstConv
Our StringPersistConverter instance for field translation


dminfo

protected DataManagerInfo dminfo
The DataManagerInfo instance we are using. This is loaded once during startup.

Constructor Detail

DataManagerNode

public DataManagerNode()
Method Detail

getPersister

public Persister getPersister()
accessor for persister


setPersister

public void setPersister(Persister p)
mutator for persister


getUniqueIDManager

public UniqueIDManager getUniqueIDManager()
accessor for uidmgr


setUniqueIDManager

public void setUniqueIDManager(UniqueIDManager mgr)
mutator for uidmgr


getConverter

public Converter getConverter()
accessor for converter


setConverter

public void setConverter(Converter c)
mutator for converter


getStrPerstConv

public StringPersistConverter getStrPerstConv()
accessor for strPerstConv


setStrPerstConv

public void setStrPerstConv(StringPersistConverter spc)
mutator for strPerstConv


getGeneratorInfo

public java.lang.String getGeneratorInfo()
Return a summary of the build settings in effect when persistency was generated.


getPersisterClass

public java.lang.String getPersisterClass()
Return the classname of the Persister we are using.


getDataSource

public java.lang.String getDataSource()
Return the name of the data source for the Persister to use.


getUniqueIDManagerClass

public java.lang.String getUniqueIDManagerClass()
Return the classname of the UniqueIDManager we are using.


getConverterClass

public java.lang.String getConverterClass()
Return the classname of the Converter we are using.


getStrPerstConvClass

public java.lang.String getStrPerstConvClass()
Return the classname of the StringPersistConverter we are using.


getImportExportSource

public java.lang.String getImportExportSource()
Return the name of the import export source.


loadDataManagerInfo

protected void loadDataManagerInfo()
                            throws SandException
Load the appropriate DataManagerInfo for our deployment.

Throws:
SandException

onStartup

protected void onStartup()
                  throws SandException
Load our Persister and check everything is ready to roll.

Overrides:
onStartup in class DataManagerNodeBase
Throws:
SandException

onReceive

protected SandMessage onReceive(SandMessage msg)
                         throws SandException
Process the incoming query or update.

Overrides:
onReceive in class DataManagerNodeBase
Throws:
SandException

loadPersister

protected Persister loadPersister(java.lang.String pclassname)
                           throws PersisterException
Get an instance of the specified persister class to use.

Throws:
PersisterException

loadUniqueIDManager

protected UniqueIDManager loadUniqueIDManager(java.lang.String mgrclassname)
Get an instance of the specified persister class to use.


loadConverter

protected Converter loadConverter(java.lang.String convClassName)
Get an instance of the specified Converter class to use.


loadStrPerstConv

protected StringPersistConverter loadStrPerstConv(java.lang.String convClassName)
Get an instance of the specified StringPersistConverter class to use.


initPersister

protected void initPersister()
                      throws SandException
Init our Persister instance, or throw if it cannot be initialized. The Persister instance is assumed to be loaded, this method inits it or eventually dies if it can't load it. When the system starts up, things can be kind of shaky, so this method retries on failure before eventually giving up. We want to do this synchronously and not in a separate thread because once the DataManager is up and running, all the nodes that depend on it will try to use it.

Throws:
SandException

retryPersisterInit

protected void retryPersisterInit(int seconds,
                                  int attempts)
                           throws SandException
Retry initializing our Persister for the given number of tries waiting the given number of seconds between tries. Throws if we were unable to initialize, returns when initialization is successful.

Throws:
SandException

initRetry

protected void initRetry(int seconds,
                         int tries)
Retry the Persister initialization until it works, or throw. This method assumes that we already tried to initi Things can be kind of shaky when a server starts up, so Spawn a thread to retry Persister initialization. Things can be kind of shaky when a server starts up, so we don't immediately keel over and die, although we should die eventually if the Persister flat out won't init. See InitRetryThread for details.


verifyRecordStatus

public static void verifyRecordStatus(SandQueryMessage msg)
If recordStatus was not specified, then add a positive match for recordStatus ACTIVE. So unless specified otherwise, every query will only be looking at active data.

An application may choose to show archived data, in which case they could choose to add a negative match for recordStatus DELETED, in order to include ARCHIVED information. Since the point of archiving is to be able to move data offline, this may not return any more listings. However an application may choose to move only some of their archived information offline, retaining a buffer of archived information online as an indication that more records exist.


getInstance

public SandPersistMessage getInstance(java.lang.String classname,
                                      long id,
                                      AuthUser user)
                               throws SandException
Call through to Persister implementation.

Specified by:
getInstance in interface IDLookup
Throws:
SandException