org.openorb.iiop
Class IIOPTransport

java.lang.Object
  |
  +--org.openorb.iiop.IIOPTransport
All Implemented Interfaces:
Transport

public class IIOPTransport
extends java.lang.Object
implements Transport

Interface for creating sockets.

Version:
$Revision: 1.11 $ $Date: 2001/07/13 00:04:50 $
Author:
Chris Wood <wood@intalio.com>

Constructor Summary
IIOPTransport(java.net.InetAddress host, int port)
           
IIOPTransport(java.net.Socket sock, int serverPort)
           
 
Method Summary
 void close()
          Close the connection this always succeeds.
 boolean establishAssociation(Address addr, TransportAssociationHolder binding)
          Check for applicability of channel for carrying messages for the specified address and setup any client transport binding.
 boolean isMessageError()
          Returns true if setMessageError has been called.
 boolean isOpen()
          Is is the transport open?
 void open()
          Open the connection.
 StorageBuffer recvMessage(int timeout, TransportAssociationHolder assoc)
          Read next message.
 void sendMessage(StorageBuffer msg, java.lang.Object assoc)
          Write message to comms protocol.
 void setMessageError()
          If this gets called then the close operation will close by sending a MessageError message.
 java.lang.String toString()
          Print out socket information.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IIOPTransport

public IIOPTransport(java.net.InetAddress host,
                     int port)

IIOPTransport

public IIOPTransport(java.net.Socket sock,
                     int serverPort)
Method Detail

open

public void open()
Open the connection. This can throw a CORBA system exception. This is never called by server channels.
Specified by:
open in interface Transport
Following copied from interface: org.openorb.net.Transport
Throws:
COMM_FAILURE - failed to open channel. This exception will be reported to clients.

close

public void close()
Close the connection this always succeeds.
Specified by:
close in interface Transport

isOpen

public boolean isOpen()
Is is the transport open?
Specified by:
isOpen in interface Transport

sendMessage

public void sendMessage(StorageBuffer msg,
                        java.lang.Object assoc)
Write message to comms protocol.
Specified by:
sendMessage in interface Transport
Parameters:
msg - The message to be sent.
assoc - contains whatever was associated with the ClientBinding in the establishBinding operation or with the ServerRequest in the recvMessage operation.
Throws:
COMM_FAILURE - permanent transport failure occoured. Cleanup and then call close.

recvMessage

public StorageBuffer recvMessage(int timeout,
                                 TransportAssociationHolder assoc)
                          throws java.io.EOFException
Read next message. This function will be regularly serviced by a worker thread.
Specified by:
recvMessage in interface Transport
Parameters:
timeout - max time to wait before recieving a message.
assoc - (out) will be set to contain the transport association for the message. This will be passed back to sendMessage when a reply is sent for server requests. For client replies the contents will be compared to the ClientBinding's association, if they don't match some action will be taken.
Throws:
java.io.EOFException - end of file has been reached. Cleanup and call close.
COMM_FAILURE - permanent transport failure occoured. Cleanup and then call close.

setMessageError

public void setMessageError()
If this gets called then the close operation will close by sending a MessageError message.

isMessageError

public boolean isMessageError()
Returns true if setMessageError has been called.

establishAssociation

public boolean establishAssociation(Address addr,
                                    TransportAssociationHolder binding)
Check for applicability of channel for carrying messages for the specified address and setup any client transport binding.
Specified by:
establishAssociation in interface Transport
Parameters:
addr - the address.
assoc - (out) will be set to contain the transport association for the client binding. This will be passed back to sendMessage when a request is sent.

toString

public java.lang.String toString()
Print out socket information.
Overrides:
toString in class java.lang.Object