org.apache.ojb.broker.metadata
Class JdbcConnectionDescriptor

java.lang.Object
  extended by org.apache.ojb.broker.metadata.JdbcConnectionDescriptor
All Implemented Interfaces:
java.io.Serializable, AttributeContainer, RepositoryElements, XmlCapable

public class JdbcConnectionDescriptor
extends java.lang.Object
implements java.io.Serializable, XmlCapable

JdbcConnectionDescriptor describes all relevant parameters of JDBC Connections used by the PersistenceBroker.

Version:
$Id: JdbcConnectionDescriptor.java 364874 2005-07-24 23:32:43Z arminw $
Author:
Thomas Mahler
See Also:
Serialized Form

Field Summary
static int AUTO_COMMIT_IGNORE_STATE
           
static int AUTO_COMMIT_SET_FALSE
           
static int AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
           
 
Fields inherited from interface org.apache.ojb.broker.metadata.RepositoryElements
_NEXT, ACCEPT_LOCKS, ACCESS, ATTRIBUTE, ATTRIBUTE_NAME, ATTRIBUTE_VALUE, AUTO_DELETE, AUTO_INCREMENT, AUTO_RETRIEVE, AUTO_UPDATE, BATCH_MODE, CASCADE_LINK_STR, CASCADE_NONE_STR, CASCADE_OBJECT_STR, CLASS_DESCRIPTOR, CLASS_EXTENT, CLASS_NAME, CLASS_PROXY, CLASS_REF, COLLECTION_CLASS, COLLECTION_DESCRIPTOR, COLUMN_NAME, CON_LOG_ABANDONED, CON_MAX_ACTIVE, CON_MAX_IDLE, CON_MAX_WAIT, CON_MIN_EVICTABLE_IDLE_TIME_MILLIS, CON_NUM_TESTS_PER_EVICTION_RUN, CON_REMOVE_ABANDONED, CON_REMOVE_ABANDONED_TIMEOUT, CON_TEST_ON_BORROW, CON_TEST_ON_RETURN, CON_TEST_WHILE_IDLE, CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS, CON_WHEN_EXHAUSTED_ACTION, CONNECTION_FACTORY, CONNECTION_POOL, CONSTANT_ARGUMENT, DATASOURCE_NAME, DBMS_NAME, DEFAULT_CONNECTION, DELETE_PROCEDURE, DOCUMENTATION, DRIVER_NAME, EAGER_RELEASE, EXTENDS, FACTORY_CLASS, FACTORY_METHOD, FIELD_CONVERSION, FIELD_DESCRIPTOR, FIELD_ID_REF, FIELD_NAME, FIELD_REF, FK_POINTING_TO_ITEMS_CLASS, FK_POINTING_TO_THIS_CLASS, FOREIGN_KEY, ID, IGNORE_AUTOCOMMIT_EXCEPTION, INCLUDE_ALL_FIELDS, INCLUDE_PK_FIELDS_ONLY, INDEX_COLUMN, INDEX_DESCRIPTOR, INDEXED, INDIRECTION_TABLE, INITIALIZATION_METHOD, INSERT_PROCEDURE, INVERSE_FK, ISOLATION_LEVEL, ITEMS_CLASS, JCD_ALIAS, JDBC_CONNECTION_DESCRIPTOR, JDBC_LEVEL, JDBC_TYPE, LENGTH, LOCKING, MAPPING_REPOSITORY, NAME, NULLABLE, OBJECT_CACHE, ORDERBY, OTM_DEPENDENT, PRECISION, PRIMARY_KEY, PROXY_PREFETCHING_LIMIT, PROXY_REFERENCE, QUERY_CUSTOMIZER, REFERENCE_DESCRIPTOR, REFERENCED_CLASS, REFRESH, REPOSITORY_VERSION, RETURN, RETURN_FIELD_REF, ROW_READER, RUNTIME_ARGUMENT, SCALE, SCHEMA_NAME, SEQUENCE_MANAGER, SEQUENCE_MANAGER_CLASS, SEQUENCE_NAME, SORT, TABLE_NAME, TAG_ACCESS, TAG_ACCESS_ANONYMOUS, TAG_ACCESS_READONLY, TAG_ACCESS_READWRITE, TAG_SUPER, UNIQUE, UPDATE_LOCK, UPDATE_PROCEDURE, URL_DBALIAS, URL_PROTOCOL, URL_SUBPROTOCOL, USE_AUTOCOMMIT, USER_NAME, USER_PASSWD, VALIDATION_QUERY, VALUE
 
Constructor Summary
JdbcConnectionDescriptor()
          Constructor declaration
 
