galaxy.server
Class DataInBroker

java.lang.Object
  |
  +--galaxy.server.DataInBroker
All Implemented Interfaces:
java.lang.Runnable

public abstract class DataInBroker
extends java.lang.Object
implements java.lang.Runnable

This class represents the consumer of a brokering connection. Subclasses of this class try to establish a connection to specified outgoing broker (i.e., the data supplier), receive the brokered data, and process the data.


Field Summary
protected  Environment env
          The call environment of the server dispatch function that created this broker.
protected  FrameDispatcher frameDispatcher
          Frame dispatcher of the Server that started this broker
protected  Server server
          The Server that created this broker.
 
Constructor Summary
DataInBroker()
          Default constructor.
DataInBroker(Server server, BrokerProxy proxy)
          Constructor.
DataInBroker(Server server, java.net.InetAddress ip, int port, GFrame frame)
          Deprecated. As of Galaxy Communicator 4.0. Use DataInBroker(Server, InetAddress, int, String).
DataInBroker(Server server, java.net.InetAddress ip, int port, java.lang.String callId)
          Constructor.
DataInBroker(Server server, java.lang.String hostName, int port, GFrame frame)
          Deprecated. As of Galaxy Communicator 4.0. Use DataInBroker(Server, String, int, String).
DataInBroker(Server server, java.lang.String hostName, int port, java.lang.String callId)
          Constructor.
 
Method Summary
protected  void abortReceived()
          This method is called when this broker catches an unexpected exception while receiving brokered data.
protected  void cleanup()
          This cleanup method is called when this broker is preparing to stop.
protected  void disconnectReceived()
          This method is called when this broker receives a disconnect message from the outgoing broker (indicates all data has been received).
 Server getServer()
          Returns the reference to the Server that created this broker.
 boolean isStopped()
          Indicates if this broker is stopped.
 void receivedBinary(GBinary bin)
          Executed when a GBinary is read by this incoming broker.
 void receivedFloat(java.lang.Float floatObject)
          Executed when a Float is read by this incoming broker.
 void receivedFloat32(Float32 float32)
          Executed when a Float32 is read by this incoming broker.
 void receivedFloat64(Float64 float64)
          Executed when a Float64 is read by this incoming broker.
 void receivedFrame(GFrame frame)
          Executed when a GFrame is read by this incoming broker.
 void receivedInt16(Int16 int16)
          Executed when an Int16 is read by this incoming broker.
 void receivedInt32(Int32 int32)
          Executed when an Int32 is read by this incoming broker.
 void receivedInt64(Int64 int64)
          Executed when an Int64 is read by this incoming broker.
 void receivedInteger(java.lang.Integer integerObject)
          Executed when an Integer is read by this incoming broker.
 void receivedList(GVector list)
          Executed when a GVector is read by this incoming broker.
 void receivedProxy(BrokerProxy proxy)
          Executed when a BrokerProxy is read by this incoming broker.
 void receivedString(java.lang.String str)
          Executed when a String is read by this incoming broker.
 void receivedSymbol(Symbol symbol)
          Executed when a Symbol is read by this incoming broker.
 void registerWithServer()
          Registers this broker with the Server that started it.
 void resetWasStarted()
          Resets (i.e., sets to false) the flag that indicates if this broker was started.
 void run()
          The thread routine for this broker.
protected  void setServer(Server server)
          Sets the reference to the Server that is associated with this broker.
 void start()
          Performs the broker client side of the handshake and starts the broker thread, assuming the handshake succeeded.
 void stop()
          Marks this broker's thread as being stopped.
 void unregisterFromServer()
          Unregisters this broker from the Server that started it.
 boolean wasStarted()
          Indicates if this broker was started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected Server server
The Server that created this broker.

env

protected Environment env
The call environment of the server dispatch function that created this broker.

frameDispatcher

protected FrameDispatcher frameDispatcher
Frame dispatcher of the Server that started this broker
Constructor Detail

DataInBroker

public DataInBroker(Server server,
                    java.net.InetAddress ip,
                    int port,
                    GFrame frame)
             throws java.io.IOException
Deprecated. As of Galaxy Communicator 4.0. Use DataInBroker(Server, InetAddress, int, String).

Constructor.
Parameters:
server - the Server that created this broker
ip - the IP address of the server that manages access to the outgoing broker to which this broker wishes to connect
port - the "listener" port of the target server
frame - a GFrame that contains the call id of the outgoing broker to which this broker wishes to connect

DataInBroker

public DataInBroker(Server server,
                    java.lang.String hostName,
                    int port,
                    GFrame frame)
             throws java.io.IOException
Deprecated. As of Galaxy Communicator 4.0. Use DataInBroker(Server, String, int, String).

Constructor.
Parameters:
server - the Server that created this broker
hostName - the host name of the server that manages access to the outgoing broker to which this broker wishes to connect
port - the "listener" port of the target server
frame - a GFrame that contains the call id of the outgoing broker to which this broker wishes to connect

