Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1)
E10684-06


oracle.adf.view.rich.context
Class ApplicationContextManager

java.lang.Object
  extended by oracle.adf.view.rich.context.ApplicationContextManager


public abstract class ApplicationContextManager
extends java.lang.Object

ApplicationContextManager is used to track changes to the runtime context of an ADF application during the request lifecycle. The series of changes that lead to the current application context are represented as a stack data structure.

Any time a change is made to the application context outside of component traversal during a JSF phase, a change object representing the change should be pushed onto the stack using the ApplicationContextManager. For example, if a UI component modifies the application's context by changing how EL expressions get evaluated then the component implementation should push a context change onto the stack when the component becomes active and pop the change when the component is no longer active.

There are times when application code running in one contexts need to invoke code that executes in a different context. An example of this is the UIComponent.invokeOnComponent(FacesContext,String,ContextCallback) method. To support these use cases the suspendContext(FacesContext) and resumeContext(FacesContext,SuspendedContext) methods may be used. The suspendContext(FacesContext) suspends the current set of context changes and restores the original root context. A new context may then be established and application logic executed. Once the the application logic has completed the previous context may be restored using the resumeContext(FacesContext, SuspendedContext) method.


Nested Class Summary
static class ApplicationContextManager.SuspendedContext
          Opaque handle representing a set of suspended context changes.

 

Constructor Summary
ApplicationContextManager()
           

 

Method Summary
protected  ApplicationContextManager.SuspendedContext createSuspendedContext(javax.faces.context.FacesContext context, java.util.Deque<ApplicationContextChange> stack)
          Creates a new suspended context
abstract  ApplicationContextChange peekContextChange()
           
abstract  ApplicationContextChange popContextChange()
          Pops the top context change off of the application context change stack.
abstract  void pushContextChange(ApplicationContextChange change)
          Pushes a new context change onto the application context change stack.
abstract  void resumeContext(javax.faces.context.FacesContext context, ApplicationContextManager.SuspendedContext suspendedContext)
          Resume a previously suspended set of context changes.
protected  java.util.Deque<ApplicationContextChange> resumeSuspendedContext(javax.faces.context.FacesContext facesContext, ApplicationContextManager.SuspendedContext suspendedContext)
          Resumes a suspended context
abstract  ApplicationContextManager.SuspendedContext suspendContext(javax.faces.context.FacesContext context)
          Suspends the current application context changes on the stack by calling ApplicationContextChange.suspend(FacesContext) on each stack entry, starting from the top of the stack and working down the stack to the root of the page.

 

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

 

Constructor Detail

ApplicationContextManager

public ApplicationContextManager()

Method Detail

pushContextChange

public abstract void pushContextChange(ApplicationContextChange change)
Pushes a new context change onto the application context change stack. If a change is pushed at a time in which the change would be illegal, the change will be replaced with a no-op ApplicationContextChange so that popping will restore the stack to the appropriate level.
Parameters:
change - the change to be pushed.
Throws:
java.lang.NullPointerException - if the change object is null.

popContextChange

public abstract ApplicationContextChange popContextChange()
                                                   throws java.util.NoSuchElementException
Pops the top context change off of the application context change stack.
Returns:
the context change that was popped off the top of the stack.
Throws:
java.util.NoSuchElementException - if the stack is empty.

peekContextChange

public abstract ApplicationContextChange peekContextChange()
Returns:
the context change currently on the top of the stack or null if the stack is empty.

suspendContext

public abstract ApplicationContextManager.SuspendedContext suspendContext(javax.faces.context.FacesContext context)
Suspends the current application context changes on the stack by calling ApplicationContextChange.suspend(FacesContext) on each stack entry, starting from the top of the stack and working down the stack to the root of the page. This operation returns the application back to the root context that existed at the beginning of the current request lifecycle phase. The suspended context changes are remove from the stack so that the stack is empty when this method completes.
Parameters:
context - FacesContext.
Returns:
a handle representing the set of suspend contexts.

resumeContext

public abstract void resumeContext(javax.faces.context.FacesContext context,
                                   ApplicationContextManager.SuspendedContext suspendedContext)
                            throws java.lang.IllegalStateException
Resume a previously suspended set of context changes. Resumed context changes are pushed back onto the stack as they are resumed.

Note: A set of suspended context changes may only be resumed once.

Parameters:
context - FacesContext.
suspendedContext - the set of suspened contexts to resume.
Throws:
java.lang.IllegalStateException - if the suspendedContext has already been resumed or if the current stack of context changes is not empty (i.e. the current context is not the page root).

createSuspendedContext

protected final ApplicationContextManager.SuspendedContext createSuspendedContext(javax.faces.context.FacesContext context,
                                                                                  java.util.Deque<ApplicationContextChange> stack)
Creates a new suspended context
Parameters:
context - the faces context
stack - the stach of changes
Returns:
the new context

resumeSuspendedContext

protected final java.util.Deque<ApplicationContextChange> resumeSuspendedContext(javax.faces.context.FacesContext facesContext,
                                                                                 ApplicationContextManager.SuspendedContext suspendedContext)
Resumes a suspended context
Parameters:
facesContext - the faces context
suspendedContext - the suspended context
Returns:
the changes

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1)
E10684-06


Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.