public class DefaultCacheFactory<K,V> extends ComponentFactory implements CacheFactory<K,V>
CacheFactory
interface.
This is a special instance of a ComponentFactory
which contains bootstrap information for the
ComponentRegistry
.
ComponentFactory
componentRegistry, configuration, log
Constructor and Description |
---|
DefaultCacheFactory() |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
construct(Class<T> componentType)
Constructs a component.
|
protected CacheSPI<K,V> |
createAndWire(Configuration configuration) |
Cache<K,V> |
createCache()
Creates and starts a
Cache instance using default configuration settings. |
Cache<K,V> |
createCache(boolean start)
Creates and optionally starts a
Cache instance using default configuration settings. |
Cache<K,V> |
createCache(Configuration configuration)
This implementation clones the configuration passed in before using it.
|
Cache<K,V> |
createCache(Configuration configuration,
boolean start)
This implementation clones the configuration passed in before using it.
|
Cache<K,V> |
createCache(InputStream is)
Creates a
Cache instance based on an InputStream passed in, which should be a stream to a valid
XML configuration file. |
Cache<K,V> |
createCache(InputStream is,
boolean start)
Creates a
Cache instance based on an InputStream passed in, which should be a stream to a valid
XML configuration file. |
Cache<K,V> |
createCache(String configFileName)
Creates and starts a
Cache instance. |
Cache<K,V> |
createCache(String configFileName,
boolean start)
Creates
Cache instance, and optionally starts it. |
static CacheFactory |
getInstance()
Deprecated.
|
void |
setDefaultClassLoader(ClassLoader loader)
Allows users to specify a default class loader to use for both the construction and running of the cache.
|
assertTypeConstructable
@Deprecated public static CacheFactory getInstance()
public Cache<K,V> createCache() throws ConfigurationException
CacheFactory
Cache
instance using default configuration settings. See Configuration
for default values.createCache
in interface CacheFactory<K,V>
ConfigurationException
- if there are problems with the default configurationpublic Cache<K,V> createCache(boolean start) throws ConfigurationException
CacheFactory
Cache
instance using default configuration settings. See Configuration
for default values.createCache
in interface CacheFactory<K,V>
start
- if true, starts the cacheConfigurationException
- if there are problems with the default configurationpublic Cache<K,V> createCache(String configFileName) throws ConfigurationException
CacheFactory
Cache
instance. The following are all valid calls:
factory.createCache("myCacheService.xml"); // file is in class path factory.createCache("etc/myCacheService.xml"); // file is in etc/ relative to the directory you started the JVM factory.createCache("/home/jbosscache/myCacheService.xml"); // file is in the /home/jbosscache directory
createCache
in interface CacheFactory<K,V>
configFileName
- the named XML file should exist in the classpath or should be a fully qualified or relative (to your JVM working directory) path to a file on the local file system. Note that the classpath is checked first for the existence of this file.Cache
instanceConfigurationException
- if there are problems with the configurationpublic Cache<K,V> createCache(String configFileName, boolean start) throws ConfigurationException
CacheFactory
Cache
instance, and optionally starts it.createCache
in interface CacheFactory<K,V>
configFileName
- the named XML file should exist in the classpath or should be a fully qualified or relative (to your JVM working directory) path to a file on the local file system. Note that the classpath is checked first for the existence of this file.start
- if true, the cache is started before returning.Cache
instanceConfigurationException
- if there are problems with the configurationfor examples on valid config file names.
public Cache<K,V> createCache(Configuration configuration) throws ConfigurationException
createCache
in interface CacheFactory<K,V>
configuration
- to useConfigurationException
- if there are problems with the cfgpublic Cache<K,V> createCache(Configuration configuration, boolean start) throws ConfigurationException
createCache
in interface CacheFactory<K,V>
configuration
- to usestart
- whether to start the cacheConfigurationException
- if there are problems with the cfgprotected CacheSPI<K,V> createAndWire(Configuration configuration) throws Exception
Exception
public void setDefaultClassLoader(ClassLoader loader)
loader
- class loader to use as a default.public Cache<K,V> createCache(InputStream is) throws ConfigurationException
CacheFactory
Cache
instance based on an InputStream
passed in, which should be a stream to a valid
XML configuration file.createCache
in interface CacheFactory<K,V>
is
- the InputStream
Cache
instanceConfigurationException
- if there are problems with the configurationpublic Cache<K,V> createCache(InputStream is, boolean start) throws ConfigurationException
CacheFactory
Cache
instance based on an InputStream
passed in, which should be a stream to a valid
XML configuration file.createCache
in interface CacheFactory<K,V>
is
- the InputStream
start
- if true, the cache is started before returning.Cache
instanceConfigurationException
- if there are problems with the configurationprotected <T> T construct(Class<T> componentType)
ComponentFactory
construct
in class ComponentFactory
componentType
- type of componentCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.