Class FBManagedConnectionFactory
- java.lang.Object
- 
- org.firebirdsql.jaybird.xca.FBManagedConnectionFactory
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- AttachmentProperties,- BaseProperties,- DatabaseConnectionProperties,- FirebirdConnectionProperties
 
 public final class FBManagedConnectionFactory extends java.lang.Object implements FirebirdConnectionProperties, java.io.Serializable FBManagedConnectionFactory is a factory forFBManagedConnection, and implements many of the internal functions of FBManagedConnection. This 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 managed connection is associated with a xid. - Author:
- David Jencks , Mark Rotteveel
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description FBManagedConnectionFactory()Create a new pure-Java FBManagedConnectionFactory.FBManagedConnectionFactory(boolean shared)Create a new pure-Java FBManagedConnectionFactory.FBManagedConnectionFactory(boolean shared, GDSType gdsType)Create a new FBManagedConnectionFactory based on the given GDSType.FBManagedConnectionFactory(boolean shared, GDSType gdsType, FBConnectionProperties connectionProperties)Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.FBManagedConnectionFactory(GDSType gdsType)Create a new FBManagedConnectionFactory based on the given GDSType.FBManagedConnectionFactory(GDSType gdsType, FBConnectionProperties connectionProperties)Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description FBManagedConnectionFactorycanonicalize()Thecanonicalizemethod is used in FBDriver to reuse previous fbmcf instances if they have been created.java.util.Map<ConnectionProperty,java.lang.Object>connectionPropertyValues()An unmodifiable view on the connection properties held by this BaseProperties implementation.javax.sql.DataSourcecreateConnectionFactory()Creates ajavax.sql.DataSourceinstance.javax.sql.DataSourcecreateConnectionFactory(XcaConnectionManager connectionManager)Creates ajavax.sql.DataSourceinstance.FBManagedConnectioncreateManagedConnection()Creates a new physical connection to the Firebird database using the default configuration.FBManagedConnectioncreateManagedConnection(FBConnectionRequestInfo connectionRequestInfo)Creates a new physical connection to the Firebird database.booleanequals(java.lang.Object other)voidforget(FBManagedConnection mc, javax.transaction.xa.Xid xid)java.lang.BooleangetBooleanProperty(java.lang.String name)Retrieves abooleanproperty value by name.FBConnectionPropertiesgetCacheKey()FbDatabaseFactorygetDatabaseFactory()FBConnectionRequestInfogetDefaultConnectionRequestInfo()FBTpbgetDefaultTpb()GDSTypegetGDSType()Get the GDS implementation type around which this factory is based.java.lang.IntegergetIntProperty(java.lang.String name)Retrieves anintproperty value by name.java.lang.StringgetProperty(java.lang.String name)Retrieves a string property value by name.booleangetShared()FBTpbgetTpb(int isolation)TransactionParameterBuffergetTransactionParameters(int isolation)Get the transaction parameter buffer corresponding to the current connection request information.inthashCode()voidrecover(FBManagedConnection mc, javax.transaction.xa.Xid xid)voidsetBooleanProperty(java.lang.String name, java.lang.Boolean value)Sets abooleanproperty by name.voidsetDefaultConnectionManager(XcaConnectionManager defaultCm)voidsetIntProperty(java.lang.String name, java.lang.Integer value)Sets anintproperty by name.voidsetNonStandardProperty(java.lang.String propertyMapping)Set the property that does not have corresponding setter method.voidsetProperty(java.lang.String name, java.lang.String value)Sets a property by name.voidsetTransactionParameters(int isolation, TransactionParameterBuffer tpb)Set transaction parameters for the specified transaction isolation level.- 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentPropertiesgetAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.BasePropertiesgetBooleanProperty, getIntProperty, getProperty
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.DatabaseConnectionPropertiesgetBlobBufferSize, getDatabaseName, getDataTypeBind, getDecfloatRound, getDecfloatTraps, getDefaultIsolation, getDefaultTransactionIsolation, getGeneratedKeysEnabled, getMaxBlobCacheSize, getMaxInlineBlobSize, getPageCacheSize, getScrollableCursor, getServerBatchBufferSize, getSessionTimeZone, getSqlDialect, getTpbMapping, isColumnLabelForName, isDefaultResultSetHoldable, isExtendedMetadata, isIgnoreProcedureType, isTimestampUsesLocalTimezone, isUseFirebirdAutocommit, isUseServerBatch, isUseStreamBlobs, setBlobBufferSize, setColumnLabelForName, setDatabaseName, setDataTypeBind, setDecfloatRound, setDecfloatTraps, setDefaultIsolation, setDefaultResultSetHoldable, setDefaultTransactionIsolation, setExtendedMetadata, setGeneratedKeysEnabled, setIgnoreProcedureType, setMaxBlobCacheSize, setMaxInlineBlobSize, setPageCacheSize, setScrollableCursor, setServerBatchBufferSize, setSessionTimeZone, setSqlDialect, setTimestampUsesLocalTimezone, setTpbMapping, setUseFirebirdAutocommit, setUseServerBatch, setUseStreamBlobs
 - 
