|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter
public abstract class FrameworkAdapter
An interface that provides access to all the data necessary for Orchestra to work while isolating Orchestra from the actual UI presentation framework being used.
A different concrete subclass of this type is then provided for each UI framework that Orchestra supports (and additional subtypes can be defined by users if required). This allows Orchestra to support multiple presentation frameworks, such as JSF and plain JSP. Method getCurrentInstance is used by Orchestra code to locate the appropriate adapter instance when needed.
The method setCurrentInstance must be called at the start of each request in order to set the appropriate adapter instance for whatever UI framework will be handing that request.
Constructor Summary | |
---|---|
FrameworkAdapter()
Constructor. |
Method Summary | |
---|---|
abstract boolean |
containsRequestAttribute(String key)
|
abstract boolean |
containsRequestParameterAttribute(String key)
|
abstract boolean |
containsSessionAttribute(String key)
|
protected ConversationMessager |
createConversationMessager()
If this method is not overridden by a subclass, then method setConversationMessager must be used to explicitly provide an instance. |
abstract Object |
getBean(String name)
Return the variable with the specified name, or null if no such bean exists. |
ConversationMessager |
getConversationMessager()
Return an object that can report internal application problems to the user associated with the current request. |
static FrameworkAdapter |
getCurrentInstance()
Return an object that implements the non-static methods of this abstract class in a manner appropriate for whatever UI framework is handling the current request. |
String |
getCurrentViewId()
Return a string that identifies what view (logical application page) the user is currently working with. |
abstract String |
getInitParameter(String key)
Return the global init parameter with the specified name. |
abstract Object |
getRequestAttribute(String key)
Get a request-scope variable. |
abstract Object |
getRequestParameterAttribute(String key)
Get a value from the set of input parameters sent by the user as part of the request. |
abstract Object |
getSessionAttribute(String key)
Get a variable from the session-scope of the current user. |
abstract void |
invokeNavigation(String navigationName)
Navigate to the specified logical destination. |
void |
prepare()
Ensure this object is valid, and perform any once-only initialisation required. |
abstract void |
redirect(String url)
Instruct the remote browser to fetch the specified URL. |
void |
setConversationMessager(ConversationMessager conversationMessager)
Set the object that can report internal application problems to the user associated with a request. |
static void |
setCurrentInstance(FrameworkAdapter frameworkAdapter)
Expected to be called only by a servlet filter at the start and end of each request. |
abstract void |
setRequestAttribute(String key,
Object value)
|
abstract void |
setSessionAttribute(String key,
Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FrameworkAdapter()
This constructor deliberately takes no parameters, as this class may be extended in future releases, adding new framework-specific properties if more are needed. Changing the constructor would not be elegant, so instead this class uses "setter" methods to set the properties of this object, and the prepare() method to ensure object integrity.
Method Detail |
---|
public static void setCurrentInstance(FrameworkAdapter frameworkAdapter)
The prepare method of the provided frameworkAdapter is called if it has not already been done. This ensures that the object is valid before the request begins. An unchecked exception may therefore be thrown if the instance is misconfigured.
public static FrameworkAdapter getCurrentInstance()
public void prepare()
This method must be called before any call to any method on this class other than setters. Multiple calls to this method are safe; all except the first one will be ignored. The setCurrentInstance method calls this method automatically.
This method may be overridden by subclasses to perform once-only initialisation. If this is done, call super.prepare at the end of the subclass implementation.
This method can throw unchecked exceptions if there is a problem with the configuration of this object.
protected ConversationMessager createConversationMessager()
public ConversationMessager getConversationMessager()
If setConversationManager was called explicitly when this object was set up, then the provided instance is returned. Otherwise what is returned is determined by the concrete subclass. See the appropriate subclass documentation for details.
public void setConversationMessager(ConversationMessager conversationMessager)
public abstract String getInitParameter(String key)
public abstract Object getRequestParameterAttribute(String key)
public abstract boolean containsRequestParameterAttribute(String key)
public abstract Object getRequestAttribute(String key)
public abstract void setRequestAttribute(String key, Object value)
public abstract boolean containsRequestAttribute(String key)
public abstract Object getSessionAttribute(String key)
public abstract void setSessionAttribute(String key, Object value)
public abstract boolean containsSessionAttribute(String key)
public abstract void redirect(String url) throws IOException
IOException
public abstract Object getBean(String name)
In frameworks that support "managed beans", ie creation of objects on demand then this may trigger the creation of the specified object. In frameworks that do not support this, then the lookup may just return null if no object with the specified name currently exists.
Note that no "property traversal" is required or expected; a name of "a.b.c" is NOT evaluated as "property c of property b of bean a", but as the bean with name 'a.b.c'.
public abstract void invokeNavigation(String navigationName) throws IOException
For frameworks that have a built-in navigation system, that system should be invoked.
For frameworks with no logical navigation system, the navigationName is treated as a plain URL. Whether a FORWARD or a REDIRECT to this URL is perfomed is determined by the subclass.
IOException
public String getCurrentViewId()
The primary use of this is to pass it to the "view controller manager" to obtain the "view controller" bean that holds the lifecycle methods needed for the current view.
For frameworks like JSF, this is the "view id".
By default a fixed value is returned, which allows frameworks that do not have a concept of a "current logical page" to automatically support a single "view controller" bean for the whole application.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |