com.sun.genericra.outbound
Class ManagedConnection

java.lang.Object
  extended by com.sun.genericra.outbound.ManagedConnection
All Implemented Interfaces:
javax.resource.spi.ManagedConnection

public class ManagedConnection
extends java.lang.Object
implements javax.resource.spi.ManagedConnection

Represents the ManagedConnection of the Generic JMS resource adapter.

Author:
Sivakumar Thyagarajan

Constructor Summary
ManagedConnection(AbstractManagedConnectionFactory factory, javax.resource.spi.security.PasswordCredential pc, ConnectionRequestInfo info, javax.jms.Connection physicalCon)
           
 
Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
          Adds a connection event listener to the ManagedConnection instance.
 void associateConnection(java.lang.Object connectionHandle)
           
 boolean canSessionsBeCreated()
           
 void cleanup()
          Application server calls this method to force any cleanup on the ManagedConnection instance.
 javax.jms.Session createLocalSession(boolean transacted, int acknowledgeMode, int sessionType)
           
 void destroy()
          Destroys the physical connection to the underlying resource manager.
 java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
           
 javax.resource.spi.LocalTransaction getLocalTransaction()
           
 java.io.PrintWriter getLogWriter()
           
 java.lang.Object getManagedConnectionFactory()
           
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
           
 javax.resource.spi.security.PasswordCredential getPasswordCredential()
           
 javax.jms.Connection getPhysicalConnection()
           
 javax.jms.Session getPhysicalJMSSession(boolean transacted, int ack, int sessionType)
           
 javax.transaction.xa.XAResource getXAResource()
           
 boolean isDestroyed()
           
 boolean isTransactionInProgress()
           
 void isValid()
           
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
           
 void sendConnectionClosedEvent(ConnectionHandle handle)
           
 void sendConnectionErrorEvent(ConnectionHandle handle)
           
 void sendConnectionEvent(int eventType, java.lang.Exception ex)
           
 void sendConnectionEvent(int eventType, java.lang.Exception ex, java.lang.Object connectionHandle)
           
 void setLogWriter(java.io.PrintWriter pw)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedConnection

public ManagedConnection(AbstractManagedConnectionFactory factory,
                         javax.resource.spi.security.PasswordCredential pc,
                         ConnectionRequestInfo info,
                         javax.jms.Connection physicalCon)
                  throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException
Method Detail

getPhysicalJMSSession

public javax.jms.Session getPhysicalJMSSession(boolean transacted,
                                               int ack,
                                               int sessionType)
                                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

createLocalSession

public javax.jms.Session createLocalSession(boolean transacted,
                                            int acknowledgeMode,
                                            int sessionType)
                                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Application server calls this method to force any cleanup on the ManagedConnection instance. This method calls the invalidate method on all logical connection handles associated with this ManagedConnection.

Specified by:
cleanup in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - if the physical connection is no more valid

destroy

public void destroy()
             throws javax.resource.ResourceException
Destroys the physical connection to the underlying resource manager.

Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - if there is an error in closing the physical connection

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

setLogWriter

public void setLogWriter(java.io.PrintWriter pw)
                  throws javax.resource.ResourceException
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

associateConnection

public void associateConnection(java.lang.Object connectionHandle)
                         throws javax.resource.ResourceException
Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

addConnectionEventListener

public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
Adds a connection event listener to the ManagedConnection instance.

Specified by:
addConnectionEventListener in interface javax.resource.spi.ManagedConnection
Parameters:
listener - ConnectionEventListener
See Also:
removeConnectionEventListener

removeConnectionEventListener

public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
Specified by:
removeConnectionEventListener in interface javax.resource.spi.ManagedConnection

sendConnectionEvent

public void sendConnectionEvent(int eventType,
                                java.lang.Exception ex)

sendConnectionEvent

public void sendConnectionEvent(int eventType,
                                java.lang.Exception ex,
                                java.lang.Object connectionHandle)

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Specified by:
getMetaData in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      javax.resource.spi.ConnectionRequestInfo cri)
                               throws javax.resource.ResourceException
Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

isTransactionInProgress

public boolean isTransactionInProgress()

getPhysicalConnection

public javax.jms.Connection getPhysicalConnection()

getManagedConnectionFactory

public java.lang.Object getManagedConnectionFactory()

isDestroyed

public boolean isDestroyed()

isValid

public void isValid()
             throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

getPasswordCredential

public javax.resource.spi.security.PasswordCredential getPasswordCredential()

canSessionsBeCreated

public boolean canSessionsBeCreated()

sendConnectionClosedEvent

public void sendConnectionClosedEvent(ConnectionHandle handle)
Parameters:
handle -

sendConnectionErrorEvent

public void sendConnectionErrorEvent(ConnectionHandle handle)
Parameters:
handle -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object