org.instantreality.InstantIO
Class NetworkNode

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

public final class NetworkNode
extends Node
implements Namespace.Listener

Exports slots to and imports slots from other software components on the network.

Author:
Patrick Dähne

Nested Class Summary
 
Nested classes/interfaces inherited from class org.instantreality.InstantIO.Namespace
Namespace.Listener
 
Field Summary
static Field[] fields
          Meta information about the fields of this Node.
 
Fields inherited from class org.instantreality.InstantIO.Node
NODE_DISABLED, NODE_ERROR, NODE_RUNNING, NODE_SLEEPING
 
Constructor Summary
NetworkNode()
          Creates a new NetworkNode object.
 
Method Summary
 void disable()
          Disables the NetworkNode.
 void enable()
          Enables the NetworkNode.
 java.net.InetAddress getAddress()
          Returns the address the NetworkNode is listening at for other NetworkNodes.
 java.lang.String getDetailedInfo()
          Returns a detailed information string.
 boolean getExportSlots()
          Returns the "exportSlots" flag that controls if the NetworkNode exports slots to other NetworkNodes.
 short getId()
          Returns the ID of the NetworkNode.
 boolean getImportSlots()
          Returns the "importSlots" flag that controls if the NetworkNode imports slots from other NetworkNodes.
 java.net.InetAddress getMulticastAddress()
          Returns the multicast address used for automatically connecting NetworkNodes on the network.
 int getMulticastPort()
          Returns the multicast port used for automatically connecting NetworkNodes on the network.
 int getMulticastTtl()
          Returns the multicast time-to-live value.
 int getPort()
          Returns the port the NetworkNode is listening at for other NetworkNodes.
 java.lang.String getPrefix()
          Returns the prefix that is put in front of all slots exported by this NetworkNode.
 java.lang.String getServers()
          Returns the list of servers the NetworkNode should connect to.
 void inSlotAdded(Namespace namespace, java.lang.String label, InSlot inSlot)
          Gets called when a new inslot is added to the parent namespace.
 void inSlotRemoved(Namespace namespace, java.lang.String label, InSlot inSlot)
          Gets called when an inslot is removed from the parent namespace.
 void outSlotAdded(Namespace namespace, java.lang.String label, OutSlot outSlot)
          Gets called when a new outslot is added to the parent namespace.
 void outSlotRemoved(Namespace namespace, java.lang.String label, OutSlot outSlot)
          Gets called when an outslot is removed from the parent namespace.
 void routeAdded(Namespace namespace, java.lang.String from, java.lang.String to)
          Gets called when a route is added to the parent Namespace.
 void routeRemoved(Namespace namespace, java.lang.String from, java.lang.String to)
          Gets called when a route is removed from the parent Namespace.
 void setAddress(java.net.InetAddress address)
          Sets the address the NetworkNode is listening at for other NetworkNodes.
 void setExportSlots(boolean exportSlots)
          Sets the "exportSlots" flag that controls if the NetworkNode exports slots to other NetworkNodes.
 void setId(short id)
          Sets the ID of the NetworkNode.
 void setImportSlots(boolean importSlots)
          Sets the "importSlots" flag that controls if the NetworkNode imports slots from other NetworkNodes.
 void setMulticastAddress(java.net.InetAddress address)
          Sets the multicast address used for automatically connecting NetworkNodes on the network.
 void setMulticastPort(int port)
          Sets the multicast port used for automatically connecting NetworkNodes on the network.
 void setMulticastTtl(int ttl)
          Sets the multicast time-to-live value.
 void setPort(int port)
          Sets the port the NetworkNode is listening at for other NetworkNodes.
 void setPrefix(java.lang.String prefix)
          Sets the prefix that is put in front of all slots exported by this NetworkNode.
 void setServers(java.lang.String servers)
          Sets the list of servers the NetworkNode should connect to.
 NodeType type()
          Returns meta information about the NetworkNode.
 
Methods inherited from class org.instantreality.InstantIO.Node
addLog, getFieldNames, getFieldValue, getLog, getShortInfo, getState, initialize, newData, setFieldValue, setState, setState, shutdown, start, startInSlot, startOutSlot, stop, stopInSlot, stopOutSlot, typeName
 
Methods inherited from class org.instantreality.InstantIO.Namespace
addExternalRoute, addInSlot, addListener, addNamespace, addNamespace, addOutSlot, addRoute, clear, clearExternalRoutes, clearNamespaces, clearRoutes, dirty, dispose, 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

fields

public static final Field[] fields
Meta information about the fields of this Node.

Constructor Detail

NetworkNode

public NetworkNode()
Creates a new NetworkNode object.

Method Detail

setMulticastAddress

public void setMulticastAddress(java.net.InetAddress address)
Sets the multicast address used for automatically connecting NetworkNodes on the network.

Parameters:
address - The multicast address.

getMulticastAddress

public java.net.InetAddress getMulticastAddress()
Returns the multicast address used for automatically connecting NetworkNodes on the network.

Returns:
The multicast address.

setMulticastPort

public void setMulticastPort(int port)
Sets the multicast port used for automatically connecting NetworkNodes on the network.

Parameters:
port - The multicast port.

getMulticastPort

