org.firebirdsql.jca
Class FBManagedConnectionFactory

java.lang.Object
  extended byorg.firebirdsql.jca.FBManagedConnectionFactory
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, java.io.Serializable

public class FBManagedConnectionFactory
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory, java.io.Serializable

FBManagedConnectionFactory implements the jca ManagedConnectionFactory interface and also many of the internal functions of ManagedConnection. This nonstandard behavior is required due to firebird requiring all work done in a transaction to be done over one connection. To support xa semantics, the correct db handle must be located whenever a ManagedConnection is associated with an xid. WARNING: this adapter will probably not work properly in an environment where ManagedConnectionFactory is serialized and deserialized, and the deserialized copy is expected to function as anything other than a key.

Version:
$ $
Author:
David Jencks
See Also:
, Serialized Form

Constructor Summary
FBManagedConnectionFactory()
           
FBManagedConnectionFactory(GDSType type)
           
 
Method Summary
 FBManagedConnectionFactory canonicalize()
          The canonicalize method is used in FBDriver to reuse previous fbmcf instances if they have been create.
 java.lang.Object createConnectionFactory()
          The createConnectionFactory method creates a DataSource with a default stand alone ConnectionManager.
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
          The createConnectionFactory method creates a DataSource using the supplied ConnectionManager..
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          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.
 boolean equals(java.lang.Object other)
           
 java.lang.Integer getBlobBufferLength()
          Get the BlobBufferLength value.
 java.lang.String getDatabase()
           
 FBConnectionRequestInfo getDefaultConnectionRequestInfo()
           
 java.lang.String getEncoding()
           
 java.lang.String getLocalEncoding()
           
 java.io.PrintWriter getLogWriter()
          Get the log writer for this ManagedConnectionFactory instance.
 java.lang.String getPassword()
           
 FBTpb getTpb()
           
 java.lang.Integer getTransactionIsolation()
           
 java.lang.String getTransactionIsolationName()
           
 GDSType getType()
           
 java.lang.String getUserName()
           
 int hashCode()
           
 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 setBlobBufferLength(java.lang.Integer blobBufferLengthWrapper)
          Set the BlobBufferLength value.
 void setConnectionRequestInfo(FBConnectionRequestInfo cri)
           
 void setDatabase(java.lang.String database)
           
 void setEncoding(java.lang.String encoding)
           
 void setLocalEncoding(java.lang.String localEncoding)
           
 void setLogWriter(java.io.PrintWriter out)
          Set the log writer for this ManagedConnectionFactory instance.
 void setPassword(java.lang.String password)
           
 void setTpb(FBTpb tpb)
           
 void setTpbMapper(FBTpbMapper mapper)
           
 void setTransactionIsolation(java.lang.Integer level)
           
 void setTransactionIsolationName(java.lang.String level)
           
 void setUserName(java.lang.String userName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FBManagedConnectionFactory

public FBManagedConnectionFactory()

FBManagedConnectionFactory

public FBManagedConnectionFactory(GDSType type)
Method Detail

getType

public GDSType getType()

setDatabase

public void setDatabase(java.lang.String database)

getDatabase

public java.lang.String getDatabase()

setConnectionRequestInfo

public void setConnectionRequestInfo(FBConnectionRequestInfo cri)

getDefaultConnectionRequestInfo

public FBConnectionRequestInfo getDefaultConnectionRequestInfo()

setUserName

public void setUserName(java.lang.String userName)

getUserName

public java.lang.String getUserName()

setPassword

public void setPassword(java.lang.String password)

getPassword

public java.lang.String getPassword()

setTpb

public void setTpb(FBTpb tpb)

getTpb

public FBTpb getTpb()

setTpbMapper

public void setTpbMapper(FBTpbMapper mapper)
                  throws FBResourceException
Throws:
FBResourceException

setTransactionIsolation

public void setTransactionIsolation(java.lang.Integer level)
                             throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

getTransactionIsolation

public java.lang.Integer getTransactionIsolation()
                                          throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

setTransactionIsolationName

public void setTransactionIsolationName(java.lang.String level)
                                 throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

getTransactionIsolationName

public java.lang.String getTransactionIsolationName()
                                             throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

setEncoding

public void setEncoding(java.lang.String encoding)

getEncoding

public java.lang.String getEncoding()

setLocalEncoding

public void setLocalEncoding(java.lang.String localEncoding)

getLocalEncoding

public java.lang.String getLocalEncoding()

getBlobBufferLength

public java.lang.Integer getBlobBufferLength()
Get the BlobBufferLength value.

Returns:
the BlobBufferLength value.

setBlobBufferLength

public void setBlobBufferLength(java.lang.Integer blobBufferLengthWrapper)
Set the BlobBufferLength value.

Parameters:
blobBufferLengthWrapper - The new BlobBufferLength value.

hashCode

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

equals

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

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
                                         throws javax.resource.ResourceException
The createConnectionFactory method creates a DataSource using the supplied ConnectionManager..

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cxManager - a ConnectionManager value
Returns:
a java.lang.Object value
Throws:
javax.resource.ResourceException - if an error occurs

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
The createConnectionFactory method creates a DataSource with a default stand alone ConnectionManager. Ours can implement pooling.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Returns:
a java.lang.Object value
Throws:
javax.resource.ResourceException - if an error occurs

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cri)
                                                             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. Parameters: Subject - Caller's security information cxRequestInfo - Additional resource adapter specific connection request information Returns: ManagedConnection instance Throws: ResourceException - generic exception SecurityException - security related error ResourceAllocationException - failed to allocate system resources for connection request ResourceAdapterInternalException - resource adapter related error condition EISSystemException - internal error condition in EIS instance

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

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. Parameters: connectionSet - candidate connection set Subject - caller's security information cxRequestInfo - additional resource adapter specific connection request information Returns: ManagedConnection if resource adapter finds an acceptable match otherwise null Throws: ResourceException - generic exception SecurityException - security related error ResourceAdapterInternalException - resource adapter related error condition NotSupportedException - if operation is not supported

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

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. Parameters: out - PrintWriter - an out stream for error logging and tracing Throws: ResourceException - generic exception ResourceAdapterInternalException - resource adapter related error condition

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

getLogWriter

public java.io.PrintWriter getLogWriter()
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. Returns: PrintWriter Throws: ResourceException - generic exception

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory

canonicalize

public FBManagedConnectionFactory canonicalize()
The canonicalize method is used in FBDriver to reuse previous fbmcf instances if they have been create. It should really be package access level

Returns:
a FBManagedConnectionFactory value


Copyright © 2001 David Jencks and other authors. All rights reserved.