com.stc.connector.framework.jca.system
Class STCManagedConnectionFactory

java.lang.Object
  extended bycom.stc.connector.framework.util.JndiJCAObject
      extended bycom.stc.connector.framework.jca.system.STCManagedConnectionFactory
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, javax.naming.Referenceable, javax.resource.Referenceable, java.io.Serializable, STCManagedMaster

public class STCManagedConnectionFactory
extends JndiJCAObject
implements javax.resource.spi.ManagedConnectionFactory, STCManagedMaster

Class implementing the ManagedConnectionFactory interface. The ManagedConnectionFactory instance is a factory of both ManagedConnection and EIS-specific connection factory instances. This interface supports connection pooling by providing methods for matching and creation of ManagedConnection instance. A ManagedConnectionFactory instance is required to be a JavaBean.

Version:
$Version$
Author:
$Author: smarkov $
See Also:
Serialized Form

Constructor Summary
STCManagedConnectionFactory()
          Constructor for STCManagedConnectionFactory.
 
Method Summary
 java.lang.Object createConnectionFactory()
          Creates a Connection Factory instance.
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
          Creates a Connection Factory instance.
 STCPropertiesInfo createCRI()
          Creates a new ConnectionRequestInfo instance out of the common properties in the ManagedConnectionFactory instance and the provided ConnectionRequestInfo instance.
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          Creates a new physical connection to the underlying EIS resource manager, ManagedConnectionFactory uses the security information (passed as Subject) and additional ConnectionRequestInfo (which is specific to ResourceAdapter and opaque to application server) to create this new connection.
 void createMBean(java.lang.String mbeanClassName, java.lang.String mbeanName)
          Creates the MBean
 java.lang.String getApplicationConnectionFactoryClass()
          Gets the value of the ApplicationConnectionFactoryClass property.
 java.lang.String getConfigurationInstance()
          Gets the value of the ConfigurationInstance property.
 com.stc.configuration.IConfiguration getConfigurationModel()
          Gets the configuration model for the instance of the ManagedConnectionFactory.
 java.lang.String getConfigurationTemplate()
          Gets the value of the ConfigurationTemplate property.
 java.lang.String getEwayConnectionClass()
          Gets the value of the EwayConnectionClass property.
 java.lang.String getEwayManagedConnectionMBeanClass()
          Gets the value of the EwayMCFMBeanClass property.
 java.lang.String getEwayMCFDescription()
           
 java.lang.String getEwayMCFMBeanClass()
          Gets the value of the EwayMCFMBeanClass property.
 java.lang.String getEwayMCFMBeanName()
          Gets the value of the EwayMCFMBeanName property.
 java.lang.String getEwayMCFName()
           
 java.io.PrintWriter getLogWriter()
          Get the log writer for this ManagedConnectionFactory instance.
 java.lang.Object getMBean()
          Getter for ManagedConnectionFactory's MBean
 java.lang.String getProcessConfigurationParameters()
          Gets the value of the ProcessConfigurationParameters property.
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          Returns a matched connection from the candidate set of connections.
 void setApplicationConnectionFactoryClass(java.lang.String className)
          Sets the value of the ApplicationConnectionFactoryClass property.
 void setConfigurationInstance(java.lang.String configInstance)
          Sets the value of the ConfigurationInstance property.
 void setConfigurationTemplate(java.lang.String configTemplate)
          Sets the value of the ConfigurationTemplate property.
 void setEwayConnectionClass(java.lang.String className)
          Sets the value of the EwayConnectionClass property.
 void setEwayManagedConnectionMBeanClass(java.lang.String className)
          Sets the value of the EwayManagedConnMBeanClass property.
 void setEwayMCFDescription(java.lang.String asDescription)
           
 void setEwayMCFMBeanClass(java.lang.String className)
          Sets the value of the EwayMCFMBeanClass property.
 void setEwayMCFMBeanName(java.lang.String mbeanName)
          Sets the value of the EwayMCFMBeanName property.
 void setEwayMCFName(java.lang.String asName)
           
 void setLogWriter(java.io.PrintWriter out)
          Set the log writer for this ManagedConnectionFactory instance.
 void setProcessConfigurationParameters(java.lang.String value)
          Sets the value of the ProcessConfigurationParameters property.
 java.lang.String toString()
          Gets the String-ified form of the ManagedConnectionFactory instance.
 