Methods inherited from interface org.firebirdsql.jdbc.FirebirdConnectionPropertiesgetBuffersNumber, getDatabase, getNonStandardProperty, getUserName, setBuffersNumber, setDatabase, setNonStandardProperty, setUserName
 
- 
 
- 
- 
- 
Constructor Detail- 
FBManagedConnectionFactorypublic FBManagedConnectionFactory() Create a new pure-Java FBManagedConnectionFactory.This managed connection factory can be shared. 
 - 
FBManagedConnectionFactorypublic FBManagedConnectionFactory(boolean shared) Create a new pure-Java FBManagedConnectionFactory.- Parameters:
- shared- Indicates that this Managed Connection Factory can be shared or not. When- trueconfiguration changes are not allowed after the first connection or datasource has been created to ensure all shared users have the same expectation of configuration.
 
 - 
FBManagedConnectionFactorypublic FBManagedConnectionFactory(GDSType gdsType) Create a new FBManagedConnectionFactory based on the given GDSType.This managed connection factory can be shared. - Parameters:
- gdsType- The GDS implementation to use
 
 - 
FBManagedConnectionFactorypublic FBManagedConnectionFactory(boolean shared, GDSType gdsType)Create a new FBManagedConnectionFactory based on the given GDSType.- Parameters:
- shared- Indicates that this Managed Connection Factory can be shared or not. When- trueconfiguration changes are not allowed after the first connection or datasource has been created to ensure all shared users have the same expectation of configuration.
- gdsType- The GDS implementation to use
 
 - 
FBManagedConnectionFactorypublic FBManagedConnectionFactory(GDSType gdsType, FBConnectionProperties connectionProperties) Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.This managed connection factory can be shared. - Parameters:
- gdsType- The GDS implementation to use
- connectionProperties- Initial connection properties (will be copied), use of- nullis allowed
 
 - 
FBManagedConnectionFactorypublic FBManagedConnectionFactory(boolean shared, GDSType gdsType, FBConnectionProperties connectionProperties)Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.- Parameters:
- shared- Indicates that this Managed Connection Factory can be shared or not. When- trueconfiguration changes are not allowed after the first connection or datasource has been created to ensure all shared users have the same expectation of configuration.
- gdsType- The GDS implementation to use
- connectionProperties- Initial connection properties (will be copied), use of- nullis allowed
 
 
- 
 - 
Method Detail- 
getDatabaseFactorypublic FbDatabaseFactory getDatabaseFactory() 
 - 
getGDSTypepublic GDSType getGDSType() Get the GDS implementation type around which this factory is based.- Returns:
- The GDS implementation type
 
 - 
getSharedpublic boolean getShared() - Returns:
- trueif this instance can be safely shared (modification disallowed after creation of first connection/data source)
 
 - 
getTransactionParameterspublic TransactionParameterBuffer getTransactionParameters(int isolation) Description copied from interface:FirebirdConnectionPropertiesGet the transaction parameter buffer corresponding to the current connection request information.- Specified by:
- getTransactionParametersin interface- FirebirdConnectionProperties
- Parameters:
- isolation- transaction isolation level for which TPB should be returned.
- Returns:
- instance of TransactionParameterBuffer.
 
 - 
setNonStandardPropertypublic void setNonStandardProperty(java.lang.String propertyMapping) Description copied from interface:FirebirdConnectionPropertiesSet the property that does not have corresponding setter method.- Specified by:
- setNonStandardPropertyin interface- FirebirdConnectionProperties
- Parameters:
- propertyMapping- parameter value in the- propertyName[=propertyValue]form, this allows setting non-standard parameters using configuration files.
 
 - 
setTransactionParameterspublic void setTransactionParameters(int isolation, TransactionParameterBuffer tpb)Description copied from interface:FirebirdConnectionPropertiesSet transaction parameters for the specified transaction isolation level. The specified TPB is used as a default mapping for the specified isolation level.- Specified by:
- setTransactionParametersin interface- FirebirdConnectionProperties
- Parameters:
- isolation- transaction isolation level.
- tpb- instance of- TransactionParameterBuffercontaining transaction parameters.
 
 - 
setDefaultConnectionManagerpublic void setDefaultConnectionManager(XcaConnectionManager defaultCm) 
 - 
