public class SampleConnectionFactory
extends java.lang.Object
implements javax.resource.cci.ConnectionFactory, java.io.Serializable, javax.resource.Referenceable
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
methods by calling the
ConnectionManager.allocateConnection(ManagedConnectionFactory, ConnectionRequestInfo)
method.
This allows the application server to provide connection pooling and other services.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
Copyright statement.
|
Constructor and Description |
---|
SampleConnectionFactory(javax.resource.spi.ConnectionManager cm,
javax.resource.spi.ManagedConnectionFactory mcf)
The class constructor.
|
Modifier and Type | Method and Description |
---|---|
javax.resource.cci.Connection |
getConnection()
This method gets a connection allocated by the connection manager.
|
javax.resource.cci.Connection |
getConnection(javax.resource.cci.ConnectionSpec cSpec)
This method gets the connection allocated by connection manager.
|
javax.resource.cci.ResourceAdapterMetaData |
getMetaData()
This method gets the connection metadata.
|
javax.resource.cci.RecordFactory |
getRecordFactory()
This method gets the record factory.
|
javax.naming.Reference |
getReference()
This method gets the reference of this class.
|
void |
setReference(javax.naming.Reference reference)
This method sets the class field reference to the one provided.
|
public static final java.lang.String COPYRIGHT
public SampleConnectionFactory(javax.resource.spi.ConnectionManager cm, javax.resource.spi.ManagedConnectionFactory mcf)
cm
- The javax.resource.spi.ConnectionManagermcf
- The ManagedConnectionFactorypublic javax.resource.cci.Connection getConnection() throws javax.resource.ResourceException
getConnection
in interface javax.resource.cci.ConnectionFactory
javax.resource.ResourceException
- Raised if it cannot get a connection from the application server.public javax.resource.cci.Connection getConnection(javax.resource.cci.ConnectionSpec cSpec) throws javax.resource.ResourceException
getConnection
in interface javax.resource.cci.ConnectionFactory
cSpec
- The connectionSpecjavax.resource.ResourceException
- Raised if cannot get a connection from the application server.public javax.resource.cci.ResourceAdapterMetaData getMetaData() throws javax.resource.ResourceException
getMetaData
in interface javax.resource.cci.ConnectionFactory
javax.resource.ResourceException
public javax.resource.cci.RecordFactory getRecordFactory() throws javax.resource.ResourceException
getRecordFactory
in interface javax.resource.cci.ConnectionFactory
javax.resource.ResourceException
public void setReference(javax.naming.Reference reference)
reference
- The referencepublic javax.naming.Reference getReference()
getReference
in interface javax.naming.Referenceable