org.instantreality.InstantIO
Class Namespace

java.lang.Object
  extended by org.instantreality.InstantIO.Namespace
Direct Known Subclasses:
Node, Root

public class Namespace
extends java.lang.Object

Container for InSlots and OutSlots.

Namespace object are used to automatically connect InSlots and OutSlots. InSlots and OutSlots connect to each other when they

So, when you use the system to exchange data values between different software components, you usually create a Namespace, add your InSlots and OutSlots to that namespace, and create routes between these InSlots and OutSlots. The following piece of code demonstrates how to connect an OutSlot "out" to an InSlot "in":
 // Create the namespace
 Namespace namespace = new Namespace();
 
 // Create the outslot and add it to the namespace
 OutSlot outSlot = new OutSlot(Integer.class);
 namespace.addOutSlot("out", outSlot);
 
 // Create the inslot and add it to the namespace
 InSlot inSlot = new InSlot(Integer.class);
 namespace.addInSlot("in", inSlot);
 
 // Create a route that maps "out" to "in"
 namespace.addRoute("out", "in");
 
 // Enable the namespace
 namespace.enable();
 
In this example, the OutSlot and the InSlot get connected when the namespace is enabled. A namespace is disabled by default. A namespace connects OutSlots and InSlots only when it is enabled. It is perfectly ok to enable the namespace before you add any OutSlots, InSlots and routes. In this case OutSlots and InSlots get connected as soon as all preconditions to connect them are fulfilled.

In the example above, we created a new Namespace object. But when there are lots of different software components that need to exchange data, it gets difficult to provide them with the same namespace object. For this reason, a special descendant of the Namespace class exists: The Root singleton. Exactly one instance of this class exists in an application. So all software components can obtain this single instance and add their OutSlots and InSlots to it. The following piece of code demonstrates how to do that:

 // Get the root namespace
 Namespace root = Root.the();
 
 // Add OutSlots and InSlots to the root namespace
 root.addOutSlot("out", outSlot);
 root.addInSlot("in", inSlot);
 
The Root singleton is enabled by default.

Besides of adding slots and routes to namespaces, you can also add subnamespaces. Subnamespaces are normal Namespace objects, i.e. you can add slots and routes to them. By using so-called "external routes", you can export OutSlots and InSlots from subnamespaces to their parent namespace. The following piece of code demonstrates how to create a subnamespace, and how to export the slots in the subname to the parent namespace.

 // Get the root namespace
 Namespace root = Root.the();
 
 // Create a subnamespace and add it to the root namespace
 Namespace subnamespace = new Namespace();
 root.addNamespace("label", subnamespace);
 
 // Create the outslot and add it to the subnamespace
 OutSlot outSlot = new OutSlot(Integer.class);
 subnamespace.addOutSlot("subout", outSlot);
 
 // Create the inslot and add it to the subnamespace
 InSlot inSlot = new InSlot(Integer.class);
 subnamespace.addInSlot("subin", inSlot);
 
 // Export the outslot as "out" to the root namespace
 subnamespace.addExternalRoute("subout", "out");
 
 // Export the inslot as "in" to the root namespace
 subnamespace.addExternalRoute("subin", "in");
 
 // Create a route that maps "out" to "in" in the root
 // namespace
 root.addRoute("out", "in");
 
In the example above, the outslot and the inslot get connected, because there is a route from "out" to "in", and the outslot and the inslot are exported under these labels into the root namespace.

Subnamespaces inherit the enabled/disabled state of their parent namespace. I.e. when you add a namespace to an enabled namespace, it gets enabled, and when you add a namespace to a disabled namespace, it gets disabled. When you enabled or disable a parent namespace, the subnamespaces get enabled or disabled likewise.

Author:
Patrick Dähne
See Also:
OutSlot, InSlot, Root

Nested Class Summary
static interface Namespace.Listener
          Allows to receive information about the status of a Namespace.
 
Constructor Summary
Namespace()
          Creates a new Namespace object.
 
