oracle.clex.persistence.toplink
Class ClientSessionProvider

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

public class ClientSessionProvider
extends ConnectionProvider

Vital information required for TOPLink connection.

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 TOPLink Connection Provider in cle-providers.xml:

 
 
 
   
     

     
     
     
     
     
     
     
     
     
     
     
     
   
 
 
Note:- The property mappingDescriptor specifies the location of the deployment XML for the TopLink project for version 9.0.3 thats places at at the root of the classpath (ie. WEB-INF/classes/DocumentRequest.xml - for the above example).

Typical Usage in a Handler:

  public Vector aHandlerMethod( <ArgumentType> aArgument)
    throws Exception
  {
    Vector result = null;
    ClientSession session = (ClientSession) getConnection(sessionId);   *
    // use the customCode here ...
    finally
    {
      releaseConnection();
    }
    return theResult;
  } // end aHandlerMethod
 

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable connections
          This is a table of TOPLinkConnections keyed by user
protected  boolean isRuntime
           
static java.lang.String ISRUNTIME
           
protected  java.lang.String mappingDescriptor
           
static java.lang.String MAPPINGDESCRIPTOR
           
static int NUMBER_OF_TRIES
           
protected  java.lang.String projectName
           
static java.lang.String PROJECTNAME
           
protected  java.lang.String projectPackage
           
static java.lang.String PROJECTPACKAGE
           
protected  oracle.toplink.threetier.Server server
           
protected  boolean shouldLogMessages
           
static java.lang.String SHOULDLOGMESSAGES
           
 
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
ClientSessionProvider(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()
          Connect to the database using its own provider info The cle_providers.xml has the entries
 void disconnect()
          Disconnect Provider from the database
 java.lang.Object getConnection(java.lang.Object sessionId)
          Returns a ClientSession.
 java.lang.Object getConnection(java.lang.Object sessionId, int failover)
          Not yet implemented.
 java.lang.String getMappingDescriptor()
          Returns the mapping descriptor
 java.lang.String getProjectName()
          Sets the toplink project name
 java.lang.String getProjectPackage()
          Returns the package for the toplink project
 int hashCode()
          Override Object.hashCode() so that we can differentiate TOPLinkConnection copies in the ConnectionPool.
 boolean isConnected()
          Returns the state of the connection for the Provider
 boolean isSame(ConnectionProvider provider)
          Compares this ClientSessionConnection info and returns true if their values are the same...
 void releaseConnection(java.lang.Object sessionId)
          Does nothing..
 void setMappingDescriptor(java.lang.String mdesc)
          Sets the mapping descriptor
 void setProjectName(java.lang.String aString)
          Sets the toplink project name
 boolean shouldLogMessages()
          Returns true if the messages should be log.
 
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

PROJECTPACKAGE

public static final java.lang.String PROJECTPACKAGE

PROJECTNAME

public static final java.lang.String PROJECTNAME

MAPPINGDESCRIPTOR

public static final java.lang.String MAPPINGDESCRIPTOR

SHOULDLOGMESSAGES

public static final java.lang.String SHOULDLOGMESSAGES

ISRUNTIME

public static final java.lang.String ISRUNTIME

projectPackage

protected java.lang.String projectPackage

projectName

protected java.lang.String projectName

server

protected oracle.toplink.threetier.Server server

mappingDescriptor

protected java.lang.String mappingDescriptor

shouldLogMessages

protected boolean shouldLogMessages

isRuntime

protected boolean isRuntime

connections

protected java.util.Hashtable connections
This is a table of TOPLinkConnections keyed by user

NUMBER_OF_TRIES

public static final int NUMBER_OF_TRIES
Constructor Detail

ClientSessionProvider

public ClientSessionProvider(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

getMappingDescriptor

public java.lang.String getMappingDescriptor()
Returns the mapping descriptor

getProjectPackage

public java.lang.String getProjectPackage()
Returns the package for the toplink project

getProjectName

public java.lang.String getProjectName()
Sets the toplink project name

shouldLogMessages

public boolean shouldLogMessages()
Returns true if the messages should be log. false is returned otherwise

setMappingDescriptor

public void setMappingDescriptor(java.lang.String mdesc)
Sets the mapping descriptor

setProjectName

public void setProjectName(java.lang.String aString)
Sets the toplink project name

hashCode

public int hashCode()
Override Object.hashCode() so that we can differentiate TOPLinkConnection copies in the ConnectionPool. 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
Following copied from class: oracle.cle.persistence.ConnectionProvider
See Also:
Object

isSame

public boolean isSame(ConnectionProvider provider)
Compares this ClientSessionConnection info and returns true if their values are the same... false otherwise. Returns false when projectName is different
Overrides:
isSame in class ConnectionProvider

connect

public void connect()
Connect to the database using its own provider info The cle_providers.xml has the entries

disconnect

public void disconnect()
Disconnect Provider from the database

isConnected

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

releaseConnection

public void releaseConnection(java.lang.Object sessionId)
Does nothing.. ClientSessions are disposable. To release close the server connection, you should invoke disconnect
Overrides:
releaseConnection in class ConnectionProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId)
                               throws CLEException
Returns a ClientSession. It will attempt to retrieve a connection for number of times specified by NUMBER_OF_TRIES, if the first attempt is not successful. If after attempting for NUMBER_OF_TRIES, and still a connection is not acquired, it will throw an CLEException.
Overrides:
getConnection in class ConnectionProvider

getConnection

public java.lang.Object getConnection(java.lang.Object sessionId,
                                      int failover)
Not yet implemented. Returns null.
Overrides:
getConnection in class ConnectionProvider


Copyright © 2003 ORACLE Corp. All Rights Reserved.