Oracle ADF Model and Business Components API Reference 10.1.2 B14022-02


oracle.jbo.common.ampool
Interface EnvInfoProvider

All Known Implementing Classes:
JUEnvInfoProvider, OCIEnvInfoProvider

public interface EnvInfoProvider

Invoked by DefaultConnectionStrategy when the application pool is establishing connection to the database or when the application pool is recycling an ApplicationModule.

Application developers may implement this interface to provide dynamic information to oracle.jbo.Transaction.connect(String, Properties). Examples of dynamic information may include a database username or a database user password.

Application developers may also implement this interface to provide dynamic session information to oracle.jbo.server.ApplicationModuleImpl.prepareSession(Session). Examples of dynamic session environment may include the authenticated principal name.


Method Summary
 java.lang.Object getInfo(java.lang.String info, java.lang.Object env)
          Invoked by the ApplicationPool to acquire dynamic application context before the following ApplicationModule lifecycle events:
 int getNumOfRetries()
          Returns the number times that the default connection strategy should attempt to create/connect and application module instance before failing.
 void modifyInitialContext(java.lang.Object initialContext)
          Deprecated. getInfo(String, Object) should be implemented instead.

 

Method Detail

getInfo

public java.lang.Object getInfo(java.lang.String info,
                                java.lang.Object env)
Invoked by the ApplicationPool to acquire dynamic application context before the following ApplicationModule lifecycle events:

1. An ApplicationModule instance is created 2. An ApplicationModule instance is connected 3. An ApplicationModule instance is reused by an ApplicationPool session which is differnt than the session which had previously used it. Please see SessionCookie for more information about ApplicationPool sessions.

An EnvInfoProvider implementation may respond to the request by providing session context for the ApplicationModule instance in the environment Hashtable which is passed to getInfo.

getInfo is always invoked with a Hashtable instance though it may also be invoked with a java.util.Properties (extends Hashtable) in some scenarios. Any session context that is specified by getInfo will also be available in the BC4J middle tier via Session and during invocation of {@link oracle.jbo.server.ApplicationModuleImpl#prepareSession(Session).

getInfo may also be used to dynamically specify JDBC credentials. For example, the following code snippet may be used to dynamically specify the JDBC credentials for the current ApplicationModule session (please see the article at http://otn.oracle.com/products/jdev/howtos/bc4j/howto_dynamic_jdbc.html for more information about dynamically specifying JDBC credentials to BC4J): ((Hashtable)env).put(Configuration.DB_USERNAME_PROPERTY, <username>); ((Hashtable)env).put(Configuration.DB_PASSWORD_PROPERTY, <password>); ((Hashtable)env).put(Configuration.DB_CONNECT_STRING_PROPERTY, <connect string>); return null;

Finally, getInfo may also be invoked multiple times during a connect attempt, if previous connect attempts have failed. This is intended to give the EnvInfoProvider an opportunity to correct the dynamic JDBC credentials before ultimately failing with an exception. The connection exception, if one occurred, is available to the EnvInfoProvider via the context with the DefaultConnectionStrategy.LAST_EXCEPTION key.

Parameters:
info - Unused. Retained for legacy reasons. Please note that before connecting the pooling framework may invoke getInfo multiple times with the following values for the info parameter: 1. Configuration.DB_USERNAME_PROPERTY 2. Configuration.DB_PASSWORD_PROPERTY 3. null Though it is only necessary to actually respond to the null request.
env - a Hashtable object containing the environment that will be passed to: oracle.jbo.Transaction.connect(String, Properties) oracle.jbo.server.ApplicationModuleImpl.prepareSession(Session)
Returns:
Unused. Retained for legacy reasons.
See Also:
for an example implementation of an EnvInfoProvider for a JClient.

modifyInitialContext

public void modifyInitialContext(java.lang.Object initialContext)
Deprecated. getInfo(String, Object) should be implemented instead.
Invoked when the application pool is creating a new application module instance. The environment hashtable may be modified by the EnvInfoProvider to provide dynamic application module context.
Since:
9.0.2

getNumOfRetries

public int getNumOfRetries()
Returns the number times that the default connection strategy should attempt to create/connect and application module instance before failing.

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-02


Copyright © 1997, 2005, Oracle. All rights reserved.