org.instantreality.InstantIO
Class InlineNode

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

public final class InlineNode
extends Node

A simple Node that loads its contents from a file.

By using the StateKeeperXML class, you can save the contents of a namespace, e.g. a subtree of the data flow graph consisting of namespaces, nodes and routes, to an XML file. By using the InlineNode, you can later integrate the saved subtree into other data flow graphs. The InlineNode takes an URL as parameter where the XML file is located. When it gets enabled, it reconstructs the subtree from that XML file and puts it into itself. This means that you can partition your data flow graph into smaller "macros" that can be combined into one single data flow graph later on by using InlineNodes.

The following example demonstrates how to create a new InlineNode that reads its contents from a file "macro.xml" located in the current working directory:

 InlineNode inlineNode = new InlineNode();
 inlineNode.setURL("macro.xml");
 
 // The following call automatically enables the InlineNode
 // and loads its contents from the URL:
 Root.the().addNamespace(inlineNode);
 

Author:
Patrick Dähne
See Also:
StateKeeperXML

Nested Class Summary
 
Nested classes/interfaces inherited from class org.instantreality.InstantIO.Namespace
Namespace.Listener
 
Field Summary
static Field[] fields
          Defines the fields of the InlineNode.
 
Fields inherited from class org.instantreality.InstantIO.Node
NODE_DISABLED, NODE_ERROR, NODE_RUNNING, NODE_SLEEPING
 
Constructor Summary
InlineNode()
          Creates the new InlineNode object.
 
Method Summary
 java.lang.String getURL()
          Returns the URL of the file the namespace is read from.
protected  void initialize()
          Initializes the InlineNode object.
 boolean saveState()
          Returns if the contents of this Node should be saved.
 void setURL(java.lang.String url)
          Sets the URL of the file the namespace is read from.
 NodeType type()
          Returns meta information about the InlineNode.
 
Methods inherited from class org.instantreality.InstantIO.Node
addLog, getDetailedInfo, getFieldNames, getFieldValue, getLog, getShortInfo, getState, 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, disable, dispose, enable, enabled, finalize, getBaseURL, getLabel, removeExternalRoute, removeInSlot, removeListener, removeNamespace, removeOutSlot, removeRoute, 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
Defines the fields of the InlineNode.

Constructor Detail

InlineNode

public InlineNode()
Creates the new InlineNode object.

Method Detail

setURL

public void setURL(java.lang.String url)
Sets the URL of the file the namespace is read from. This URL can be relative - in this case it is resolved by using the base URL of the node.

Parameters:
url - The URL of the file.
See Also:
Namespace.setBaseURL(java.net.URL), Namespace.getBaseURL()

getURL

public java.lang.String getURL()
Returns the URL of the file the namespace is read from.

Returns:
The URL of the file

initialize

protected void initialize()
Initializes the InlineNode object.

Overrides:
initialize in class Node

saveState

public boolean saveState()
Returns if the contents of this Node should be saved. For the InlineNode, this method always returns false.

Overrides:
saveState in class Namespace
Returns:
true when the contents of this Namespace should be saved, false otherwise

type

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

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