org.apache.ojb.broker.metadata
Class ConnectionRepository

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

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

See Also:
Serialized Form

Field Summary
 
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
ConnectionRepository()
           
 
Method Summary
 void addDescriptor(JdbcConnectionDescriptor jcd)
          Add a new JdbcConnectionDescriptor.
 JdbcConnectionDescriptor addDescriptor(java.lang.String jcdAlias, javax.sql.DataSource dataSource, java.lang.String username, java.lang.String password)
          Creates and adds a new connection descriptor for the given JDBC data source.
 JdbcConnectionDescriptor addDescriptor(java.lang.String jcdAlias, java.lang.String jdbcDriver, java.lang.String jdbcConnectionUrl, java.lang.String username, java.lang.String password)
          Creates and adds a new connection descriptor for the given JDBC connection url.
 java.util.List getAllDescriptor()
          Return a deep copy of all managed JdbcConnectionDescriptor.
 JdbcConnectionDescriptor getDescriptor(PBKey pbKey)
          Returns the matching JdbcConnectionDescriptor or null if no descriptor could be found.
 PBKey getStandardPBKeyForJcdAlias(java.lang.String jcdAlias)
          Return the matching PBKey for the given jcdAlias name, or null if no match was found.
 void removeDescriptor(java.lang.Object validKey)
          Remove a descriptor.
 java.lang.String toXML()
          returns the XML marshalled version of this instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionRepository

public ConnectionRepository()
Method Detail

getDescriptor

public JdbcConnectionDescriptor getDescriptor(PBKey pbKey)
Returns the matching JdbcConnectionDescriptor or null if no descriptor could be found. The user name and pass word will be set to match the supplied PBKey object. If the original user name and pass word are desired, the PBKey should be obtained with getStandardPBKeyForJcdAlias(String).


getStandardPBKeyForJcdAlias

public PBKey getStandardPBKeyForJcdAlias(java.lang.String jcdAlias)
Return the matching PBKey for the given jcdAlias name, or null if no match was found.


addDescriptor

public void addDescriptor(JdbcConnectionDescriptor jcd)
Add a new JdbcConnectionDescriptor.


addDescriptor

public JdbcConnectionDescriptor addDescriptor(java.lang.String jcdAlias,
                                              java.lang.String jdbcDriver,
                                              java.lang.String jdbcConnectionUrl,
                                              java.lang.String username,
                                              java.lang.String password)
Creates and adds a new connection descriptor for the given JDBC connection url. This method tries to guess the platform to be used, but it should be checked afterwards nonetheless using the JdbcConnectionDescriptor.getDbms() method. For properties that are not part of the url, the following standard values are explicitly set:

Parameters:
jcdAlias - The connection alias for the created connection; if 'default' is used, then the new descriptor will become the default connection descriptor
jdbcDriver - The fully qualified jdbc driver name
jdbcConnectionUrl - The connection url of the form '[protocol]:[sub protocol]:{database-specific path]' where protocol is usually 'jdbc'
username - The user name (can be null)
password - The password (can be null)
Returns:
The created connection descriptor
See Also:
JdbcConnectionDescriptor.getDbms()

addDescriptor

public JdbcConnectionDescriptor addDescriptor(java.lang.String jcdAlias,
                                              javax.sql.DataSource dataSource,
                                              java.lang.String username,
                                              java.lang.String password)
Creates and adds a new connection descriptor for the given JDBC data source. This method tries to guess the platform to be used, but it should be checked afterwards nonetheless using the JdbcConnectionDescriptor.getDbms() method. Note that the descriptor won't have a value for the driver because it is not possible to retrieve the driver classname from the data source.

Parameters:
jcdAlias - The connection alias for the created connection; if 'default' is used, then the new descriptor will become the default connection descriptor
dataSource - The data source
username - The user name (can be null)
password - The password (can be null)
Returns:
The created connection descriptor
See Also:
JdbcConnectionDescriptor.getDbms()

removeDescriptor

public void removeDescriptor(java.lang.Object validKey)
Remove a descriptor.

Parameters:
validKey - This could be the JdbcConnectionDescriptor itself, or the associated PBKey.

getAllDescriptor

public java.util.List getAllDescriptor()
Return a deep copy of all managed JdbcConnectionDescriptor.


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