|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.sandev.tools.SANDPlatformRoot.SANDPlatformRootNodeDecl
org.sandev.tools.SANDPlatformRoot.SANDPlatformRootNodeBase
org.sandev.tools.SANDPlatformRoot.SANDPlatformRootNode
public class SANDPlatformRootNode
Implementation of SANDPlatformRootNodeDecl. The root instance is accessable through the SingletonAccessor class, which is maintained by the startup and shutdown methods.
| Field Summary | |
|---|---|
protected org.sandev.basics.nodecommon.CharSerializer |
charSerializer
The CharSerializer to use when reading the Configuration from file. |
protected org.sandev.basics.sandmessages.Configuration |
config
On startup, we load the configuration. |
protected java.util.HashMap |
dictionary
Messageable instances keyed by instance name. |
protected static java.lang.String |
LOGGER_NAME
|
protected org.sandev.basics.nodecommon.NodeInstanceFactory |
nodeInstanceFactory
The NodeInstanceFactory to use when instantiating nodes. |
protected org.sandev.basics.nodecommon.SingletonAccessor |
singletonAccessor
Our SingletonAccessor reference. |
| Fields inherited from class org.sandev.tools.SANDPlatformRoot.SANDPlatformRootNodeBase |
|---|
ctrlwrappers, helperNodes, LOGDEBUG, LOGERROR, LOGFATAL, logger, LOGINFO, logLevel, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGWARN, messager, nodeInstance, 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.tools.SANDPlatformRoot.SANDPlatformRootNodeDecl |
|---|
charSerializerClassName, nodeInstanceFactoryClassName, propertiesPath |
| 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 | |
|---|---|
SANDPlatformRootNode()
The default ctor initializes the basics for this node, since it doesn't get the benefit of the work done by initNode. |
|
| Method Summary | |
|---|---|
protected org.sandev.basics.nodecommon.Messageable |
findNodeForName(java.lang.String key,
org.sandev.basics.nodecommon.Controllable[] nodes)
Walk the tree of nodes and return the one with the specified name. |
org.sandev.basics.nodecommon.CharSerializer |
getCharSerializer()
accessor for charSerializer |
org.sandev.basics.sandmessages.Configuration |
getConfiguration()
accessor for config |
java.util.Map |
getDictionary()
|
protected org.sandev.basics.structs.NodeInstance[] |
getLocalNodes(org.sandev.basics.sandmessages.Configuration conf)
Given a Configuration, return an array of those nodes which are to run on this server. |
protected org.sandev.basics.nodecommon.Logger |
getLoggerForNode(org.sandev.basics.structs.NodeInstance decl)
Return a new Logger for use by the node instance corresponding to the declaration. |
protected org.sandev.basics.nodecommon.Logger |
getLoggerForNode(java.lang.String loggerName)
Return a new Logger with the given name. |
protected org.sandev.basics.nodecommon.Messager |
getMessagerForNode(org.sandev.basics.nodecommon.Messageable node,
org.sandev.basics.structs.NodeInstance decl)
Return a new Messager for use by the node instance corresponding to the declaration. |
org.sandev.basics.nodecommon.Messageable |
getNode(java.lang.String instanceName)
Using the dictionary and the node tree, find the Messageable corresponding to the instance name specified. |
org.sandev.basics.nodecommon.NodeInstanceFactory |
getNodeInstanceFactory()
accessor for nodeInstanceFactory |
java.lang.String |
getNodeInstanceName()
Override of standard generated method. |
java.lang.String |
getPropertiesPath()
Initializing accessor for propertiesPath. |
org.sandev.basics.nodecommon.SingletonAccessor |
getRootSingletonAccessor()
|
java.lang.String |
getServername()
Override of standard generated method. |
org.sandev.basics.nodecommon.SingletonAccessor |
getSingletonAccessor()
accessor for singletonAccessor |
protected void |
initNode(java.lang.Object node,
org.sandev.basics.structs.NodeInstance decl)
Initialize a node with the basics it needs. |
protected void |
initNodeInstanceFactory()
Initialize our NodeInstanceFactory reference. |
protected void |
loadConfiguration()
Load the configuration from file. |
protected void |
onShutdown()
Clean up what we created. |
void |
setCharSerializer(org.sandev.basics.nodecommon.CharSerializer val)
mutator for charSerializer |
void |
setConfiguration(org.sandev.basics.sandmessages.Configuration config)
mutator for config |
void |
setNodeInstanceFactory(org.sandev.basics.nodecommon.NodeInstanceFactory val)
mutator for nodeInstanceFactory |
void |
setSingletonAccessor(org.sandev.basics.nodecommon.SingletonAccessor val)
mutator for singletonAccessor |
protected void |
setupServices(org.sandev.basics.nodecommon.Controllable parent,
org.sandev.basics.structs.NodeInstance[] nodes)
Walk the node declaration tree creating the nodes and their corresponding control services. |
protected void |
signalRemoteShutdown(int code)
Signal the other servers in this configuration that they need to perform a systemwide shutdown with the specified code. |
void |
startup()
On startup, we load the configuration, and initialize the top level nodes as our helper nodes. |
void |
systemwideShutdown(int code)
Override to handle the global signalling. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String LOGGER_NAME
protected org.sandev.basics.nodecommon.SingletonAccessor singletonAccessor
protected org.sandev.basics.nodecommon.CharSerializer charSerializer
protected org.sandev.basics.nodecommon.NodeInstanceFactory nodeInstanceFactory
protected org.sandev.basics.sandmessages.Configuration config
protected java.util.HashMap dictionary
| Constructor Detail |
|---|
public SANDPlatformRootNode()
| Method Detail |
|---|
public org.sandev.basics.nodecommon.SingletonAccessor getSingletonAccessor()
public void setSingletonAccessor(org.sandev.basics.nodecommon.SingletonAccessor val)
public org.sandev.basics.nodecommon.SingletonAccessor getRootSingletonAccessor()
getRootSingletonAccessor in interface org.sandev.basics.nodecommon.SandRootpublic org.sandev.basics.nodecommon.CharSerializer getCharSerializer()
getCharSerializer in interface org.sandev.basics.nodecommon.SandRootpublic void setCharSerializer(org.sandev.basics.nodecommon.CharSerializer val)
setCharSerializer in interface org.sandev.basics.nodecommon.SandRootpublic org.sandev.basics.nodecommon.NodeInstanceFactory getNodeInstanceFactory()
public void setNodeInstanceFactory(org.sandev.basics.nodecommon.NodeInstanceFactory val)
public org.sandev.basics.sandmessages.Configuration getConfiguration()
getConfiguration in interface org.sandev.basics.nodecommon.SandRootpublic void setConfiguration(org.sandev.basics.sandmessages.Configuration config)
public java.util.Map getDictionary()
public void startup()
throws org.sandev.basics.nodecommon.ControlException
startup in interface org.sandev.basics.nodecommon.Controllablestartup in class SANDPlatformRootNodeBaseorg.sandev.basics.nodecommon.ControlException
protected void onShutdown()
throws org.sandev.basics.structs.SandException
onShutdown in class SANDPlatformRootNodeBaseorg.sandev.basics.structs.SandException
public void systemwideShutdown(int code)
throws org.sandev.basics.nodecommon.ControlException
systemwideShutdown in interface org.sandev.basics.nodecommon.ControllablesystemwideShutdown in class SANDPlatformRootNodeBaseorg.sandev.basics.nodecommon.ControlExceptionpublic java.lang.String getNodeInstanceName()
getNodeInstanceName in class SANDPlatformRootNodeBasepublic java.lang.String getServername()
getServername in class SANDPlatformRootNodeBasepublic org.sandev.basics.nodecommon.Messageable getNode(java.lang.String instanceName)
getNode in interface org.sandev.basics.nodecommon.SandRoot
protected org.sandev.basics.nodecommon.Messageable findNodeForName(java.lang.String key,
org.sandev.basics.nodecommon.Controllable[] nodes)
public java.lang.String getPropertiesPath()
getPropertiesPath in interface org.sandev.basics.nodecommon.SandRootgetPropertiesPath in class SANDPlatformRootNodeBase
protected void signalRemoteShutdown(int code)
throws org.sandev.basics.nodecommon.ControlException
org.sandev.basics.nodecommon.ControlExceptionprotected org.sandev.basics.structs.NodeInstance[] getLocalNodes(org.sandev.basics.sandmessages.Configuration conf)
If SAND_RUNMODE=development in our environment,
then all the nodes are being run on this server regardless of what
is listed in the configuration. This is a typical development
setup.
protected void loadConfiguration()
protected void setupServices(org.sandev.basics.nodecommon.Controllable parent,
org.sandev.basics.structs.NodeInstance[] nodes)
protected void initNode(java.lang.Object node,
org.sandev.basics.structs.NodeInstance decl)
protected org.sandev.basics.nodecommon.Logger getLoggerForNode(org.sandev.basics.structs.NodeInstance decl)
Yes, reflection is slow, but it makes the system very flexible and we only pay for it at startup time. We are leaving open the possibility of specifying different Loggers for specific nodes within a configuration.
protected org.sandev.basics.nodecommon.Logger getLoggerForNode(java.lang.String loggerName)
getLoggerForNode(NodeInstance)
protected org.sandev.basics.nodecommon.Messager getMessagerForNode(org.sandev.basics.nodecommon.Messageable node,
org.sandev.basics.structs.NodeInstance decl)
Yes, reflection is slow, but it makes the system very flexible and we only pay for it at startup time. We are leaving open the possibility of specifying different Messagers for specific nodes within a configuration.
protected void initNodeInstanceFactory()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||