Boeing Simulation 3.1 API Specification

server
Class ServerComponentFactory

java.lang.Object
  |
  +--server.ServerComponentFactory

public class ServerComponentFactory
extends Object

This class only has one responsibility and that is to generate the necessary components for the server and then pass them a CreatesConnection so that they can connect. It is made a singleton to ensure that duplicate sets of components are never unknowingly dispatched to connect (even though this may be checked for on server side as well). The server does not have any knowledge of how to create the components and thus must rely on this class to generate them in the manner that it was compiled to. Component class types are passed into the generate command, which in turn looks up the rule on how to create that type of component and then does so. The reason that rules must be defined is because components may in fact be located on other system, and creating them could require more than just calling "new ComponentType"

Version:
$Revision: 1.23 $
Author:
Dave Jurgens
See Also:
Server, SimulatorComponentGenerator

Nested Class Summary
protected static interface ServerComponentFactory.ComponentCreator
          This interface describes a rule on how to creates a component.
 
Field Summary
private  HashMap creationRules
          This map contains all known mapping between component types and how to create them.
private  int currentPort
           
private  boolean generated
          Whether the generateComponents method has already been called.
static int MISSION_CONTROL_PORT
           
protected static long serialVersionUID
           
protected static server.ServerComponentFactory singleton
           
static int UAV_MANAGER_PORT
           
static int UCAV_MANAGER_PORT
           
 
Constructor Summary
protected ServerComponentFactory()
           
 
Method Summary
 void generateComponents(connect.CreatesConnection serverConnection, Class[] componentTypes)
          This method should create all the components necessary specified by the server.
protected  HashMap generateRules()
          This method should generate the map that connects class types for rules on how to create them.
protected  int getNextPort()
          Returns the next available port.
static server.ServerComponentFactory instance()
          Returns the singleton instance of this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
See Also:
Constant Field Values

singleton

protected static server.ServerComponentFactory singleton

generated

private boolean generated
Whether the generateComponents method has already been called.


currentPort

private int currentPort

UAV_MANAGER_PORT

public static final int UAV_MANAGER_PORT
See Also:
Constant Field Values

UCAV_MANAGER_PORT

public static final int UCAV_MANAGER_PORT
See Also:
Constant Field Values

MISSION_CONTROL_PORT

public static final int MISSION_CONTROL_PORT
See Also:
Constant Field Values

creationRules

private final HashMap creationRules
This map contains all known mapping between component types and how to create them.

Constructor Detail

ServerComponentFactory

protected ServerComponentFactory()
Method Detail

instance

public static server.ServerComponentFactory instance()
Returns the singleton instance of this factory.


generateComponents

public void generateComponents(connect.CreatesConnection serverConnection,
                               Class[] componentTypes)
This method should create all the components necessary specified by the server. If a component type is specified that no rule has been defined for, throw an error.


getNextPort

protected int getNextPort()
Returns the next available port.


generateRules

protected HashMap generateRules()
This method should generate the map that connects class types for rules on how to create them.


Boeing Simulation 3.1 API Specification

To submit a bug or feature email the author of that class. Funding for this research was provided by Boeing and DARPA.