com.mulesoft.adapter.ra
Class CCIConnectionFactory

java.lang.Object
  extended by com.mulesoft.adapter.ra.CCIConnectionFactory
All Implemented Interfaces:
com.sap.aii.af.lib.ra.cci.XIConnectionFactory, Serializable, Referenceable, javax.resource.cci.ConnectionFactory

public class CCIConnectionFactory
extends Object
implements com.sap.aii.af.lib.ra.cci.XIConnectionFactory, Serializable, javax.resource.Referenceable

CciConnectionFactory serves as factory for the sample CCI connections. In addition it is able to deliver the message RecordFactory. The CciConnectionFactory itself is created by the ManagedConnectionFactory connection to an adapter within the XI AF. For JNDI look-up purposes a ConnectionFactory like this must also implement Serializable and Referenceable.

See Also:
Serialized Form

Constructor Summary
CCIConnectionFactory()
          The JCA specification requires a default constructor for ConnectionFactory (pg.
CCIConnectionFactory(javax.resource.spi.ManagedConnectionFactory mcf)
          In case of the two-tier approach non ConnectionManager object is passed to the ManagedConnectionFactory whereas in the J2EE approach it is.
CCIConnectionFactory(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm)
          This constructor is used in the context of XI AF: The J2EE server passed a ConnectionManager object via the createConnectionFactory call to the ManagedConnectionFactory, which in turn will call this constructor with itself and the ConenctionManager object as argument.
 
Method Summary
 javax.resource.cci.Connection getConnection()
          The main task for the ConnectionFactory is to create/return CCI connections for the XI AF.
 javax.resource.cci.Connection getConnection(javax.resource.cci.ConnectionSpec spec)
          The second getter method returns a connection based on additional (selection) information which are contained in the ConnectionSpec object.
 javax.resource.cci.ResourceAdapterMetaData getMetaData()
          getMetaData() returns meta data information of the resource adapter as specified in JCA
 javax.resource.cci.RecordFactory getRecordFactory()
          getRecordFactory() must return the XI AF messageFactory.
 Reference getReference()
          Returns the stored Reference object.
 com.sap.aii.af.lib.ra.cci.XIConnectionSpec getXIConnectionSpec()
          Returns a specific CCI ConnectionSpec for NetWeaver XI (XI specific)
 com.sap.aii.af.lib.ra.cci.XIRecordFactory getXIRecordFactory()
          Returns the NetWeaver XI record factory (NetWeaver specific)
 void setReference(Reference ref)
          ConnectionFactory implementing classes must also implement the Referenceable interface (see pg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CCIConnectionFactory

public CCIConnectionFactory()
                     throws javax.resource.ResourceException
The JCA specification requires a default constructor for ConnectionFactory (pg. 199) although it is actually not used by the ManagedConnectionFactory. It may be used for the two-tier approach and is not relevant for the XI AF. (CCI JCA 1.0)

Throws:
javax.resource.ResourceException - If manager creation fails or access to XI MessageFactory returns an error

CCIConnectionFactory

public CCIConnectionFactory(javax.resource.spi.ManagedConnectionFactory mcf)
                     throws javax.resource.ResourceException
In case of the two-tier approach non ConnectionManager object is passed to the ManagedConnectionFactory whereas in the J2EE approach it is. The JCA specification requires that resource adapters have a default ConnectionManager implementation for the first case that must not be used in the second. To fulfill the JCA specification this sample ConnectionFactory class offers a two-tier instantiation method which is not relevant for XI AF. (ra implementation specific)

Parameters:
mcf - ManagedConnectionFactory that creates this CciConnectionFactory
Throws:
javax.resource.ResourceException - Thrown if mcf is not of sample

CCIConnectionFactory

public CCIConnectionFactory(javax.resource.spi.ManagedConnectionFactory mcf,
                            javax.resource.spi.ConnectionManager cm)
                     throws javax.resource.ResourceException
This constructor is used in the context of XI AF: The J2EE server passed a ConnectionManager object via the createConnectionFactory call to the ManagedConnectionFactory, which in turn will call this constructor with itself and the ConenctionManager object as argument. (ra implementation specific)

Parameters:
mcf - ManagedConnectionFactory that creates this CciConnectionFactory
cm - ConnectionManager of the J2EE server
Throws:
javax.resource.ResourceException - Thrown if mcf is not of sample
Method Detail

getConnection

public javax.resource.cci.Connection getConnection()
                                            throws javax.resource.ResourceException
The main task for the ConnectionFactory is to create/return CCI connections for the XI AF. The first of two getter methods returns a connection without any additional selection criterias. The ConnectionFactory delegates this request to the (J2EE) ConnectionManager which in turn communicates with the ManagedConnectionFactory to retrieve an existing connection or create a new one.

Specified by:
getConnection in interface javax.resource.cci.ConnectionFactory
Returns:
CCI connection ready to process interactions (CCI JCA 1.0)
Throws:
javax.resource.ResourceException

getConnection

public javax.resource.cci.Connection getConnection(javax.resource.cci.ConnectionSpec spec)
                                            throws javax.resource.ResourceException
The second getter method returns a connection based on additional (selection) information which are contained in the ConnectionSpec object. For the XI AF objects of class XIConnectionSpec must be used here. XIConnectionSpec implements ConnectionSpec

Specified by:
getConnection in interface javax.resource.cci.ConnectionFactory
Parameters:
spec - ConnectionSpec with a kind of selection specification to find a connection with particular properties.
Returns:
CCI connection ready to process interactions
Throws:
javax.resource.ResourceException - Thrown if spec is not a CciConnectionSpec or of connection cannot be allocated (CCI JCA 1.0)

getMetaData

public javax.resource.cci.ResourceAdapterMetaData getMetaData()
                                                       throws javax.resource.ResourceException
getMetaData() returns meta data information of the resource adapter as specified in JCA

Specified by:
getMetaData in interface javax.resource.cci.ConnectionFactory
Returns:
Meta data of the resource adapter
Throws:
javax.resource.ResourceException - Thrown if meta data object cannot be instantiated (CCI JCA 1.0)

getRecordFactory

public javax.resource.cci.RecordFactory getRecordFactory()
                                                  throws javax.resource.ResourceException
getRecordFactory() must return the XI AF messageFactory. The XI AF uses this returned message factory to create the messages which are given to the resource adapter in the interaction afterwards. Note that the messageFactory can be used for the inbound direction as well to create the messages which are given to the XI AF via ejb.onMessage() The usage of the XI AF MessageFactory ensures that the customer records implement the Message interface AND that the implementing object is a XI message.

Specified by:
getRecordFactory in interface javax.resource.cci.ConnectionFactory
Returns:
RecordFactory implementing object of class MessageFactory
Throws:
javax.resource.ResourceException - Thrown if record factory object cannot be instantiated (CCI JCA 1.0)

setReference

public void setReference(Reference ref)
ConnectionFactory implementing classes must also implement the Referenceable interface (see pg. 199 JCA specification). The reason is that ConnectionFactory objects are retrieved by JNDI lookups. (CCI JCA 1.0)

Parameters:
ref - Reference object to store.

getReference

public Reference getReference()
Returns the stored Reference object. (CCI JCA 1.0)

Specified by:
getReference in interface Referenceable
Returns:
reference Reference object if stored, null otherwise.

getXIConnectionSpec

public com.sap.aii.af.lib.ra.cci.XIConnectionSpec getXIConnectionSpec()
                                                               throws javax.resource.NotSupportedException
Returns a specific CCI ConnectionSpec for NetWeaver XI (XI specific)

Specified by:
getXIConnectionSpec in interface com.sap.aii.af.lib.ra.cci.XIConnectionFactory
Returns:
XIConnectionSpec
Throws:
javax.resource.NotSupportedException

getXIRecordFactory

public com.sap.aii.af.lib.ra.cci.XIRecordFactory getXIRecordFactory()
                                                             throws javax.resource.NotSupportedException,
                                                                    javax.resource.ResourceException
Returns the NetWeaver XI record factory (NetWeaver specific)

Specified by:
getXIRecordFactory in interface com.sap.aii.af.lib.ra.cci.XIConnectionFactory
Returns:
XIRecordFactory
Throws:
javax.resource.NotSupportedException
javax.resource.ResourceException


Copyright © 2012. All Rights Reserved.