Method Summary
 void addAttribute(java.lang.String attributeName, java.lang.String attributeValue)
          Store the specified attribute and it's value.
 java.lang.String getAttribute(java.lang.String attributeName)
          Get the value of an attribute
 java.lang.String getAttribute(java.lang.String attributeName, java.lang.String defaultValue)
          Get the value of an attribute
 java.lang.String[] getAttributeNames()
          Returns an array of the names of all atributes of this descriptor.
 java.util.Map getAttributes()
          Returns the attribute map (name, value) of this descriptor.
 boolean getBatchMode()
           
 ConnectionPoolDescriptor getConnectionPoolDescriptor()
          Returns the connection pool descriptor.
 javax.sql.DataSource getDataSource()
          Returns the data source that this connection descriptor represents if any.
 java.lang.String getDatasourceName()
          Gets the datasourceName.
 java.lang.String getDbAlias()
          Returns the database alias name used by OJB.
 java.lang.String getDbms()
          Returns the database platform name.
 java.lang.String getDriver()
          Returns the driver name.
 boolean getEagerRelease()
           
 java.lang.String getJcdAlias()
          Get the alias name for this descriptor.
 double getJdbcLevel()
          Gets the jdbcLevel.
 ObjectCacheDescriptor getObjectCacheDescriptor()
          Returns the appropriate ObjectCacheDescriptor or null if not specified.
 java.lang.String getPassWord()
          Returns the database password.
 PBKey getPBKey()
          Return a key to identify the connection descriptor.
 java.lang.String getProtocol()
          Returns the database protocol.
 SequenceDescriptor getSequenceDescriptor()
          Return the associated SequenceDescriptor or null if not set.
 java.lang.String getSubProtocol()
          Returns the database sub-protocol.
 int getUseAutoCommit()
           
 java.lang.String getUserName()
          Returns the database user name.
 boolean isDataSource()
           
 boolean isDefaultConnection()
           
 boolean isIgnoreAutoCommitExceptions()
           
 void setBatchMode(boolean flag)
           
 void setConnectionPoolDescriptor(ConnectionPoolDescriptor cpd)
          Sets the connection pool descriptor.
 void setDataSource(javax.sql.DataSource dataSource)
          Sets the data source that this connection descriptor represents.
 void setDatasourceName(java.lang.String datasourceName)
          Sets the datasourceName.
 void setDbAlias(java.lang.String str)
          Sets the database alias name.
 void setDbms(java.lang.String str)
          Sets the database platform name.
 void setDefaultConnection(boolean defaultConnection)
           
 void setDriver(java.lang.String str)
          Set the database driver.
 void setEagerRelease(boolean flag)
           
 void setIgnoreAutoCommitExceptions(boolean ignoreAutoCommitExceptions)
           
 void setJcdAlias(java.lang.String jcdAlias)
          Set an alias name for this descriptor.
 void setJdbcLevel(double jdbcLevel)
           
 void setJdbcLevel(java.lang.String jdbcLevel)
          Sets the jdbcLevel. parse the string setting and check that it is indeed an integer.
 void setObjectCacheDescriptor(ObjectCacheDescriptor objectCacheDescriptor)
          Sets the ObjectCacheDescriptor for representing connection/database.
 void setPassWord(java.lang.String str)
          Sets the database password.
 void setProtocol(java.lang.String str)
          Sets the database protocol.
 void setSequenceDescriptor(SequenceDescriptor sequenceDescriptor)
          Set the SequenceDescriptor for this connection descriptor.
 void setSubProtocol(java.lang.String str)
          Sets the database sub-protocol.
 void setUseAutoCommit(int useAutoCommit)
           
 void setUserName(java.lang.String str)
          Sets the database user name.
 java.lang.String toString()
          Returns a String representation of this class.
 java.lang.String toXML()
          returns the XML marshalled version of this instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTO_COMMIT_IGNORE_STATE

public static final int AUTO_COMMIT_IGNORE_STATE
See Also:
Constant Field Values

AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE

public static final int AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
See Also:
Constant Field Values

AUTO_COMMIT_SET_FALSE

public static final int AUTO_COMMIT_SET_FALSE
See Also:
Constant Field Values
Constructor Detail

JdbcConnectionDescriptor

public JdbcConnectionDescriptor()
Constructor declaration

Method Detail

getObjectCacheDescriptor

public ObjectCacheDescriptor getObjectCacheDescriptor()
Returns the appropriate ObjectCacheDescriptor or null if not specified.


setObjectCacheDescriptor

public void setObjectCacheDescriptor(ObjectCacheDescriptor objectCacheDescriptor)
Sets the ObjectCacheDescriptor for representing connection/database.


getDataSource

public javax.sql.DataSource getDataSource()
Returns the data source that this connection descriptor represents if any.

Returns:
The data source or null

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Sets the data source that this connection descriptor represents.

Parameters:
dataSource - The data source

getJcdAlias

public java.lang.String getJcdAlias()
Get the alias name for this descriptor.


setJcdAlias

public void setJcdAlias(java.lang.String jcdAlias)
Set an alias name for this descriptor.


isDefaultConnection

public boolean isDefaultConnection()

