org.sandev.basics.CacheManager
Class CacheManagerNode

java.lang.Object
  extended by org.sandev.basics.CacheManager.CacheManagerNodeDecl
      extended by org.sandev.basics.CacheManager.CacheManagerNodeBase
          extended by org.sandev.basics.CacheManager.CacheManagerNode
All Implemented Interfaces:
Controllable, Loggable, Messageable

public class CacheManagerNode
extends CacheManagerNodeBase

Implementation of the CacheManagerNode.


Field Summary
protected  java.util.Map map
          Our lookup map of CacheActions
protected  AuthUser notificationUser
          The AuthUser which we use for authorization of outgoing CacheAction sends.
 
Fields inherited from class org.sandev.basics.CacheManager.CacheManagerNodeBase
ctrlwrappers, helperNodes, incomingAsyncCacheActionMessage, incomingAsyncSandUpdateMessage, incomingSyncCacheAction, LOGDEBUG, LOGERROR, LOGFATAL, logger, LOGINFO, logLevel, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGWARN, messager, nodeInstance, outgoingAsyncCacheAction, parent, sandNodeErrorMessage, sandNodeState, SANDNODESTATE_FAILED, SANDNODESTATE_FAILING, SANDNODESTATE_RESUMING, SANDNODESTATE_RUNNING, SANDNODESTATE_STARTING, SANDNODESTATE_STOPPED, SANDNODESTATE_STOPPING, SANDNODESTATE_SUSPENDED, SANDNODESTATE_SUSPENDING, SANDNODESTATE_UNDEFINED, sandRoot
 
Fields inherited from class org.sandev.basics.CacheManager.CacheManagerNodeDecl
localAuthUserLookup, notificationPassword, notificationUsername
 
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
CacheManagerNode()
          Default ctor initializes our CacheAction map.
 
Method Summary
protected  void doWildcardCleanup(CacheAction msg)
          Clean up any instances we have that match the source and the messageClass specified.
protected  CacheAction handleOnReceive(CacheAction msg)
          Deal with the registration.
 void onDelivery(CacheAction msg)
          If we get an incoming CacheAction, and somebody is registered for it, then send it on.
 void onDelivery(SandUpdateMessage msg)
          If we get an incoming update message, and somebody is tracking the contained instance, then send out a CacheAction for it.
protected  CacheAction onReceive(CacheAction msg)
          Override the onReceive processing to process this registration.
protected  void onStartup()
          When we startup, we load our notification AuthUser if a username was specified.
 
