Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.6.0)

E10686-07

oracle.adf.share
Class ADFContext

java.lang.Object
  extended by oracle.adf.share.ADFContext
Direct Known Subclasses:
DefaultContext, DefaultNamedContext, ServletADFContext

public abstract class ADFContext
extends java.lang.Object

The execution context for an ADF application


Field Summary
static java.lang.String ADF_DOMAIN_CONFIG
           
static java.lang.String ADF_PROPERTY_NS
           
static java.lang.String ADF_SESSIONDEF_PACKAGES
           
static java.lang.String APACHE_PREFIX
           
static java.lang.String APPLICATION_DATA_KEY
           
static java.lang.String APPLICATION_DATA_SEP
           
protected static java.lang.String APPLICATION_NAME_SCOPE_KEY
           
static java.lang.String APPLICATION_SCOPE
           
static java.lang.String APPLICATION_UID
           
static java.lang.String ATTRIBUTE_FORMATTER_MAP_KEY
           
static java.lang.String CONNECTIONS_RESOURCE
           
protected static java.lang.String DEFAULT_APPLICATION_NAME
           
static java.lang.String GLASSFISH_PREFIX
           
static java.lang.String GLASSFISH_SERVER_VERSION
           
static java.lang.String MDS_CC_VALUES_FOR_EDIT
           
static java.lang.String MDS_MAX_CACHE_SIZE
           
static java.lang.String MDS_PARTITION_APPID
           
static java.lang.String MDS_SESSION_OPTIONS_FACTORY
           
static java.lang.String NAMED_CONTEXT_ENV
           
static java.lang.String ORACLE_MULTITENANT_ENABLED
           
static java.lang.String OVERRIDDEN_RES_BUNDLES
           
static java.lang.String OVERRIDE_RES_BUNDLE_PACKAGE
           
static java.lang.String PERSDEF_BASE_PACKAGE
           
static java.lang.String REQUEST_SCOPE
           
static java.lang.String SESSION_SCOPE
           
static java.lang.String SESSIONDEF_BASE_PACKAGE
           
static java.lang.String TOMCAT_SERVER_VERSION
           
static java.lang.String TOMCAT_SURFIX
           
static int TYPE_GENERIC
           
static int TYPE_HTTP
           
static int TYPE_NAMED
           
static int TYPE_PORTLET
           
static java.lang.String USE_ROLE_BASED_CUST_CLASS
           
static java.lang.String USER_CUST_CLASSES
           
static java.lang.String VIEW_SCOPE
           
 
Constructor Summary
protected ADFContext()
           
 
Method Summary
 void clearCachedLocale()
          Clears the cached locale for the context and it's Enviroment (if any).
 java.util.Map createScope(java.lang.String name)
          May be implemented by custom ADFContext classes to create a scope for the specfied name.
protected  java.util.Map<java.lang.String,java.lang.Object> createScope(java.lang.String name, boolean concurrent)
           
protected  java.util.Map<java.lang.String,java.lang.Object> findApplicationScopeMap()
           
static ADFContext findCurrent()
          Gets the ADF context for the current thread.
 java.util.Map<java.lang.String,java.lang.Object> findScope(java.lang.String name)
          Retrieve a scope from the ADFContext.
static ADFContext get(java.lang.String name)
          This method will be used by callers that have already associated a named context using registerNamedContext method.
 java.lang.String getADFApplicationUID()
          This method will help to get application UID for the JPS unqiue map name to resolve BUG5985198
 ADFConfig getADFConfig()
          Gets the ADF configuration Object used by current thread.
 ADFConfigEx getADFConfigEx()
           
 java.lang.String getADFContextProperty(java.lang.String propName)
          This method will help find all ADFContext nodes in adf-config.xml and return property value based on the name
 java.util.Map<java.lang.String,java.lang.Object> getADFFacesViewScopeMap()
           
 ADFSettings getADFSettings()
          Gets the ADF Settings Object used by current thread.
 ADFConfig getApplication()
          Deprecated. Use getADFConfig() instead.
 java.lang.String getApplicationName()
          Gets the Application Name.
 java.util.Map<java.lang.String,java.lang.Object> getApplicationScope()
          A convenience method for the standard applicationScope.
