Oracle Application Development Framework Lifecycle Java API Reference 10g Release 3 (10.1.3) B25779-01


oracle.adf.share
Class ADFContext

java.lang.Object
  extended byoracle.adf.share.ADFContext


public abstract class ADFContext
extends java.lang.Object

The execution context for an ADF application


Field Summary
static java.lang.String APPLICATION_SCOPE
           
static java.lang.String REQUEST_SCOPE
           
static java.lang.String SESSION_SCOPE
           

 

Constructor Summary
ADFContext()
           

 

Method Summary
protected  java.lang.Object createMDSSession()
           
 java.util.Map createScope(java.lang.String name)
          May be implemented by custom ADFContext classes to create a scope for the specfied name.
 ADFConfig getADFConfig()
          Gets the ADF configuration Object used by current thread.
 ADFConfig getApplication()
          Deprecated. Using getADFConfig() instead.
 java.util.Map getApplicationScope()
          A convenience method for the standard applicationScope.
 javax.naming.Context getConfigSecurityContext()
          Gets the security context for the current thread
 javax.naming.Context getConnectionsContext()
          Convenience for accessing the adf jndi context, for managing adf connection definitions.
static ADFContext getCurrent()
          Gets the ADF context for the current thread
 Environment getEnvironment()
           
 oracle.adf.share.el.ADFExpressionEvaluator getExpressionEvaluator()
           
 java.lang.Object getMDSInstanceAsObject()
           
 java.lang.Object getMDSSessionAsObject()
           
 java.util.Map getRequestScope()
          A convenience method for the standard requestScope.
 java.util.Map getScope(java.lang.String name)
          Retrieve a scope from the ADFContext.
 java.util.Set getScopeNames()
          Returns the names of all the scopes that are supported by the current ADFContext.
 oracle.adf.share.security.SecurityContext getSecurityContext()
          Gets the security context for the current thread
 java.util.Map getSessionScope()
          A convenience method for the standard sessionScope.
 java.util.Map getStateManager(java.lang.String scopeName, java.util.Hashtable env)
          Returns a StateManagerScopeAdapter for the specified scope.
 javax.servlet.jsp.el.VariableResolver getVariableResolver()
          Returns a variable resolver for this context.
 boolean hasEnvironment()
           
 boolean hasSession()
          Checks the environment to see if this ADFContext references a native session.
 boolean isHttpContext()
          Returns true if the ADFContext is running in an http container.
protected abstract  Environment loadEnvironment()
          Uncomment if classloader is not thread safe.
protected  oracle.adf.share.security.SecurityContext loadSecurityContext()
           
 void putScope(java.lang.String name, java.util.Map scope)
          Add a scope to the ADFContext.
 void removeAsCurrent()
          Disassociates this context from the current thread.
 java.util.Map removeScope(java.lang.String name)
          Remove a scope from the ADFContext.
 void setAsCurrent()
          Sets up this context as the current context.
 void setExpressionEvaluator(oracle.adf.share.el.ADFExpressionEvaluator expressionEvaluator)
           
protected  void setSecurityContext(oracle.adf.share.security.SecurityContext ctx)
           
 void setVariableResolver(javax.servlet.jsp.el.VariableResolver variableResolver)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

SESSION_SCOPE

public static java.lang.String SESSION_SCOPE

REQUEST_SCOPE

public static java.lang.String REQUEST_SCOPE

APPLICATION_SCOPE

public static java.lang.String APPLICATION_SCOPE

Constructor Detail

ADFContext

public ADFContext()

Method Detail

loadEnvironment

protected abstract Environment loadEnvironment()
Uncomment if classloader is not thread safe. Doubt it. -dm 4/5/2005 private static ThreadLocal initialized = new ThreadLocal(); private static Object storeLock = new Object();

putScope

public void putScope(java.lang.String name,
                     java.util.Map scope)
Add a scope to the ADFContext.

Scopes may be used by ADF applications to store application state. For example, the following code could be used to store an application state in the sessionScope:

Map sessionScope = ADFContext.getCurrent().getSessionScope().put(<stateId>, <state>);

ADF supports three standard scopes: applicationScope, sessionScope, and requestScope. The lifecycles of these scopes are defined in the ADFScopes documentation and may depend upon the ADFContext's environment. For example, the lifecycle of the sessionScope may be different in a servlet container than it would be in an EJB container or in a java application.

This method may be used by applications that wish to define custom scopes. If an application has defined a custom scope then it is the application's responsibility to manage the lifecycle of that custom scope.

Please note that a custom scope's lifecycle cannot exceed that of the ADFContext itself -- once the ADFContext goes out of scope then all custom scopes will also go out of scope. Applications that require a custom scope with a lifecycle greater than the ADFContext's must manage those custom scopes elsewhere and associate them with each ADFContext object as it comes into scope.

For example, in a servlet container the ADFContext has request level scope -- once request processing ends the ADFContext object will go out of scope. However, the sessionScope must have a scope that spans multiple requests. ADF solves this issue by associating the session scope to the ADFContext each time the ADFContext is created.

