public interface JDBCFactory
extends javax.naming.Referenceable, java.io.Serializable
Title: Open Service Framework
Description: A JDBC Factory
interface represents a serializable
configuration object that allows service developers to create connections to a
Database System.
The JDBC Factory
is a wrapper around the standard
Java Database Connectivity
data source. It provides an interface
for a reliable database connection that may be stopped, started, suspended
and resumed. The connection also reports connectivity failures as State
Notification Events.
This interface may be used in conjunction with Referenceable
factories such as those supported by JNDI
, or it may provide a
wrapping mechanism that offers Referenceable
support for
connection definitions that do not normally support Naming
and
JNDI
interfaces.
JDBC Factory
objects are created as serializable entities that
are intended to be persisted into an Entity Repository
. The
artifact that represents a factory is an XML document. Reference to the
artifact may be added as a parameter to the
AbstractServiceConfigurationObject
. The
property will be presented as a
ServiceConfigurationProperty
property with
ServicePropertyType.JDBC_FACTORY
type.
At Service initialization time the factory's reference will be resolved and
the factory artifact will be marshaled back into an object. If the factory
isLifeCycleManaged()
the Container Context
will
automatically manage the connection's life cycle. For instance the connection
will be started when the service is started and it will re-cycle and stop
along with the service. The resulting connection's state may be monitored by
a State Notification Event Listener
that may be set on the
connection. Any logging that the connection may perform can likewise be
routed to a particular logger mechanism such as that used by the Service. The
factory provides methods that allow the Service to be automatically
associated with error logging and state notification. Alternatively Service
developers may choose to control life cycle, logging and event management
them selves by specifying their own components.
Copyright: Copyright (c) 2009
Company: StreamScape Technologies
Modifier and Type | Field and Description |
---|---|
static long |
Day |
static long |
Hour |
static long |
Minute |
static long |
Second |
Modifier and Type | Method and Description |
---|---|
DatabaseConnection |
createConnection()
Creates a connection using default credentials.
|
DatabaseConnection |
createConnection(java.lang.String connectionName)
Creates a connection using default credentials.
|
DatabaseConnection |
createConnection(java.lang.String connectionName,
java.lang.String userName,
java.lang.String password)
Creates a named connection and loads it into the reference list.
|
void |
destroyAll()
Cleans up all transient objects and frees up all resources created by this factory.
|
boolean |
getAutoCommit()
Gets the default value for autoCommit mode of any created connection
|
java.lang.String |
getCatalog()
Gets the catalog of any created connection
|
long |
getConnectionCheckInterval()
Returns the number of milliseconds between checks of the connection's state.
|
int |
getConnectionTimeout()
Gets the number of seconds the connection attempt will wait before throwing
an exception.
|
java.lang.String |
getDefaultPassword()
Gets the default password.
|
java.lang.String |
getDefaultUser()
Gets the default user.
|
java.lang.String |
getDescription()
Returns the functional description of this factory.
|
java.lang.String |
getFactoryName()
Returns the name of the JDBC factory instance.
|
java.lang.String |
getFactoryType()
Returns the factory Type.
|
int |
getHoldability()
Gets the holdability value of any created connection
|
java.lang.String |
getJDBCDriverClassName()
Returns the class name of the JDBC driver.
|
int |
getMajorVersion()
Returns the major version of the factory.
|
int |
getMinorVersion()
Returns the minor version of the factory
|
java.lang.String |
getPollingQuery()
Returns the interval of the polling.
|
java.util.Properties |
getProperties()
Returns JDBC driver properties
|
java.lang.String |
getProperty(java.lang.String name)
Returns the value of specified property for the JDBC driver.
|
int |
getQueryTimeout()
Gets the numbers of seconds to wait for a query to complete before throwing
an excpetion.
|
boolean |
getReadOnly()
Gets the readOnly mode of any created connection
|
long |
getReconnectInterval()
Returns the frequency at which to check the connection's state in milliseconds (when connection is in RECONNECT state).
|
int |
getReconnectRetries()
Returns the number of times a connection will try to reconnect.
|
int |
getTransactionIsolation()
Gets the transaction isolation level of any created connection
|
java.lang.String |
getUrl()
Gets the default url.
|
java.lang.String |
getVendorString()
Returns the complete version string.
|
boolean |
isLifeCycleManaged()
Returns
true if the factory's connection life cycle is to be
managed by the Service Context. |
boolean |
isReliableConnection()
Returns
true if the connection created by the factory is
reliable. |
java.util.List |
listDriverProperties()
Returns a vector of
JDBC Driver Property Info objects. |
DatabaseConnection |
lookupConnection(java.lang.String connectionName)
Returns a reference to a connection in the local reference list.
|
void |
removeConnection(java.lang.String name)
Removes the connection from the local reference list.
|
void |
setAutoCommit(boolean autoCommit)
Sets the default value for autoCommit mode of any created connection
|
void |
setCatalog(java.lang.String catalog)
Sets the catalog of any created connection
|
void |
setConnectionCheckInterval(long millis)
Sets the frequency at which to check the connection's state in milliseconds.
|
void |
setConnectionTimeout(int seconds)
Sets the number of seconds to wait for a successfull connection before throwing
an exception.
|
void |
setDefaultPassword(java.lang.String password)
Sets the default password
|
void |
setDefaultUser(java.lang.String userName)
Sets the default user.
|
void |
setDescription(java.lang.String desc)
Sets the functional description for this JDBC factory.
|
void |
setHoldability(int holdability)
Sets the holdability value of any created connection.
|
void |
setLifeCycleManaged(boolean managed)
Sets whether this factory's connection life cycle is managed by the
container context or not.
|
void |
setPollingQuery(java.lang.String query)
Sets the query which is executed to check whether DB Server is alive
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets the JDBC driver property to the specified value
|
void |
setQueryTimeout(int seconds)
Sets the numbers of seconds to wait for a query to complete before throwing
an excpetion.
|
void |
setReadOnly(boolean readOnly)
Sets the readOnly mode of any created connection.
|
void |
setReconnectInterval(long millis)
Sets the frequency at which to check the connection's state in milliseconds (when connection is in RECONNECT state).
|
void |
setReconnectRetries(int retry)
Sets the number of times that a reliable connection tries to reconnect.
|
void |
setReliableConnection(boolean reliable)
Specifies if the connection that is created will be reliable.
|
void |
setTransactionIsolation(int level)
Sets the transaction isolation level of any created connection.
|
void |
setUrl(java.lang.String url)
Sets the url for this factory.
|
static final long Day
static final long Hour
static final long Minute
static final long Second
java.lang.String getFactoryName()
java.lang.String getFactoryType()
java.lang.String getDescription()
int getMajorVersion()
int getMinorVersion()
java.lang.String getVendorString()
void setDefaultUser(java.lang.String userName)
userName
- java.lang.String getDefaultUser()
void setDefaultPassword(java.lang.String password)
password
- Stringjava.lang.String getDefaultPassword()
void setDescription(java.lang.String desc)
desc
- Stringjava.lang.String getUrl()
void setUrl(java.lang.String url)
url
- Stringboolean isLifeCycleManaged()
true
if the factory's connection life cycle is to be
managed by the Service Context. When true
the connection will
be started (connected) implicitly as part of the
Service.init()
method. The connection is
established immediatley before method is invoked. If the connection
attempt results in a failure the service is put into suspended mode
on platforms that support this mode. Otherwise the service is placed into
stopped mode. If the factory defines a reliable connection the
connection's retry cycle completes prior to the Service transitioning into
a stopped or suspended mode.void setLifeCycleManaged(boolean managed)
managed
- void setReliableConnection(boolean reliable)
DatabaseSQLException
occurs.
The reconnect is attempted based on reconnection retries and timouts. If
the connection does not succeed the service is placed in a Suspended
state or Stopped state depending on what the service hosting environment
supports.reliable
- booleanboolean isReliableConnection()
true
if the connection created by the factory is
reliable.void setReconnectRetries(int retry)
retry
- int getReconnectRetries()
void setPollingQuery(java.lang.String query)
query
- java.lang.String getPollingQuery()
java.lang.String getJDBCDriverClassName()
void setProperty(java.lang.String name, java.lang.String value) throws JDBCConfigurationException
name
- Stringvalue
- StringJDBCConfigurationException
java.lang.String getProperty(java.lang.String name) throws JDBCConfigurationException
name
- StringJDBCConfigurationException
java.util.Properties getProperties()
java.util.List listDriverProperties() throws JDBCConfigurationException, RuntimeContextException
JDBC Driver Property Info
objects.JDBCConfigurationException
RuntimeContextException
void setAutoCommit(boolean autoCommit)
autoCommit
- boolean getAutoCommit()
void setCatalog(java.lang.String catalog)
catalog
- java.lang.String getCatalog()
void setHoldability(int holdability)
holdability
- int getHoldability()
void setReadOnly(boolean readOnly)
boolean getReadOnly()
void setTransactionIsolation(int level)
Connection.TRANSACTION_NONE
Connection.TRANSACTION_READ_UNCOMMITTED
Connection.TRANSACTION_READ_COMMITTED
Connection.TRANSACTION_REPEATABLE_READ
Connection.TRANSACTION_SERIALIZABLE
level
- int getTransactionIsolation()
long getConnectionCheckInterval()
void setConnectionCheckInterval(long millis)
millis
- longvoid setReconnectInterval(long millis)
millis
- longlong getReconnectInterval()
int getConnectionTimeout()
JDBCConfigurationException
void setConnectionTimeout(int seconds)
seconds
- intint getQueryTimeout()
void setQueryTimeout(int seconds)
seconds
- intvoid destroyAll() throws JDBCConfigurationException
JDBCFactoryConfigurationException
JDBCConfigurationException
DatabaseConnection createConnection() throws JDBCConfigurationException
Sys$Default.[factoryType].[factoryName]
using the lookupConnection(java.lang.String)
method.JDBCConfigurationException
DatabaseConnection createConnection(java.lang.String connectionName) throws JDBCConfigurationException
JDBCConfigurationException
DatabaseConnection createConnection(java.lang.String connectionName, java.lang.String userName, java.lang.String password) throws JDBCConfigurationException
lookupConnection(java.lang.String)
method.connectionName
- StringuserName
- Stringpassword
- StringJDBCConfigurationException
void removeConnection(java.lang.String name) throws JDBCConfigurationException
name
- StringJDBCConfigurationException
DatabaseConnection lookupConnection(java.lang.String connectionName) throws JDBCConfigurationException
connectionName
- StringJDBCConfigurationException
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.