Method Summary
 void addExternalRoute(java.lang.String internal, java.lang.String external)
          Adds an external route to the Namespace.
 void addInSlot(java.lang.String label, InSlot inSlot)
          Adds an InSlot to the Namespace.
 void addListener(Namespace.Listener listener)
          Adds a Listener to the Namespace.
 java.lang.String addNamespace(Namespace namespace)
          Adds a Subnamespace to this Namespace.
 java.lang.String addNamespace(java.lang.String label, Namespace namespace)
          Adds a Subnamespace to this Namespace.
 void addOutSlot(java.lang.String label, OutSlot outSlot)
          Adds an OutSlot to the Namespace.
 void addRoute(java.lang.String from, java.lang.String to)
          Adds a route to the Namespace.
 void clear()
          Removes all routes, external routes and subnamespaces from this Namespace.
 void clearExternalRoutes()
          Removes all external routes from the Namespace.
 void clearNamespaces()
          Removes all subnamespaces from the Namespace.
 void clearRoutes()
          Removes all routes from the Namespace.
 boolean dirty()
          Returns if this Namespaces has unsaved changes.
 void disable()
          Disables the Namespace.
 void dispose()
          Disposes a Namespace object.
 void enable()
          Enables the Namespace.
 boolean enabled()
          Returns if the Namespace is enabled or disabled.
protected  void finalize()
          Destroys a Namespace object.
 java.net.URL getBaseURL()
          Returns the base URL of the Namespace.
 java.util.Vector getFieldNames()
          Returns the names of all fields.
 java.lang.String getFieldValue(java.lang.String name)
          Returns the value of a field.
 java.lang.String getLabel()
          Returns the label of the Namespace.
protected  void initialize()
          Gets called when the Namespace is enabled.
 void removeExternalRoute(java.lang.String internal, java.lang.String external)
          Removes an external route from the Namespace.
 void removeInSlot(java.lang.String label, InSlot inSlot)
          Removes an InSlot from the Namespace.
 void removeListener(Namespace.Listener listener)
          Removes a Listener from the Namespace.
 Namespace removeNamespace(java.lang.String label)
          Removes a Subnamespace from the Namespace.
 void removeOutSlot(java.lang.String label, OutSlot outSlot)
          Removes an OutSlot from the Namespace.
 void removeRoute(java.lang.String from, java.lang.String to)
          Removes a route from the Namespace.
 boolean saveState()
          Returns if the contents of this Namespace should be saved.
 void setBaseURL(java.net.URL url)
          Sets the base URL of the Namespace.
 void setDirty(boolean dirty)
          Sets the status of the dirty flag.
 void setFieldValue(java.lang.String name, java.lang.String value)
          Sets the value of a field.
 void setFieldValues(java.lang.String paramLine)
          Sets the values of fields from a line of parameters.
protected  void shutdown()
          Gets called when the Namespace is disabled.
protected  java.lang.String typeName()
          Returns the type name of the Namespace.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Namespace

public Namespace()
Creates a new Namespace object. The Namespace is disabled by default and contains no slots, subnamespaces or routes.

The following example demonstrated how the create a new Namespace and how to enable it:

 Namespace namespace = new Namespace();
 namespace.enable();
 

Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Destroys a Namespace object. Automatically calls the dispose method.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
dispose()

dispose

public void dispose()
Disposes a Namespace object. By calling this method, you disable the Namespace, dispose and remove all subnamespaces, remove all OutSlots, InSlots and routes, and remove this namespace from its parent namespace (if any).

The following example demonstrates how to dispose a namespace when you do not need it anymore:

 Namespace namespace = ...;
 namespace.dispose();
 


addListener

public final void addListener(Namespace.Listener listener)
Adds a Listener to the Namespace. You can use Listener objects when you need to get notifications when slots are added to or removed from the Namespace.

Parameters:
listener - The listener.
See Also:
removeListener(org.instantreality.InstantIO.Namespace.Listener)

removeListener

public final void removeListener(Namespace.Listener listener)
Removes a Listener from the Namespace.

Parameters:
listener - The listener.
See Also:
addListener(org.instantreality.InstantIO.Namespace.Listener)

enable

public void enable()
Enables the Namespace. Only enabled namespaces connect their OutSlots and InSlots. Enabling a Namespaces also enables all subnamespaces. Calling this method on an already enabled namespace does not result in any action.

The following example demonstrates how to enable and later on disable a namespace:

 Namespace namespace = ...;
 namespace.enable();
 ...
 namespace.disable();
 

See Also:
disable(), enabled()

disable

