org.apache.myfaces.flow.cdi
Class FlowScopedContextImpl

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

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

Minimal implementation of FlowScope.

Author:
Leonardo Uribe

Constructor Summary
FlowScopedContextImpl(javax.enterprise.inject.spi.BeanManager beanManager, Map<Class,FlowReference> flowBeanReferences)
           
 
Method Summary
protected  void checkActive(FacesContext facesContext)
          Make sure that the Context is really active.
 boolean destroy(javax.enterprise.context.spi.Contextual bean)
          Destroy the Contextual Instance of the given Bean.
static void destroyAllActive(ContextualStorage 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  ContextualStorage getContextualStorage(boolean createIfNotExist, String clientWindowFlowId)
          An implementation has to return the underlying storage which contains the items held in the Context.
 String getCurrentClientWindowFlowId(FacesContext facesContext)
           
protected  FlowScopeBeanHolder getFlowScopeBeanHolder()
           
protected  FlowScopeBeanHolder getFlowScopeBeanHolder(FacesContext facesContext)
           
 Class<? extends Annotation> getScope()
           
 boolean isActive()
           
 boolean isActive(FacesContext facesContext)
           
 boolean isPassivatingScope()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowScopedContextImpl

public FlowScopedContextImpl(javax.enterprise.inject.spi.BeanManager beanManager,
                             Map<Class,FlowReference> flowBeanReferences)
Method Detail

getFlowScopeBeanHolder

protected FlowScopeBeanHolder getFlowScopeBeanHolder()

getFlowScopeBeanHolder

protected FlowScopeBeanHolder getFlowScopeBeanHolder(FacesContext facesContext)

getCurrentClientWindowFlowId

public String getCurrentClientWindowFlowId(FacesContext facesContext)

getContextualStorage

protected ContextualStorage getContextualStorage(boolean createIfNotExist,
                                                 String clientWindowFlowId)
An implementation has to return the underlying storage which contains the items held in the Context.

Parameters:
createIfNotExist - whether a ContextualStorage shall get created if it doesn't yet exist.
Returns:
the underlying storage

getScope

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

isActive

public boolean isActive()
Specified by:
isActive in interface javax.enterprise.context.spi.Context

isActive

public boolean isActive(FacesContext facesContext)

isPassivatingScope

public boolean isPassivatingScope()
Returns:
whether the served scope is a passivating scope

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 static void destroyAllActive(ContextualStorage 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(FacesContext facesContext)
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.