getPropertypublic java.lang.String getProperty(java.lang.String name) Description copied from interface:BasePropertiesRetrieves a string property value by name.For properties with an explicit default, this method should return the string presentation of that default, not null. Forintorbooleanthe string equivalent is returned.- Specified by:
- getPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Value of the property, or nullwhen not set or not a known property
 
 - 
setPropertypublic void setProperty(java.lang.String name, java.lang.String value)Description copied from interface:BasePropertiesSets a property by name.This method can be used to set all defined properties, but also properties not known by Jaybird. When setting intorbooleanproperties, the appropriate conversions are applied. Usingnullwill reset to the default value. Forbooleanproperties, an empty string is taken to meantrue.- Specified by:
- setPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
getIntPropertypublic java.lang.Integer getIntProperty(java.lang.String name) Description copied from interface:BasePropertiesRetrieves anintproperty value by name.For properties with an explicit default, this method should return the integer presentation of that default. For implementation simplicity, it is allowed to convert any string property to intinstead of checking if something is actually anintproperty- Specified by:
- getIntPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Integer with value of the property, or nullwhen not set
 
 - 
setIntPropertypublic void setIntProperty(java.lang.String name, java.lang.Integer value)Description copied from interface:BasePropertiesSets anintproperty by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent. - Specified by:
- setIntPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
getBooleanPropertypublic java.lang.Boolean getBooleanProperty(java.lang.String name) Description copied from interface:BasePropertiesRetrieves abooleanproperty value by name.For properties with an explicit default, this method should return the boolean presentation of that default. For implementation simplicity, it is allowed to convert any string property to booleaninstead of checking if something is actually anintproperty- Specified by:
- getBooleanPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Integer with value of the property, or nullwhen not set
 
 - 
setBooleanPropertypublic void setBooleanProperty(java.lang.String name, java.lang.Boolean value)Description copied from interface:BasePropertiesSets abooleanproperty by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent. - Specified by:
- setBooleanPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
connectionPropertyValuespublic java.util.Map<ConnectionProperty,java.lang.Object> connectionPropertyValues() Description copied from interface:BasePropertiesAn unmodifiable view on the connection properties held by this BaseProperties implementation.Be aware, implementations can have additional properties that are not mapped from ConnectionProperty. Such properties will need to be retrieved in an implementation-specific manner.- Specified by:
- connectionPropertyValuesin interface- BaseProperties
- Returns:
- An unmodifiable view on the property values held in this properties instance
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object other) - Overrides:
- equalsin class- java.lang.Object
 
 - 
getDefaultConnectionRequestInfopublic FBConnectionRequestInfo getDefaultConnectionRequestInfo() throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
getDefaultTpbpublic FBTpb getDefaultTpb() throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
getTpbpublic FBTpb getTpb(int isolation) throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
createConnectionFactorypublic javax.sql.DataSource createConnectionFactory(XcaConnectionManager connectionManager) Creates ajavax.sql.DataSourceinstance. The data source instance gets initialized with the passed XcaConnectionManager.- Parameters:
- connectionManager- Connection manager
- Returns:
- data source instance
 
 - 
createConnectionFactorypublic javax.sql.DataSource createConnectionFactory() Creates ajavax.sql.DataSourceinstance. The data source instance gets initialized with a default XcaConnectionManager provided by the resource adapter.- Returns:
- data source instance
 
 - 
createManagedConnectionpublic FBManagedConnection createManagedConnection() throws java.sql.SQLException Creates a new physical connection to the Firebird database using the default configuration.- Returns:
- Managed connection instance
- Throws:
- java.sql.SQLException- generic exception
- See Also:
- createManagedConnection(FBConnectionRequestInfo)
 
 - 
createManagedConnectionpublic FBManagedConnection createManagedConnection(FBConnectionRequestInfo connectionRequestInfo) throws java.sql.SQLException Creates a new physical connection to the Firebird database.ManagedConnectionFactory uses the additional ConnectionRequestInfo to create this new connection. - Parameters:
- connectionRequestInfo- Additional resource adapter specific connection request information, can be- nullfor default
- Returns:
- Managed connection instance
- Throws:
- java.sql.SQLException- generic exception
- See Also:
- createManagedConnection()
 
 - 
canonicalizepublic FBManagedConnectionFactory canonicalize() Thecanonicalizemethod is used in FBDriver to reuse previous fbmcf instances if they have been created. It should really be package access level- Returns:
- a FBManagedConnectionFactoryvalue
 
 - 
forgetpublic void forget(FBManagedConnection mc, javax.transaction.xa.Xid xid) 
 - 
recoverpublic void recover(FBManagedConnection mc, javax.transaction.xa.Xid xid) 
 - 
getCacheKeypublic FBConnectionProperties getCacheKey() 
 
- 
 
-