public void disable()
Disables the Namespace. Disabled namespaces disconnect their OutSlots and InSlots. Disabling a Namespaces also disables all subnamespaces. Calling this method on an already disabled namespace does not result in any action.

The following example demonstrates how to enable and later on disable a namespace:

 Namespace namespace = ...;
 namespace.enable();
 ...
 namespace.disable();
 

See Also:
enable(), enabled()

enabled

public final boolean enabled()
Returns if the Namespace is enabled or disabled. Namespaces only connect their OutSlots and InSlots when they are enabled.

The following example demonstrates how to check if a namespace is enabled:

 Namespace namespace = ...;
 if (namespace.enabled())
 {
   // namespace is enabled
 }
 else
 {
   // namespace is not enabled
 }
 

Returns:
true when the Namespace is enabled, false otherwise.
See Also:
enable(), disable()

getLabel

public final java.lang.String getLabel()
Returns the label of the Namespace.

The following example prints the label of a namespace to the console:

 Namespace namespace = ...;
 System.out.println("Label = " + namespace.getLabel());
 

Returns:
The label.

typeName

protected java.lang.String typeName()
Returns the type name of the Namespace. For instances of the Namespace class, this method always returns "Namespace". For instances of the Node class which inherits from the Namespace class, this method returns the unique type name of the Node.

The following example prints the type name of a namespace to the console:

 Namespace namespace = ...;
 System.out.println("Type name = " + namespace.typeName());
 

Returns:
The type name (always "Namespace" for instances of the Namespace class).

clear

public final void clear()
Removes all routes, external routes and subnamespaces from this Namespace.

The following example demonstrates how to clear a namespace:

 Namespace namespace = ...;
 namespace.clear();
 


saveState

public boolean saveState()
Returns if the contents of this Namespace should be saved. The default implementation of this method always returns true. Overwrite this method when you implement a Node whoose contents should not be saved. For example, the contents of the InlineNode do not get saved, because they are loaded from an URL when instanciating the InlineNode.

The following example demonstrates how to check if the contents of a namespace should be saved:

 Namespace namespace = ...;
 if (namespace.saveState() == true)
 {
   // save the state of the namespace
 }
 else
 {
   // do not save the state of the namespace
 }
 

Returns:
true when the contents of this Namespace should be saved, false otherwise

dirty

public final boolean dirty()
Returns if this Namespaces has unsaved changes.

Returns:
true when the Namespace needs to be saved.

setDirty

public final void setDirty(boolean dirty)
Sets the status of the dirty flag. The dirty flag is set (true) when the Namespaces has unsaved changes.

Parameters:
dirty - true when the Namespace needs to be saved, false otherwise. When you set the dirty flag to true, this method also sets the dirty flags of all parent namespaces to true. When you set the dirty flag to false, this method also sets the dirty flag of all children namespaces to false.

setBaseURL

public void setBaseURL(java.net.URL url)
Sets the base URL of the Namespace. The base URL is used by Nodes to resolve relative URLs.

Parameters:
url - The base URL.
See Also:
getBaseURL()

getBaseURL

public java.net.URL getBaseURL()
Returns the base URL of the Namespace. The base URL is used by Nodes to resolve relative URLs.

 Namespace namespace = ...;
 System.out.println("Base URL = " + namespace.getBaseURL());
 

Returns:
The base URL.
See Also:
setBaseURL(java.net.URL)

setFieldValues

public void setFieldValues(java.lang.String paramLine)
Sets the values of fields from a line of parameters. The parameter line is a set of key-value parameters like this: "key1=value1 key2=value2". This method extracts the key-value pairs and calls setFieldValue(key, value).

Parameters:
paramLine - A string consisting of key-value pairs.

setFieldValue

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

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.

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.

Returns:
A vector filled with the names of all fields.

addOutSlot

public void addOutSlot(java.lang.String label,
                       OutSlot outSlot)
Adds an OutSlot to the Namespace. When the Namespace is enabled, the OutSlot automatically gets connected to all InSlots contained in the Namespace that have To remove an OutSlot later on from the namespace, call the removeOutSlot method.

It is perfectly ok to add an OutSlot under the same or different labels to one or more namespaces. When you add the OutSlot n times under the same label to a namespace, you also have to call removeOutSlot n times to remove the OutSlot from that namespace.

