Top Description Fields Constructors Methods
com.sun.faces.application.view

public Class ViewScopeContextManager

extends Object
Class Inheritance
Imports
com.sun.faces.util.FacesLogger, .Util, java.util.ArrayList, .HashSet, .Iterator, .Map, .Set, java.util.concurrent.ConcurrentHashMap, java.util.logging.Level, .Logger, javax.enterprise.context.spi.Contextual, .CreationalContext, javax.enterprise.inject.spi.Bean, .BeanManager, .PassivationCapable, javax.faces.component.UIViewRoot, javax.faces.context.ExternalContext, .FacesContext, javax.inject.Named, javax.servlet.http.HttpSession, .HttpSessionEvent

The manager that deals with CDI ViewScoped beans.

Field Summary

Modifier and TypeField and Description
private static final String
ACTIVE_VIEW_CONTEXTS

Stores the constant to keep track of all the active view scope contexts.

private static final String
ACTIVE_VIEW_MAPS

Stores the constants to keep track of the active view maps.

private final BeanManager
private boolean
private static final Logger
private Class<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear(FacesContext
the Faces context.
facesContext
)

Clear the current view map using the Faces context.

public void
clear(FacesContext
the Faces context.
facesContext
,
Map<String, Object>
the given view map.
viewMap
)

Clear the given view map.

private void
copyViewScopeContextsFromSession(Map<Object, Map<String, ViewScopeContextObject>> contexts, Map<String, Object> viewMap)

Copies view-scope context from the session, in case the view map identity has changed, which is the case when cluster failover or a session-saving reload occurs

public <
the type.
T
>
T

Returns:

the value or null if not found.
createBean
(FacesContext
the faces context.
facesContext
,
Contextual<T>
the contextual.
contextual
,
CreationalContext<T>
the creational.
creational
)

Create the bean.

private void
destroyBeans(Map<String, Object>
the view map.
viewMap
,
Map<String, ViewScopeContextObject>
the context map.
contextMap
)

Destroy the view scoped beans for the given view and context map.

public void
public void
public <
the type.
T
>
T

Returns:

the value or null if not found.
getBean
(FacesContext
the faces context.
facesContext
,
Contextual<T>
the contextual.
contextual
)

Get the value from the view map (or null if not found).

private Map<String, ViewScopeContextObject>

Returns:

the context map.
getContextMap
(FacesContext
the Faces context.
facesContext
)

Get the context map.

private Map<String, ViewScopeContextObject>

Returns:

the context map.
getContextMap
(FacesContext
the Faces context.
facesContext
,
boolean
flag to indicate if we are creating the context map.
create
)

Get the context map.

private Map<String, ViewScopeContextObject>

Returns:

the context map.
getContextMap
(FacesContext
the Faces context.
facesContext
,
Map<String, Object>
flag to indicate if we are creating the context map.
viewMap
)

Get the context map.

private String

Returns:

the name.
getName
(Object
the object.
instance
)

Get the name of the bean for the given object.

public void
sessionDestroyed(HttpSessionEvent
the HTTP session event.
hse
)

Called when a session destroyed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACTIVE_VIEW_CONTEXTSback to summary
private static final String ACTIVE_VIEW_CONTEXTS

Stores the constant to keep track of all the active view scope contexts.

ACTIVE_VIEW_MAPSback to summary
private static final String ACTIVE_VIEW_MAPS

Stores the constants to keep track of the active view maps.

beanManagerback to summary
private final BeanManager beanManager
isCdiOneOneOrGreaterback to summary
private boolean isCdiOneOneOrGreater
LOGGERback to summary
private static final Logger LOGGER
viewScopedCDIEventFireHelperImplClassback to summary
private Class<T> viewScopedCDIEventFireHelperImplClass

Constructor Detail

ViewScopeContextManagerback to summary
public ViewScopeContextManager()

Method Detail

clearback to summary
public void clear(FacesContext facesContext)

Clear the current view map using the Faces context.

Parameters
facesContext:FacesContext

the Faces context.

clearback to summary
public void clear(FacesContext facesContext, Map<String, Object> viewMap)

Clear the given view map.

Parameters
facesContext:FacesContext

the Faces context.

viewMap:Map<String, Object>

the given view map.

copyViewScopeContextsFromSessionback to summary
private void copyViewScopeContextsFromSession(Map<Object, Map<String, ViewScopeContextObject>> contexts, Map<String, Object> viewMap)

Copies view-scope context from the session, in case the view map identity has changed, which is the case when cluster failover or a session-saving reload occurs

createBeanback to summary
public <T> T createBean(FacesContext facesContext, Contextual<T> contextual, CreationalContext<T> creational)

Create the bean.

Parameters
<T>
the type.
facesContext:FacesContext

the faces context.

contextual:Contextual<T>

the contextual.

creational:CreationalContext<T>

the creational.

Returns:T

the value or null if not found.

destroyBeansback to summary
private void destroyBeans(Map<String, Object> viewMap, Map<String, ViewScopeContextObject> contextMap)

Destroy the view scoped beans for the given view and context map.

Parameters
viewMap:Map<String, Object>

the view map.

contextMap:Map<String, ViewScopeContextObject>

the context map.

fireDestroyedEventback to summary
public void fireDestroyedEvent(FacesContext facesContext, UIViewRoot root)
fireInitializedEventback to summary
public void fireInitializedEvent(FacesContext facesContext, UIViewRoot root)
getBeanback to summary
public <T> T getBean(FacesContext facesContext, Contextual<T> contextual)

Get the value from the view map (or null if not found).

Parameters
<T>
the type.
facesContext:FacesContext

the faces context.

contextual:Contextual<T>

the contextual.

Returns:T

the value or null if not found.

getContextMapback to summary
private Map<String, ViewScopeContextObject> getContextMap(FacesContext facesContext)

Get the context map.

Parameters
facesContext:FacesContext

the Faces context.

Returns:Map<String, ViewScopeContextObject>

the context map.

getContextMapback to summary
private Map<String, ViewScopeContextObject> getContextMap(FacesContext facesContext, boolean create)

Get the context map.

Parameters
facesContext:FacesContext

the Faces context.

create:boolean

flag to indicate if we are creating the context map.

Returns:Map<String, ViewScopeContextObject>

the context map.

getContextMapback to summary
private Map<String, ViewScopeContextObject> getContextMap(FacesContext facesContext, Map<String, Object> viewMap)

Get the context map.

Parameters
facesContext:FacesContext

the Faces context.

viewMap:Map<String, Object>

flag to indicate if we are creating the context map.

Returns:Map<String, ViewScopeContextObject>

the context map.

getNameback to summary
private String getName(Object instance)

Get the name of the bean for the given object.

Parameters
instance:Object

the object.

Returns:String

the name.

sessionDestroyedback to summary
public void sessionDestroyed(HttpSessionEvent hse)

Called when a session destroyed.

Parameters
hse:HttpSessionEvent

the HTTP session event.