org.apache.myfaces.cdi.view
Class ViewScopeContextImpl

java.lang.Object
  extended by org.apache.myfaces.cdi.view.ViewScopeContextImpl
All Implemented Interfaces:
javax.enterprise.context.spi.Context

@Typed
public class ViewScopeContextImpl
extends Object
implements javax.enterprise.context.spi.Context

CDI Context to handle @ViewScoped beans.

Author:
Leonardo Uribe

Constructor Summary
ViewScopeContextImpl(javax.enterprise.inject.spi.BeanManager beanManager)
           
 
Method Summary
protected  void checkActive()
          Make sure that the Context is really active.
 boolean destroy(javax.enterprise.context.spi.Contextual bean)
          Destroy the Contextual Instance of the given Bean.
 void destroyAllActive()
          destroys all the Contextual Instances in the Storage returned by getContextualStorage(boolean).
static void destroyAllActive(ViewScopeContextualStorage storage)
          Destroys all the Contextual Instances in the specified ContextualStorage.
<T> T
get(javax.enterprise.context.spi.Contextual<T> bean)
           
<T> T
get(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
           
protected  ViewScopeContextualStorage getContextualStorage(boolean createIfNotExist)
           
 String getCurrentViewScopeId(boolean create)
          We need to pass the session scoped windowbean holder and the requestscoped windowIdHolder in a later phase because getBeans is only allowed from AfterDeploymentValidation onwards.
 Class<? extends Annotation> getScope()
           
protected  ViewScopeBeanHolder getViewScopeBeanHolder()
           
protected  ViewScopeBeanHolder getViewScopeBeanHolder(FacesContext facesContext)
           
 boolean isActive()
          The WindowContext is active once a current windowId is set for the current Thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewScopeContextImpl

public ViewScopeContextImpl(javax.enterprise.inject.spi.BeanManager beanManager)
Method Detail

getViewScopeBeanHolder

protected ViewScopeBeanHolder getViewScopeBeanHolder()

getViewScopeBeanHolder

protected ViewScopeBeanHolder getViewScopeBeanHolder(FacesContext facesContext)

getCurrentViewScopeId

public String getCurrentViewScopeId(boolean create)
We need to pass the session scoped windowbean holder and the requestscoped windowIdHolder in a later phase because getBeans is only allowed from AfterDeploymentValidation onwards.


getContextualStorage

protected ViewScopeContextualStorage getContextualStorage(boolean createIfNotExist)

getScope

public Class<? extends Annotation> getScope()
Specified by:
getScope in interface javax.enterprise.context.spi.Context

isActive

public boolean isActive()
The WindowContext is active once a current windowId is set for the current Thread.

Specified by:
isActive in interface javax.enterprise.context.spi.Context
Returns:

get

public <T> T get(javax.enterprise.context.spi.Contextual<T> bean)
Specified by:
get in interface javax.enterprise.context.spi.Context

get

public <T> T get(javax.enterprise.context.spi.Contextual<T> bean,
                 javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Specified by:
get in interface javax.enterprise.context.spi.Context

destroy

public boolean destroy(javax.enterprise.context.spi.Contextual bean)
Destroy the Contextual Instance of the given Bean.

Parameters:
bean - dictates which bean shall get cleaned up
Returns:
true if the bean was destroyed, false if there was no such bean.

destroyAllActive

public void destroyAllActive()
destroys all the Contextual Instances in the Storage returned by getContextualStorage(boolean).


destroyAllActive

public static void destroyAllActive(ViewScopeContextualStorage storage)
Destroys all the Contextual Instances in the specified ContextualStorage. This is a static method to allow various holder objects to cleanup properly in @PreDestroy.


checkActive

protected void checkActive()
Make sure that the Context is really active.

Throws:
javax.enterprise.context.ContextNotActiveException - if there is no active Context for the current Thread.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.