The following example demonstrates how to add and later remove a boolean OutSlot that provides button press events:

 Namespace namespace = ...;
 OutSlot outSlot = new OutSlot(Boolean.class);
 namespace.addOutSlot("Button", outSlot);
 ...
 namespace.removeOutSlot("Button", outSlot);
 

Parameters:
label - The label of the OutSlot. The label is a string that specifies what kind of data you want to send to the OutSlot. It is used to automatically connect to InSlots when you add an OutSlot to a Namespace. OutSlots connect to InSlots of the same data type when they have the same label or when a route exists that maps the label of the OutSlot to the label of the InSlot. Case does not matter.
outSlot - The OutSlot.
See Also:
removeOutSlot(java.lang.String, org.instantreality.InstantIO.OutSlot)

removeOutSlot

public void removeOutSlot(java.lang.String label,
                          OutSlot outSlot)
Removes an OutSlot from the Namespace. The OutSlot gets disconnected from all InSlots contained in the Namespace it is currently connected to.

The following example demonstrates how to add and later remove a boolean OutSlot that provides button press events:

 Namespace namespace = ...;
 OutSlot outSlot = new OutSlot(Boolean.class);
 namespace.addOutSlot("Button", outSlot);
 ...
 namespace.removeOutSlot("Button", outSlot);
 

Parameters:
label - The label of the OutSlot in this Namespace.
outSlot - The OutSlot.
See Also:
addOutSlot(java.lang.String, org.instantreality.InstantIO.OutSlot)

addInSlot

public void addInSlot(java.lang.String label,
                      InSlot inSlot)
Adds an InSlot to the Namespace. When the Namespace is enabled, the InSlot automatically gets connected to all OutSlots contained in the Namespace that have To remove an InSlot later on from the namespace, call the removeInSlot method.

It is perfectly ok to add an InSlot under the same or different labels to one or more namespaces. When you add the InSlot n times under the same label to a namespace, you also have to call removeInSlot n times to remove the InSlot from that namespace.

The following example demonstrates how to add and later remove a boolean InSlot that receives button press events:

 Namespace namespace = ...;
 InSlot inSlot = new InSlot(Boolean.class);
 namespace.addInSlot("Button", inSlot);
 ...
 namespace.removeInSlot("Button", inSlot);
 

Parameters:
label - The label of the InSlot. The label is a string that specifies what kind of data you want to receive from the InSlot. It is used to automatically connect to OutSlots when you add an InSlot to a Namespace. InSlots connect to OutSlots of the same data type when they have the same label or when a route exists that maps the label of the OutSlot to the label of the InSlot. Case does not matter.
inSlot - The InSlot.
See Also:
removeInSlot(java.lang.String, org.instantreality.InstantIO.InSlot)

removeInSlot

public void removeInSlot(java.lang.String label,
                         InSlot inSlot)
Removes an InSlot from the Namespace. The InSlot gets disconnected from all OutSlots contained in the Namespace it is currently connected to.

The following example demonstrates how to add and later remove a boolean InSlot that receives button press events:

 Namespace namespace = ...;
 InSlot inSlot = new InSlot(Boolean.class);
 namespace.addInSlot("Button", inSlot);
 ...
 namespace.removeInSlot("Button", inSlot);
 

Parameters:
label - The label of the InSlot in this Namespace.
inSlot - The InSlot.
See Also:
addInSlot(java.lang.String, org.instantreality.InstantIO.InSlot)

addExternalRoute

public void addExternalRoute(java.lang.String internal,
                             java.lang.String external)
Adds an external route to the Namespace. External routes are used to export slots to the parent namespace. All slots whose label matches the internal label of the route are exported to the parent namespace under the external label of the route. When you try to add an external route that already exists in the namespace, the call gets silently ignored.

The following example demonstrates how to add an OutSlot and an InSlot to a namespace, how to export them to the parent namespace, and how to remove them from the parent namespace later on:

 Namespace namespace = ...;
 namespace.enable();
 
 // Create the outslot and add it to the namespace
 OutSlot outSlot = new OutSlot(Integer.class);
 namespace.addOutSlot("out", outSlot);
 
 // Create the inslot and add it to the namespace
 InSlot inSlot = new InSlot(Integer.class);
 namespace.addInSlot("in", inSlot);
 
 // Export the outslot as "extern-out" to the parent namespace
 namespace.addExternalRoute("out", "extern-out");
 
 // Export the inslot as "extern-in" to the parent namespace
 namespace.addExternalRoute("in", "extern-in");
 
 ...
 
 // Remove the outslot from the parent namespace
 namespace.removeExternalRoute("out", "extern-out");
 
 // Remove the inslot from the parent namespace
 namespace.removeExternalRoute("in", "extern-in");
 

