things.thing
Class Cluster

java.lang.Object
  extended by things.thing.Cluster

public class Cluster
extends java.lang.Object

A cluster of things.

Version:
1.0

Version History

EPG - Initial - 10 JAN 08
 
Author:
Erich P. Gatejen

Field Summary
 java.util.HashMap<java.lang.String,things.thing.Cluster.Node> nodes
          Cluster nodes.
 
Constructor Summary
Cluster(SystemInterface si, ExpressionInterface parentInterface)
          Construct a cluster not owned by a THING.
Cluster(THING owner)
          Construct a cluster owned by a THING.
 
Method Summary
 void add(java.lang.String clusterNodeName, java.lang.String thingName)
          Add a node to the cluster.
 void add(java.lang.String clusterNodeName, java.lang.String thingName, ThingsPropertyView overlayProperties)
          Add a node to the cluster.
 boolean checkClusterDone()
          Check the cluster if it is done.
 RESULT getResult()
          Get the result for the cluster.
 void start()
          Start the cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

public java.util.HashMap<java.lang.String,things.thing.Cluster.Node> nodes
Cluster nodes.

Constructor Detail

Cluster

public Cluster(THING owner)
        throws java.lang.Throwable
Construct a cluster owned by a THING.

Parameters:
owner - the owner.
Throws:
Throwable, - mostly if the owner is null.
java.lang.Throwable

Cluster

public Cluster(SystemInterface si,
               ExpressionInterface parentInterface)
        throws java.lang.Throwable
Construct a cluster not owned by a THING.

Parameters:
si - A system interface.
parentInterface - A parent interface.
Throws:
Throwable, - mostly if the si or parentInterface are null.
java.lang.Throwable
Method Detail

add

public void add(java.lang.String clusterNodeName,
                java.lang.String thingName)
         throws java.lang.Throwable
Add a node to the cluster.

Parameters:
clusterNodeName - a unique name for the node.
thingName - the thing name to run as the node.
Throws:
java.lang.Throwable - if either parameter is null or the node name has already been used.

add

public void add(java.lang.String clusterNodeName,
                java.lang.String thingName,
                ThingsPropertyView overlayProperties)
         throws java.lang.Throwable
Add a node to the cluster.

Parameters:
clusterNodeName - a unique name for the node.
thingName - the thing name to run as the node.
overlayProperties - properties to overlay for that thing only. May not be null. (Use the other method).
Throws:
java.lang.Throwable - if either parameter is null or the node name has already been used.

start

public void start()
           throws java.lang.Throwable
Start the cluster. IF the cluster has already been started, this will have no effect.

Throws:
java.lang.Throwable - A resolution of all start exceptions. Note that the exception will not interrupt the start list. It will finish attempting to start all nodes before letting an exception out. So, your cluster may be running!

checkClusterDone

public boolean checkClusterDone()
                         throws java.lang.Throwable
Check the cluster if it is done. If all nodes are done, it will return true.

Returns:
true if all nodes are done, otherwise false (including if it hasn't been started yet).
Throws:
java.lang.Throwable

getResult

public RESULT getResult()
                 throws java.lang.Throwable
Get the result for the cluster. the cluster may still be running.

Returns:
the result.
Throws:
java.lang.Throwable - A fault if there is any troubles.


Things.