cs138.launch
Class LauncherFactory

java.lang.Object
  extended by cs138.launch.LauncherFactory

public final class LauncherFactory
extends java.lang.Object

Factory class for launching nodes and initializing services. All methods take the class type that you are trying to launch and this deals with spawning a new jvm on a specific host and launching.

Author:
rm

Constructor Summary
LauncherFactory()
           
 
Method Summary
static void initialize(boolean startGUI)
          This method will start the ServiceController on the port specified by the properties file.
static java.lang.String launchLocalNode(java.lang.Class<? extends ManageableNode> clazz)
          Creates a new node in a new JVM on the local host.
static java.lang.String launchNode(java.lang.Class<? extends ManageableNode> clazz, java.lang.String host, int port)
          Creates a new node in a new JVM on the specified host.
static java.lang.String launchRandomNode(java.lang.Class<? extends ManageableNode> clazz)
          Creates a new node in a new JVM on the random host.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LauncherFactory

public LauncherFactory()
Method Detail

launchLocalNode

public static java.lang.String launchLocalNode(java.lang.Class<? extends ManageableNode> clazz)
                                        throws java.io.IOException
Creates a new node in a new JVM on the local host. This node will be of the type specified by the class argument. This will then return the identifier of that new node, or null if there was an error launching the remote node. The identifier can then be used to lookup the node.

Parameters:
clazz - The Class type of the node to launch
Returns:
The String identifier for the newly created node or null if an error occurred while launching it.
Throws:
java.io.IOException

launchNode

public static java.lang.String launchNode(java.lang.Class<? extends ManageableNode> clazz,
                                          java.lang.String host,
                                          int port)
                                   throws java.io.IOException
Creates a new node in a new JVM on the specified host. This node will be of the type specified by the class argument. This will then return the identifier of that new node, or null if there was an error launching the remote node. The identifier can then be used to lookup the node.

Parameters:
clazz - The Class type of the node to launch
host - The host that the new node should be launched on.
port - The port that ServiceDiscovery is running on
Returns:
The String identifier for the newly created node or null if an error occurred while launching it.
Throws:
java.io.IOException

launchRandomNode

public static java.lang.String launchRandomNode(java.lang.Class<? extends ManageableNode> clazz)
                                         throws java.io.IOException
Creates a new node in a new JVM on the random host. This node will be of the type specified by the class argument. This will then return the identifier of that new node, or null if there was an error launching the remote node. The identifier can then be used to lookup the node.

Parameters:
clazz - The Class type of the node to launch
Returns:
The String identifier for the newly created node or null if an error occurred while launching it.
Throws:
java.io.IOException

initialize

public static void initialize(boolean startGUI)
This method will start the ServiceController on the port specified by the properties file. It will optionally start the GUI based on the boolean argument.

Parameters:
startGUI - Starts the GUI if true.