Parameters:
internal - The internal label. Case does not matter. This label may contain the wildcards "?", "*" and "[]". "?" stands for exactly one arbitrary character. "*" stands for an arbitrary number of arbitrary characters. In square brackets, you can specify the characters that are allowed at that position. "[1-9]" means that the characters from "1" to "9" are allowed at this position. "[aeiou]" means that the characters "a", "e", "i", "o", and "u" are allowed at this position. To use the wildcard characters without their special meaning, escape them using the backslash character "\".
external - The external label. Case does not matter. This label may not contain wildcards. Instead, you can use two variables that get replaced by their respective values: "{SlotLabel}" gets replaced by the original name of the slot in the namespace, and "{NamespaceLabel}" gets replaced by the current label of the namespace. To use the character "{" without its special meaning, escape it using the backslash character "\".
See Also:
removeExternalRoute(java.lang.String, java.lang.String)

removeExternalRoute

public void removeExternalRoute(java.lang.String internal,
                                java.lang.String external)
Removes an external route from the Namespace. All slots that are exported to the parent namespace by this route are removed from the parent namespace.

The following example demonstrates how to add an OutSlot and an InSlot to a namespace, how to export them to the parent namespace, and how to remove them from the parent namespace later on:

 Namespace namespace = ...;
 namespace.enable();
 
 // Create the outslot and add it to the namespace
 OutSlot outSlot = new OutSlot(Integer.class);
 namespace.addOutSlot("out", outSlot);
 
 // Create the inslot and add it to the namespace
 InSlot inSlot = new InSlot(Integer.class);
 namespace.addInSlot("in", inSlot);
 
 // Export the outslot as "extern-out" to the parent namespace
 namespace.addExternalRoute("out", "extern-out");
 
 // Export the inslot as "extern-in" to the parent namespace
 namespace.addExternalRoute("in", "extern-in");
 
 ...
 
 // Remove the outslot from the parent namespace
 namespace.removeExternalRoute("out", "extern-out");
 
 // Remove the inslot from the parent namespace
 namespace.removeExternalRoute("in", "extern-in");
 

Parameters:
internal - The internal label.
external - The external label.
See Also:
addExternalRoute(java.lang.String, java.lang.String)

clearExternalRoutes

public final void clearExternalRoutes()
Removes all external routes from the Namespace.

The following example demonstrates how to remove all external routes from a namespace:

 Namespace namespace = ...;
 namespace.clearExternalRoutes();
 


addRoute

public void addRoute(java.lang.String from,
                     java.lang.String to)
Adds a route to the Namespace. All OutSlots in the Namespace that match the "from" label of the route are connected to all InSlots in the Namespace that match the "to" label and have the same data type. When you try to add a route that already exists in the namespace, the call gets silently ignored.

The following example demonstrates how to add an OutSlot and an InSlot to a namespace, how to connect them by a route, and how to remove the route later on:

 Namespace namespace = ...;
 namespace.enable();
 
 // Create the outslot and add it to the namespace
 OutSlot outSlot = new OutSlot(Integer.class);
 namespace.addOutSlot("out", outSlot);
 
 // Create the inslot and add it to the namespace
 InSlot inSlot = new InSlot(Integer.class);
 namespace.addInSlot("in", inSlot);
 
 // Add a route that maps "out" to "in". This
 // automatically connects the outslot and the
 // inslot added in the code above
 namespace.addRoute("out", "in");
 
 ...
 
 // Remove the route. This automatically
 // disconnects the outslot and the inslot added in
 // the code above
 namespace.removeRoute("out", "in");
 

Parameters:
from - The "from" label. Case does not matter. This label may contain the wildcards "?", "*" and "[]". "?" stands for exactly one arbitrary character. "*" stands for an arbitrary number of arbitrary characters. In square brackets, you can specify the characters that are allowed at that position. "[1-9]" means that the characters from "1" to "9" are allowed at this position. "[aeiou]" means that the characters "a", "e", "i", "o", and "u" are allowed at this position. To use the wildcard characters without their special meaning, escape them using the backslash character "\".
to - The "to" label. Case does not matter. This label also may contain wildcard characters.
See Also:
removeRoute(java.lang.String, java.lang.String)