Methods inherited from class com.stc.connector.framework.util.JndiJCAObject
getReference, getVersion, setReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory
equals, hashCode
 

Constructor Detail

STCManagedConnectionFactory

public STCManagedConnectionFactory()
Constructor for STCManagedConnectionFactory.

Method Detail

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
                                         throws javax.resource.ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with the passed ConnectionManager. In the managed scenario, ConnectionManager is provided by the application server.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cm - ConnectionManager to be associated with created EIS connection factory instance .
Returns:
EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance.
Throws:
javax.resource.ResourceException - upon error.

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with a default ConnectionManager provided by the resource adapter. This is used in non-managed mode.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Returns:
EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance.
Throws:
javax.resource.ResourceException - upon error.

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                                                             throws javax.resource.ResourceException
Creates a new physical connection to the underlying EIS resource manager, ManagedConnectionFactory uses the security information (passed as Subject) and additional ConnectionRequestInfo (which is specific to ResourceAdapter and opaque to application server) to create this new connection.

Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
subject - The Subject provided by the container which may contain credentials for authenticating to the EIS.
cxRequestInfo - The ConnectionRequestInfo containing information which can be used for creating the EIS connection.
Returns:
A ManagedConnection instance.
Throws:
javax.resource.ResourceException - upon error.

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                                                             throws javax.resource.ResourceException
Returns a matched connection from the candidate set of connections. ManagedConnectionFactory uses the security info (as in Subject) and information provided through ConnectionRequestInfo and additional Resource Adapter specific criteria to do matching. Note that criteria used for matching is specific to a resource adapter and is not prescribed by the Connector specification. This method returns a ManagedConnection instance that is the best match for handling the connection allocation request.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
connectionSet - The candidate connection set.
subject - The Subject provided by the container which may contain credentials for authenticating to the EIS.
cxRequestInfo - The ConnectionRequestInfo containing information which can be used for creating the EIS connection.
Returns:
A ManagedConnection instance from the candidate connection set which matches the Subject and/or ConnectionRequestInfo. A null is returned if no candidates matched; return null causes a new ManagedConnection to be created.
Throws:
javax.resource.ResourceException - upon error.

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Set the log writer for this ManagedConnectionFactory instance. The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionfactory instance will be printed. ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled. The ManagedConnection instances created by ManagedConnectionFactory "inherits" the log writer, which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
out - Character output stream associated with this ManagedConnectionFactory instance.
Throws:
javax.resource.ResourceException - upon error.

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Get the log writer for this ManagedConnectionFactory instance. The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionFactory instance will be printed. ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled.

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Returns:
Character output stream associated with this ManagedConnectionFactory instance.
Throws:
javax.resource.ResourceException - upon error.

toString

public java.lang.String toString()
Gets the String-ified form of the ManagedConnectionFactory instance.

Returns:
A String with information regarding the ManagedConnectionFactory instance.

getConfigurationModel

public com.stc.configuration.IConfiguration getConfigurationModel()
Gets the configuration model for the instance of the ManagedConnectionFactory. The configuration model holds the properties of the ManagedConnectionFactory.

Returns:
An instance of IConfiguration which can be used to get the properties of the ManagedConnectionFactory.

getConfigurationTemplate

public java.lang.String getConfigurationTemplate()
Gets the value of the ConfigurationTemplate property.

Returns:
String containing the value of the ConfigurationTemplate property.

setConfigurationTemplate

public void setConfigurationTemplate(java.lang.String configTemplate)
                              throws java.lang.Exception
Sets the value of the ConfigurationTemplate property.

Parameters:
configTemplate - String containing the value to be assigned to ConfigurationTemplate.
Throws:
java.lang.Exception - upon error.

getConfigurationInstance

public java.lang.String getConfigurationInstance()
Gets the value of the ConfigurationInstance property.

Returns:
String containing the value of the ConfigurationInstance property.

setConfigurationInstance

public void setConfigurationInstance(java.lang.String configInstance)
                              throws java.lang.Exception
Sets the value of the ConfigurationInstance property.

Parameters:
configInstance - String containing the value to be assigned to ConfigurationInstance.
Throws:
java.lang.Exception - upon error.

getEwayConnectionClass