DataInBroker

public DataInBroker()
Default constructor.

DataInBroker

public DataInBroker(Server server,
                    java.net.InetAddress ip,
                    int port,
                    java.lang.String callId)
             throws java.io.IOException
Constructor.
Parameters:
server - the Server that created this broker
ip - the IP address of the server that manages access to the outgoing broker to which this broker wishes to connect
port - the "listener" port of the target server
callId - the call id of the outgoing broker to which this broker wishes to connect

DataInBroker

public DataInBroker(Server server,
                    java.lang.String hostName,
                    int port,
                    java.lang.String callId)
             throws java.io.IOException
Constructor.
Parameters:
server - the Server that created this broker
hostName - the host name of the server that manages access to the outgoing broker to which this broker wishes to connect
port - the "listener" port of the target server
callId - the call id of the outgoing broker to which this broker wishes to connect

DataInBroker

public DataInBroker(Server server,
                    BrokerProxy proxy)
             throws java.io.IOException
Constructor.
Parameters:
server - the Server that created this broker
proxy - the broker proxy to use to initialize this broker
Method Detail

getServer

public Server getServer()
Returns the reference to the Server that created this broker.
Returns:
the server reference

setServer

protected void setServer(Server server)
Sets the reference to the Server that is associated with this broker.
Parameters:
server - the server reference

isStopped

public boolean isStopped()
Indicates if this broker is stopped.
Returns:
true if stopped, false otherwise

wasStarted

public boolean wasStarted()
Indicates if this broker was started.
Returns:
true if this broker was started, false otherwise

resetWasStarted

public void resetWasStarted()
Resets (i.e., sets to false) the flag that indicates if this broker was started.

start

public void start()
Performs the broker client side of the handshake and starts the broker thread, assuming the handshake succeeded.

run

public void run()
The thread routine for this broker. While this broker's socket connection is open, data is read off the connection and processed. by the various received methods defined by subclasses of this class.
Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Marks this broker's thread as being stopped.

cleanup

protected void cleanup()
This cleanup method is called when this broker is preparing to stop. This is called before the socket connection is closed. Override this method to provide your own customized cleanup routine. The generic DataInBroker cleanup will still take place.

disconnectReceived

protected void disconnectReceived()
This method is called when this broker receives a disconnect message from the outgoing broker (indicates all data has been received). Override this method to provide your own customized finalization routine. This broker is stopped after this method is called.

abortReceived

protected void abortReceived()
This method is called when this broker catches an unexpected exception while receiving brokered data. Override this method to provide your own customized error handling routine. This broker is stopped after this method is called.

registerWithServer

public void registerWithServer()
Registers this broker with the Server that started it. At the moment, this will cause this broker to be stopped if the server loses its connection to the Hub.

unregisterFromServer

public void unregisterFromServer()
Unregisters this broker from the Server that started it.

receivedString

public void receivedString(java.lang.String str)
Executed when a String is read by this incoming broker.
Parameters:
str - the string received

receivedBinary

public void receivedBinary(GBinary bin)
Executed when a GBinary is read by this incoming broker.
Parameters:
bin - the binary object received

receivedFrame

public void receivedFrame(GFrame frame)
Executed when a GFrame is read by this incoming broker.
Parameters:
frame - the frame received

receivedList

public void receivedList(GVector list)
Executed when a GVector is read by this incoming broker.
Parameters:
list - the list received

receivedInt16

public void receivedInt16(Int16 int16)
Executed when an Int16 is read by this incoming broker.
Parameters:
int16 - the 16-bit integer array received

receivedInt32

public void receivedInt32(Int32 int32)
Executed when an Int32 is read by this incoming broker.
Parameters:
int32 - the 32-bit integer array received

receivedInt64

public void receivedInt64(Int64 int64)
Executed when an Int64 is read by this incoming broker.
Parameters:
int64 - the 64-bit integer array received

receivedFloat32

public void receivedFloat32(Float32 float32)
Executed when a Float32 is read by this incoming broker.
Parameters:
float32 - the 32-bit floating point number array received

receivedFloat64

public void receivedFloat64(Float64 float64)
Executed when a Float64 is read by this incoming broker.
Parameters:
float64 - the 64-bit floating point number array received

receivedInteger

public void receivedInteger(java.lang.Integer integerObject)
Executed when an Integer is read by this incoming broker.
Parameters:
integerObject - the integer received

receivedFloat

public void receivedFloat(java.lang.Float floatObject)
Executed when a Float is read by this incoming broker.
Parameters:
floatObject - the float received

receivedSymbol

public void receivedSymbol(Symbol symbol)
Executed when a Symbol is read by this incoming broker.
Parameters:
symbol - the symbol received

receivedProxy

public void receivedProxy(BrokerProxy proxy)
Executed when a BrokerProxy is read by this incoming broker.
Parameters:
proxy - the proxy received