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

java.lang.Object
  |
  +--com.ibm.commerce.messaging.adapters.jcasample.SampleConnectionFactory
All Implemented Interfaces:
java.io.Serializable

public class SampleConnectionFactory
extends java.lang.Object
implements java.io.Serializable

This class provides a client API for getting a managed connection. A connection manager (of type javax.resource.spi.ConnectionManager) is assigned to this class by the application server during class construction. With this connection manager provided by the application server, the application creates a connection using getConnection method by calling ConnectionManager.allocateConnection method. Doing so, the application server can provide connection pooling and other services.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          Copyright statement.
 
Constructor Summary
SampleConnectionFactory(ConnectionManager cm, ManagedConnectionFactory mcf)
          SampleConnectionFactory constructor
 
Method Summary
 Connection getConnection()
          Gets a connection allocated by connection manager.It invokes the ConnectionManager.allocateConnection method of the application server.
 Connection getConnection(ConnectionSpec cSpec)
          Gets the connection allocated by connection manager.
 ResourceAdapterMetaData getMetaData()
          Gets the meta data
 RecordFactory getRecordFactory()
          Gets the record factory
 javax.naming.Reference getReference()
          Gets the reference of this class.
 void setReference(javax.naming.Reference reference)
          Sets the class field reference to the one provided.
 
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

SampleConnectionFactory

public SampleConnectionFactory(ConnectionManager cm,
                               ManagedConnectionFactory mcf)
SampleConnectionFactory constructor
Parameters:
cm - The javax.resource.spi.ConnectionManager
mcf - The ManagedConnectionFactory
Method Detail

getConnection

public Connection getConnection()
                         throws ResourceException
Gets a connection allocated by connection manager.It invokes the ConnectionManager.allocateConnection method of the application server.
Returns:
The javax.resource.cci.Connection
Throws:
javax.resource.ResourceException - Raised if cannot get a connection from the application server.
ResourceException

getConnection

public Connection getConnection(ConnectionSpec cSpec)
                         throws ResourceException
Gets the connection allocated by connection manager. It invokes the ConnectionManager.allocateConnection method of the application server using an object implementing ConnectionRequestInfo interface encapsulating the provided ConnectionSpec object.
Parameters:
cSpec - The connectionSpec
Returns:
javax.resource.cci.Connection
Throws:
javax.resource.ResourceException - Raised if cannot get a connection from the appliction server.
ResourceException

getMetaData

public ResourceAdapterMetaData getMetaData()
                                    throws ResourceException
Gets the meta data
Returns:
Always null. This method does nothing in current implementation.
Throws:
javax.resource.ResourceException
ResourceException

getRecordFactory

public RecordFactory getRecordFactory()
                               throws ResourceException
Gets the record factory
Returns:
Always null. This method does nothing in current implementation.
Throws:
javax.resource.ResourceException
ResourceException

setReference

public void setReference(javax.naming.Reference reference)
Sets the class field reference to the one provided.
Parameters:
reference - The reference

getReference

public javax.naming.Reference getReference()
Gets the reference of this class.
Returns:
javax.naming.Reference