protected  java.lang.Object getApplicationScopekey()
          The application scope as defined by the ADFContext environment in which the application is being used.
protected  java.util.Map<java.lang.String,java.lang.Object> getApplicationScopeMap()
           
 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.
abstract  int getContextType()
          Returns a type for the context instance.
static ADFContext getCurrent()
          Gets the ADF context for the current thread.
protected  java.lang.String getDeployedAppName()
          This method should be overriden in sublclasses so that the appropriate application name is returned.
 javax.el.ELContext getELContext()
           
 java.lang.String getEnterpriseId()
           
 java.lang.String getEnterpriseName()
           
 Environment getEnvironment()
           
 ADFExpressionEvaluator getExpressionEvaluator()
           
 javax.el.ExpressionFactory getExpressionFactory()
           
 java.util.Locale getLocale()
           
protected  ADFContextMDSConfigHelper getMDSConfigHelper()
           
 java.lang.Object getMDSInstanceAsObject()
           
 java.lang.String getMDSLogin()
           
 java.lang.Object getMDSSessionAsObject()
          Get the MDS session associated with this context.
 java.sql.Connection getNativeDBConnection(java.sql.Connection datasourceJdbcConnection, java.lang.Class targetUnwrapClass)
          This method will help the caller to specify what type connection class type they are expecting to unwrap to.
 java.sql.Connection getNativeJdbcConnection(java.sql.Connection datasourceJdbcConnection)
          Deprecated. Please use getNativeDBConnection(Connection, Class) method instead
 java.util.Map<java.lang.String,java.lang.Object> getPageFlowScope()
           
 java.util.Map getRequestScope()
          A convenience method for the standard requestScope.
 java.util.Map<java.lang.String,java.lang.Object> 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.
 SecurityContext getSecurityContext()
          Gets the security context for the current thread
 java.util.List getSessionDefPackages()
           
 java.util.Map getSessionScope()
          A convenience method for the standard sessionScope.
 java.lang.Object getSkipLevelIdentifier()
          To be used by DataControls and Bindings to identify a particular slot as skipped in the keypath datastructure.
 java.util.Map getStateManager(java.lang.String scopeName, java.util.Hashtable env)
          Returns a StateManagerScopeAdapter for the specified scope.
static java.lang.Object getThreadLocalValue(java.lang.Object key)
           
 java.net.URL getURL()
          This method can be overridden by subclasses that have a specific instance of adf-config.xml document associated with it.
 javax.servlet.jsp.el.VariableResolver getVariableResolver()
          Returns a variable resolver for this context.
 java.util.Map<java.lang.String,java.lang.Object> getViewScope()
          This method delegates the supporting technology such as Faces or Trinidad to provide the installed View Scope.
static boolean hasCurrent()
          Check if the thread local already has ADFContext set.
 boolean hasEnvironment()
           
 boolean hasMDSSession()
          Determine if there is a MDS session associated with this context
 boolean hasSecurityContext()
          Determine if there is a SecurityContext associated with this context
 boolean hasSession()
          Checks the environment to see if this ADFContext references a native session.
static ADFContext initADFContext(java.lang.Object context, java.lang.Object session, java.lang.Object request, java.lang.Object response)
          Initializes the ADFContext for the environment of the specified context.
protected  void initialize()
          Initialize the ADFContext.
 boolean isDesignTime()
          This method will try to determine if the operating environment is Design Time.
 boolean isHighPerformanceEnvEnabled()
          Returns the value of the ExalogicOptimizationsEnabled attribute
 boolean isHttpContext()
          Returns true if the ADFContext is running in an http container.
 boolean isJBossRuntime()
          Returns true if we are running in a JBoss environment
 boolean isJEE()
          Returns true if executed in a JEE Container.
 boolean isMultiTenantEnabled()
          Check the system property oracle.multitenant.enabled is true or false
