org.instantreality.InstantIO
Class Node

java.lang.Object
  extended by org.instantreality.InstantIO.Namespace
      extended by org.instantreality.InstantIO.Node
All Implemented Interfaces:
InSlot.Listener, OutSlot.Listener
Direct Known Subclasses:
InlineNode, NetworkNode, WebNode

public abstract class Node
extends Namespace
implements OutSlot.Listener, InSlot.Listener

Superclass of all Nodes.

Author:
Patrick Dähne

Nested Class Summary
 
Nested classes/interfaces inherited from class org.instantreality.InstantIO.Namespace
Namespace.Listener
 
Field Summary
static int NODE_DISABLED
           
static int NODE_ERROR
           
static int NODE_RUNNING
           
static int NODE_SLEEPING
           
 
Constructor Summary
Node()
          Creates a new Node object.
 
Method Summary
protected  void addLog(java.lang.String entry)
          Adds an entry to the log.
 java.lang.String getDetailedInfo()
          Returns a detailed information string.
 java.util.Vector getFieldNames()
          Returns the names of all fields.
 java.lang.String getFieldValue(java.lang.String name)
          Returns the value of a field.
 void getLog(java.util.Vector entries)
          Returns the entries of the log.
 java.lang.String getShortInfo()
           
 int getState()
           
protected  void initialize()
          Gets called when the Namespace is enabled.
 void newData(InSlot inSlot)
          Gets called when new data is available on one inslot handled by this Node.
 void setFieldValue(java.lang.String name, java.lang.String value)
          Sets the value of a field.
protected  void setState(int state)
           
protected  void setState(int state, java.lang.String shortInfo)
           
protected  void shutdown()
          Gets called when the Namespace is disabled.
 void start()
          Gets called when the Node should start operation.
 void startInSlot(InSlot inSlot)
          Gets called when an inslot handled by this Node gets connected to the first outslot.
 void startOutSlot(OutSlot outSlot)
          Gets called when an outslot handled by this Node gets connected to the first inslot.
 void stop()
          Gets called when the Node should stop operation.
 void stopInSlot(InSlot inSlot)
          Gets called when the last outslot is disconnected from an inslot handled by this Node.
 void stopOutSlot(OutSlot outSlot)
          Gets called when the last inslot is disconnected from an outslot handled by this Node.
abstract  NodeType type()
          Returns meta information about the Node.
protected  java.lang.String typeName()
          Returns the type name of the Node.
 
Methods inherited from class org.instantreality.InstantIO.Namespace
addExternalRoute, addInSlot, addListener, addNamespace, addNamespace, addOutSlot, addRoute, clear, clearExternalRoutes, clearNamespaces, clearRoutes, dirty, disable, dispose, enable, enabled, finalize, getBaseURL, getLabel, removeExternalRoute, removeInSlot, removeListener, removeNamespace, removeOutSlot, removeRoute, saveState, setBaseURL, setDirty, setFieldValues
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_RUNNING

public static final int NODE_RUNNING
See Also:
Constant Field Values

NODE_SLEEPING

public static final int NODE_SLEEPING
See Also:
Constant Field Values

NODE_ERROR

public static final int NODE_ERROR
See Also:
Constant Field Values

NODE_DISABLED

public static final int NODE_DISABLED
See Also:
Constant Field Values
Constructor Detail

Node

public Node()
Creates a new Node object.

Method Detail

typeName

protected java.lang.String typeName()
Returns the type name of the Node.

Overrides:
typeName in class Namespace
Returns:
The type name.

type

public abstract NodeType type()
Returns meta information about the Node.

Returns:
NodeType object that contains meta information.

setState

protected final void setState(int state)

setState

protected final void setState(int state,
                              java.lang.String shortInfo)

getState

public final int getState()

getShortInfo

public final java.lang.String getShortInfo()

getDetailedInfo

public java.lang.String getDetailedInfo()
Returns a detailed information string.

Returns:
A string containing detailed information.

setFieldValue

public void setFieldValue(java.lang.String name,
                          java.lang.String value)
Sets the value of a field.

Overrides:
setFieldValue in class Namespace
Parameters:
name - The name of the field.
value - The new value of the field.

getFieldValue

public java.lang.String getFieldValue(java.lang.String name)
Returns the value of a field.

Overrides:
getFieldValue in class Namespace
Parameters:
name - The name of the field.
Returns:
The value of the field.

getFieldNames

public java.util.Vector getFieldNames()
Returns the names of all fields.

Overrides:
getFieldNames in class Namespace
Returns:
A vector filled with the names of all fields.

initialize

protected void initialize()
Gets called when the Namespace is enabled. Override this method when you need to do your own initializations when the Namespace is enabled. The default implementation does nothing.

Overrides:
initialize in class Namespace

shutdown

protected void shutdown()
Gets called when the Namespace is disabled. Override this method when you need to do your own deinitializations when the Namespace is disabled. The default implementation does nothing.

Overrides:
shutdown in class Namespace

start

public void start()
Gets called when the Node should start operation.


stop

public void stop()
Gets called when the Node should stop operation.


startOutSlot

public void startOutSlot(OutSlot outSlot)
Gets called when an outslot handled by this Node gets connected to the first inslot.

Specified by:
startOutSlot in interface OutSlot.Listener
Parameters:
outSlot - The outslot.

stopOutSlot

public void stopOutSlot(OutSlot outSlot)
Gets called when the last inslot is disconnected from an outslot handled by this Node.

Specified by:
stopOutSlot in interface OutSlot.Listener
Parameters:
outSlot - The outslot.

startInSlot

public void startInSlot(InSlot inSlot)
Gets called when an inslot handled by this Node gets connected to the first outslot.

Specified by:
startInSlot in interface InSlot.Listener
Parameters:
inSlot - The inslot.

stopInSlot

public void stopInSlot(InSlot inSlot)
Gets called when the last outslot is disconnected from an inslot handled by this Node.

Specified by:
stopInSlot in interface InSlot.Listener
Parameters:
inSlot - The inslot.

newData

public void newData(InSlot inSlot)
Gets called when new data is available on one inslot handled by this Node.

Specified by:
newData in interface InSlot.Listener
Parameters:
inSlot - The InSlot that generated the event.

addLog

protected void addLog(java.lang.String entry)
Adds an entry to the log.

Parameters:
entry - The new entry.

getLog

public void getLog(java.util.Vector entries)
Returns the entries of the log.

Parameters:
entries - The vector that gets filled with the entries of the log.