Package org.osgi.service.jdbc
Interface DataSourceFactory
public interface DataSourceFactory
A factory for JDBC connection factories. There are 3 preferred connection
factories for getting JDBC connections:
javax.sql.DataSource
,
javax.sql.ConnectionPoolDataSource
, and
javax.sql.XADataSource
.
DataSource providers should implement this interface and register it as an
OSGi service with the JDBC driver class name in the
OSGI_JDBC_DRIVER_CLASS
property.- "ThreadSafe"
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The "databaseName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "dataSourceName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "description" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "initialPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static final String
The "maxIdleTime" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static final String
The "maxPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static final String
The "maxStatements" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static final String
The "minPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static final String
The "networkProtocol" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "password" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "portNumber" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "propertyCycle" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.static final String
The "roleName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "serverName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "url" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
The "user" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.static final String
Service property used by aDataSourceFactory
to declare the capabilities when registering a JDBC DataSourceFactory service.static final String
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aConnectionPoolDataSource
invoking thecreateConnectionPoolDataSource(Properties props)
method.static final String
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aDataSource
invoking thecreateDataSource(Properties props)
method.static final String
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aDriver
invoking thecreateDriver(Properties props)
method.static final String
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aXADataSource
invoking thecreateXADataSource(Properties props)
method.static final String
Service property used by a JDBC driver to declare the driver class when registering a JDBC DataSourceFactory service.static final String
Service property used by a JDBC driver to declare the driver name when registering a JDBC DataSourceFactory service.static final String
Service property used by a JDBC driver to declare the driver version when registering a JDBC DataSourceFactory service. -
Method Summary
Modifier and TypeMethodDescriptionCreate a newConnectionPoolDataSource
using the given properties.createDataSource
(Properties props) Create a newDataSource
using the given properties.createDriver
(Properties props) Create a newDriver
using the given properties.createXADataSource
(Properties props) Create a newXADataSource
using the given properties.
-
Field Details
-
OSGI_JDBC_CAPABILITY
Service property used by aDataSourceFactory
to declare the capabilities when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the create method can be used. The type of this service property isString+
- Since:
- 1.1
- See Also:
-
OSGI_JDBC_CAPABILITY_DRIVER
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aDriver
invoking thecreateDriver(Properties props)
method.- Since:
- 1.1
- See Also:
-
OSGI_JDBC_CAPABILITY_DATASOURCE
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aDataSource
invoking thecreateDataSource(Properties props)
method.- Since:
- 1.1
- See Also:
-
OSGI_JDBC_CAPABILITY_CONNECTIONPOOLDATASOURCE
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aConnectionPoolDataSource
invoking thecreateConnectionPoolDataSource(Properties props)
method.- Since:
- 1.1
- See Also:
-
OSGI_JDBC_CAPABILITY_XADATASOURCE
OSGI_JDBC_CAPABILITY
service property which indicates that theDataSourceFactory
is able to provide aXADataSource
invoking thecreateXADataSource(Properties props)
method.- Since:
- 1.1
- See Also:
-
OSGI_JDBC_DRIVER_CLASS
Service property used by a JDBC driver to declare the driver class when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the driver is suitable, or the desired one.- See Also:
-
OSGI_JDBC_DRIVER_NAME
Service property used by a JDBC driver to declare the driver name when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the driver is suitable, or the desired one.- See Also:
-
OSGI_JDBC_DRIVER_VERSION
Service property used by a JDBC driver to declare the driver version when registering a JDBC DataSourceFactory service. Clients may filter or test this property to determine if the driver is suitable, or the desired one.- See Also:
-
JDBC_DATABASE_NAME
The "databaseName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_DATASOURCE_NAME
The "dataSourceName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_DESCRIPTION
The "description" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_NETWORK_PROTOCOL
The "networkProtocol" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_PASSWORD
The "password" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_PORT_NUMBER
The "portNumber" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_ROLE_NAME
The "roleName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_SERVER_NAME
The "serverName" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_USER
The "user" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_URL
The "url" property that DataSource clients should supply a value for when callingcreateDataSource(Properties)
.- See Also:
-
JDBC_INITIAL_POOL_SIZE
The "initialPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
-
JDBC_MAX_IDLE_TIME
The "maxIdleTime" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
-
JDBC_MAX_POOL_SIZE
The "maxPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
-
JDBC_MAX_STATEMENTS
The "maxStatements" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
-
JDBC_MIN_POOL_SIZE
The "minPoolSize" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
-
JDBC_PROPERTY_CYCLE
The "propertyCycle" property that ConnectionPoolDataSource and XADataSource clients may supply a value for when callingcreateConnectionPoolDataSource(Properties)
orcreateXADataSource(Properties)
on drivers that support this property.- See Also:
-
-
Method Details
-
createDataSource
Create a newDataSource
using the given properties.- Parameters:
props
- The properties used to configure theDataSource
.null
indicates no properties. If the property cannot be set on theDataSource
being created then aSQLException
must be thrown.- Returns:
- A configured
DataSource
. - Throws:
SQLException
- If theDataSource
cannot be created.
-
createConnectionPoolDataSource
Create a newConnectionPoolDataSource
using the given properties.- Parameters:
props
- The properties used to configure theConnectionPoolDataSource
.null
indicates no properties. If the property cannot be set on theConnectionPoolDataSource
being created then aSQLException
must be thrown.- Returns:
- A configured
ConnectionPoolDataSource
. - Throws:
SQLException
- If theConnectionPoolDataSource
cannot be created.
-
createXADataSource
Create a newXADataSource
using the given properties.- Parameters:
props
- The properties used to configure theXADataSource
.null
indicates no properties. If the property cannot be set on theXADataSource
being created then aSQLException
must be thrown.- Returns:
- A configured
XADataSource
. - Throws:
SQLException
- If theXADataSource
cannot be created.
-
createDriver
Create a newDriver
using the given properties.- Parameters:
props
- The properties used to configure theDriver
.null
indicates no properties. If the property cannot be set on theDriver
being created then aSQLException
must be thrown.- Returns:
- A configured
Driver
. - Throws:
SQLException
- If theDriver
cannot be created.
-