public int getMulticastPort()
Returns the multicast port used for automatically connecting NetworkNodes on the network.

Returns:
The multicast port.

setMulticastTtl

public void setMulticastTtl(int ttl)
Sets the multicast time-to-live value.

Parameters:
ttl - The time-to-live value.

getMulticastTtl

public int getMulticastTtl()
Returns the multicast time-to-live value.

Returns:
The time-to-live value.

setAddress

public void setAddress(java.net.InetAddress address)
Sets the address the NetworkNode is listening at for other NetworkNodes.

Parameters:
address - The address.

getAddress

public java.net.InetAddress getAddress()
Returns the address the NetworkNode is listening at for other NetworkNodes.

Returns:
The address.

setPort

public void setPort(int port)
Sets the port the NetworkNode is listening at for other NetworkNodes.

Parameters:
port - The port.

getPort

public int getPort()
Returns the port the NetworkNode is listening at for other NetworkNodes.

Returns:
The port.

setId

public void setId(short id)
Sets the ID of the NetworkNode. Only NetworkNodes that have the same ID can connect to each other.

Parameters:
id - The ID.

getId

public short getId()
Returns the ID of the NetworkNode. Only NetworkNodes that have the same ID can connect to each other.

Returns:
The ID.

setImportSlots

public void setImportSlots(boolean importSlots)
Sets the "importSlots" flag that controls if the NetworkNode imports slots from other NetworkNodes.

Parameters:
importSlots - The status of the "importSlots" flag.

getImportSlots

public boolean getImportSlots()
Returns the "importSlots" flag that controls if the NetworkNode imports slots from other NetworkNodes.

Returns:
The status of the "importSlots" flag.

setExportSlots

public void setExportSlots(boolean exportSlots)
Sets the "exportSlots" flag that controls if the NetworkNode exports slots to other NetworkNodes.

Parameters:
exportSlots - The status of the "exportSlots" flag.

getExportSlots

public boolean getExportSlots()
Returns the "exportSlots" flag that controls if the NetworkNode exports slots to other NetworkNodes.

Returns:
The status of the "exportSlots" flag.

setServers

public void setServers(java.lang.String servers)
Sets the list of servers the NetworkNode should connect to.

Parameters:
servers - The list of servers

getServers

public java.lang.String getServers()
Returns the list of servers the NetworkNode should connect to.

Returns:
The list of servers

setPrefix

public void setPrefix(java.lang.String prefix)
Sets the prefix that is put in front of all slots exported by this NetworkNode.

Parameters:
prefix - The prefix.

getPrefix

public java.lang.String getPrefix()
Returns the prefix that is put in front of all slots exported by this NetworkNode.

Returns:
The prefix.

getDetailedInfo

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

Overrides:
getDetailedInfo in class Node
Returns:
A string containing detailed information.

enable

public void enable()
Enables the NetworkNode.

Overrides:
enable in class Namespace
See Also:
Namespace.disable(), Namespace.enabled()

disable

public void disable()
Disables the NetworkNode.

Overrides:
disable in class Namespace
See Also:
Namespace.enable(), Namespace.enabled()

type

public NodeType type()
Returns meta information about the NetworkNode.

Specified by:
type in class Node
Returns:
A NodeType object that contains meta information.

outSlotAdded

public void outSlotAdded(Namespace namespace,
                         java.lang.String label,
                         OutSlot outSlot)
Gets called when a new outslot is added to the parent namespace.

Specified by:
outSlotAdded in interface Namespace.Listener
Parameters:
namespace - The parent namespace.
label - The label of the outslot.
outSlot - The outslot.

outSlotRemoved

public void outSlotRemoved(Namespace namespace,
                           java.lang.String label,
                           OutSlot outSlot)
Gets called when an outslot is removed from the parent namespace.

Specified by:
outSlotRemoved in interface Namespace.Listener
Parameters:
namespace - The parent namespace.
label - The label of the outslot.
outSlot - The outslot.

inSlotAdded

public void inSlotAdded(Namespace namespace,
                        java.lang.String label,
                        InSlot inSlot)
Gets called when a new inslot is added to the parent namespace.

Specified by:
inSlotAdded in interface Namespace.Listener
Parameters:
namespace - The parent namespace.
label - The label of the inslot.
inSlot - The inslot.

inSlotRemoved

public void inSlotRemoved(Namespace namespace,
                          java.lang.String label,
                          InSlot inSlot)
Gets called when an inslot is removed from the parent namespace.

Specified by:
inSlotRemoved in interface Namespace.Listener
Parameters:
namespace - The parent namespace.
label - The label of the inslot.
inSlot - The inslot.

routeAdded

public void routeAdded(Namespace namespace,
                       java.lang.String from,
                       java.lang.String to)
Gets called when a route is added to the parent Namespace.

Specified by:
routeAdded in interface Namespace.Listener
Parameters:
namespace - The parent namespace.
from - The from part of the route.
to - The to part of the route.

routeRemoved

public void routeRemoved(Namespace namespace,
                         java.lang.String from,
                         java.lang.String to)
Gets called when a route is removed from the parent Namespace.

Specified by:
routeRemoved in interface Namespace.Listener
Parameters:
namespace - The parent namespace.
from - The from part of the route.
to - The to part of the route.