org.sandev.basics.nodecommon
Interface Controllable

All Known Implementing Classes:
AuthorizerNode, AuthorizerNodeBase, CacheManagerNode, CacheManagerNodeBase, DataManagerNode, DataManagerNodeBase, MessageDriverNode, MessageDriverNodeBase

public interface Controllable

The Controllable interface defines the methods and constants associated with lifecycle management of a node. The lifecycle management methods are called by external agents, such as Sandman.

See NodeState.html for state descriptions and valid transitions.


Field Summary
static int OPERATION_FAIL
           
static int OPERATION_RESUME
           
static int OPERATION_SHUTDOWN
           
static int OPERATION_STARTUP
           
static java.lang.String OPERATION_STR_FAIL
           
static java.lang.String OPERATION_STR_RESUME
           
static java.lang.String OPERATION_STR_SHUTDOWN
           
static java.lang.String OPERATION_STR_STARTUP
           
static java.lang.String OPERATION_STR_SUSPEND
           
static java.lang.String OPERATION_STR_UNDEFINED
           
static java.lang.String[] OPERATION_STRINGS
          The order of elements in this array is important; it's set up so that you can use one of the OPERATION_* constants to look up a OPERATION_STR_* constant.
static int OPERATION_SUSPEND
           
static int OPERATION_UNDEFINED
           
static int SHUTDOWN_ERROR_RESTART_GLOBAL
          Report an error, signal all other servers bounce their local nodes, bounce our local nodes.
static int SHUTDOWN_ERROR_RESTART_LOCAL
          Report an error and bounce all local nodes.
static int SHUTDOWN_ERROR_TERMINATE
          Report an error, signal all other servers to terminate, shut down all local nodes.
static int SHUTDOWN_NORMAL
          Shut down all nodes with no error.
static int STATE_FAILED
           
static int STATE_FAILING
           
static int STATE_RESUMING
           
static int STATE_RUNNING
           
static int STATE_STARTING
           
static int STATE_STOPPED
           
static int STATE_STOPPING
           
static java.lang.String STATE_STR_FAILED
           
static java.lang.String STATE_STR_FAILING
           
static java.lang.String STATE_STR_RESUMING
           
static java.lang.String STATE_STR_RUNNING
           
static java.lang.String STATE_STR_STARTING
           
static java.lang.String STATE_STR_STOPPED
           
static java.lang.String STATE_STR_STOPPING
           
static java.lang.String STATE_STR_SUSPENDED
           
static java.lang.String STATE_STR_SUSPENDING
           
static java.lang.String STATE_STR_UNDEFINED
           
static java.lang.String[] STATE_STRINGS
          The order of elements in this array is important; it's set up so that you can use one of the STATE_* constants to look up a STATE_STR_* constant.
static int STATE_SUSPENDED
           
static int STATE_SUSPENDING
           
static int STATE_UNDEFINED
           
 
Method Summary
 void addWrapper(ControlWrapper wrapper)
          Add this ControlWrapper to our list of wrappers to notify in the event of a state change or parameter change.
 Controllable[] getHelperNodes()
          Return all helper nodes configured for this node.
 NodeInstance getNodeInstance()
          Return the NodeInstance for this node instance.
 Controllable getParent()
          If this node was configured as a helper node, return a reference to the node it is helping.
 int getSandNodeState()
          Returns the current state of the node as one of the STATE constants.
 SandRoot getSandRoot()
          Return the SandRoot that launched this instance.
 void restart()
          Calls shutdown() followed by startup().
 void resume()
          Transition a node from the suspended state to the running state.
 void setHelperNodes(Controllable[] nodes)
          Set the helper nodes as the specified array.
 void setNodeInstance(NodeInstance instance)
          Called once by the root when the node instance is created.
 void setSandRoot(SandRoot root)
          Set our back reference to the root that launched this instance.
 void shutdown()
          Transition a node from the running to the stopped state.
 void startup()
          Transition a node from the stopped to the running state.
 void suspend()
          Transition a node from the running state to the suspended state.
 void systemwideShutdown(int code)
          Signal a systemwide shutdown with the appropriate SHUTDOWN_* code.
 

Field Detail

STATE_UNDEFINED

static final int STATE_UNDEFINED
See Also:
Constant Field Values

STATE_RUNNING

static final int STATE_RUNNING
See Also:
Constant Field Values

STATE_SUSPENDED

static final int STATE_SUSPENDED
See Also:
Constant Field Values

STATE_STOPPED

static final int STATE_STOPPED
See Also:
Constant Field Values

STATE_FAILED

static final int STATE_FAILED
See Also:
Constant Field Values

STATE_STARTING

static final int STATE_STARTING
See Also:
Constant Field Values

STATE_STOPPING

static final int STATE_STOPPING
See Also:
Constant Field Values

STATE_SUSPENDING

static final int STATE_SUSPENDING
See Also:
Constant Field Values

STATE_RESUMING

static final int STATE_RESUMING
See Also:
Constant Field Values

STATE_FAILING

static final int STATE_FAILING
See Also:
Constant Field Values

STATE_STR_UNDEFINED

static final java.lang.String STATE_STR_UNDEFINED
See Also:
Constant Field Values

STATE_STR_RUNNING

static final java.lang.String STATE_STR_RUNNING
See Also:
Constant Field Values

STATE_STR_SUSPENDED

static final java.lang.String STATE_STR_SUSPENDED
See Also:
Constant Field Values

STATE_STR_STOPPED

static final java.lang.String STATE_STR_STOPPED
See Also:
Constant Field Values

