org.jppf.jca.spi
Class JPPFManagedConnection

java.lang.Object
  extended by org.jppf.jca.util.JPPFAccessorImpl
      extended by org.jppf.jca.spi.JPPFManagedConnection
All Implemented Interfaces:
ManagedConnection, JPPFAccessor

public class JPPFManagedConnection
extends JPPFAccessorImpl
implements ManagedConnection

Implementation of the ManagedConnection interface.

Author:
Laurent Cohen

Field Summary
 
Fields inherited from class org.jppf.jca.util.JPPFAccessorImpl
jppfClient, logWriter
 
Constructor Summary
JPPFManagedConnection()
          Default constructor.
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          Add a listener to the list of connection event listeners for this managed connection.
 void associateConnection(Object conn)
          Used by the container to change the association of an application-level connection handle with a ManagedConneciton instance.
 void cleanup()
          This method does nothing.
 void destroy()
          This method does nothing.
 void fireConnectionEvent(JPPFConnection connection, int eventId, Exception exception)
          Fire a connection event with the specified parameters.
 Object getConnection(Subject subject, ConnectionRequestInfo cri)
          Get a connection.
 LocalTransaction getLocalTransaction()
          Not supported.
 ManagedConnectionMetaData getMetaData()
          Get this maaged conenction's metadata.
 XAResource getXAResource()
          Not supported.
 boolean isAvailable()
          Determine whether this managed connection is available and can be reused by the application server.
 void removeConnectionEventListener(ConnectionEventListener listener)
          Remove a listener from the list of connection event listeners for this managed connection.
 
Methods inherited from class org.jppf.jca.util.JPPFAccessorImpl
getJppfClient, getLogWriter, setJppfClient, setLogWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnection
getLogWriter, setLogWriter
 

Constructor Detail

JPPFManagedConnection

public JPPFManagedConnection()
Default constructor.

Method Detail

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Add a listener to the list of connection event listeners for this managed connection.

Specified by:
addConnectionEventListener in interface ManagedConnection
Parameters:
listener - the listener to add.
See Also:
ManagedConnection.addConnectionEventListener(javax.resource.spi.ConnectionEventListener)

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Remove a listener from the list of connection event listeners for this managed connection.

Specified by:
removeConnectionEventListener in interface ManagedConnection
Parameters:
listener - the listener to remove.
See Also:
ManagedConnection.removeConnectionEventListener(javax.resource.spi.ConnectionEventListener)

fireConnectionEvent

public void fireConnectionEvent(JPPFConnection connection,
                                int eventId,
                                Exception exception)
Fire a connection event with the specified parameters.

Parameters:
connection - the connection from which the event originates.
eventId - the type of event.
exception - an eventual exception that should be part of the event. May be null.

associateConnection

public void associateConnection(Object conn)
                         throws ResourceException
Used by the container to change the association of an application-level connection handle with a ManagedConneciton instance.

Specified by:
associateConnection in interface ManagedConnection
Parameters:
conn - the new conenction to associate.
Throws:
ResourceException - if the association raised an error.
See Also:
ManagedConnection.associateConnection(java.lang.Object)

cleanup

public void cleanup()
             throws ResourceException
This method does nothing.

Specified by:
cleanup in interface ManagedConnection
Throws:
ResourceException - .
See Also:
ManagedConnection.cleanup()

destroy

public void destroy()
             throws ResourceException
This method does nothing.

Specified by:
destroy in interface ManagedConnection
Throws:
ResourceException - .
See Also:
ManagedConnection.destroy()

getConnection

public Object getConnection(Subject subject,
                            ConnectionRequestInfo cri)
                     throws ResourceException
Get a connection.

Specified by:
getConnection in interface ManagedConnection
Parameters:
subject - not used.
cri - not used.
Returns:
a JPPFConnection instance.
Throws:
ResourceException - if the connection could not be obtained.
See Also:
ManagedConnection.getConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException
Not supported.

Specified by:
getLocalTransaction in interface ManagedConnection
Returns:
nothing.
Throws:
ResourceException - always.
See Also:
ManagedConnection.getLocalTransaction()

getMetaData

public ManagedConnectionMetaData getMetaData()
                                      throws ResourceException
Get this maaged conenction's metadata.

Specified by:
getMetaData in interface ManagedConnection
Returns:
a JPPFManagedConnectionMetaData instance.
Throws:
ResourceException - if the metadata could not be obtained.
See Also:
ManagedConnection.getMetaData()

getXAResource

public XAResource getXAResource()
                         throws ResourceException
Not supported.

Specified by:
getXAResource in interface ManagedConnection
Returns:
nothing.
Throws:
ResourceException - always.
See Also:
ManagedConnection.getXAResource()

isAvailable

public boolean isAvailable()
Determine whether this managed connection is available and can be reused by the application server.

Returns:
true if this managed connection is available, false otherwise.


Copyright © 2005-2010 JPPF Team.