oracle.clex.persistence.datasource
Class DataSourceProvider

java.lang.Object
  |
  +--oracle.cle.persistence.ConnectionProvider
        |
        +--oracle.clex.persistence.jndi.JndiObjectProvider
              |
              +--oracle.clex.persistence.datasource.DataSourceProvider
All Implemented Interfaces:
Connectable, java.io.Serializable

public class DataSourceProvider
extends JndiObjectProvider

DatasourceContextProvider calls getConnection() on a datasource whose jndi name is specified by the jndiname property. Returns a java.sql.Connection

When used in J2EE (primary intent), only need to specify the jndiname in the properties. Other properties should be specified in data-sources.xml on the J2EE server.

Example Data Source Provider in cle-providers.xml:

 <?xml version="1.0" standalone="yes"?>
 <!DOCTYPE cle-providers SYSTEM "http://xmlns.oracle.com/ias/mvc/cle-providers.dtd">
 <cle-providers>
  <provider name="personnel_ds" class="oracle.clex.persistence.ds.DataSourceProvider">
    <property name="jndiname" value="jdbc/OracleDS"/>
    <property name="persistencebase" value="oracle.demo.personnel.persistence.ds"/>
    <property name="failover" value=""/>
  </provider>
 </cle-providers>
 

NOTE: If username and password are specified, then the DataSource.getConnection(username, password) method will be used instead of the default DataSource.getConnection() method.

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable cache
          This is here to support releasing a Connection via the releaseConnection method.
 
Fields inherited from class oracle.clex.persistence.jndi.JndiObjectProvider
jndiName, JNDINAME, jndiObject, NON_SSL_LOGIN
 
Fields inherited from class oracle.cle.persistence.ConnectionProvider
BASE64, connection, connectionString, CONNECTIONSTRING, defaultProperties, deploymentKey, driverType, DRIVERTYPE, encryptionType, ENCRYPTIONTYPE, failover, FAILOVER, host, HOST, NO_SCOPE, NONE, password, PASSWORD, persistenceBase, PERSISTENCEBASE, port, PORT, releasedConnectionIds, REQUEST_SCOPE, scope, SCOPE, SESSION_SCOPE, sessionConnectionIds, sid, SID, USER, userName
 
Constructor Summary
DataSourceProvider()
           
DataSourceProvider(java.util.Properties properties)
           
 
Method Summary
protected  void addPropertyKeys()
          Each subclass should overload or override this method to include all the properties that it will use.
protected  java.lang.String getCacheKey(java.lang.Object sessionId)
          This method is used in getConnection and releaseConnection to get a unique id for the cache
 java.lang.Object getConnection(java.lang.Object sessionId)
          Returns a Connection from the datasource.
 java.lang.Object getConnection(java.lang.Object sessionId, int failover)
          Does nothing...
 javax.naming.Context getInitialContext()
          Get an IntitialContext so that we can find the DataSource.
 boolean isConnected()
          Returns the state of the connection for the Provider
 void releaseConnection(java.lang.Object sessionId)
          Release the connection associated to the sessionId.
 
Methods inherited from class oracle.clex.persistence.jndi.JndiObjectProvider
applyDynamicProperties, connect, disconnect, findJndiObject, getJndiName, hashCode, isSame, setJndiName
 
Methods inherited from class oracle.cle.persistence.ConnectionProvider
addPropertyKey, clone, compareDynamicProperties, compareProperty, equals, getConnection, getConnection, getConnection, getConnection, getConnection, getConnection, getConnectionString, getDefaultProperties, getDeploymentKey, getDriverType, getEncryptionType, getFailOver, getHost, getPassword, getPassword, getPersistenceBase, getPort, getProperty, getPropertyKeys, getScope, getSid, getUnspecifiedKeys, getUserName, issueWarnings, releaseAllConnections, releaseAllConnections, releaseConnection, releaseConnection, releaseConnection, releaseRequestScopedConnections, releaseRequestScopedConnections, removePropertyKey, setConnectionString, setDefaultProperties, setDeploymentKey, setEncryptionType, setHost, setPassword, setPersistenceBase, setPort, setScope, setSid, setUserName, warn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected java.util.Hashtable cache
This is here to support releasing a Connection via the releaseConnection method. If a connection is not released to the pool, calling getConnection should return the one they are holding on to again because it is in this cache.
Constructor Detail

DataSourceProvider

public DataSourceProvider()

DataSourceProvider

public DataSourceProvider(java.util.Properties properties)
Method Detail

addPropertyKeys

protected void addPropertyKeys()
Each subclass should overload or override this method to include all the properties that it will use.
Overrides:
addPropertyKeys in class JndiObjectProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId)
Returns a Connection from the datasource.
Overrides:
getConnection in class JndiObjectProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId,
                                      int failover)
Does nothing... empty implementation
Overrides:
getConnection in class JndiObjectProvider

releaseConnection

public void releaseConnection(java.lang.Object sessionId)
Release the connection associated to the sessionId. Do nothing... the Home is just a factory, so we don't need to.
Overrides:
releaseConnection in class ConnectionProvider

isConnected

public boolean isConnected()
Returns the state of the connection for the Provider

getInitialContext

public javax.naming.Context getInitialContext()
                                       throws javax.naming.NamingException,
                                              java.lang.Exception
Get an IntitialContext so that we can find the DataSource.
Overrides:
getInitialContext in class JndiObjectProvider

getCacheKey

protected java.lang.String getCacheKey(java.lang.Object sessionId)
This method is used in getConnection and releaseConnection to get a unique id for the cache


Copyright © 2003 ORACLE Corp. All Rights Reserved.