ix.util
Class IPC.ObjectStreamCommunicationStrategy

java.lang.Object
  |
  +--ix.util.IPC.ObjectStreamCommunicationStrategy
All Implemented Interfaces:
IPC.CommunicationStrategy, IPC.SocketlikeCommunicationStrategy
Direct Known Subclasses:
IPC.SimpleIXCommunicationStrategy, IPC.XMLObjectStreamCommunicationStrategy
Enclosing class:
IPC

public static class IPC.ObjectStreamCommunicationStrategy
extends java.lang.Object
implements IPC.SocketlikeCommunicationStrategy

A communication strategy in which a destination is mapped to a host and port number, and objects are sent by writing their serialization to a socket.

Command-line arguments / parameters:

    -name-server=host:port
    -run-as-name-server=boolean
    -host=host
 
-host is used when it is necessary to specify the host name this agent should use when registering with the name-server.

See Also:
Parameters

Field Summary
(package private)  java.util.HashMap connectionTable
           
static java.lang.String defaultNameServerAddress
           
(package private)  IPC.DestinationTable destinationTable
           
(package private)  java.lang.Object serverDestination
           
 
Constructor Summary
IPC.ObjectStreamCommunicationStrategy()
           
 
Method Summary
 java.lang.Object askNameServer(java.lang.Object destination)
          Requests a ServiceAddress from the name-server.
 IPC.Connection connectTo(java.lang.Object destination)
           
 void discardAnyConnection(java.lang.Object destination)
           
 IPC.Connection getConnection(java.lang.Object destination)
           
 java.lang.Object getDestinationData(java.lang.Object destination)
          Returns a ServiceAddress from the destination table, if there's an entry for the specified destination, or else from the name-server if one exists.
 boolean haveConnection(java.lang.Object destination)
           
 java.lang.Object postDecode(java.lang.Object contents)
           
 java.lang.Object preEncode(java.lang.Object contents)
           
 void sendObject(java.lang.Object destination, java.lang.Object contents)
           
 java.lang.Object sendRequest(java.lang.Object destination, java.lang.Object contents)
           
 void setDestinationData(java.lang.Object destination, java.lang.Object data)
          The data must be a ServiceAddress.
 void setDestinationTable(IPC.DestinationTable table)
           
protected  void setupNameServer()
           
protected  void setupNameServerAddress()
           
 void setupServer(java.lang.Object destination, IPC.MessageListener listener)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destinationTable

IPC.DestinationTable destinationTable

connectionTable

java.util.HashMap connectionTable

serverDestination

java.lang.Object serverDestination

defaultNameServerAddress

public static java.lang.String defaultNameServerAddress
Constructor Detail

IPC.ObjectStreamCommunicationStrategy

public IPC.ObjectStreamCommunicationStrategy()
Method Detail

setDestinationData

public void setDestinationData(java.lang.Object destination,
                               java.lang.Object data)
The data must be a ServiceAddress.
Specified by:
setDestinationData in interface IPC.SocketlikeCommunicationStrategy

getDestinationData

public java.lang.Object getDestinationData(java.lang.Object destination)
Returns a ServiceAddress from the destination table, if there's an entry for the specified destination, or else from the name-server if one exists.

Calls askNameServer(destination) which may throw exceptions in other cases.

Specified by:
getDestinationData in interface IPC.SocketlikeCommunicationStrategy
Throws:
IPCException - if an address cannot be found.

askNameServer

public java.lang.Object askNameServer(java.lang.Object destination)
Requests a ServiceAddress from the name-server.
Throws:
AssertionFailure - if the name-server address isn't known or if the name-server returns an address that isn't a ServiceAddress.
IPCException - if the name-server does not know a address for the specified destination.

setDestinationTable

public void setDestinationTable(IPC.DestinationTable table)

connectTo

public IPC.Connection connectTo(java.lang.Object destination)
Specified by:
connectTo in interface IPC.SocketlikeCommunicationStrategy

haveConnection

public boolean haveConnection(java.lang.Object destination)

getConnection

public IPC.Connection getConnection(java.lang.Object destination)
Specified by:
getConnection in interface IPC.SocketlikeCommunicationStrategy

preEncode

public java.lang.Object preEncode(java.lang.Object contents)

postDecode

public java.lang.Object postDecode(java.lang.Object contents)

sendObject

public void sendObject(java.lang.Object destination,
                       java.lang.Object contents)
Specified by:
sendObject in interface IPC.CommunicationStrategy

sendRequest

public java.lang.Object sendRequest(java.lang.Object destination,
                                    java.lang.Object contents)

discardAnyConnection

public void discardAnyConnection(java.lang.Object destination)

setupServer

public void setupServer(java.lang.Object destination,
                        IPC.MessageListener listener)
Specified by:
setupServer in interface IPC.CommunicationStrategy

setupNameServerAddress

protected void setupNameServerAddress()

setupNameServer

protected void setupNameServer()