Parameters:
name - the name of the scope. Scope names should implement the pattern <scopeType>Scope. The session, request, and application scope types are reserved for use by ADF and should not be used by applications.
scope - the scope implementation. All scope implementations must implement the java.util.Map interface.

getScope

public java.util.Map getScope(java.lang.String name)
Retrieve a scope from the ADFContext.

See putScope(String,Map) for more information about scopes.

Parameters:
name - the scope name.
Returns:
the scope implementation. null if the scope is not found.

createScope

public java.util.Map createScope(java.lang.String name)
May be implemented by custom ADFContext classes to create a scope for the specfied name.

getScope(String) will invoke this method if the specified scope has not already been associated with the current ADFContext. The new scope will be associated with the context until removed or until the context is destroyed.


removeScope

public java.util.Map removeScope(java.lang.String name)
Remove a scope from the ADFContext.

See putScope(String,Map) for more information about scopes.

Parameters:
name - the scope name.
Returns:
the scope implementation. null if the scope is not found.

getScopeNames

public java.util.Set getScopeNames()
Returns the names of all the scopes that are supported by the current ADFContext.

See putScope(String,Map) for more information about scopes. returns a set of scope names.


getApplicationScope

public java.util.Map getApplicationScope()
A convenience method for the standard applicationScope. This method name uses JavaBean naming patterns so that it may be used by JavaBean toolsets.

Equivalent to invoking getScope(APPLICATION_SCOPE).

Returns:
the standard application scope.

getSessionScope

public java.util.Map getSessionScope()
A convenience method for the standard sessionScope. This method name uses JavaBean naming patterns so that it may be used by JavaBean toolsets.

Equivalent to invoking getScope(SESSION_SCOPE).

Returns:
the standard session scope.

getRequestScope

public java.util.Map getRequestScope()
A convenience method for the standard requestScope. This method name uses JavaBean naming patterns so that it may be used by JavaBean toolsets.

Equivalent to invoking getScope(REQUEST_SCOPE).

Returns:
the standard request scope.

getApplication

public ADFConfig getApplication()
Deprecated. Using getADFConfig() instead.
Gets the ADF configuration Object used by current thread.

getADFConfig

public ADFConfig getADFConfig()
Gets the ADF configuration Object used by current thread.

getSecurityContext

public oracle.adf.share.security.SecurityContext getSecurityContext()
Gets the security context for the current thread

getConnectionsContext

public javax.naming.Context getConnectionsContext()
                                           throws javax.naming.NamingException
Convenience for accessing the adf jndi context, for managing adf connection definitions.
Throws:
javax.naming.NamingException

getCurrent

public static ADFContext getCurrent()
Gets the ADF context for the current thread

setAsCurrent

public void setAsCurrent()
Sets up this context as the current context. This is required for multi-threaded environment such as an application server, where a thread pool is used. Should be called to associate this context to the thread retrieved from the pool.

removeAsCurrent

public void removeAsCurrent()
Disassociates this context from the current thread.

setSecurityContext

protected void setSecurityContext(oracle.adf.share.security.SecurityContext ctx)

loadSecurityContext

protected oracle.adf.share.security.SecurityContext loadSecurityContext()

getConfigSecurityContext

public javax.naming.Context getConfigSecurityContext()
                                              throws javax.naming.NamingException
Gets the security context for the current thread
Throws:
javax.naming.NamingException

getEnvironment

public final Environment getEnvironment()

hasEnvironment

public boolean hasEnvironment()

getVariableResolver

public javax.servlet.jsp.el.VariableResolver getVariableResolver()
Returns a variable resolver for this context.

The VariableResolver will be used whenever evaluating expressions that will be evaluated by the ADFContext expression evaluator.


setVariableResolver

public void setVariableResolver(javax.servlet.jsp.el.VariableResolver variableResolver)

getExpressionEvaluator

public oracle.adf.share.el.ADFExpressionEvaluator getExpressionEvaluator()

setExpressionEvaluator

public void setExpressionEvaluator(oracle.adf.share.el.ADFExpressionEvaluator expressionEvaluator)

getStateManager

public java.util.Map getStateManager(java.lang.String scopeName,
                                     java.util.Hashtable env)
Returns a StateManagerScopeAdapter for the specified scope.

isHttpContext

public boolean isHttpContext()
Returns true if the ADFContext is running in an http container.

Applications may use this to determine if it is okay to reference Http classes.


hasSession

public boolean hasSession()
Checks the environment to see if this ADFContext references a native session. The implementation should not create an session if one has not already been created.

getMDSInstanceAsObject

public java.lang.Object getMDSInstanceAsObject()

getMDSSessionAsObject

public java.lang.Object getMDSSessionAsObject()

createMDSSession

protected java.lang.Object createMDSSession()

Oracle Application Development Framework Lifecycle Java API Reference 10g Release 3 (10.1.3) B25779-01


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