static boolean isNamedContextRegistered(java.lang.String name)
          This method can be used to check if a NamedContext already exists for the provided name.
 boolean isWebsphereRuntime()
          Returns true if we are running under Websphere application server
protected abstract  Environment loadEnvironment()
           
protected  SecurityContext loadSecurityContext()
           
static void logDiagnosticsForException(java.lang.Throwable t)
          Log diagnostics for the ADFContext instance.
protected  void putApplicationScopeMap(java.util.Map<java.lang.String,java.lang.Object> scope)
          The application scope as defined by the ADFContext environment in which the application is being used.
 void putScope(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> scope)
          Add a scope to the ADFContext.
static void registerNamedContext(java.lang.String name, java.net.URL url)
           
static void registerNamedContext(java.lang.String name, java.net.URL url, java.lang.Class implClass)
          This method provides the ability to create a named ADFContext by specifying the url of the adf-config.xml file from which this ADFContext will provide the callers configuration information.
 void releaseMDSInstance()
           
 void releaseMDSSession()
          Provides api for releasing the MDS session
 void removeAsCurrent()
          Disassociates this context from the current thread.
 java.util.Map<java.lang.String,java.lang.Object> removeScope(java.lang.String name)
          Remove a scope from the ADFContext.
static java.lang.Object removeThreadLocalValue(java.lang.Object key)
           
protected  void removingScope(java.lang.String name)
           
static void resetADFContext(ADFContext ctx)
          Restore the ADFContext to the value before initADFContext was invoked.
 void setAsCurrent()
          Sets up this context as the current context.
 void setEnterpriseId(java.lang.String eid)
           
 void setExpressionEvaluator(ADFExpressionEvaluator expressionEvaluator)
           
protected  void setExpressionFactory(javax.el.ExpressionFactory expressionFactory)
           
 void setLocale(java.util.Locale locale)
          Set a locale for the context.
 void setMDSLogin(java.lang.String loginStr)
           
 void setSecurityContext(SecurityContext ctx)
          Internal: Applications should not use this method.
static void setThreadLocalValue(java.lang.Object key, java.lang.Object value)
           
 void setupADFDomainConfig(java.net.URL domainAdfConfigFileURL)
           
 void setVariableResolver(javax.servlet.jsp.el.VariableResolver variableResolver)
           