removeRoute

public void removeRoute(java.lang.String from,
                        java.lang.String to)
Removes a route from the Namespace. All OutSlots and InSlots that are connected by this route are disconnected.

The following example demonstrates how to add an OutSlot and an InSlot to a namespace, how to connect them by a route, and how to remove the route later on:

 Namespace namespace = ...;
 namespace.enable();
 
 // Create the outslot and add it to the namespace
 OutSlot outSlot = new OutSlot(Integer.class);
 namespace.addOutSlot("out", outSlot);
 
 // Create the inslot and add it to the namespace
 InSlot inSlot = new InSlot(Integer.class);
 namespace.addInSlot("in", inSlot);
 
 // Add a route that maps "out" to "in". This
 // automatically connects the outslot and the
 // inslot added in the code above
 namespace.addRoute("out", "in");
 
 ...
 
 // Remove the route. This automatically
 // disconnects the outslot and the inslot added in
 // the code above
 namespace.removeRoute("out", "in");
 

Parameters:
from - The "from" label.
to - The "to" label.
See Also:
addRoute(java.lang.String, java.lang.String)

clearRoutes

public final void clearRoutes()
Removes all routes from the Namespace.

The following example demonstrates how to remove all routes from a namespace:

 Namespace namespace = ...;
 namespace.clearRoutes();
 


addNamespace

public java.lang.String addNamespace(Namespace namespace)
Adds a Subnamespace to this Namespace. Each subnamespace must have a unique label. You can add a subnamespace only to one single parent namespace. This method automatically creates a unique label by using the type name returned be the typeName method and adding a number.

The following example demonstrates how to add a subnamespace to a parent namespace, and how to remove that subnamespace from the parent namespace later on:

 Namespace namespace = ...;
 Namespace subnamespace = ...;
 
 // Add the subnamespace to the parent namespace
 String label = namespace.addNamespace(subnamespace);
 
 ...
 
 // Remove the subnamespace from the parent namespace
 namespace.removeNamespace(label);
 

Parameters:
namespace - The child Namespace.
Returns:
The unique label the subnamespace actually got in this Namespace.
See Also:
removeNamespace(java.lang.String)

addNamespace

public java.lang.String addNamespace(java.lang.String label,
                                     Namespace namespace)
Adds a Subnamespace to this Namespace. You can add a subnamespace only to one single parent namespace. Each subnamespace must have a unique label. When the label you provide to this method is not unique, the method automatically makes it unique by adding a number.

The following example demonstrates how to add a subnamespace to a parent namespace, and how to remove that subnamespace from the parent namespace later on:

 Namespace namespace = ...;
 Namespace subnamespace = ...;
 
 // Add the subnamespace to the parent namespace
 String label = namespace.addNamespace("macro", subnamespace);
 
 ...
 
 // Remove the subnamespace from the parent namespace
 namespace.removeNamespace(label);
 

Parameters:
label - The label of the child Namespace.
namespace - The child Namespace.
Returns:
The unique label the subnamespace actually got in this Namespace.
See Also:
removeNamespace(java.lang.String)

removeNamespace

public Namespace removeNamespace(java.lang.String label)
Removes a Subnamespace from the Namespace.

The following example demonstrates how to add a subnamespace to a parent namespace, and how to remove that subnamespace from the parent namespace later on:

 Namespace namespace = ...;
 Namespace subnamespace = ...;
 
 // Add the subnamespace to the parent namespace
 String label = namespace.addNamespace(subnamespace);
 
 ...
 
 // Remove the subnamespace from the parent namespace
 namespace.removeNamespace(label);
 

Parameters:
label - The label of the child Namespace.
Returns:
The subnamespace removed by this method.
See Also:
addNamespace(java.lang.String, org.instantreality.InstantIO.Namespace)

clearNamespaces

public final void clearNamespaces()
Removes all subnamespaces from the Namespace.

The following example demonstrates how to remove all subnamespaces from a namespace:

 Namespace namespace = ...;
 namespace.clearNamespaces();
 


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.


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.