|
ModeShape Distribution 3.0.0.CR1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.jcr.LocalEnvironment
public class LocalEnvironment
An Environment
that can be used within a local (non-clustered) process.
To use a custom Environment instance, simply create a RepositoryConfiguration
as usual but then call the
RepositoryConfiguration.with(Environment)
with the Environment instance and then use the resulting
RepositoryConfiguration instance.
When a ModeShape repository configuration
defines cache containers with configuration files on
the file system or the classpath, then a LocalEnvironment
instance can be used as-is with no other configuration or
setup.
If applications wish to programmatically configure the Infinispan caches or cache containers, then those configurations can be
registered with a LocalEnvironment instance. Specifically, the addCacheContainer(String, CacheContainer)
and
addCacheContainerIfAbsent(String, CacheContainer)
methods register a programmatically created instance of a
CacheContainer
. Alternatively, the defineCache(String, String, Configuration)
method can be used to register a
named cache with a programmatically created Infinispan cache configuration
.
Field Summary | |
---|---|
static String |
DEFAULT_CONFIGURATION_NAME
The name for the default cache container that is used when getCacheContainer() is called or if null is supplied as
the name in getCacheContainer(String) . |
static Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> |
DEFAULT_TRANSACTION_MANAGER_LOOKUP_CLASS
|
Constructor Summary | |
---|---|
LocalEnvironment()
|
|
LocalEnvironment(Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> transactionManagerLookupClass)
|
Method Summary | |
---|---|
org.infinispan.manager.CacheContainer |
addCacheContainer(String name,
org.infinispan.manager.CacheContainer cacheContainer)
Add the supplied CacheContainer under the supplied name if and only if there is not already a cache container
registered at that name. |
void |
addCacheContainerIfAbsent(String name,
org.infinispan.manager.CacheContainer cacheContainer)
Add the supplied CacheContainer under the supplied name if and only if there is not already a cache container
registered at that name. |
protected org.infinispan.manager.CacheContainer |
createContainer(org.infinispan.configuration.global.GlobalConfiguration globalConfiguration,
org.infinispan.configuration.cache.Configuration configuration)
|
protected org.infinispan.manager.CacheContainer |
createContainer(String configFile)
|
protected org.infinispan.configuration.cache.Configuration |
createDefaultConfiguration()
|
protected org.infinispan.configuration.global.GlobalConfiguration |
createGlobalConfiguration()
|
org.infinispan.configuration.cache.Configuration |
defineCache(String cacheName,
org.infinispan.configuration.cache.Configuration configuration)
Define within the default cache container an Infinispan cache with the given cache name and configuration. |
org.infinispan.configuration.cache.Configuration |
defineCache(String cacheContainerName,
String cacheName,
org.infinispan.configuration.cache.Configuration configuration)
Define within the named cache container an Infinispan cache with the given cache name and configuration. |
protected void |
doShutdown()
Shutdown all containers and caches. |
org.infinispan.manager.CacheContainer |
getCacheContainer()
Get the default cache container. |
org.infinispan.manager.CacheContainer |
getCacheContainer(String name)
Get the cache container with the given name. |
org.jgroups.Channel |
getChannel(String name)
Get the JGroups channel with the given logical name. |
ClassLoader |
getClassLoader(ClassLoader fallbackLoader,
String... classpathEntries)
Get a classloader given the supplied set of logical classpath entries, which the implementation can interpret however it needs. |
boolean |
isShared()
Return whether this environment is shared amongst multiple repositories. |
protected Context |
jndiContext()
|
void |
setShared(boolean shared)
Set whether this environment is shared amongst multiple repositories. |
void |
shutdown()
Shutdown this environment, allowing it to reclaim any resources. |
protected void |
shutdown(org.infinispan.manager.CacheContainer container)
|
protected Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> |
transactionManagerLookupClass()
|
protected org.infinispan.transaction.lookup.TransactionManagerLookup |
transactionManagerLookupInstance()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> DEFAULT_TRANSACTION_MANAGER_LOOKUP_CLASS
public static final String DEFAULT_CONFIGURATION_NAME
getCacheContainer()
is called or if null is supplied as
the name in getCacheContainer(String)
.
Constructor Detail |
---|
public LocalEnvironment()
public LocalEnvironment(Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> transactionManagerLookupClass)
Method Detail |
---|
public org.infinispan.manager.CacheContainer getCacheContainer() throws IOException, NamingException
IOException
NamingException
public org.infinispan.manager.CacheContainer getCacheContainer(String name) throws IOException, NamingException
Environment
getCacheContainer
in interface Environment
name
- the name of the cache container; may be null
IOException
- if there is an error accessing any resources required to start the container
NamingException
- if there is an error accessing JNDI (if that is used in the implementation)public org.jgroups.Channel getChannel(String name)
Environment
getChannel
in interface Environment
name
- the name of the channel; may not be null
public void shutdown()
This method does nothing if the environment has been marked as shared
.
shutdown
in interface Environment
protected void doShutdown()
public ClassLoader getClassLoader(ClassLoader fallbackLoader, String... classpathEntries)
Environment
getClassLoader
in interface Environment
fallbackLoader
- the classloader that should be used is the fallback class loaderclasspathEntries
- the logical classpath entries
protected void shutdown(org.infinispan.manager.CacheContainer container)
protected Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> transactionManagerLookupClass()
protected org.infinispan.transaction.lookup.TransactionManagerLookup transactionManagerLookupInstance()
protected org.infinispan.manager.CacheContainer createContainer(String configFile) throws IOException, NamingException
IOException
NamingException
protected org.infinispan.configuration.cache.Configuration createDefaultConfiguration()
protected org.infinispan.configuration.global.GlobalConfiguration createGlobalConfiguration()
protected org.infinispan.manager.CacheContainer createContainer(org.infinispan.configuration.global.GlobalConfiguration globalConfiguration, org.infinispan.configuration.cache.Configuration configuration)
protected Context jndiContext() throws NamingException
NamingException
public void addCacheContainerIfAbsent(String name, org.infinispan.manager.CacheContainer cacheContainer)
CacheContainer
under the supplied name if and only if there is not already a cache container
registered at that name.
name
- the cache container name; may be null if the default configuration name
should be usedcacheContainer
- the cache container; may not be nullpublic org.infinispan.manager.CacheContainer addCacheContainer(String name, org.infinispan.manager.CacheContainer cacheContainer)
CacheContainer
under the supplied name if and only if there is not already a cache container
registered at that name.
name
- the cache container name; may be null if the default configuration name
should be usedcacheContainer
- the cache container; may not be null
public org.infinispan.configuration.cache.Configuration defineCache(String cacheName, org.infinispan.configuration.cache.Configuration configuration)
EmbeddedCacheManager
interface for
this method to succeed.
cacheName
- the name of the cache being defined; may not be nullconfiguration
- the cache configuration; may not be null
public org.infinispan.configuration.cache.Configuration defineCache(String cacheContainerName, String cacheName, org.infinispan.configuration.cache.Configuration configuration)
EmbeddedCacheManager
interface for
this method to succeed.
cacheContainerName
- the name of the cache container; if null, the default
container name
is usedcacheName
- the name of the cache being defined; may not be nullconfiguration
- the cache configuration; may not be null
public void setShared(boolean shared)
true
.
shared
- true if this environment is shared, or false otherwiseisShared()
public boolean isShared()
setShared(boolean)
|
ModeShape Distribution 3.0.0.CR1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |