org.figure8.join.services.cache
Class CacheLoader

java.lang.Object
  extended by org.figure8.join.services.cache.CacheLoader

public class CacheLoader
extends java.lang.Object

This object is responsible for loading the eternal caches of Join application. Once data are loaded, it exposes cached data to web tier registering a EternalCacheAccessor within application context and ServletContext.
Because this registration is done during application context creation, we cannot use the registration method provided by the ContainerContextHandler (application context is still null) ... We have to do this in a Spring specific way by implementing BeanFactoryAware and using the registration method of the current BeanFactory.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

Field Summary
protected  ArtifactManager artifactManager
          The ArtifactManager for getting data to put in caches
protected  CacheManager cacheManager
          The CacheManager referencing caches
protected  PermissionManager permissionManager
          The PermissionManager for getting data to put in caches
protected  IntegrationProcessManager processManager
          The IntegrationProcessManager for gettnig data to put in caches
 
Constructor Summary
CacheLoader()
          Creates a new instance of CacheLoader
 
Method Summary
 EternalCacheAccessor getEternalCacheAccesor()
           
 boolean hasLoadedCaches()
           
 void loadCaches()
          Load the eternal caches of Join application.
protected  void loadDeliverableTypesCache()
          Load the eternal cache containing DeliverableTypes
protected  void loadReleasesCache()
          Load the eternal cache containing Releases
protected  void loadRolesCache()
          Load the eternal cache containing Roles
protected  void loadStepsCache()
          Load the eternal cache containing Steps
protected  void registerCacheAccessor()
          Simply build an EternalCacheAccessor instance and register it within ServletContext using the EternalCacheAccessor.CONTEXT_KEY.
 void setArtifactManager(ArtifactManager artifactManager)
           
 void setCacheManager(CacheManager cacheManager)
           
 void setIntegrationProcessManager(IntegrationProcessManager processManager)
           
 void setPermissionManager(PermissionManager permissionManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheManager

protected CacheManager cacheManager
The CacheManager referencing caches


artifactManager

protected ArtifactManager artifactManager
The ArtifactManager for getting data to put in caches


permissionManager

protected PermissionManager permissionManager
The PermissionManager for getting data to put in caches


processManager

protected IntegrationProcessManager processManager
The IntegrationProcessManager for gettnig data to put in caches

Constructor Detail

CacheLoader

public CacheLoader()
Creates a new instance of CacheLoader

Method Detail

setCacheManager

public void setCacheManager(CacheManager cacheManager)
Parameters:
cacheManager - The cache manager instance to use for getting caches to load

setArtifactManager

public void setArtifactManager(ArtifactManager artifactManager)
Parameters:
artifactManager - The artifact manager instance to use for getting data

setPermissionManager

public void setPermissionManager(PermissionManager permissionManager)
Parameters:
permissionManager - The permission manager instance to use for getting data

setIntegrationProcessManager

public void setIntegrationProcessManager(IntegrationProcessManager processManager)
Parameters:
processManager - The integration process manager instance to use for getting data

hasLoadedCaches

public boolean hasLoadedCaches()
Returns:
Flag telling if loader has already filled eternal caches

getEternalCacheAccesor

public EternalCacheAccessor getEternalCacheAccesor()
Returns:
The registred accessor for accessing eternal caches

loadCaches

public void loadCaches()
                throws BootstrapException
Load the eternal caches of Join application. Once data are loaded, it exposes cached data to web tier registering a EternalCacheAccessor within ServletContext.
This method should called at application startup, after the supplied CacheManager instance has been initialized too (ex: by Spring Framework...)

Throws:
BootstrapException - if one of the eternal caches is not available of if an infrastructure exception occurs during data retrieval.

loadStepsCache

protected void loadStepsCache()
                       throws CacheException,
                              BootstrapException
Load the eternal cache containing Steps

Throws:
CacheException - if step cache cannot be filled with retrieved steps
BootstrapException - if cache cannot be retrieved through its manager

loadRolesCache

protected void loadRolesCache()
                       throws CacheException,
                              BootstrapException
Load the eternal cache containing Roles

Throws:
CacheException - if role cache cannot be filled with retrieved roles
BootstrapException - if cache cannot be retrieved through its manager

loadReleasesCache

protected void loadReleasesCache()
                          throws CacheException,
                                 BootstrapException
Load the eternal cache containing Releases

Throws:
CacheException - if cache cannot be filled with retrieved releases
BootstrapException - if cache cannot be retrieved through its manager

loadDeliverableTypesCache

protected void loadDeliverableTypesCache()
                                  throws CacheException,
                                         BootstrapException
Load the eternal cache containing DeliverableTypes

Throws:
CacheException - if cache cannot be filled with retrieved types
BootstrapException - if cache cannot be retrieves through its manager

registerCacheAccessor

protected void registerCacheAccessor()
Simply build an EternalCacheAccessor instance and register it within ServletContext using the EternalCacheAccessor.CONTEXT_KEY.
Subclasses may override this method to allow some more specific registration or a more evolved cache accessor implementation.



Copyright © 2005-2008 Join. All Rights Reserved.