public java.lang.String getEwayConnectionClass()
Gets the value of the EwayConnectionClass property.

Returns:
String containing the value of the EwayConnectionClass property.

setEwayConnectionClass

public void setEwayConnectionClass(java.lang.String className)
Sets the value of the EwayConnectionClass property.

Parameters:
className - String containing the value to be assigned to EwayConnectionClass.

getApplicationConnectionFactoryClass

public java.lang.String getApplicationConnectionFactoryClass()
Gets the value of the ApplicationConnectionFactoryClass property.

Returns:
String containing the value of the ApplicationConnectionFactoryClass property.

setApplicationConnectionFactoryClass

public void setApplicationConnectionFactoryClass(java.lang.String className)
                                          throws java.lang.Exception
Sets the value of the ApplicationConnectionFactoryClass property.

Parameters:
className - String containing the value to be assigned to ApplicationConnectionFactoryClass.
Throws:
java.lang.Exception - upon error.

getProcessConfigurationParameters

public java.lang.String getProcessConfigurationParameters()
Gets the value of the ProcessConfigurationParameters property.

Returns:
String containing the value of the ProcessConfigurationParameters property.

setProcessConfigurationParameters

public void setProcessConfigurationParameters(java.lang.String value)
                                       throws java.lang.Exception
Sets the value of the ProcessConfigurationParameters property.

Throws:
java.lang.Exception - upon error.

createCRI

public STCPropertiesInfo createCRI()
Creates a new ConnectionRequestInfo instance out of the common properties in the ManagedConnectionFactory instance and the provided ConnectionRequestInfo instance. Any null property values in the ConnectionRequestInfo are populated with the property values of those same properties in the ManagedConnectionFactory instance.

Returns:
A ConnectionRequestInfo with possible null property values filled in with the values of the same properties in the ManagedConnectionFactory.

setEwayMCFMBeanClass

public void setEwayMCFMBeanClass(java.lang.String className)
                          throws java.lang.Exception
Sets the value of the EwayMCFMBeanClass property.

Parameters:
className - String containing the value to be assigned to EwayMCFMBeanClass.
Throws:
java.lang.Exception - upon error.

getEwayMCFMBeanClass

public java.lang.String getEwayMCFMBeanClass()
Gets the value of the EwayMCFMBeanClass property.

Returns:
String containing the value of the EwayMCFMBeanClass property.

setEwayMCFMBeanName

public void setEwayMCFMBeanName(java.lang.String mbeanName)
                         throws java.lang.Exception
Sets the value of the EwayMCFMBeanName property.

Throws:
java.lang.Exception - upon error.

getEwayMCFMBeanName

public java.lang.String getEwayMCFMBeanName()
Gets the value of the EwayMCFMBeanName property.

Returns:
String containing the value of the EwayMCFMBeanName property.

setEwayManagedConnectionMBeanClass

public void setEwayManagedConnectionMBeanClass(java.lang.String className)
                                        throws java.lang.Exception
Sets the value of the EwayManagedConnMBeanClass property.

Parameters:
className - String containing the value to be assigned to EwayManagedConnMBeanClass.
Throws:
java.lang.Exception - upon error.

getEwayManagedConnectionMBeanClass

public java.lang.String getEwayManagedConnectionMBeanClass()
Gets the value of the EwayMCFMBeanClass property.

Returns:
String containing the value of the EwayManagedConnMBeanClass property.

setEwayMCFName

public void setEwayMCFName(java.lang.String asName)
                    throws java.lang.Exception
Throws:
java.lang.Exception

getEwayMCFName

public java.lang.String getEwayMCFName()

setEwayMCFDescription

public void setEwayMCFDescription(java.lang.String asDescription)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getEwayMCFDescription

public java.lang.String getEwayMCFDescription()

getMBean

public java.lang.Object getMBean()
Getter for ManagedConnectionFactory's MBean

Specified by:
getMBean in interface STCManagedMaster
Returns:
MBean object associated with the managed connection factory

createMBean

public void createMBean(java.lang.String mbeanClassName,
                        java.lang.String mbeanName)
                 throws STCCreateMBeanException
Creates the MBean

Specified by:
createMBean in interface STCManagedMaster
Parameters:
mbeanClassName - classname of MBean impl class
mbeanName - name of MBean
Throws:
STCCreateMBeanException