Module org.firebirdsql.jaybird
Package org.firebirdsql.ds

# Class FBAbstractCommonDataSource

java.lang.Object
org.firebirdsql.ds.RootCommonDataSource
org.firebirdsql.ds.AbstractConnectionPropertiesDataSource
org.firebirdsql.ds.FBAbstractCommonDataSource

All Implemented Interfaces:
  `CommonDataSource`, `AttachmentProperties`, `BaseProperties`, `DatabaseConnectionProperties`, `FirebirdConnectionProperties`

Direct Known Subclasses:
  `FBConnectionPoolDataSource`, `FBXADataSource`

public abstract class FBAbstractCommonDataSource extends AbstractConnectionPropertiesDataSource
Abstract class for properties and behaviour common to DataSources, XADataSources and ConnectionPoolDataSources

Since:
  2.2
Author:
  Mark Rotteveel

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final String`
  `REF_DESCRIPTION`
  `protected static final String`
  `REF_PROPERTIES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FBAbstractCommonDataSource()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract void`
  `checkNotStarted()`
  Method to check if this DataSource has not yet started.
  `Map<ConnectionProperty,Object>`
  `connectionPropertyValues()`
  An unmodifiable view on the connection properties held by this BaseProperties implementation.
  `Boolean`
  `getBooleanProperty(String name)`
  Retrieves a `boolean` property value by name.
  `protected final FBConnectionProperties`
  `getConnectionProperties()`
  `String`
  `getDescription()`
  `Integer`
  `getIntProperty(String name)`
  Retrieves an `int` property value by name.
  `String`
  `getProperty(String name)`
  Retrieves a string property value by name.
  `TransactionParameterBuffer`
  `getTransactionParameters(int isolation)`
  Get the transaction parameter buffer corresponding to the current connection request information.
  `void`
  `setBooleanProperty(String name, Boolean value)`
  Sets a `boolean` property by name.
  `protected final void`
  `setConnectionProperties(FBConnectionProperties connectionProperties)`
  `void`
  `setDescription(String description)`
  `void`
  `setIntProperty(String name, Integer value)`
  Sets an `int` property by name.
  `final void`
  `setNonStandardProperty(String propertyMapping)`
  Method that allows setting non-standard property in the form "key=value" form.
  `void`
  `setProperty(String name, String value)`
  Sets a property by name.
  `void`
  `setTransactionParameters(int isolation, TransactionParameterBuffer tpb)`
  Set transaction parameters for the specified transaction isolation level.
  `protected static void`
  `updateReference(Reference ref, FBAbstractCommonDataSource instance)`
  Updates the supplied reference with RefAddr properties relevant to this class.
  `protected final LockCloseable`
  `withLock()`

  ### Methods inherited from class org.firebirdsql.ds.AbstractConnectionPropertiesDataSource

  `getAuthPlugins, getBlobBufferSize, getCharSet, getConnectTimeout, getDatabaseName, getDataTypeBind, getDbCryptConfig, getDecfloatRound, getDecfloatTraps, getDefaultIsolation, getDefaultTransactionIsolation, getEnableProtocol, getEncoding, getGeneratedKeysEnabled, getLoginTimeout, getMaxBlobCacheSize, getMaxInlineBlobSize, getPageCacheSize, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getReportSQLWarnings, getRoleName, getScrollableCursor, getServerBatchBufferSize, getServerName, getSessionTimeZone, getSocketBufferSize, getSocketFactory, getSoTimeout, getSqlDialect, getTpbMapping, getType, getUser, getUserName, getWireCrypt, isAllowTxStmts, isAsyncFetch, isColumnLabelForName, isCreateDatabaseIfNotExist, isDefaultResultSetHoldable, isExtendedMetadata, isIgnoreProcedureType, isUseCatalogAsPackage, isUseFirebirdAutocommit, isUseServerBatch, isUseStreamBlobs, isWireCompression, setAllowTxStmts, setAsyncFetch, setAuthPlugins, setBlobBufferSize, setCharSet, setColumnLabelForName, setConnectTimeout, setCreateDatabaseIfNotExist, setDatabaseName, setDataTypeBind, setDbCryptConfig, setDecfloatRound, setDecfloatTraps, setDefaultIsolation, setDefaultResultSetHoldable, setDefaultTransactionIsolation, setEnableProtocol, setEncoding, setExtendedMetadata, setGeneratedKeysEnabled, setIgnoreProcedureType, setLoginTimeout, setMaxBlobCacheSize, setMaxInlineBlobSize, setPageCacheSize, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setReportSQLWarnings, setRoleName, setScrollableCursor, setServerBatchBufferSize, setServerName, setSessionTimeZone, setSocketBufferSize, setSocketFactory, setSoTimeout, setSqlDialect, setTpbMapping, setType, setUseCatalogAsPackage, setUseFirebirdAutocommit, setUser, setUserName, setUseServerBatch, setUseStreamBlobs, setWireCompression, setWireCrypt`

  ### Methods inherited from class org.firebirdsql.ds.RootCommonDataSource

  `getLogWriter, getParentLogger, setLogWriter`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties

  `getBooleanProperty, getIntProperty, getProperty`

  ### Methods inherited from interface javax.sql.CommonDataSource

  `createShardingKeyBuilder`

- ## Field Details

  - ### REF_DESCRIPTION

    protected static final String REF_DESCRIPTION
    See Also:
      - Constant Field Values

  - ### REF_PROPERTIES

    protected static final String REF_PROPERTIES
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### FBAbstractCommonDataSource

    public FBAbstractCommonDataSource()

- ## Method Details

  - ### withLock

    protected final LockCloseable withLock()

  - ### checkNotStarted

    protected abstract void checkNotStarted() throws IllegalStateException
    Method to check if this DataSource has not yet started.

    Implementations should throw IllegalStateException when the DataSource is already in use and modifying properties is not allowed.

    Throws:
      `IllegalStateException` - When the DataSource is already in use

  - ### getDescription

    public String getDescription()

  - ### setDescription

    public void setDescription(String description)

  - ### getTransactionParameters

    public TransactionParameterBuffer getTransactionParameters(int isolation)
    Description copied from interface: `FirebirdConnectionProperties`
    Get the transaction parameter buffer corresponding to the current connection request information.
    Parameters:
      `isolation` - transaction isolation level for which TPB should be returned.
    Returns:
      instance of `TransactionParameterBuffer`.

  - ### setTransactionParameters

    public void setTransactionParameters(int isolation, TransactionParameterBuffer tpb)
    Description copied from interface: `FirebirdConnectionProperties`
    Set transaction parameters for the specified transaction isolation level. The specified TPB is used as a default mapping for the specified isolation level.
    Parameters:
      `isolation` - transaction isolation level.
      `tpb` - instance of `TransactionParameterBuffer` containing transaction parameters.

  - ### setNonStandardProperty

    public final void setNonStandardProperty(String propertyMapping)
    Method that allows setting non-standard property in the form "key=value" form. This method is needed by some containers to specify properties in the configuration.
    Parameters:
      `propertyMapping` - mapping between property name (key) and its value. Name and value are separated with "=", ":" or whitespace character. Whitespace characters on the beginning of the string and between key and value are ignored. No escaping is possible: "\n" is backslash-en, not a new line mark.
    See Also:
      - `setProperty(String, String)`

  - ### getProperty

    public String getProperty(String name)
    Description copied from interface: `BaseProperties`
    Retrieves a string property value by name.

    For properties with an explicit default, this method should return the string presentation of that default, not `null`. For `int` or `boolean` the string equivalent is returned.

    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Value of the property, or `null` when not set or not a known property

  - ### setProperty

    public void setProperty(String name, String value)
    Description copied from interface: `BaseProperties`
    Sets a property by name.

    This method can be used to set all defined properties, but also properties not known by Jaybird. When setting `int` or `boolean` properties, the appropriate conversions are applied. Using `null` will reset to the default value. For `boolean` properties, an empty string is taken to mean `true`.

    Parameters:
      `name` - Property name (not `null` or empty)
      `value` - Property value (use `null` to apply default)

  - ### getIntProperty

    public Integer getIntProperty(String name)
    Description copied from interface: `BaseProperties`
    Retrieves an `int` property 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 `int` instead of checking if something is actually an `int` property

    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Integer with value of the property, or `null` when not set

  - ### setIntProperty

    public void setIntProperty(String name, Integer value)
    Description copied from interface: `BaseProperties`
    Sets an `int` property by name.

    For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.

    Parameters:
      `name` - Property name (not `null` or empty)
      `value` - Property value (use `null` to apply default)

  - ### getBooleanProperty

    public Boolean getBooleanProperty(String name)
    Description copied from interface: `BaseProperties`
    Retrieves a `boolean` property 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 `boolean` instead of checking if something is actually a `boolean` property

    Parameters:
      `name` - Property name (not `null` or empty)
    Returns:
      Integer with value of the property, or `null` when not set

  - ### setBooleanProperty

    public void setBooleanProperty(String name, Boolean value)
    Description copied from interface: `BaseProperties`
    Sets a `boolean` property by name.

    For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.

    Parameters:
      `name` - Property name (not `null` or empty)
      `value` - Property value (use `null` to apply default)

  - ### connectionPropertyValues

    public Map<ConnectionProperty,Object> connectionPropertyValues()
    Description copied from interface: `BaseProperties`
    An 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.

    Returns:
      An unmodifiable view on the property values held in this properties instance

  - ### setConnectionProperties

    protected final void setConnectionProperties(FBConnectionProperties connectionProperties)

  - ### getConnectionProperties

    protected final FBConnectionProperties getConnectionProperties()

  - ### updateReference

    protected static void updateReference(Reference ref, FBAbstractCommonDataSource instance) throws NamingException
    Updates the supplied reference with RefAddr properties relevant to this class.
    Parameters:
      `ref` - Reference to update
      `instance` - Instance of this class to obtain values
    Throws:
      `NamingException`