| java.lang.Object com.jofti.manager.IndexManagerImpl
IndexManagerImpl | public class IndexManagerImpl implements IndexManager(Code) | | The manager is responsible for providing access to caches. This class is not a singleton
and is not intended to be used in that manner.
The usage for the cache manager is:
IndexManager manager = new IndexManagerImpl();
manager.setConfigFile("configFile");
manager.init();
IndexCache index = manager.getIndex("name");
or:
IndexManager manager = new IndexManagerImpl();
manager.init(inputStream);
IndexCache index = manager.getIndex("name");
or
IndexManager manager = new IndexManagerImpl();
manager.init(configFile);
IndexCache index = manager.getIndex("name");
The name of the index is one of the indexs configured in the configFile.
NameSpaced caches such as JBossCache are obtained using:
IndexManager manager = new IndexManagerImpl();
manager.init(configFile);
NameSpacedIndex index = manager.getNameSpacedIndex("name");
author: Steve Woodcock version: 1.0 |
IndexManagerImpl | public IndexManagerImpl()(Code) | | Creates a new instance of IndexManagerImpl
|
addIndex | public Index addIndex(IndexConfig config, Object cache, String classesFileName) throws JoftiException(Code) | | This method allows cache instances to be added to the cache
programatically rather than at start-up.
The usage is for example:
DefaultIndexConfig config = new DefaultIndexConfig();
config.setName("test");
IndexCache index = (IndexCache)
manager.addIndexedCache(config, ,
);
any type of cache can be added in this manner, providing a CacheAdapter
exists for it and the correct adapter has been configured in the
IndexConfig class. If you are using a nameSpaced cache like JBossCache then the usage wouldbe: DefaultIndexConfig config = new DefaultIndexConfig(); config.setName("test"); NameSpacedIndex index = (NameSpacedIndex)manager.addIndexedCache(config, , );
Note: The cache implementations must be started correctly before they arepassed into this method. Added caches are assumed to have been startedand the manager will NOT attempt to initialise the actual cacheimplementation. Parameters: config - -the config class containing definitions of the adapter, indextype and parser to use. Parameters: cache - -the cache implementation. Passing NULL will result in the adapter creating a newcache instance. Parameters: classesFileName - -the xml file containing the classes definitions for the cache.This file must be available on the classpath. The added cache. throws: JoftiException -
|
addIndex | public Index addIndex(IndexConfig config, Object cache) throws JoftiException(Code) | | This method allows cache instances to be added to the cache
programatically rather than at start-up. The usage is for example:
DefaultIndexConfig config = new DefaultIndexConfig();
config.setName("test");
IndexCache index = (IndexCache)
manager.addIndexedCache(config, ,
);
any type of cache can be added in this manner, providing a CacheAdapter
exists for it and the correct adapter has been configured in the
IndexConfig class. If you are using a nameSpaced cache like JBossCache then the usage wouldbe: DefaultIndexConfig config = new DefaultIndexConfig(); config.setName("test"); NameSpacedIndex index = (NameSpacedIndex)manager.addIndexedCache(config, );
Note: The cache implementations must be started correctly before they arepassed into this method. Added caches are assumed to have been startedand the manager will NOT attempt to initialise the actual cacheimplementation. Parameters: config - -the config class containing definitions of the adapter, indextype and parser to use. Parameters: cache - -the cache implementation. Passing NULL will result in the adapter creating a newcache instance. The added cache. throws: JoftiException -
|
addIndexCache | public Index addIndexCache(IndexConfig config, String classesFileName) throws JoftiException(Code) | | This method allows cache instances to be added to the cache
programatically rather than at start-up. This method will result in the
adapter used creating a new instance of its cache type.
Any type of cache can be added in this manner, providing a CacheAdapter
exists for it and the correct adapter has been configured in the
IndexConfig class. Note: This method is the equivalent of an index entry in theconfiguration file. The manager will atttempt to construct and initialisea new indexed cache based on the attributes in the cacheConfig class andthe class definition file. Parameters: config - -the config class containing definitions of the adapter, indextype and parser to use. Parameters: classesFileName - -the xml file containing the classes definitions for thecache.This file must be available on the classpath. The added cache. throws: JoftiException -
|
addIndexCache | public Index addIndexCache(IndexConfig config) throws JoftiException(Code) | | This method allows cache instances to be added to the cache
programatically rather than at start-up.
Any type of cache can be added in this manner, providing a CacheAdapter
exists for it and the correct adapter has been configured in the
IndexConfig class. This method will result in theadapter used creating a new instance of its cache type. Note: This method is the equivalent of an index entry in theconfiguration file. The manager will atttempt to construct and initialisea new indexed cache based solely on the attributes in the cacheConfigclass. Class definitions can be added using attribute classMappings in theIndexConfig class. See this class for details on how to configure these. Parameters: config - -the config class containing definitions of the adapter, indextype and parser to use. The added cache. throws: JoftiException -
|
destroy | public synchronized void destroy()(Code) | | |
destroyIndex | public synchronized void destroyIndex(Object cache)(Code) | | Used to shutdown and remove a cache from the manager. You should always use this method
to remove a cache from the manager - as some cache implementations explicitly require a
shutdown phase to be run before they can be removed.
Parameters: cache - - the cache to be destroyed. |
getIndexCache | public Index getIndexCache(String indexName) throws JoftiException(Code) | | Retrieves a cache from the manager. If the cache does not exist in the manager the
method returns NULL, rather than throw an exception.
Attempting to retrieve a name spaced cache using this method will result in an
exception.
Parameters: indexName - - the key name to retrive the cache. This set in the config as the cacheName. - the cache or NULL if no cache can be found under that name. throws: JoftiException - |
getNameSpacedIndex | public NameSpacedIndex getNameSpacedIndex(String indexName) throws JoftiException(Code) | | Retrieves a name spaced indexed cache from the manager. If the cache does not exist in the manager the
method returns NULL, rather than throw an exception.
Attempting to retrieve a non-name spaced cache using this method will result in an
exception.
Parameters: indexName - - the key name to retrive the cache. This set in the config as the cacheName. - the cache or NULL if no cache can be found under that name. throws: JoftiException - |
init | public synchronized void init(String configFileName) throws JoftiException(Code) | | Initialise method that takes a config file name. This over-rides the
fileName (if any) set in the setConfigFile() method.
Parameters: configFileName - throws: JoftiException - |
init | public synchronized void init() throws JoftiException(Code) | | Initialise method that no parameters. This configures the Indexes with the
fileName set in the setConfigFile() method.
throws: JoftiException - |
init | public synchronized void init(InputStream configStream) throws JoftiException(Code) | | Initialise method that takes an inputstream. This over-rides the fileName
(if any) set in the setConfigFile() method.
Parameters: configStream - throws: JoftiException - |
setConfigFile | public void setConfigFile(String configFile)(Code) | | Sets a config file to use in the indexManager. This file must be on the
classpath.
|
|
|