STATE_STR_FAILED

static final java.lang.String STATE_STR_FAILED
See Also:
Constant Field Values

STATE_STR_STARTING

static final java.lang.String STATE_STR_STARTING
See Also:
Constant Field Values

STATE_STR_STOPPING

static final java.lang.String STATE_STR_STOPPING
See Also:
Constant Field Values

STATE_STR_SUSPENDING

static final java.lang.String STATE_STR_SUSPENDING
See Also:
Constant Field Values

STATE_STR_RESUMING

static final java.lang.String STATE_STR_RESUMING
See Also:
Constant Field Values

STATE_STR_FAILING

static final java.lang.String STATE_STR_FAILING
See Also:
Constant Field Values

STATE_STRINGS

static final java.lang.String[] STATE_STRINGS
The order of elements in this array is important; it's set up so that you can use one of the STATE_* constants to look up a STATE_STR_* constant. For example:

String stopped = STATE_STRINGS[STATE_STOPPED];


OPERATION_UNDEFINED

static final int OPERATION_UNDEFINED
See Also:
Constant Field Values

OPERATION_STARTUP

static final int OPERATION_STARTUP
See Also:
Constant Field Values

OPERATION_SHUTDOWN

static final int OPERATION_SHUTDOWN
See Also:
Constant Field Values

OPERATION_SUSPEND

static final int OPERATION_SUSPEND
See Also:
Constant Field Values

OPERATION_RESUME

static final int OPERATION_RESUME
See Also:
Constant Field Values

OPERATION_FAIL

static final int OPERATION_FAIL
See Also:
Constant Field Values

OPERATION_STR_UNDEFINED

static final java.lang.String OPERATION_STR_UNDEFINED
See Also:
Constant Field Values

OPERATION_STR_STARTUP

static final java.lang.String OPERATION_STR_STARTUP
See Also:
Constant Field Values

OPERATION_STR_SHUTDOWN

static final java.lang.String OPERATION_STR_SHUTDOWN
See Also:
Constant Field Values

OPERATION_STR_SUSPEND

static final java.lang.String OPERATION_STR_SUSPEND
See Also:
Constant Field Values

OPERATION_STR_RESUME

static final java.lang.String OPERATION_STR_RESUME
See Also:
Constant Field Values

OPERATION_STR_FAIL

static final java.lang.String OPERATION_STR_FAIL
See Also:
Constant Field Values

OPERATION_STRINGS

static final java.lang.String[] OPERATION_STRINGS
The order of elements in this array is important; it's set up so that you can use one of the OPERATION_* constants to look up a OPERATION_STR_* constant. For example:

String shutdown = OPERATION_STRINGS[OPERATION_SHUTDOWN];


SHUTDOWN_NORMAL

static final int SHUTDOWN_NORMAL
Shut down all nodes with no error.

See Also:
Constant Field Values

SHUTDOWN_ERROR_TERMINATE

static final int SHUTDOWN_ERROR_TERMINATE
Report an error, signal all other servers to terminate, shut down all local nodes.

See Also:
Constant Field Values

SHUTDOWN_ERROR_RESTART_LOCAL

static final int SHUTDOWN_ERROR_RESTART_LOCAL
Report an error and bounce all local nodes.

See Also:
Constant Field Values

SHUTDOWN_ERROR_RESTART_GLOBAL

static final int SHUTDOWN_ERROR_RESTART_GLOBAL
Report an error, signal all other servers bounce their local nodes, bounce our local nodes.

See Also:
Constant Field Values
Method Detail

startup

void startup()
             throws ControlException
Transition a node from the stopped to the running state.

Throws:
ControlException

shutdown

void shutdown()
              throws ControlException
Transition a node from the running to the stopped state.

Throws:
ControlException

suspend

void suspend()
             throws ControlException
Transition a node from the running state to the suspended state.

Throws:
ControlException

resume

void resume()
            throws ControlException
Transition a node from the suspended state to the running state.

Throws:
ControlException

restart

void restart()
             throws ControlException
Calls shutdown() followed by startup().

Throws:
ControlException

getSandNodeState

int getSandNodeState()
Returns the current state of the node as one of the STATE constants.


getParent

Controllable getParent()
If this node was configured as a helper node, return a reference to the node it is helping. Top level nodes are helper nodes for the root node. The root node has no parent (so this method returns null).


getHelperNodes

Controllable[] getHelperNodes()
Return all helper nodes configured for this node. Returns an empty array if this node has no helpers.


setHelperNodes

void setHelperNodes(Controllable[] nodes)
Set the helper nodes as the specified array. This method should only be used for setting up the system, the helper nodes should never be replaced at runtime outside of configuration management.


getNodeInstance

NodeInstance getNodeInstance()
Return the NodeInstance for this node instance. This contains the runtime configuration info and is set once by the root when the node is created.


setNodeInstance

void setNodeInstance(NodeInstance instance)
Called once by the root when the node instance is created. The instance information should not be changed after the node has been created.


getSandRoot

SandRoot getSandRoot()
Return the SandRoot that launched this instance.


setSandRoot

void setSandRoot(SandRoot root)
Set our back reference to the root that launched this instance.


systemwideShutdown

void systemwideShutdown(int code)
                        throws ControlException
Signal a systemwide shutdown with the appropriate SHUTDOWN_* code. Nodes sharing the same root are considered local.

Throws:
ControlException

addWrapper

void addWrapper(ControlWrapper wrapper)
Add this ControlWrapper to our list of wrappers to notify in the event of a state change or parameter change.