com.ibm.j2ca.base
Class WBIManagedConnectionFactory

java.lang.Object
  extended bycom.ibm.j2ca.base.WBIManagedConnectionFactory
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, java.io.Serializable

public abstract class WBIManagedConnectionFactory
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation

A managed connection factory for the container-managed configuration and creation of physical connections to the underlying EIS. A subclass of WBIManagedConnectionFactory should:

See Also:
Serialized Form

Constructor Summary
WBIManagedConnectionFactory()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 java.lang.Object createConnectionFactory()
          Returns a connection factory instance.
abstract  java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connMgr)
          Returns a connection factory instance.
abstract  javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
          Returns a new managed connection instance.
 boolean equals(java.lang.Object o)
           
 java.lang.String getBiDiContext_PasswordEIS()
           
 java.lang.String getBiDiContext_PasswordSkip()
           
 java.lang.String getBiDiContext_UserNameEIS()
           
 java.lang.String getBiDiContext_UserNameSkip()
           
 com.ibm.j2ca.base.bidi.WBIBiDiContext getBiDiContext()
           
 java.lang.String getBiDiContextEIS()
           
 java.lang.String getBiDiContextMetadata()
           
 java.lang.String getBiDiContextSkip()
           
 java.lang.String getBiDiContextSpecialFormat()
           
 java.lang.String getBiDiTranslatedPassword(java.lang.String password)
           
 java.lang.String getBiDiTranslatedUserName(java.lang.String user)
           
 LogUtils getLogUtils()
           
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getPassword()
           
 javax.resource.spi.security.PasswordCredential getPasswordCredential(javax.security.auth.Subject subject, WBIConnectionRequestInfo info)
          Returns an instance of the matching PasswordCredential from the subject.
protected  java.beans.PropertyChangeSupport getPropertyChangeSupport()
          Provides a PropertyChangeSupport instance that can be used to notify any listeners of property changes on the factory.
 java.lang.Boolean getReauthSupported()
           
 javax.resource.spi.ResourceAdapter getResourceAdapter()
          Returns the resource adapter instance associated with this factory.
 java.lang.String getUserName()
           
 int hashCode()
           
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo requestInfo)
          Selects the matching ManagedConnection from the candidate set provided by the caller.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 void setBiDiContext_PasswordEIS(java.lang.String biDiContext_PasswordEIS)
           
 void setBiDiContext_PasswordSkip(java.lang.String biDiContext_PasswordSkip)
           
 void setBiDiContext_UserNameEIS(java.lang.String biDiContext_UserNameEIS)
           
 void setBiDiContext_UserNameSkip(java.lang.String biDiContext_UserNameSkip)
           
 void setBiDiContextEIS(java.lang.String biDiContextEIS)
           
 void setBiDiContextMetadata(java.lang.String biDiContextMetadata)
           
 void setBiDiContextSkip(java.lang.String biDiContextSkip)
           
 void setBiDiContextSpecialFormat(java.lang.String biDiContextSpecialFormat)
           
 void setLogUtils(LogUtils utils)
           
 void setLogWriter(java.io.PrintWriter out)
           
 void setPassword(java.lang.String newValue)
           
 void setReauthSupported(java.lang.Boolean newValue)
           
 void setResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter)
          Sets the resource adapter instance associated with this factory.
 void setUserName(java.lang.String newValue)
           
protected  void validate()
          Validates the configuration properties defined for this managed connection factory instance.
protected  void verifyBiDiFormatValues()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WBIManagedConnectionFactory

public WBIManagedConnectionFactory()
Method Detail

createManagedConnection

public abstract javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                             javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
                                                                      throws javax.resource.ResourceException
Returns a new managed connection instance. Intended for use by the resource adapter container.

A subclass should evaluate the connection details and the security credentials and return a new WBIManagedConnection instance configured appropriately.

Note on XA Support: If the resource adapter implementation supports XA, the implementation of createManagedConnection must be prepared to support invocations in which the Subject instance passed provides security credentials and the ConnectionRequestInfo parameter is simply a null pointer. The ManagedConnection instance returned from this invocation need not represent a valid physical connection, but it must be able to provide an XAResource instance for the underlying EIS via method ManagedConnection.getXAResource().

This requirement relates to transaction recovery and enables the resource adapter container to get an XAResource instance for the EIS to begin recovery even when the container lacks appropriate connection parameters from a client. For more information, see the Java Connector Architecture 1.5 specification.

Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createConnectionFactory

public abstract java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connMgr)
                                                  throws javax.resource.ResourceException
Returns a connection factory instance. Intended for use by the resource adapter container in a managed environment, since presumably the container has its own optimized connection manager. The factory generated is handed off to CCI clients, enabling them to generate handles to the physical EIS connection.

A subclass should return its own EIS-specific WBIConnectionFactory instance.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Returns a connection factory instance. Intended for use non-managed environments only, since this method employs a default connection manager that is not optimized.

A subclass can choose to override this method if it wishes to provide its own ConnectionManager instance for use in non-managed environments.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

hashCode

public int hashCode()
Specified by:
hashCode in interface javax.resource.spi.ManagedConnectionFactory

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo requestInfo)
                                                             throws javax.resource.ResourceException
