org.apache.ojb.broker.metadata
Class ConnectionPoolDescriptor

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by org.apache.ojb.broker.util.pooling.PoolConfiguration
                  extended by org.apache.ojb.broker.metadata.ConnectionPoolDescriptor
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>, AttributeContainer, RepositoryElements, XmlCapable

public class ConnectionPoolDescriptor
extends org.apache.ojb.broker.util.pooling.PoolConfiguration
implements java.io.Serializable, XmlCapable

Encapsulates connection pooling and JDBC-driver configuration properties managed by JdbcConnectionDescriptor.

Every new instantiated ConnectionPoolDescriptor is associated with default connection pool attributes.

Version:
$Id: ConnectionPoolDescriptor.java 364802 2005-04-30 20:55:15Z mkalen $
Author:
Armin Waibel
See Also:
Serialized Form

Field Summary
static java.lang.String DBCP_PROPERTY_NAME_PREFIX
          String prefix for DBCP properties.
static java.lang.String FETCH_SIZE
          Configuration attribute name for JDBC fetchSize hint.
static java.lang.String JDBC_PROPERTY_NAME_PREFIX
          String prefix for JDBC properties passed to DriverManager.
 
Fields inherited from class org.apache.ojb.broker.util.pooling.PoolConfiguration
DEFAULT_LOG_ABANDONED, DEFAULT_MAX_ACTIVE, DEFAULT_MAX_IDLE, DEFAULT_MAX_WAIT, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_MIN_IDLE, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_REMOVE_ABANDONED, DEFAULT_REMOVE_ABANDONED_TIMEOUT, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN, DEFAULT_TEST_WHILE_IDLE, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_WHEN_EXHAUSTED_ACTION, LOG_ABANDONED, MAX_ACTIVE, MAX_IDLE, MAX_WAIT, MIN_EVICTABLE_IDLE_TIME_MILLIS, MIN_IDLE, NUM_TESTS_PER_EVICTION_RUN, REMOVE_ABANDONED, REMOVE_ABANDONED_TIMEOUT, TEST_ON_BORROW, TEST_ON_RETURN, TEST_WHILE_IDLE, TIME_BETWEEN_EVICTION_RUNS_MILLIS, VALIDATION_QUERY, WHEN_EXHAUSTED_ACTION
 
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
ConnectionPoolDescriptor()
           
 
Method Summary
 void addAttribute(java.lang.String attributeName, java.lang.String attributeValue)
          Sets a custom configuration attribute.
 java.lang.Class getConnectionFactory()
           
 java.util.Properties getDbcpProperties()
          Returns the DBCP properties to be used for Statement caching when creating DBCP connection pool in OJB ConnectionFactory.
 int getFetchSize()
          Returns the fetchSize hint set for this connection pool.
 java.util.Properties getJdbcProperties()
          Returns the JDBC properties to be used by the ConnectionFactory when creating connections from DriverManager.
 void setConnectionFactory(java.lang.Class connectionFactory)
           
 void setFetchSize(int fetchSize)
          Sets the fetchSize hint for this connection pool.
 java.lang.String toXML()
          returns the XML marshalled version of this instance.
 
Methods inherited from class org.apache.ojb.broker.util.pooling.PoolConfiguration
getAbandonedConfig, getAttribute, getAttribute, getKeyedObjectPoolConfig, getMaxActive, getMaxIdle, getMaxWait, getMinEvictableIdleTimeMillis, getMinIdle, getNumTestsPerEvictionRun, getObjectPoolConfig, getRemoveAbandonedTimeout, getTimeBetweenEvictionRunsMillis, getValidationQuery, getWhenExhaustedAction, isLogAbandoned, isRemoveAbandoned, isTestOnBorrow, isTestOnReturn, isTestWhileIdle, setLogAbandoned, setMaxActive, setMaxIdle, setMaxWait, setMinEvictableIdleTimeMillis, setMinIdle, setNumTestsPerEvictionRun, setRemoveAbandoned, setRemoveAbandonedTimeout, setTestOnBorrow, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setValidationQuery, setWhenExhaustedAction
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

JDBC_PROPERTY_NAME_PREFIX

public static final java.lang.String JDBC_PROPERTY_NAME_PREFIX
String prefix for JDBC properties passed to DriverManager.

See Also:
Constant Field Values

DBCP_PROPERTY_NAME_PREFIX

public static final java.lang.String DBCP_PROPERTY_NAME_PREFIX
String prefix for DBCP properties. Currently OJB only uses this for setting DBCP parameters for pooling of Statement, not the max/test-parameters etc for the DBCP Connection pool (since there is only a JDBC2.0+ version of the Basic-classes ie BasicDataSource and no DriverManager-based one).

See Also:
Constant Field Values

FETCH_SIZE

public static final java.lang.String FETCH_SIZE
Configuration attribute name for JDBC fetchSize hint.

See Also:
Constant Field Values
Constructor Detail

ConnectionPoolDescriptor

public ConnectionPoolDescriptor()
Method Detail

getConnectionFactory

public java.lang.Class getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(java.lang.Class connectionFactory)

getFetchSize

public int getFetchSize()
Returns the fetchSize hint set for this connection pool.

Returns:
fetchSize hint or 0 if JDBC-driver specific default is used

setFetchSize

public void setFetchSize(int fetchSize)
Sets the fetchSize hint for this connection pool.

Parameters:
fetchSize - fetchSize hint or 0 to use JDBC-driver specific default

getJdbcProperties

public java.util.Properties getJdbcProperties()
Returns the JDBC properties to be used by the ConnectionFactory when creating connections from DriverManager.

Returns:
JDBC-driver specific properties (might be empty, never null)

getDbcpProperties

public java.util.Properties getDbcpProperties()
Returns the DBCP properties to be used for Statement caching when creating DBCP connection pool in OJB ConnectionFactory.

Returns:
DBCP properties (might be empty, never null)

addAttribute

public void addAttribute(java.lang.String attributeName,
                         java.lang.String attributeValue)
Sets a custom configuration attribute.

Specified by:
addAttribute in interface AttributeContainer
Overrides:
addAttribute in class org.apache.ojb.broker.util.pooling.PoolConfiguration
Parameters:
attributeName - the attribute name. Names starting with JDBC_PROPERTY_NAME_PREFIX will be used (without the prefix) by the ConnectionFactory when creating connections from DriverManager (not used for external DataSource connections). Names starting with DBCP_PROPERTY_NAME_PREFIX to Commons DBCP (if used, also without prefix).
attributeValue - the attribute value

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.


(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