com.cliftonsnyder.clutch.util
Class ClutchState

java.lang.Object
  extended by com.cliftonsnyder.clutch.util.ClutchState
All Implemented Interfaces:
java.io.Serializable

public class ClutchState
extends java.lang.Object
implements java.io.Serializable

A helper class that maintains all of the local state and configuration information for Clutch. ClutchState also contains a main() method, and can be run on the command-line to provide useful information about the state of Clutch on a given machine.

Author:
Clifton L. Snyder
See Also:
Serialized Form

Field Summary
static int DEFAULT_AGENT_COUNT
          the default number of agents that should be created
static java.lang.String DEFAULT_AGENTNODE_NAME
          the default name for the ProActive Node that will hold all of the Clutch Agents ("agentNode")
static java.lang.String DEFAULT_DATANODE_NAME
           
static int DEFAULT_MAXPEERS
          the default value for maxPeers (2)
static int DEFAULT_PORT
          the default RMI port to use (10001)
 
Constructor Summary
ClutchState(java.lang.String configFile)
          constructor for the ClutchState object
 
Method Summary
 void dump(java.io.PrintStream out)
           
 int getAgentCount()
           
 Node getAgentNode()
           
 Node getDataNode()
           
 int getMaxPeers()
           
 java.lang.String getProperty(java.lang.String key)
          a catchall for the properties in the configuration file for which an explicit getter does not exist
 Agent getRemoteAgent()
           
 Agent getRemoteAgent(java.lang.String agentClassname)
           
 Agent getRemoteAgentFromHost(java.lang.String hostname, java.lang.String agentClassname)
          retrieves a remote Agent from one of the bootstrap locations specified in the configuration file
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_AGENT_COUNT

public static final int DEFAULT_AGENT_COUNT
the default number of agents that should be created

See Also:
Constant Field Values

DEFAULT_AGENTNODE_NAME

public static final java.lang.String DEFAULT_AGENTNODE_NAME
the default name for the ProActive Node that will hold all of the Clutch Agents ("agentNode")

See Also:
Constant Field Values

DEFAULT_DATANODE_NAME

public static final java.lang.String DEFAULT_DATANODE_NAME
See Also:
Constant Field Values

DEFAULT_MAXPEERS

public static final int DEFAULT_MAXPEERS
the default value for maxPeers (2)

See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
the default RMI port to use (10001)

See Also:
Constant Field Values
Constructor Detail

ClutchState

public ClutchState(java.lang.String configFile)
constructor for the ClutchState object

Parameters:
configFile - the location of the Clutch configuration file
Method Detail

dump

public void dump(java.io.PrintStream out)

main

public static void main(java.lang.String[] args)
Parameters:
args - This main method optionally takes the location of a Clutch configuration file as a parameter. If the parameter is not supplied, the default location of '$PWD/etc/clutch.properties' is used. If no configuration file exists at that location, ClutchState will use default values to populate all of its variables and retrieve Nodes and Agents. The output of running this method on the command line should be a brief diagnostic summary of the current local configuration and status of Clutch.

getAgentCount

public int getAgentCount()

getAgentNode

public Node getAgentNode()
Returns:
the ProActive node in which the Clutch Agent's should be registered on the local machine

getDataNode

public Node getDataNode()

getMaxPeers

public int getMaxPeers()
Returns:
the maximum number of peers that Clutch Agents will be allowed to have

getProperty

public java.lang.String getProperty(java.lang.String key)
a catchall for the properties in the configuration file for which an explicit getter does not exist

Parameters:
key - the name of the property
Returns:
the value of the property

getRemoteAgentFromHost

public Agent getRemoteAgentFromHost(java.lang.String hostname,
                                    java.lang.String agentClassname)
retrieves a remote Agent from one of the bootstrap locations specified in the configuration file

Returns:
an Agent from somewhere in the Clutch network

getRemoteAgent

public Agent getRemoteAgent(java.lang.String agentClassname)

getRemoteAgent

public Agent getRemoteAgent()