static void unregisterNamedContext(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_GENERIC

public static final int TYPE_GENERIC
See Also:
Constant Field Values

TYPE_HTTP

public static final int TYPE_HTTP
See Also:
Constant Field Values

TYPE_PORTLET

public static final int TYPE_PORTLET
See Also:
Constant Field Values

TYPE_NAMED

public static final int TYPE_NAMED
See Also:
Constant Field Values

MDS_PARTITION_APPID

public static final java.lang.String MDS_PARTITION_APPID
See Also:
Constant Field Values

MDS_SESSION_OPTIONS_FACTORY

public static final java.lang.String MDS_SESSION_OPTIONS_FACTORY
See Also:
Constant Field Values

SESSION_SCOPE

public static final java.lang.String SESSION_SCOPE
See Also:
Constant Field Values

REQUEST_SCOPE

public static final java.lang.String REQUEST_SCOPE
See Also:
Constant Field Values

APPLICATION_SCOPE

public static final java.lang.String APPLICATION_SCOPE
See Also:
Constant Field Values

VIEW_SCOPE

public static final java.lang.String VIEW_SCOPE
See Also:
Constant Field Values

SESSIONDEF_BASE_PACKAGE

public static final java.lang.String SESSIONDEF_BASE_PACKAGE
See Also:
Constant Field Values

PERSDEF_BASE_PACKAGE

public static final java.lang.String PERSDEF_BASE_PACKAGE
See Also:
Constant Field Values

OVERRIDE_RES_BUNDLE_PACKAGE

public static final java.lang.String OVERRIDE_RES_BUNDLE_PACKAGE
See Also:
Constant Field Values

NAMED_CONTEXT_ENV

public static final java.lang.String NAMED_CONTEXT_ENV
See Also:
Constant Field Values

USE_ROLE_BASED_CUST_CLASS

public static final java.lang.String USE_ROLE_BASED_CUST_CLASS
See Also:
Constant Field Values

USER_CUST_CLASSES

public static final java.lang.String USER_CUST_CLASSES
See Also:
Constant Field Values

ADF_SESSIONDEF_PACKAGES

public static final java.lang.String ADF_SESSIONDEF_PACKAGES
See Also:
Constant Field Values

MDS_CC_VALUES_FOR_EDIT

public static final java.lang.String MDS_CC_VALUES_FOR_EDIT
See Also:
Constant Field Values

MDS_MAX_CACHE_SIZE

public static final java.lang.String MDS_MAX_CACHE_SIZE
See Also:
Constant Field Values

OVERRIDDEN_RES_BUNDLES

public static final java.lang.String OVERRIDDEN_RES_BUNDLES
See Also:
Constant Field Values

APPLICATION_DATA_KEY

public static final java.lang.String APPLICATION_DATA_KEY
See Also:
Constant Field Values

APPLICATION_DATA_SEP

public static final java.lang.String APPLICATION_DATA_SEP
See Also:
Constant Field Values

APPLICATION_NAME_SCOPE_KEY

protected static final java.lang.String APPLICATION_NAME_SCOPE_KEY
See Also:
Constant Field Values

DEFAULT_APPLICATION_NAME

protected static final java.lang.String DEFAULT_APPLICATION_NAME
See Also:
Constant Field Values

CONNECTIONS_RESOURCE

public static final java.lang.String CONNECTIONS_RESOURCE
See Also:
Constant Field Values

ADF_PROPERTY_NS

public static final java.lang.String ADF_PROPERTY_NS
See Also:
Constant Field Values

APPLICATION_UID

public static final java.lang.String APPLICATION_UID
See Also:
Constant Field Values

ADF_DOMAIN_CONFIG

public static final java.lang.String ADF_DOMAIN_CONFIG
See Also:
Constant Field Values

ORACLE_MULTITENANT_ENABLED

public static final java.lang.String ORACLE_MULTITENANT_ENABLED
See Also:
Constant Field Values

ATTRIBUTE_FORMATTER_MAP_KEY

public static final java.lang.String ATTRIBUTE_FORMATTER_MAP_KEY
See Also:
Constant Field Values

TOMCAT_SERVER_VERSION

public static final java.lang.String TOMCAT_SERVER_VERSION
See Also:
Constant Field Values

APACHE_PREFIX

public static final java.lang.String APACHE_PREFIX
See Also:
Constant Field Values

TOMCAT_SURFIX

public static final java.lang.String TOMCAT_SURFIX
See Also:
Constant Field Values

GLASSFISH_PREFIX

public static final java.lang.String GLASSFISH_PREFIX
See Also:
Constant Field Values

GLASSFISH_SERVER_VERSION

public static final java.lang.String GLASSFISH_SERVER_VERSION
See Also:
Constant Field Values
Constructor Detail

ADFContext

protected ADFContext()
Method Detail

loadEnvironment

protected abstract Environment loadEnvironment()

putScope

public void putScope(java.lang.String name,
                     java.util.Map<java.lang.String,java.lang.Object> 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 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.

isDesignTime

public boolean isDesignTime()
This method will try to determine if the operating environment is Design Time.


getScope

public java.util.Map<java.lang.String,java.lang.Object> 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.

findScope

public java.util.Map<java.lang.String,java.lang.Object> findScope(java.lang.String name)
Retrieve a scope from the ADFContext. This will not create the scope if it does not exist.

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

getApplicationScopekey

protected java.lang.Object getApplicationScopekey()
The application scope as defined by the ADFContext environment in which the application is being used. For instance the ApplicationScope is the ServletContextListener in case of a web application.

Returns:
the key that defines the application scope.

putApplicationScopeMap

protected void putApplicationScopeMap(java.util.Map<java.lang.String,java.lang.Object> scope)
The application scope as defined by the ADFContext environment in which the application is being used. This should be overriden to manage the lifecycle as defined in that ADFContext. The aim of this method is to cache the application scope, this may not be necessary in a ServletEnvironment.

Parameters:
scope - - The application scope.

getApplicationScopeMap

protected java.util.Map<java.lang.String,java.lang.Object> getApplicationScopeMap()

findApplicationScopeMap

protected java.util.Map<java.lang.String,java.lang.Object> findApplicationScopeMap()

getViewScope

public java.util.Map<java.lang.String,java.lang.Object> getViewScope()
This method delegates the supporting technology such as Faces or Trinidad to provide the installed View Scope. No default implementation is provided, if there is no supporting technology is available an exception will be thrown.


getADFFacesViewScopeMap

public java.util.Map<java.lang.String,java.lang.Object> getADFFacesViewScopeMap()

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.


createScope

protected java.util.Map<java.lang.String,java.lang.Object> createScope(java.lang.String name,
                                                                       boolean concurrent)

removingScope

protected void removingScope(java.lang.String name)

removeScope

public java.util.Map<java.lang.String,java.lang.Object> 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<java.lang.String,java.lang.Object> 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. Use getADFConfig() instead.

Gets the ADF configuration Object used by current thread.


getADFConfig

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


getEnterpriseId

public java.lang.String getEnterpriseId()

getEnterpriseName

public java.lang.String getEnterpriseName()

setEnterpriseId

public void setEnterpriseId(java.lang.String eid)

getADFConfigEx

public ADFConfigEx getADFConfigEx()

getADFSettings

public ADFSettings getADFSettings()
Gets the ADF Settings Object used by current thread.


getSecurityContext

public SecurityContext getSecurityContext()
Gets the security context for the current thread


hasSecurityContext

public boolean hasSecurityContext()
Determine if there is a SecurityContext associated with this context

Returns:
True if a Security Context was created for this context, otherwise false

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

hasCurrent

public static boolean hasCurrent()
Check if the thread local already has ADFContext set.


findCurrent

public static ADFContext findCurrent()
Gets the ADF context for the current thread. findCurrent will throw if the current thread has not been initialized with an ADFContext. Callers should invoke initADFContext(Object, Object, Object, Object) to avoid that exception before invoking findCurrent.

findCurrent should be used if you want to ensure that your code does not inadvertantly initialize an ADFContext. Please see getCurrent() for a further discussion of improper ADFContexts.


getCurrent

public static ADFContext getCurrent()
Gets the ADF context for the current thread. getCurrent will automatically initialize a DefaultContext if one does not exist. This may result in memory leaks if the calling thread is reused before #resetADFContext(Object) is invoked.

Callers should use initADFContext(Object, Object, Object, Object) to initialize an ADFContext before using getCurrent. Callers may also use findCurrent() to ensure that their code does not inadvertantly initialize an improper ADFContext.

An improper ADFContext is initialized if that context implementation does not match the environment that is using it. For example, if a caller is executing in a web environment than the proper ADFContext implementation would be ServletADFContext. The DefaultContext implementation would be improper for use in the web environment. The proper context may be initialized by invoking initADFContext with the required external context (the ServletContext, etc. when used in a web environment).

The use of an improper ADFContext could result in memory leaks if the ADFContext is not properly reset when the calling thread is done using it. An improper use could also lead to unexpected application behaviour if an ADFContext client initializes an ADFContext state that is required by another thread which is using the proper ADFContext. Using initADFContext with findCurrent can help diagnose/avoid these potential issues.


isMultiTenantEnabled

public boolean isMultiTenantEnabled()
Check the system property oracle.multitenant.enabled is true or false

Returns:
true if oracle.multitenant.enabled is true

getADFContextProperty

public java.lang.String getADFContextProperty(java.lang.String propName)
This method will help find all ADFContext nodes in adf-config.xml and return property value based on the name

Parameters:
propName - the property name, like "adfAppUID"
Returns:

getADFApplicationUID

public java.lang.String getADFApplicationUID()
This method will help to get application UID for the JPS unqiue map name to resolve BUG5985198

Returns:

setupADFDomainConfig

public void setupADFDomainConfig(java.net.URL domainAdfConfigFileURL)

registerNamedContext

public static void registerNamedContext(java.lang.String name,
                                        java.net.URL url,
                                        java.lang.Class implClass)
                                 throws javax.naming.NameAlreadyBoundException
This method provides the ability to create a named ADFContext by specifying the url of the adf-config.xml file from which this ADFContext will provide the callers configuration information. This API is typically to be used when using the default ADFContext in the context of a running application is not a choice because of the use of ThreadContext store. An example of usage for this can be at design time, when the application being developed in IDE is not running but needs access to its application specific configuration. It can't use the default ADFContext because it won't be application specific instead it will be specific to IDE, that's where the application can use this method.

Parameters:
name - - The name to be given to this Context.
url - - The string representing the URL to the adf-config.xml file to be associated with this named context.
implClass - - concrete class for the context implementation
Throws:
javax.naming.NameAlreadyBoundException - - thrown if a context with the contextInfos already exists

registerNamedContext

public static void registerNamedContext(java.lang.String name,
                                        java.net.URL url)
                                 throws javax.naming.NameAlreadyBoundException
Throws:
javax.naming.NameAlreadyBoundException

unregisterNamedContext

public static void unregisterNamedContext(java.lang.String name)
Parameters:
name - of the namedContext that is registered with ADFContext Unregister the Named Context if it is registered.

isNamedContextRegistered

public static boolean isNamedContextRegistered(java.lang.String name)
This method can be used to check if a NamedContext already exists for the provided name.

Parameters:
name - of the registered context

get

public static ADFContext get(java.lang.String name)
                      throws java.lang.Exception
This method will be used by callers that have already associated a named context using registerNamedContext method.

Parameters:
name - - The name of the context for which ADFContext is to be returned
Returns:
ADFContext - The ADF Context created for the contextInfos
Throws:
java.lang.Exception - - If a contextInfos for this name was not already created
See Also:
registerNamedContext

getURL

public java.net.URL getURL()
This method can be overridden by subclasses that have a specific instance of adf-config.xml document associated with it. This method will be overridden by Named ADF Context


getApplicationName

public java.lang.String getApplicationName()
Gets the Application Name. This will be over ridden by subclasses that can return a meaningful application name such as in the case of a deployed application.


getDeployedAppName

protected java.lang.String getDeployedAppName()
This method should be overriden in sublclasses so that the appropriate application name is returned. Default is null.

Returns:
the deployed application name.

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.


logDiagnosticsForException

public static void logDiagnosticsForException(java.lang.Throwable t)
Log diagnostics for the ADFContext instance.

This logs the allocation stacks for the ADFContext instance. These can be useful for detecting ADFContext leaks. To enable diagnostic collection/logging you must configure the oracle.adf.share.ADFContext.allocationLogger for finest level logging.


setSecurityContext

public void setSecurityContext(SecurityContext ctx)
Internal: Applications should not use this method.


getMDSLogin

public java.lang.String getMDSLogin()

setMDSLogin

public void setMDSLogin(java.lang.String loginStr)

loadSecurityContext

protected SecurityContext loadSecurityContext()

getConfigSecurityContext

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

Throws:
javax.naming.NamingException

getLocale

public java.util.Locale getLocale()

setLocale

public void setLocale(java.util.Locale locale)
Set a locale for the context. This locale will only be returned if an environment has not been defined for the ADFContext. The environment may not be defined if the ADFContext is acquired from a java application.


clearCachedLocale

public void clearCachedLocale()
Clears the cached locale for the context and it's Enviroment (if any).


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 ADFExpressionEvaluator getExpressionEvaluator()

setExpressionEvaluator

public void setExpressionEvaluator(ADFExpressionEvaluator expressionEvaluator)

getELContext

public javax.el.ELContext getELContext()

getExpressionFactory

public javax.el.ExpressionFactory getExpressionFactory()

setExpressionFactory

protected void setExpressionFactory(javax.el.ExpressionFactory expressionFactory)

getStateManager

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


isHighPerformanceEnvEnabled

public boolean isHighPerformanceEnvEnabled()
Returns the value of the ExalogicOptimizationsEnabled attribute


isJEE

public boolean isJEE()
Returns true if executed in a JEE Container.


getContextType

public abstract int getContextType()
Returns a type for the context instance. Current types include:
  • TYPE_GENERIC
  • TYPE_HTTP
  • TYPE_PORTLET
  • the type may be checked to implement logic specific to a platform.


    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()
    Get the MDS session associated with this context. If no MDS sesion exists, then a new MDS session will be created and associated with this context.


    getSessionDefPackages

    public java.util.List getSessionDefPackages()

    hasMDSSession

    public boolean hasMDSSession()
    Determine if there is a MDS session associated with this context

    Returns:
    True if a mds session was created for this context, otherwise false
    See Also:
    getMDSSessionAsObject

    releaseMDSSession

    public void releaseMDSSession()
    Provides api for releasing the MDS session


    releaseMDSInstance

    public void releaseMDSInstance()

    getSkipLevelIdentifier

    public java.lang.Object getSkipLevelIdentifier()
    To be used by DataControls and Bindings to identify a particular slot as skipped in the keypath datastructure.


    isWebsphereRuntime

    public boolean isWebsphereRuntime()
    Returns true if we are running under Websphere application server


    isJBossRuntime

    public boolean isJBossRuntime()
    Returns true if we are running in a JBoss environment


    getNativeJdbcConnection

    public java.sql.Connection getNativeJdbcConnection(java.sql.Connection datasourceJdbcConnection)
    Deprecated. Please use getNativeDBConnection(Connection, Class) method instead

    Takes a connection provided by a data source and extracts out the native connection if necessary.


    getNativeDBConnection

    public java.sql.Connection getNativeDBConnection(java.sql.Connection datasourceJdbcConnection,
                                                     java.lang.Class targetUnwrapClass)
    This method will help the caller to specify what type connection class type they are expecting to unwrap to.

    Parameters:
    datasourceJdbcConnection - actual connection runtime object
    targetUnwrapClass - the expected class unwrap to
    Returns:
    unwrapped connection object

    getMDSConfigHelper

    protected ADFContextMDSConfigHelper getMDSConfigHelper()

    getThreadLocalValue

    public static java.lang.Object getThreadLocalValue(java.lang.Object key)

    setThreadLocalValue

    public static void setThreadLocalValue(java.lang.Object key,
                                           java.lang.Object value)

    removeThreadLocalValue

    public static java.lang.Object removeThreadLocalValue(java.lang.Object key)

    initialize

    protected void initialize()
    Initialize the ADFContext. This is invoked after the ADFContext has been initialized internally and in a usable state.


    initADFContext

    public static ADFContext initADFContext(java.lang.Object context,
                                            java.lang.Object session,
                                            java.lang.Object request,
                                            java.lang.Object response)
    Initializes the ADFContext for the environment of the specified context.

    Parameters:
    context - the ServletContext or PortletContext of the current execution environment.
    session - the HttpSession or PortletSession of the current execution environment. OPTIONAL.
    request - the HttpServletRequest or PortletRequest of the current execution environment. OPTIONAL.
    response - the HttpServletResponse or PortletResponse of the current execution environment. OPTIONAL.
    Returns:
    the ADFContext that was current when init was invoked. Should be passed back to resetADFContext after the block requiring the ADFContext has completed.

    resetADFContext

    public static void resetADFContext(ADFContext ctx)
    Restore the ADFContext to the value before initADFContext was invoked.

    Parameters:
    ctx - the ADFContext that was returned from initADFContext.

    getPageFlowScope

    public java.util.Map<java.lang.String,java.lang.Object> getPageFlowScope()

    Oracle Fusion Middleware Java API Reference for Oracle ADF Share
    11g Release 1 (11.1.1.6.0)

    E10686-07

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