com.ibm.etill.kitcashcassette
Class KitCashConnection

java.lang.Object
  |
  +--com.ibm.etill.kitcashcassette.KitCashConnection
All Implemented Interfaces:
com.ibm.etill.framework.io.ETillConnection

public class KitCashConnection
extends java.lang.Object
implements com.ibm.etill.framework.io.ETillConnection

A KitCashConnection instance is created every time a consumer's wallet opens a socket on a KitCashComPoint's server socket. The KitCashConnection object is passed by the Payment Manager framework to the cassette (using the KitCashCassette.service(protocolRequest, protocolResponse) method. The cassette can then use this Connection object to read and write messages to and from the consumer's wallet.

Most of the actual reading and writing of KitCash protocol messages is handled by the KitCashMessageWrapper class.

See Also:
KitCashMessageWrapper, KitCashComPoint.establishConnection(), com.ibm.etill.kitcashcassette.KitCashCassette#service(ProtocolRequest, ProtocolResponse)

Constructor Summary
KitCashConnection(java.net.Socket socket)
          Constructs a new socket connection between wallet and cassette.
 
Method Summary
 void closeConnection()
          Closes the socket associated with this object.
 java.lang.Object read()
          Reads the next KitCashMessageWrapper received at the KitCashComPoint.
 void setConnection(java.lang.Object o)
          Deprecated. not required by cassette developers
 java.lang.String toString()
          Returns a string representation of the KitCashConnection object.
 java.lang.Object write(java.lang.Object message)
          Writes the KitCashMessage parameter to the KitCashComPoint.
 void writeErrorResponse(KitCashException kce)
          Writes the KitCashException parameter to the KitCashComPoint.
 java.lang.Object writeErrorResponse(java.lang.Object message)
          Deprecated. cassette developers should define their own error response methods (if required)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KitCashConnection

public KitCashConnection(java.net.Socket socket)
Constructs a new socket connection between wallet and cassette.
Parameters:
socket - the socket used by the KitCashComPoint
Method Detail

closeConnection

public void closeConnection()
                     throws java.io.IOException
Closes the socket associated with this object.
Specified by:
closeConnection in interface com.ibm.etill.framework.io.ETillConnection
Throws:
java.io.IOException - if the operation fails

read

public java.lang.Object read()
                      throws java.io.IOException
Reads the next KitCashMessageWrapper received at the KitCashComPoint.
Specified by:
read in interface com.ibm.etill.framework.io.ETillConnection
Returns:
a KitCashMessageWrapper object
Throws:
java.io.IOException - if the operation fails
See Also:
KitCashMessageWrapper.readMessage(java.io.InputStream)

setConnection

public void setConnection(java.lang.Object o)
Deprecated. not required by cassette developers

Specified by:
setConnection in interface com.ibm.etill.framework.io.ETillConnection

toString

public java.lang.String toString()
Returns a string representation of the KitCashConnection object.
Overrides:
toString in class java.lang.Object
Returns:
key information about the KitCashConnection object

write

public java.lang.Object write(java.lang.Object message)
                       throws java.io.IOException
Writes the KitCashMessage parameter to the KitCashComPoint.
Specified by:
write in interface com.ibm.etill.framework.io.ETillConnection
Parameters:
message - the KitCashMessage to be sent
Returns:
null
Throws:
java.io.IOException - if the operation fails
See Also:
KitCashMessageWrapper, KitCashMessage

writeErrorResponse

public void writeErrorResponse(KitCashException kce)
                        throws java.io.IOException
Writes the KitCashException parameter to the KitCashComPoint.
Parameters:
kce - the KitCashException to be sent
Throws:
java.io.IOException - if the operation fails
See Also:
KitCashException, KitCashMessageWrapper

writeErrorResponse

public java.lang.Object writeErrorResponse(java.lang.Object message)
                                    throws java.io.IOException
Deprecated. cassette developers should define their own error response methods (if required)

Specified by:
writeErrorResponse in interface com.ibm.etill.framework.io.ETillConnection