Boeing Simulation 3.1 API Specification

connect.socket
Class SocketComponentTemplate

java.lang.Object
  |
  +--connect.socket.SocketComponentTemplate
All Implemented Interfaces:
Component
Direct Known Subclasses:
BasicCommandControl, BasicPerspectiveUnifier, SimulatorUAVManager, SimulatorUCAVManager, SocketMissionControlTemplate, SocketObjectLocaterTemplate, TargetControl

public abstract class SocketComponentTemplate
extends Object
implements Component


Field Summary
private  connect.CreatesConnection connection
           
private  boolean debug
           
private static boolean DEBUG
           
private  int numOfPoints
          The number of RelayPoint objects constructed for this Component
protected  int portNumber
          The port number for this socket based component.
private  connect.ComponentEmissary representative
           
private static long serialVersionUID
           
private  ServerSocket ss
           
 
Constructor Summary
SocketComponentTemplate(int portNumber)
           
 
Method Summary
protected abstract  boolean accept(Class requestingType)
          Returns whether this component will accept a connection from the the requesting object of the speicifed type.
protected abstract  boolean allowMethod(util.MethodRequest request)
          Returns true if this component allows the MethodRequest to be invoked upon itself.
 void connect(connect.CreatesConnection cc)
          Connects to the component specified by the CreatesConnection.
private  void debug(String s)
          If in debug mode, print the string.
protected  connect.ComponentEmissary getComponentEmissary()
          Returns the ComponentEmissary that represents this object.
 connect.CreatesConnection getConnection()
          Returns the CreatesConnection that opaquely connects to this component.
protected  int getMaxPoints()
          Returns the maximum number of RelayPoint objects for this component.
protected abstract  void processAcceptedConnection(Class hostType, connect.ChannelBundle acceptedConnection)
          When a component connects to the component that it requested the connection to, this method is called.
protected  void processRelayPoint(connect.ChannelBundle bundle)
          Continuously reads in objects from the RelayPoint.
protected abstract  void processRequestingConnection(connect.ComponentEmissary requesting, connect.ChannelBundle incomingConnection)
          All implementers should extends this method to define their behavior when another component connects.
 void spawnRelayPoint(int relayPort)
          Generated a RelayPoint that is connected to this component.
private  void startAcceptingThread()
          Continuously accept incoming connections and then pass off the ChannelBundle to the implementing class for behavior based processing.
private  void startProcessingThread(connect.ComponentEmissary ce, connect.ChannelBundle bundle)
           
private  void startRelayThread(connect.ChannelBundle bundle)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

portNumber

protected final int portNumber
The port number for this socket based component.


serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

connection

private connect.CreatesConnection connection

ss

private ServerSocket ss

representative

private final connect.ComponentEmissary representative

debug

private final boolean debug
See Also:
Constant Field Values

numOfPoints

private int numOfPoints
The number of RelayPoint objects constructed for this Component

Constructor Detail

SocketComponentTemplate

public SocketComponentTemplate(int portNumber)
Method Detail

accept

protected abstract boolean accept(Class requestingType)
Returns whether this component will accept a connection from the the requesting object of the speicifed type.


allowMethod

protected abstract boolean allowMethod(util.MethodRequest request)
Returns true if this component allows the MethodRequest to be invoked upon itself.


connect

public void connect(connect.CreatesConnection cc)
Connects to the component specified by the CreatesConnection.

Specified by:
connect in interface Component
See Also:
CreatesConnection.connect(connect.ComponentEmissary)

debug

private void debug(String s)
If in debug mode, print the string.


processAcceptedConnection

protected abstract void processAcceptedConnection(Class hostType,
                                                  connect.ChannelBundle acceptedConnection)
When a component connects to the component that it requested the connection to, this method is called.


processRelayPoint

protected void processRelayPoint(connect.ChannelBundle bundle)
Continuously reads in objects from the RelayPoint. MethodRequest objects are expected, and are invoked by first checking if the allowMethod(MethodRequest) returns true. A break in the connection to the RelayPoint does not cause the failure of the Thread responsible for this component. Extending subclasses should override this method for additional functionality from the RelayPoint.


processRequestingConnection

protected abstract void processRequestingConnection(connect.ComponentEmissary requesting,
                                                    connect.ChannelBundle incomingConnection)
All implementers should extends this method to define their behavior when another component connects.


startAcceptingThread

private void startAcceptingThread()
Continuously accept incoming connections and then pass off the ChannelBundle to the implementing class for behavior based processing.


startProcessingThread

private void startProcessingThread(connect.ComponentEmissary ce,
                                   connect.ChannelBundle bundle)

startRelayThread

private void startRelayThread(connect.ChannelBundle bundle)

getComponentEmissary

protected connect.ComponentEmissary getComponentEmissary()
Returns the ComponentEmissary that represents this object.


getConnection

public connect.CreatesConnection getConnection()
Returns the CreatesConnection that opaquely connects to this component.

Specified by:
getConnection in interface Component

getMaxPoints

protected int getMaxPoints()
Returns the maximum number of RelayPoint objects for this component. By default this returns 0. Subclassese should override this method to increase the amount of default RelayPoint objects possible.

See Also:
spawnRelayPoint(int)

spawnRelayPoint

public void spawnRelayPoint(int relayPort)
Generated a RelayPoint that is connected to this component. The implementation is designed to create only one RelayPoint and it is of type SocketRelayComponent. Subclassese may wish to override this method to change the type of relay point or the number created.

Parameters:
relayPort - the port on which the construct RelayPoint will listen for requests.

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.