Methods inherited from class org.sandev.basics.CacheManager.CacheManagerNodeBase
addWrapper, callQuery, deliver, deliverCacheActionMessage, deliverSandUpdateMessage, fieldHasFlag, getDeploymentPrefix, getHelperNodes, getIDCache, getIncomingAsyncCacheActionMessage, getIncomingAsyncCacheActionMessageDefaultValue, getIncomingAsyncCacheActionMessageFieldPrintValue, getIncomingAsyncCacheActionMessageFlag, getIncomingAsyncCacheActionMessageInvalidValue, getIncomingAsyncCacheActionMessageMetatype, getIncomingAsyncCacheActionMessagePrintValue, getIncomingAsyncCacheActionMessageRange, getIncomingAsyncCacheActionMessageValidityCheck, getIncomingAsyncSandUpdateMessage, getIncomingAsyncSandUpdateMessageDefaultValue, getIncomingAsyncSandUpdateMessageFieldPrintValue, getIncomingAsyncSandUpdateMessageFlag, getIncomingAsyncSandUpdateMessageInvalidValue, getIncomingAsyncSandUpdateMessageMetatype, getIncomingAsyncSandUpdateMessagePrintValue, getIncomingAsyncSandUpdateMessageRange, getIncomingAsyncSandUpdateMessageValidityCheck, getIncomingSyncCacheAction, getIncomingSyncCacheActionDefaultValue, getIncomingSyncCacheActionFieldPrintValue, getIncomingSyncCacheActionFlag, getIncomingSyncCacheActionInvalidValue, getIncomingSyncCacheActionMetatype, getIncomingSyncCacheActionPrintValue, getIncomingSyncCacheActionRange, getIncomingSyncCacheActionValidityCheck, getLocalAuthUserLookup, getLocalAuthUserLookupDefaultValue, getLocalAuthUserLookupFieldPrintValue, getLocalAuthUserLookupFlag, getLocalAuthUserLookupInvalidValue, getLocalAuthUserLookupLengthMax, getLocalAuthUserLookupLengthNorm, getLocalAuthUserLookupMetatype, getLocalAuthUserLookupPrintValue, getLocalAuthUserLookupRange, getLocalAuthUserLookupValidityCheck, getLogger, getLoggerDefaultValue, getLoggerFieldPrintValue, getLoggerFlag, getLoggerInvalidValue, getLoggerMetatype, getLoggerPrintValue, getLoggerRange, getLoggerValidityCheck, getLogLevel, getLogLevelActualVals, getLogLevelDefaultValue, getLogLevelEnumSummary, getLogLevelFieldPrintValue, getLogLevelFlag, getLogLevelInvalidValue, getLogLevelKeyVals, getLogLevelMetatype, getLogLevelPrintVals, getLogLevelPrintValue, getLogLevelRange, getLogLevelValidityCheck, getMessager, getMessagerDefaultValue, getMessagerFieldPrintValue, getMessagerFlag, getMessagerInvalidValue, getMessagerMetatype, getMessagerPrintValue, getMessagerRange, getMessagerValidityCheck, getNodeInstance, getNodeInstanceDefaultValue, getNodeInstanceFieldPrintValue, getNodeInstanceFlag, getNodeInstanceInvalidValue, getNodeInstanceMetatype, getNodeInstanceName, getNodeInstancePrintValue, getNodeInstanceRange, getNodeInstanceValidityCheck, getNotificationPassword, getNotificationPasswordDefaultValue, getNotificationPasswordFieldPrintValue, getNotificationPasswordFlag, getNotificationPasswordInvalidValue, getNotificationPasswordLengthMax, getNotificationPasswordLengthNorm, getNotificationPasswordMetatype, getNotificationPasswordPrintValue, getNotificationPasswordRange, getNotificationPasswordValidityCheck, getNotificationUsername, getNotificationUsernameDefaultValue, getNotificationUsernameFieldPrintValue, getNotificationUsernameFlag, getNotificationUsernameInvalidValue, getNotificationUsernameLengthMax, getNotificationUsernameLengthNorm, getNotificationUsernameMetatype, getNotificationUsernamePrintValue, getNotificationUsernameRange, getNotificationUsernameValidityCheck, getOutgoingAsyncCacheAction, getOutgoingAsyncCacheActionDefaultValue, getOutgoingAsyncCacheActionFieldPrintValue, getOutgoingAsyncCacheActionFlag, getOutgoingAsyncCacheActionInvalidValue, getOutgoingAsyncCacheActionMetatype, getOutgoingAsyncCacheActionPrintValue, getOutgoingAsyncCacheActionRange, getOutgoingAsyncCacheActionValidityCheck, getParent, 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, init, log, log, logLevelActual2Print, logLevelLabelToValue, logLevelLabelToValueStatic, logLevelPrint2Actual, logLevelPrint2Key, logLevelValueToLabel, logLevelValueToLabelStatic, notifyStateChange, onFailure, onRestart, onResume, onShutdown, onSuspend, readConfigParamsFromNodeInstance, receive, receive, restart, resume, sandNodeStateActual2Print, sandNodeStateLabelToValue, sandNodeStateLabelToValueStatic, sandNodeStatePrint2Actual, sandNodeStatePrint2Key, sandNodeStateValueToLabel, sandNodeStateValueToLabelStatic, send, setHelperNodes, setIncomingAsyncCacheActionMessage, setIncomingAsyncCacheActionMessage, setIncomingAsyncSandUpdateMessage, setIncomingAsyncSandUpdateMessage, setIncomingSyncCacheAction, setIncomingSyncCacheAction, setLocalAuthUserLookup, setLocalAuthUserLookup, setLogger, setLogger, setLogLevel, setMessager, setMessager, setNodeInstance, setNodeInstance, setNotificationPassword, setNotificationPassword, setNotificationUsername, setNotificationUsername, setOutgoingAsyncCacheAction, setOutgoingAsyncCacheAction, setParent, setSandNodeErrorMessage, setSandNodeErrorMessage, setSandNodeState, setSandRoot, setupSecureReceive, setupSubscriptions, shutdown, startup, suspend, systemwideShutdown, validTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected java.util.Map map
Our lookup map of CacheActions


notificationUser

protected AuthUser notificationUser
The AuthUser which we use for authorization of outgoing CacheAction sends. This is initialized as needed.

Constructor Detail

CacheManagerNode

public CacheManagerNode()
Default ctor initializes our CacheAction map. We use a TreeMap rather than a HashMap since the number of registrations can be large and additional memory overhead of a hash table nearly doubles the memory required. In this case the access time is not critical enough to be worth the extra memory footprint.

Method Detail

onStartup

protected void onStartup()
                  throws SandException
When we startup, we load our notification AuthUser if a username was specified. That way we are immediately ready for processing any incoming updates.

Overrides:
onStartup in class CacheManagerNodeBase
Throws:
SandException

onDelivery

public void onDelivery(SandUpdateMessage msg)
                throws SandException
If we get an incoming update message, and somebody is tracking the contained instance, then send out a CacheAction for it.

No notification is sent for an ADD action, since the instance can't have been cached yet. That's because the uniqueID hasn't been assigned until the ADD action completes, so it couldn't have been placed into a cache based on the ID.

Overrides:
onDelivery in class CacheManagerNodeBase
Throws:
SandException

onDelivery

public void onDelivery(CacheAction msg)
                throws SandException
If we get an incoming CacheAction, and somebody is registered for it, then send it on.

Overrides:
onDelivery in class CacheManagerNodeBase
Throws:
SandException

onReceive

protected CacheAction onReceive(CacheAction msg)
                         throws SandException
Override the onReceive processing to process this registration. Calls through to handleOnReceive.

Overrides:
onReceive in class CacheManagerNodeBase
Throws:
SandException

handleOnReceive

protected CacheAction handleOnReceive(CacheAction msg)
                               throws SandException
Deal with the registration. Since wildcard deregistrations involve iteration over the map, we are synchronized to avoid trying to process two registrations at once.

Throws:
SandException

doWildcardCleanup

protected void doWildcardCleanup(CacheAction msg)
Clean up any instances we have that match the source and the messageClass specified.