org.apache.myfaces.cdi.view
Class ViewScopeBeanHolder

java.lang.Object
  extended by org.apache.myfaces.cdi.view.ViewScopeBeanHolder
All Implemented Interfaces:
Serializable

@SessionScoped
public class ViewScopeBeanHolder
extends Object
implements Serializable

Author:
Leonardo Uribe
See Also:
Serialized Form

Field Summary
static String VIEW_SCOPE_PREFIX_KEY
           
 
Constructor Summary
ViewScopeBeanHolder()
           
 
Method Summary
 void destroyBeans()
          This method properly destroys all current @WindowScoped beans of the active session and also prepares the storage for new beans.
 void destroyBeans(String viewScopeId)
           
 void destroyBeansOnPreDestroy()
           
 Map<String,ViewScopeContextualStorage> forceNewStorage()
          This method will replace the storageMap and with a new empty one.
 String generateUniqueViewScopeId()
           
 ViewScopeContextualStorage getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager, String viewScopeId)
          This method will return the ViewScopeContextualStorage or create a new one if no one is yet assigned to the current windowId.
 Map<String,ViewScopeContextualStorage> getStorageMap()
           
 void init()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_SCOPE_PREFIX_KEY

public static final String VIEW_SCOPE_PREFIX_KEY
See Also:
Constant Field Values
Constructor Detail

ViewScopeBeanHolder

public ViewScopeBeanHolder()
Method Detail

init

@PostConstruct
public void init()

getContextualStorage

public ViewScopeContextualStorage getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager,
                                                       String viewScopeId)
This method will return the ViewScopeContextualStorage or create a new one if no one is yet assigned to the current windowId.

Parameters:
beanManager - we need the CDI BeanManager for serialisation.
windowId - the windowId for the current browser tab or window.

getStorageMap

public Map<String,ViewScopeContextualStorage> getStorageMap()

forceNewStorage

public Map<String,ViewScopeContextualStorage> forceNewStorage()
This method will replace the storageMap and with a new empty one. This method can be used to properly destroy the WindowBeanHolder beans without having to sync heavily. Any Contextual.destroy(Object, javax.enterprise.context.spi.CreationalContext) should be performed on the returned old storage map.

Returns:
the old storageMap.

destroyBeans

public void destroyBeans()
This method properly destroys all current @WindowScoped beans of the active session and also prepares the storage for new beans. It will automatically get called when the session context closes but can also get invoked manually, e.g. if a user likes to get rid of all it's @ViewScoped beans.


destroyBeans

public void destroyBeans(String viewScopeId)

destroyBeansOnPreDestroy

@PreDestroy
public void destroyBeansOnPreDestroy()

generateUniqueViewScopeId

public String generateUniqueViewScopeId()


Copyright © 2014 The Apache Software Foundation. All rights reserved.