com.ibm.commerce.messaging.adapters.jcasample

Class SampleConnectionFactory

  • java.lang.Object
    • com.ibm.commerce.messaging.adapters.jcasample.SampleConnectionFactory
  • All Implemented Interfaces:
    java.io.Serializable, javax.naming.Referenceable, javax.resource.cci.ConnectionFactory


    public class SampleConnectionFactory
    extends java.lang.Object
    implements javax.resource.cci.ConnectionFactory, java.io.Serializable, javax.resource.Referenceable
    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 methods by calling the ConnectionManager.allocateConnection(ManagedConnectionFactory, ConnectionRequestInfo) method. This allows the application server to provide connection pooling and other services.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      Copyright statement.
    • Constructor Summary

      Constructors 
      Constructor and Description
      SampleConnectionFactory(javax.resource.spi.ConnectionManager cm, javax.resource.spi.ManagedConnectionFactory mcf)
      The class constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

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

      • SampleConnectionFactory

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

      • getConnection

        public javax.resource.cci.Connection getConnection()
                                                    throws javax.resource.ResourceException
        This method gets a connection allocated by the connection manager. The ConnectionManager.allocateConnection method of the application server is invoked.
        Specified by:
        getConnection in interface javax.resource.cci.ConnectionFactory
        Returns:
        javax.resource.cci.Connection
        Throws:
        javax.resource.ResourceException - Raised if it cannot get a connection from the application server.
      • getConnection

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

        public javax.resource.cci.ResourceAdapterMetaData getMetaData()
                                                               throws javax.resource.ResourceException
        This method gets the connection metadata.
        Specified by:
        getMetaData in interface javax.resource.cci.ConnectionFactory
        Returns:
        This method always returns null. This method does nothing in current implementation.
        Throws:
        javax.resource.ResourceException
      • getRecordFactory

        public javax.resource.cci.RecordFactory getRecordFactory()
                                                          throws javax.resource.ResourceException
        This method gets the record factory.
        Specified by:
        getRecordFactory in interface javax.resource.cci.ConnectionFactory
        Returns:
        This method always returns null. This method does nothing in current implementation.
        Throws:
        javax.resource.ResourceException
      • setReference

        public void setReference(javax.naming.Reference reference)
        This method sets the class field reference to the one provided.
        Parameters:
        reference - The reference
      • getReference

        public javax.naming.Reference getReference()
        This method gets the reference of this class.
        Specified by:
        getReference in interface javax.naming.Referenceable
        Returns:
        javax.naming.Reference