isDataSource

public boolean isDataSource()

setDefaultConnection

public void setDefaultConnection(boolean defaultConnection)

getSequenceDescriptor

public SequenceDescriptor getSequenceDescriptor()
Return the associated SequenceDescriptor or null if not set.


setSequenceDescriptor

public void setSequenceDescriptor(SequenceDescriptor sequenceDescriptor)
Set the SequenceDescriptor for this connection descriptor.


getConnectionPoolDescriptor

public ConnectionPoolDescriptor getConnectionPoolDescriptor()
Returns the connection pool descriptor.


setConnectionPoolDescriptor

public void setConnectionPoolDescriptor(ConnectionPoolDescriptor cpd)
Sets the connection pool descriptor.


getPBKey

public PBKey getPBKey()
Return a key to identify the connection descriptor.


getUseAutoCommit

public int getUseAutoCommit()

setUseAutoCommit

public void setUseAutoCommit(int useAutoCommit)

isIgnoreAutoCommitExceptions

public boolean isIgnoreAutoCommitExceptions()

setIgnoreAutoCommitExceptions

public void setIgnoreAutoCommitExceptions(boolean ignoreAutoCommitExceptions)

getDbms

public java.lang.String getDbms()
Returns the database platform name.


setDbms

public void setDbms(java.lang.String str)
Sets the database platform name.


getDriver

public java.lang.String getDriver()
Returns the driver name.


setDriver

public void setDriver(java.lang.String str)
Set the database driver.


getProtocol

public java.lang.String getProtocol()
Returns the database protocol.


setProtocol

public void setProtocol(java.lang.String str)
Sets the database protocol.


getSubProtocol

public java.lang.String getSubProtocol()
Returns the database sub-protocol.


setSubProtocol

public void setSubProtocol(java.lang.String str)
Sets the database sub-protocol.


getDbAlias

public java.lang.String getDbAlias()
Returns the database alias name used by OJB.


setDbAlias

public void setDbAlias(java.lang.String str)
Sets the database alias name. These names you could find in the repository.dtd.


getUserName

public java.lang.String getUserName()
Returns the database user name.


setUserName

public void setUserName(java.lang.String str)
Sets the database user name.


getPassWord

public java.lang.String getPassWord()
Returns the database password.


setPassWord

public void setPassWord(java.lang.String str)
Sets the database password.


getDatasourceName

public java.lang.String getDatasourceName()
Gets the datasourceName.

Returns:
Returns a String

setDatasourceName

public void setDatasourceName(java.lang.String datasourceName)
Sets the datasourceName.

Parameters:
datasourceName - The datasourceName to set

getJdbcLevel

public double getJdbcLevel()
Gets the jdbcLevel.

Returns:
Returns a String

setJdbcLevel

public void setJdbcLevel(java.lang.String jdbcLevel)
Sets the jdbcLevel. parse the string setting and check that it is indeed an integer.

Parameters:
jdbcLevel - The jdbcLevel to set

setJdbcLevel

public void setJdbcLevel(double jdbcLevel)

getEagerRelease

public boolean getEagerRelease()

setEagerRelease

public void setEagerRelease(boolean flag)

getBatchMode

public boolean getBatchMode()

setBatchMode

public void setBatchMode(boolean flag)

toString

public java.lang.String toString()
Returns a String representation of this class.


toXML

public java.lang.String toXML()
Description copied from interface: XmlCapable
returns the XML marshalled version of this instance.

Specified by:
toXML in interface XmlCapable
Returns:
the XML String representing this object.

addAttribute

public void addAttribute(java.lang.String attributeName,
                         java.lang.String attributeValue)
Description copied from interface: AttributeContainer
Store the specified attribute and it's value.

Specified by:
addAttribute in interface AttributeContainer
Parameters:
attributeName - the name of the attribute to retrieve
attributeValue - the attribute's value
See Also:
AttributeContainer.addAttribute(String, String)

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName,
                                     java.lang.String defaultValue)
Description copied from interface: AttributeContainer
Get the value of an attribute

Specified by:
getAttribute in interface AttributeContainer
Parameters:
attributeName - the attribute to retrieve
defaultValue - the value to return if the attribute is not present
Returns:
the attribute value
See Also:
AttributeContainer.getAttribute(String, String)

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName)
Description copied from interface: AttributeContainer
Get the value of an attribute

Specified by:
getAttribute in interface AttributeContainer
Parameters:
attributeName - the attribute to retrieve
Returns:
the attribute value
See Also:
AttributeContainer.getAttribute(String)

getAttributes

public java.util.Map getAttributes()
Returns the attribute map (name, value) of this descriptor. Note that the returned map is not modifiable.

Returns:
The attributes

getAttributeNames

public java.lang.String[] getAttributeNames()
Returns an array of the names of all atributes of this descriptor.

Returns:
The list of attribute names (will not be null)


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30