public class FBManagedConnectionFactory extends java.lang.Object implements javax.resource.spi.ManagedConnectionFactory, FirebirdConnectionProperties, java.io.Serializable
Constructor and Description |
---|
FBManagedConnectionFactory()
Create a new pure-Java FBManagedConnectionFactory.
|
FBManagedConnectionFactory(org.firebirdsql.gds.impl.GDSType gdsType)
Create a new FBManagedConnectionFactory based around the given GDSType.
|
FBManagedConnectionFactory(org.firebirdsql.gds.impl.GDSType gdsType,
FBConnectionProperties connectionProperties) |
Modifier and Type | Method and Description |
---|---|
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) |
void |
forget(FBManagedConnection mc,
javax.transaction.xa.Xid xid) |
int |
getBlobBufferLength()
Deprecated.
|
int |
getBlobBufferSize() |
int |
getBuffersNumber() |
FBConnectionProperties |
getCacheKey() |
java.lang.String |
getCharSet() |
int |
getConnectTimeout()
Get the current connect timeout.
|
java.lang.String |
getDatabase() |
DatabaseParameterBuffer |
getDatabaseParameterBuffer()
Get the database parameter buffer corresponding to the current connection
request information.
|
FBConnectionRequestInfo |
getDefaultConnectionRequestInfo() |
java.lang.String |
getDefaultIsolation()
Get the default transaction isolation level as string.
|
FBTpb |
getDefaultTpb() |
int |
getDefaultTransactionIsolation()
Get the default transaction isolation level.
|
java.lang.String |
getEncoding() |
GDS |
getGDS() |
org.firebirdsql.gds.impl.GDSType |
getGDSType()
Get the GDS implementation type around which this factory is based.
|
java.lang.String |
getLocalEncoding()
Deprecated.
use
getCharSet() instead. |
java.io.PrintWriter |
getLogWriter()
Get the log writer for this
ManagedConnectionFactory
instance. |
java.lang.String |
getNonStandardProperty(java.lang.String key)
Get the property that does not have corresponding getter method by its
name.
|
java.lang.String |
getPassword() |
java.lang.String |
getRoleName() |
int |
getSocketBufferSize() |
int |
getSoTimeout()
Get the current Socket blocking timeout (SoTimeout).
|
java.lang.String |
getSqlDialect() |
FBTpb |
getTpb(int defaultTransactionIsolation) |
java.lang.String |
getTpbMapping()
Get the used TPB mapping.
|
java.lang.Integer |
getTransactionIsolation()
Deprecated.
|
java.lang.String |
getTransactionIsolationName()
Deprecated.
|
TransactionParameterBuffer |
getTransactionParameters(int isolation)
Get the transaction parameter buffer corresponding to the current
connection request information.
|
java.lang.String |
getType() |
java.lang.String |
getUserName() |
java.lang.String |
getUseTranslation() |
int |
hashCode() |
boolean |
isDefaultResultSetHoldable()
Get the default ResultSet holdability.
|
boolean |
isTimestampUsesLocalTimezone() |
boolean |
isUseFirebirdAutocommit()
Get whether to use Firebird autocommit (experimental).
|
boolean |
isUseStandardUdf() |
boolean |
isUseStreamBlobs() |
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 |
recover(FBManagedConnection mc,
javax.transaction.xa.Xid xid) |
void |
setBlobBufferLength(int value)
Deprecated.
|
void |
setBlobBufferSize(int bufferSize) |
void |
setBuffersNumber(int buffersNumber) |
void |
setCharSet(java.lang.String charSet) |
void |
setConnectTimeout(int connectTimeout)
Set the connect timeout.
|
void |
setDatabase(java.lang.String database) |
void |
setDefaultConnectionManager(javax.resource.spi.ConnectionManager defaultCm) |
void |
setDefaultIsolation(java.lang.String isolation)
Set the default transaction isolation level as string.
|
void |
setDefaultResultSetHoldable(boolean isHoldable)
Sets the default ResultSet holdability.
|
void |
setDefaultTransactionIsolation(int defaultIsolationLevel)
Set the default transaction isolation level.
|
void |
setEncoding(java.lang.String encoding) |
void |
setLocalEncoding(java.lang.String localEncoding)
Deprecated.
use
setCharSet(String) instead. |
void |
setLogWriter(java.io.PrintWriter out)
Set the log writer for this
ManagedConnectionFactory
instance. |
void |
setNonStandardProperty(java.lang.String propertyMapping)
Set the property that does not have corresponding setter method.
|
void |
setNonStandardProperty(java.lang.String key,
java.lang.String value)
Set the property that does not have corresponding setter method.
|
void |
setPassword(java.lang.String password) |
void |
setRoleName(java.lang.String roleName) |
void |
setSocketBufferSize(int socketBufferSize) |
void |
setSoTimeout(int soTimeout)
Set the Socket blocking timeout (SoTimeout).
|
void |
setSqlDialect(java.lang.String sqlDialect) |
void |
setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone) |
void |
setTpbMapping(java.lang.String tpbMapping)
Set path to the properties file with the TPB mapping.
|
void |
setTransactionIsolation(java.lang.Integer value)
Deprecated.
|
void |
setTransactionIsolationName(java.lang.String name)
Deprecated.
|
void |
setTransactionParameters(int isolation,
TransactionParameterBuffer tpb)
Set transaction parameters for the specified transaction isolation level.
|
void |
setType(java.lang.String type) |
void |
setUseFirebirdAutocommit(boolean useFirebirdAutocommit)
Set whether to use Firebird autocommit (experimental).
|
void |
setUserName(java.lang.String userName) |
void |
setUseStandardUdf(boolean useStandardUdf) |
void |
setUseStreamBlobs(boolean useStreamBlobs) |
void |
setUseTranslation(java.lang.String translationPath) |
public FBManagedConnectionFactory()
public FBManagedConnectionFactory(org.firebirdsql.gds.impl.GDSType gdsType)
gdsType
- The GDS implementation to usepublic FBManagedConnectionFactory(org.firebirdsql.gds.impl.GDSType gdsType, FBConnectionProperties connectionProperties)
public GDS getGDS()
public org.firebirdsql.gds.impl.GDSType getGDSType()
public int getBlobBufferLength()
getBlobBufferSize()
public void setBlobBufferLength(int value)
setBlobBufferSize(int)
public java.lang.Integer getTransactionIsolation()
getDefaultTransactionIsolation()
public void setTransactionIsolation(java.lang.Integer value)
setDefaultTransactionIsolation(int)
public java.lang.String getTransactionIsolationName()
getDefaultIsolation()
public void setTransactionIsolationName(java.lang.String name)
setDefaultIsolation(String)
public java.lang.String getLocalEncoding()
getCharSet()
instead.public void setLocalEncoding(java.lang.String localEncoding)
setCharSet(String)
instead.public int getBlobBufferSize()
getBlobBufferSize
in interface FirebirdConnectionProperties
public int getBuffersNumber()
getBuffersNumber
in interface FirebirdConnectionProperties
public java.lang.String getCharSet()
getCharSet
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setCharSet(String)
public java.lang.String getDatabase()
getDatabase
in interface FirebirdConnectionProperties
public DatabaseParameterBuffer getDatabaseParameterBuffer() throws java.sql.SQLException
FirebirdConnectionProperties
getDatabaseParameterBuffer
in interface FirebirdConnectionProperties
DatabaseParameterBuffer
.java.sql.SQLException
- if database parameter buffer cannot be created.public java.lang.String getDefaultIsolation()
FirebirdConnectionProperties
FirebirdConnectionProperties.getDefaultTransactionIsolation()
, however
it takes a string as parameter instead of a numeric constant.getDefaultIsolation
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setDefaultIsolation(String)
public int getDefaultTransactionIsolation()
FirebirdConnectionProperties
getDefaultTransactionIsolation
in interface FirebirdConnectionProperties
public java.lang.String getEncoding()
getEncoding
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setEncoding(String)
public java.lang.String getNonStandardProperty(java.lang.String key)
FirebirdConnectionProperties
getNonStandardProperty
in interface FirebirdConnectionProperties
key
- name of the property to get.public java.lang.String getPassword()
getPassword
in interface FirebirdConnectionProperties
public java.lang.String getRoleName()
getRoleName
in interface FirebirdConnectionProperties
public int getSocketBufferSize()
getSocketBufferSize
in interface FirebirdConnectionProperties
public java.lang.String getSqlDialect()
getSqlDialect
in interface FirebirdConnectionProperties
public java.lang.String getTpbMapping()
FirebirdConnectionProperties
getTpbMapping
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setTpbMapping(String)
public TransactionParameterBuffer getTransactionParameters(int isolation)
FirebirdConnectionProperties
getTransactionParameters
in interface FirebirdConnectionProperties
isolation
- transaction isolation level for which TPB should be returned.TransactionParameterBuffer
.public java.lang.String getType()
getType
in interface FirebirdConnectionProperties
public java.lang.String getUserName()
getUserName
in interface FirebirdConnectionProperties
public java.lang.String getUseTranslation()
getUseTranslation
in interface FirebirdConnectionProperties
public boolean isTimestampUsesLocalTimezone()
isTimestampUsesLocalTimezone
in interface FirebirdConnectionProperties
true
if the Jaybird 1.0 handling of the calendar
in corresponding setters. This is also compatible with MySQL
calendar treatment.public boolean isUseStandardUdf()
isUseStandardUdf
in interface FirebirdConnectionProperties
true
if driver should assume that standard UDF are
installed.public boolean isUseStreamBlobs()
isUseStreamBlobs
in interface FirebirdConnectionProperties
true
if stream blobs should be created, otherwise
false
.public void setBlobBufferSize(int bufferSize)
setBlobBufferSize
in interface FirebirdConnectionProperties
bufferSize
- size of the BLOB buffer in bytes.public void setBuffersNumber(int buffersNumber)
setBuffersNumber
in interface FirebirdConnectionProperties
buffersNumber
- number of cache buffers that should be allocated for this
connection, should be specified for ClassicServer instances,
SuperServer has a server-wide configuration parameter.public void setCharSet(java.lang.String charSet)
setCharSet
in interface FirebirdConnectionProperties
charSet
- Character set for the connection. Similar to
encoding
property, but accepts Java names
instead of Firebird ones.public void setDatabase(java.lang.String database)
setDatabase
in interface FirebirdConnectionProperties
database
- path to the database including the server name and the
port, if needed.public void setDefaultIsolation(java.lang.String isolation)
FirebirdConnectionProperties
FirebirdConnectionProperties.setDefaultTransactionIsolation(int)
,
however it takes a string as parameter instead of a numeric constant.
Following strings are allowed:
"TRANSACTION_READ_COMMITTED"
for a READ COMMITTED
isolation level.
"TRANSACTION_REPEATABLE_READ"
for a REPEATABLE READ
isolation level.
"TRANSACTION_SERIALIZABLE"
for a SERIALIZABLE
isolation level.
setDefaultIsolation
in interface FirebirdConnectionProperties
isolation
- string constant representing a default isolation level.public void setDefaultTransactionIsolation(int defaultIsolationLevel)
FirebirdConnectionProperties
setDefaultTransactionIsolation
in interface FirebirdConnectionProperties
defaultIsolationLevel
- default transaction isolation level.public void setEncoding(java.lang.String encoding)
setEncoding
in interface FirebirdConnectionProperties
encoding
- Character encoding for the connection. See Firebird
documentation for more information.public void setNonStandardProperty(java.lang.String key, java.lang.String value)
FirebirdConnectionProperties
setNonStandardProperty
in interface FirebirdConnectionProperties
key
- name of the property to set.value
- value of the property.public void setNonStandardProperty(java.lang.String propertyMapping)
FirebirdConnectionProperties
setNonStandardProperty
in interface FirebirdConnectionProperties
propertyMapping
- parameter value in the ?propertyName[=propertyValue]? form,
this allows setting non-standard parameters using
configuration files.public void setPassword(java.lang.String password)
setPassword
in interface FirebirdConnectionProperties
password
- password corresponding to the specified user name.public void setRoleName(java.lang.String roleName)
setRoleName
in interface FirebirdConnectionProperties
roleName
- SQL role to use.public void setSocketBufferSize(int socketBufferSize)
setSocketBufferSize
in interface FirebirdConnectionProperties
socketBufferSize
- socket buffer size in bytes.public void setSqlDialect(java.lang.String sqlDialect)
setSqlDialect
in interface FirebirdConnectionProperties
sqlDialect
- SQL dialect of the client.public void setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
setTimestampUsesLocalTimezone
in interface FirebirdConnectionProperties
timestampUsesLocalTimezone
- true
if the Jaybird 1.0 handling of the
calendar in corresponding setters. This is also compatible
with MySQL calendar treatment.public void setTpbMapping(java.lang.String tpbMapping)
FirebirdConnectionProperties
"res:"
should be used to specify resource
in the classpath.
For the compatibility reasons, if no protocol is specified, classpath is used by default.
Properties file contains a mapping between the transaction isolation
level (name of the constant in the Connection
interface
and a comma-separated list of TPB parameters.
setTpbMapping
in interface FirebirdConnectionProperties
tpbMapping
- path to the properties file.public void setTransactionParameters(int isolation, TransactionParameterBuffer tpb)
FirebirdConnectionProperties
setTransactionParameters
in interface FirebirdConnectionProperties
isolation
- transaction isolation level.tpb
- instance of TransactionParameterBuffer
containing
transaction parameters.public void setType(java.lang.String type)
setType
in interface FirebirdConnectionProperties
type
- type of the connection, for example, "PURE_JAVA", "LOCAL",
"EMBEDDED", depends on the GDS implementations installed in the system.public void setUserName(java.lang.String userName)
setUserName
in interface FirebirdConnectionProperties
userName
- name of the user that will be used when connecting to the
database.public void setUseStandardUdf(boolean useStandardUdf)
setUseStandardUdf
in interface FirebirdConnectionProperties
useStandardUdf
- true
if driver should assume that standard UDF
are installed.public void setUseStreamBlobs(boolean useStreamBlobs)
setUseStreamBlobs
in interface FirebirdConnectionProperties
useStreamBlobs
- true
if stream blobs should be created,
otherwise false
.public void setUseTranslation(java.lang.String translationPath)
setUseTranslation
in interface FirebirdConnectionProperties
translationPath
- path to the character translation table.public boolean isDefaultResultSetHoldable()
FirebirdConnectionProperties
isDefaultResultSetHoldable
in interface FirebirdConnectionProperties
true
when ResultSets are holdable by default, false
not holdable.public void setDefaultResultSetHoldable(boolean isHoldable)
FirebirdConnectionProperties
setDefaultResultSetHoldable
in interface FirebirdConnectionProperties
isHoldable
- true
when ResultSets are holdable by default, false
not holdable.public void setDefaultConnectionManager(javax.resource.spi.ConnectionManager defaultCm)
public int getSoTimeout()
FirebirdConnectionProperties
getSoTimeout
in interface FirebirdConnectionProperties
public void setSoTimeout(int soTimeout)
FirebirdConnectionProperties
setSoTimeout
in interface FirebirdConnectionProperties
soTimeout
- Timeout in milliseconds (0 is 'infinite')public int getConnectTimeout()
FirebirdConnectionProperties
getConnectTimeout
in interface FirebirdConnectionProperties
public void setConnectTimeout(int connectTimeout)
FirebirdConnectionProperties
setConnectTimeout
in interface FirebirdConnectionProperties
connectTimeout
- Connect timeout in seconds (0 is 'infinite', or better: OS specific timeout)public boolean isUseFirebirdAutocommit()
FirebirdConnectionProperties
isUseFirebirdAutocommit
in interface FirebirdConnectionProperties
public void setUseFirebirdAutocommit(boolean useFirebirdAutocommit)
FirebirdConnectionProperties
setUseFirebirdAutocommit
in interface FirebirdConnectionProperties
useFirebirdAutocommit
- true
Use Firebird autocommitpublic int hashCode()
hashCode
in interface javax.resource.spi.ManagedConnectionFactory
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in interface javax.resource.spi.ManagedConnectionFactory
equals
in class java.lang.Object
public FBConnectionRequestInfo getDefaultConnectionRequestInfo() throws javax.resource.ResourceException
javax.resource.ResourceException
public FBTpb getDefaultTpb() throws javax.resource.ResourceException
javax.resource.ResourceException
public FBTpb getTpb(int defaultTransactionIsolation) throws FBResourceException
FBResourceException
public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager) throws javax.resource.ResourceException
createConnectionFactory
method creates a DataSource
using the supplied ConnectionManager.createConnectionFactory
in interface javax.resource.spi.ManagedConnectionFactory
cxManager
- a ConnectionManager
valuejava.lang.Object
valuejavax.resource.ResourceException
- if an error occurspublic java.lang.Object createConnectionFactory() throws javax.resource.ResourceException
createConnectionFactory
method creates a DataSource
with a default stand alone ConnectionManager. Ours can implement pooling.createConnectionFactory
in interface javax.resource.spi.ManagedConnectionFactory
javax.sql.DataSource
based around this
connection factoryjavax.resource.ResourceException
- if an error occurspublic javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
createManagedConnection
in interface javax.resource.spi.ManagedConnectionFactory
subject
- Caller's security informationcri
- Additional resource adapter specific connection request
informationjavax.resource.ResourceException
- generic exceptionjavax.resource.spi.SecurityException
- security related errorjavax.resource.spi.ResourceAllocationException
- failed to allocate system resources for connection requestjavax.resource.spi.ResourceAdapterInternalException
- resource adapter related error conditionjavax.resource.spi.EISSystemException
- internal error condition in EIS instancepublic javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo) throws javax.resource.ResourceException
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.
matchManagedConnections
in interface javax.resource.spi.ManagedConnectionFactory
connectionSet
- candidate connection setsubject
- caller's security informationcxRequestInfo
- additional resource adapter specific connection request
informationjavax.resource.ResourceException
- -
generic exceptionjavax.resource.spi.SecurityException
- -
security related errorjavax.resource.spi.ResourceAdapterInternalException
- -
resource adapter related error conditionjavax.resource.NotSupportedException
- -
if operation is not supportedpublic void setLogWriter(java.io.PrintWriter out) throws javax.resource.ResourceException
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(java.io.PrintWriter)
to set
ManagedConnection
specific logging and tracing.
setLogWriter
in interface javax.resource.spi.ManagedConnectionFactory
out
- an out stream for error logging and tracingjavax.resource.ResourceException
- generic exceptionjavax.resource.spi.ResourceAdapterInternalException
- resource adapter related error conditionpublic java.io.PrintWriter getLogWriter()
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.getLogWriter
in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException
- generic exceptionpublic FBManagedConnectionFactory canonicalize()
canonicalize
method is used in FBDriver to reuse
previous fbmcf instances if they have been create. It should really be
package access levelFBManagedConnectionFactory
valuepublic void forget(FBManagedConnection mc, javax.transaction.xa.Xid xid) throws GDSException
GDSException
public void recover(FBManagedConnection mc, javax.transaction.xa.Xid xid) throws GDSException
GDSException
public final FBConnectionProperties getCacheKey()
Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.