oracle.clex.persistence.bc4j
Class ApplicationModuleProvider

java.lang.Object
  |
  +--oracle.cle.persistence.ConnectionProvider
        |
        +--oracle.clex.persistence.bc4j.ApplicationModuleProvider
All Implemented Interfaces:
Connectable, java.io.Serializable

public class ApplicationModuleProvider
extends ConnectionProvider

Provides a specific ApplicationModule.

Attributes can automatically be set and loaded by specifying properties in the "cle-providers.xml" file at the root of the classpath (ie. WEB-INF/classes/cle-providers.xml). See the http://xmlns.oracle.com/ias/mvc/cle-providers.dtd for more on structure of the file.

Example BC4J Application Module 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_bc4j" class="oracle.clex.persistence.bc4j.ApplicationModuleProvider">
 	  <property name="user" value="scott"/>
    <!-- the password is "tiger", but encrypted it is "dGlnZXI=" -->
 	  <property name="password" value="dGlnZXI="/>
    <property name="encryptiontype" value="BASE64"/>
 	  <property name="modulename" value="oracle.demo.personnel.persistence.bc4j.Bc4jModule"/>
    <!-- Any encrypted passwords in the connectionstring property get decrypted automatically at runtime -->
 	  <property name="connectionstring" value="jdbc:oracle:thin:scott/dGlnZXI=@localhost:1521:orcl"/>
 	  <property name="host" value="localhost"/>
 	  <property name="sid" value="orcl"/>
 	  <property name="persistencebase" value="oracle.demo.personnel.persistence.bc4j"/>
 	  <property name="failover" value=""/>
  </provider>
 </cle-providers>
 

Typical Usage in a Handler:

  public Vector aHandlerMethod(Object sessionId, <ArgumentType> aArgument)
    throws Exception
  {
    MyApplicationModule appModule = (MyApplicationModule)getConnection(sessionId);
    ... use the appModule here ...
    releaseConnection(appModule);

    return theResult;
  } // end aHandlerMethod
 

NOTE: This currently only supports LOCAL deployment of BC4J modules. Other deployments should not be difficult. We have to decide whether they should be provided separately or through the same provider. Probably the same provider with different deployment options specified through the properties files.

See Also:
Serialized Form

Field Summary
protected  oracle.jbo.common.ampool.ApplicationPool applicationPool
          The Pool of ApplicationModules
protected  java.lang.String moduleName
          This should be specified in the properties for this provider
static java.lang.String MODULENAME
          Constant for modulename
protected  java.util.Hashtable pool
          Holds the ApplicationModules that this provider has doled out
protected  java.lang.String urlPackagePrefix
          This should be specified in the properties for this provider
 
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
ApplicationModuleProvider()
           
ApplicationModuleProvider(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.
 void connect()
          Do nothing...
protected  oracle.jbo.ApplicationModule createModule()
          Finds and creates the ApplicationModule for the information specified in the properties file for this provider.
 void disconnect()
          Do nothing...
protected  oracle.jbo.common.ampool.ApplicationPool getApplicationPool()
           
 java.lang.Object getConnection(java.lang.Object sessionId)
          Returns a new BC4J ApplicationModule with its own Transaction space
 java.lang.Object getConnection(java.lang.Object sessionId, int failover)
          Returns null.
protected  java.lang.String getModuleName()
           
protected  java.lang.String getPoolKey(java.lang.Object sessionId)
          This method is used in getConnection and releaseConnection to get a unique id for the pool
 int hashCode()
          Override Object.hashCode() so that we can differentiate copies of this provider.
 boolean isConnected()
          Always returns true.
 boolean isSame(ConnectionProvider provider)
          Compares this ConnectionProvider with the specified one and returns true if their values are the same...
 void releaseConnection(java.lang.Object sessionId)
          Release the connection associated to the sessionId
protected  void setApplicationPool(oracle.jbo.common.ampool.ApplicationPool pool)
           
protected  void setModuleName(java.lang.String aString)
           
 
Methods inherited from class oracle.cle.persistence.ConnectionProvider
addPropertyKey, applyDynamicProperties, 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

MODULENAME

public static final java.lang.String MODULENAME
Constant for modulename

pool

protected java.util.Hashtable pool
Holds the ApplicationModules that this provider has doled out

moduleName

protected java.lang.String moduleName
This should be specified in the properties for this provider

urlPackagePrefix

protected java.lang.String urlPackagePrefix
This should be specified in the properties for this provider

applicationPool

protected oracle.jbo.common.ampool.ApplicationPool applicationPool
The Pool of ApplicationModules
Constructor Detail

ApplicationModuleProvider

public ApplicationModuleProvider()

ApplicationModuleProvider

public ApplicationModuleProvider(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 ConnectionProvider

hashCode

public int hashCode()
Override Object.hashCode() so that we can differentiate copies of this provider. Uses the String class' hashCode method because the mere mortals who wrote this method didn't want to be bothered by writing it
Overrides:
hashCode in class ConnectionProvider
See Also:
Object

isSame

public boolean isSame(ConnectionProvider provider)
Compares this ConnectionProvider with the specified one and returns true if their values are the same... false otherwise.
Overrides:
isSame in class ConnectionProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId)
                               throws java.lang.Exception
Returns a new BC4J ApplicationModule with its own Transaction space
Overrides:
getConnection in class ConnectionProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId,
                                      int failover)
                               throws java.lang.Exception
Returns null. Failover is not yet supported in ApplicationModuleProvider. It will be, though... not too difficult to do.
Overrides:
getConnection in class ConnectionProvider

connect

public void connect()
Do nothing... This provider requires that we return a new ApplicationModule each time we call getConnection. Each new module defines its own transaction space.

disconnect

public void disconnect()
Do nothing... This provider requires that we return a new ApplicationModule each time we call getConnection. Each new module defines its own transaction space.

isConnected

public boolean isConnected()
Always returns true. Do nothing... This provider requires that we return a new ApplicationModule each time we call getConnection. Each new module defines its own transaction space.

setModuleName

protected void setModuleName(java.lang.String aString)

getModuleName

protected java.lang.String getModuleName()

getApplicationPool

protected oracle.jbo.common.ampool.ApplicationPool getApplicationPool()

setApplicationPool

protected void setApplicationPool(oracle.jbo.common.ampool.ApplicationPool pool)

createModule

protected oracle.jbo.ApplicationModule createModule()
                                             throws java.lang.Exception
Finds and creates the ApplicationModule for the information specified in the properties file for this provider.

getPoolKey

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

releaseConnection

public void releaseConnection(java.lang.Object sessionId)
Release the connection associated to the sessionId
Overrides:
releaseConnection in class ConnectionProvider


Copyright © 2003 ORACLE Corp. All Rights Reserved.