org.jboss.cache.loader
Class CacheLoaderManager

java.lang.Object
  extended by org.jboss.cache.loader.CacheLoaderManager

public class CacheLoaderManager
extends java.lang.Object

Manages all cache loader funxtionality. This class is typically initialised with an XML DOM Element, represeting a cache loader configuration, or a CacheLoaderConfig object. Usage: CacheLoaderManager manager = new CacheLoaderManager(); manager.setConfig(myXmlSnippet, myTreeCache); CacheLoader loader = manager.getCacheLoader(); The XML configuration passed in would typically look like: false / org.jboss.cache.loader.FileCacheLoader true false false location=/tmp/file ]]>

Author:
Manik Surtani (manik@jboss.org)

Constructor Summary
CacheLoaderManager()
           
 
Method Summary
 CacheLoader getCacheLoader()
          Returns the cache loader
 CacheLoaderConfig getCacheLoaderConfig()
          Returns the configuration element of the cache loaders
 boolean isExtendedCacheLoader()
          Gets whether the cache loader supports the ExtendedCacheLoader API.
 boolean isFetchPersistentState()
          Returns true if at least one of the configured cache loaders has set fetchPersistentState to true.
 boolean isPassivation()
          Tests if we're using passivation
 void preload(Fqn fqn, boolean preloadParents, boolean preloadChildren)
          Preloads a specific Fqn into the cache from the configured cacheloader
 void preloadCache()
          Performs a preload on the cache based on the cache loader preload configs used when configuring the cache.
 void purgeLoaders(boolean force)
           
 void setCacheLoader(CacheLoader loader)
          Overrides generated cache loader with the one provided,for backward compat.
 void setConfig(CacheLoaderConfig config, TreeCache cache)
          Sets a configuration object and creates a cacheloader accordingly.
 void setConfig(org.w3c.dom.Element cacheLoaderConfig, TreeCache cache)
          Creates a cache loader based on an XML element passed in.
 void startCacheLoader()
           
 void stopCacheLoader()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheLoaderManager

public CacheLoaderManager()
Method Detail

setConfig

public void setConfig(org.w3c.dom.Element cacheLoaderConfig,
                      TreeCache cache)
               throws java.lang.Exception
Creates a cache loader based on an XML element passed in.

Parameters:
cacheLoaderConfig -
Throws:
java.lang.Exception

setConfig

public void setConfig(CacheLoaderConfig config,
                      TreeCache cache)
               throws java.lang.Exception
Sets a configuration object and creates a cacheloader accordingly.

Parameters:
config -
cache -
Throws:
java.lang.Exception

preloadCache

public void preloadCache()
                  throws java.lang.Exception
Performs a preload on the cache based on the cache loader preload configs used when configuring the cache.

Throws:
java.lang.Exception

preload

public void preload(Fqn fqn,
                    boolean preloadParents,
                    boolean preloadChildren)
             throws java.lang.Exception
Preloads a specific Fqn into the cache from the configured cacheloader

Parameters:
fqn - fqn to preload
preloadParents - whether we preload parents
preloadChildren - whether we preload children
Throws:
java.lang.Exception

getCacheLoaderConfig

public CacheLoaderConfig getCacheLoaderConfig()
Returns the configuration element of the cache loaders


getCacheLoader

public CacheLoader getCacheLoader()
Returns the cache loader


setCacheLoader

public void setCacheLoader(CacheLoader loader)
Overrides generated cache loader with the one provided,for backward compat.

Parameters:
loader -

isPassivation

public boolean isPassivation()
Tests if we're using passivation


isFetchPersistentState

public boolean isFetchPersistentState()
Returns true if at least one of the configured cache loaders has set fetchPersistentState to true.


isExtendedCacheLoader

public boolean isExtendedCacheLoader()
Gets whether the cache loader supports the ExtendedCacheLoader API.

Returns:
true if the cache loader implements ExtendedCacheLoader, or, if the cache loader is a ChainingCacheLoader, all cache loaders in the chain whose FetchPersistentState property is true implement ExtendedCacheLoader.

stopCacheLoader

public void stopCacheLoader()

startCacheLoader

public void startCacheLoader()
                      throws java.lang.Exception
Throws:
java.lang.Exception

purgeLoaders

public void purgeLoaders(boolean force)
                  throws java.lang.Exception
Throws:
java.lang.Exception


Copyright 1998-2005 JBoss Inc . All Rights Reserved.