Selects the matching ManagedConnection from the candidate set provided by the caller. a) Connector does not support reauthentication. In other words, the security info of the existing managed connection and the security info of the request have to match. The request security info can be read either from the Subject or the ConnectionRequestInfo. This value is compared with the security info of the ManagedConnection from the candidate set. If there is no match, method returns null to the caller. If the match is found, the next step is to match remining properties of the ConnectionRequestInfo. The Connector has the knowledge to verify that particluar value of the property can be overwritten, so after finding compatible properties the ManagedConnection is returned to the caller. If there is no match or properties are not 'compatible', the method returns null. When ConnectionRequestInfo and Subject are null, the security info and properties of the ManagedConnections from the candidate set are compared with the default values of the ManagedConnectionFactory. If there is a match, the ManagedConnection is returned to the caller, otherwise null is returned. b) Connector supports reauthentication - Only properties from the ConnectionRequestInfo have to match. The Connector has the knowledge to verify that particluar value of the property can be overwritten, so if it finds compatible properties, it overwrites them and then returns ManagedConnection to the caller. If there is no match or properties are not 'compatible', the method returns null. When ConnectionRequestInfo is null, the security info and properties of the ManagedConnections from the candidate set are compared with the default values of the ManagedConnectionFactory. If there is a match, the ManagedConnection is returned to the caller, otherwise null is returned.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

getBiDiContextEIS

public java.lang.String getBiDiContextEIS()

setBiDiContextEIS

public void setBiDiContextEIS(java.lang.String biDiContextEIS)

getBiDiContextMetadata

public java.lang.String getBiDiContextMetadata()

setBiDiContextMetadata

public void setBiDiContextMetadata(java.lang.String biDiContextMetadata)

getBiDiContextSpecialFormat

public java.lang.String getBiDiContextSpecialFormat()

setBiDiContextSpecialFormat

public void setBiDiContextSpecialFormat(java.lang.String biDiContextSpecialFormat)

getBiDiContextSkip

public java.lang.String getBiDiContextSkip()

setBiDiContextSkip

public void setBiDiContextSkip(java.lang.String biDiContextSkip)

getBiDiContext

public com.ibm.j2ca.base.bidi.WBIBiDiContext getBiDiContext()

setReauthSupported

public void setReauthSupported(java.lang.Boolean newValue)

getReauthSupported

public java.lang.Boolean getReauthSupported()

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String newValue)
                 throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String newValue)
                 throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

getPasswordCredential

public javax.resource.spi.security.PasswordCredential getPasswordCredential(javax.security.auth.Subject subject,
                                                                            WBIConnectionRequestInfo info)
                                                                     throws javax.resource.spi.SecurityException
Returns an instance of the matching PasswordCredential from the subject. If subject is null, return an instance of PasswordCredential constructed from the ConnectionRequestInfo. If subject and ConnectionRequestInfo are null, allow the subclass to determine a default PasswordCredential.

Throws:
javax.resource.spi.SecurityException

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)

getPropertyChangeSupport

protected java.beans.PropertyChangeSupport getPropertyChangeSupport()
Provides a PropertyChangeSupport instance that can be used to notify any listeners of property changes on the factory.


validate

protected void validate()
                 throws javax.resource.spi.InvalidPropertyException
Validates the configuration properties defined for this managed connection factory instance.

A subclass should override this method and add checks for its custom configuration properties (as well as call super.validate)

Throws:
javax.resource.spi.InvalidPropertyException

setResourceAdapter

public void setResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter)
                        throws javax.resource.ResourceException
Sets the resource adapter instance associated with this factory. This and getResourceAdapter() enable a resource adapter container to associate a ResourceAdapter instance with this ManagedConnectionFactory. The primary value is that the factory can access any configuration properties globally defined on the ResourceAdapter.

Specified by:
setResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociation
Throws:
javax.resource.ResourceException
See Also:
getResourceAdapter()

getResourceAdapter

public javax.resource.spi.ResourceAdapter getResourceAdapter()
Returns the resource adapter instance associated with this factory.

Specified by:
getResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociation
See Also:
setResourceAdapter(javax.resource.spi.ResourceAdapter)

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

setLogUtils

public void setLogUtils(LogUtils utils)

getLogUtils

public LogUtils getLogUtils()

setBiDiContext_UserNameEIS

public void setBiDiContext_UserNameEIS(java.lang.String biDiContext_UserNameEIS)

getBiDiContext_UserNameEIS

public java.lang.String getBiDiContext_UserNameEIS()

setBiDiContext_UserNameSkip

public void setBiDiContext_UserNameSkip(java.lang.String biDiContext_UserNameSkip)

getBiDiContext_UserNameSkip

public java.lang.String getBiDiContext_UserNameSkip()

setBiDiContext_PasswordEIS

public void setBiDiContext_PasswordEIS(java.lang.String biDiContext_PasswordEIS)

getBiDiContext_PasswordEIS

public java.lang.String getBiDiContext_PasswordEIS()

setBiDiContext_PasswordSkip

public void setBiDiContext_PasswordSkip(java.lang.String biDiContext_PasswordSkip)

getBiDiContext_PasswordSkip

public java.lang.String getBiDiContext_PasswordSkip()

getBiDiTranslatedUserName

public java.lang.String getBiDiTranslatedUserName(java.lang.String user)

getBiDiTranslatedPassword

public java.lang.String getBiDiTranslatedPassword(java.lang.String password)

verifyBiDiFormatValues

protected void verifyBiDiFormatValues()
                               throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException