|
JSF-Spring | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.mindmatters.faces.spring.factory.ApplicationScope
public final class ApplicationScope
Alternative singleton Scope implementation. This Scope relies on a ServletContext and a PortletContext repectively and therefore will work with Servlet and Portlet environments.
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
For logging. |
Constructor Summary | |
---|---|
ApplicationScope(java.lang.Object context)
Creates a scope relying on a ServletContext or a PortletContext respectively (depends on the type of context ). |
Method Summary | |
---|---|
void |
clear()
Clears the scope. |
java.lang.Object |
get(java.lang.String name,
ObjectFactory objectFactory)
Return the object with the given name from the underlying scope, creating it
if not found in the underlying storage mechanism. |
java.lang.String |
getConversationId()
Return the conversation id for the current underlying scope, if any. |
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
Register a callback to be executed at destruction of the specified object (or at destruction of the entire scope, if the scope does not destroy individual objects but rather only terminate in its entirety). |
java.lang.Object |
remove(java.lang.String name)
Remove the object with the given name from the underlying scope. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.commons.logging.Log logger
Constructor Detail |
---|
public ApplicationScope(java.lang.Object context)
context
).
context
- The ServletContext or the PortletContext respectivelyMethod Detail |
---|
public java.lang.Object get(java.lang.String name, ObjectFactory objectFactory)
creating it
if not found in the underlying storage mechanism.
get
in interface Scope
name
- the name of the object to retrieveobjectFactory
- the ObjectFactory
to use to create the scoped object if it is not present in the
underlying storage mechanism
public java.lang.Object remove(java.lang.String name)
name
from the underlying scope.
Returns null
if no object was found; otherwise
returns the removed Object
.
remove
in interface Scope
name
- the name of the object to remove
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
Implementations should do their best to execute the callback at the appropriate time. If such a callback is not supported by the underlying runtime environment, the callback must be ignored and a corresponding warning should be logged.
registerDestructionCallback
in interface Scope
name
- the name of the object to execute the destruction callback forcallback
- the destruction callback to be executedpublic java.lang.String getConversationId()
The exact value of the converation id is totally dependent on the
underlying storage mechanism (of course). In the case of session scoped
beans a good conversation id probably would be the
session id
; in the case
of a JCache scope a good conversation id probably would be the name of
the associated cache.
It is perfectly valid to return null
in an
implementation of this method if the underlying storage mechanism has
no obvious good candidate for a conversation id.
getConversationId
in interface Scope
null
if there is no
conversation id for this scopepublic void clear()
|
JSF-Spring | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |