com.ibm.commerce.messaging.adapters.jcasample
Class SampleManagedConnection

java.lang.Object
  |
  +--com.ibm.commerce.messaging.adapters.jcasample.SampleManagedConnection

public class SampleManagedConnection
extends java.lang.Object

This class represents a physical connection that managed by an application server.


Field Summary
static java.lang.String COPYRIGHT
          Copyright statement.
 
Constructor Summary
SampleManagedConnection()
          SampleManagedConnection default constructor
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener evtListener)
          Adds a connection event listener to the existing event listener list.
 void associateConnection(java.lang.Object connection)
          Associates this managed connection to SampleConnection.
 void cleanup()
          Cleanup the connections.
 void destroy()
          Destroys the connection.
 java.lang.Object getConnection(javax.security.auth.Subject subject, ConnectionRequestInfo cri)
          Gets the connection
 LocalTransaction getLocalTransaction()
          Gets localTransaction
 java.io.PrintWriter getLogWriter()
          Gets logWriter
 ManagedConnectionMetaData getMetaData()
          Gets managed connection meta data.
 javax.transaction.xa.XAResource getXAResource()
          Gets XA resource
 void removeConnectionEventListener(ConnectionEventListener listener)
          Removes a ConnectionEventListener from the existing event listener list.
 void sendEvent(int eventType, java.lang.Exception ex)
          Sends an event.
 void sendEvent(int eventType, java.lang.Exception ex, java.lang.Object connectionHandle)
          Sends an event to the event listener.
 void setConnection( SampleConnection con)
          Sets the connection
 void setLogWriter(java.io.PrintWriter pw)
          Sets the log writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
Copyright statement.
See Also:
Constant Field Values
Constructor Detail

SampleManagedConnection

public SampleManagedConnection()
                        throws ResourceException
SampleManagedConnection default constructor
Throws:
javax.resource.ResoureceException
ResourceException
Method Detail

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener evtListener)
Adds a connection event listener to the existing event listener list.

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Removes a ConnectionEventListener from the existing event listener list.

getMetaData

public ManagedConnectionMetaData getMetaData()
                                      throws ResourceException
Gets managed connection meta data.
Returns:
ManagedConnectionMetaData
Throws:
javax.resource.ResourceException - Raised when any error occured.
ResourceException

destroy

public void destroy()
             throws ResourceException
Destroys the connection.
Throws:
javax.resource.ResourceException - Raised when failed to destroy the connection.
ResourceException

associateConnection

public void associateConnection(java.lang.Object connection)
                         throws ResourceException
Associates this managed connection to SampleConnection. Check if the connection is SampleConnection.
Parameters:
connection - The connection Object
Throws:
javax.resource.ResourceException - Raised when IllegalStateException is thrown.
ResourceException

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      ConnectionRequestInfo cri)
                               throws ResourceException
Gets the connection
Parameters:
subject - The Subject,
cri - The ConnectionRequestInfo
Returns:
connection
Throws:
javax.resource.ResourceException
ResourceException

setConnection

public void setConnection(SampleConnection con)
Sets the connection

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws ResourceException
Gets XA resource
Returns:
Always null. This method does nothing in current implementation.
Throws:
javax.resource.ResourceException
ResourceException

cleanup

public void cleanup()
             throws ResourceException
Cleanup the connections. The connection will be destoyed.
Throws:
javax.resource.ResourceException
ResourceException

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException
Gets localTransaction
Returns:
Always null. This method does nothing in current implementation.
Throws:
ResourceException

sendEvent

public void sendEvent(int eventType,
                      java.lang.Exception ex)
Sends an event. This method will invoke sendEvent(eventType, ex, null) method.

sendEvent

public void sendEvent(int eventType,
                      java.lang.Exception ex,
                      java.lang.Object connectionHandle)
Sends an event to the event listener.
Parameters:
eventType - The event type.
connectionHandle - The connection handle

setLogWriter

public void setLogWriter(java.io.PrintWriter pw)
                  throws ResourceException
Sets the log writer
Throws:
javax.resource.ResourceException
ResourceException

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws ResourceException
Gets logWriter
Returns:
PrintWriter
Throws:
javax.resource.ResourceException
ResourceException