com.ibm.etill.framework.io
Interface ETillConnection
- All Known Implementing Classes:
- FrameworkDataStream
- public interface ETillConnection
An ETillConnection represents a logical connection to a ComPoint.
Analogy:
- Socket is to SocketServer as ETillConnection is to ComPoint
- FileDesriptor is to File as ETillConnection is to ComPoint
An ETillConnection handles I/O in the same manner as Sockets and
FileDescriptors, via Streams
Notes:
- The associated ComPoint establishes the connection
- The ETillConnection constructor should validate that the
data avaiable thru said connection is valid(formated) for the given
data stream.
- The read() method will assume valid message and parse it.
Method Summary |
void |
closeConnection()
Deletes the logical connection associated with this object. |
Object |
read()
Waits for and returns an Object received from the ComPoint associated
with the ETillConnection instance. |
void |
setConnection(Object o)
An ETillConnection object needs to store an instance of the logical
connection for it's associated ComPoint. |
Object |
write(Object message)
Writes an Object to the ComPoint associated
with the ETillConnection instance. |
Object |
writeErrorResponse(Object message)
Writes an Object to the ComPoint associated
with the ETillConnection instance. |
setConnection
public void setConnection(Object o)
throws IOException
- An ETillConnection object needs to store an instance of the logical
connection for it's associated ComPoint. Once a ComPoint establishes a
connection it will register that connect by invoking this method. This
will enable the ETillConnection object to always be knowledgeable of
its connection type.
This method should handle the validation data on a given connection
before registering the connection.
.
- Returns:
- void
read
public Object read()
throws IOException
- Waits for and returns an Object received from the ComPoint associated
with the ETillConnection instance.
If nothing is read this method returns null. (That should never happen)
This method returns if a valid message is read or if an Exception
occurs.
- Returns:
- Object
write
public Object write(Object message)
throws IOException
- Writes an Object to the ComPoint associated
with the ETillConnection instance.
If the Compoint is synchronous this method expects to receive a reply
which it returns an Object; otherwise it throws an Exception.
If the ComPoint is asynchronous this method returns right away with
a null
- Parameters:
tc
- Object- Returns:
- a Object containing the answer from the write or null if
nothing is read.
writeErrorResponse
public Object writeErrorResponse(Object message)
throws IOException
- Writes an Object to the ComPoint associated
with the ETillConnection instance.
If the Compoint is synchronous this method expects to receive a reply
which it returns an Object; otherwise it throws an Exception.
If the ComPoint is asynchronous this method returns right away with
a null
- Parameters:
tc
- Object- Returns:
- a Object containing the answer from the write or null if
nothing is read.
closeConnection
public void closeConnection()
throws IOException
- Deletes the logical connection associated with this object.