Package org.infinispan.manager
Class DefaultCacheManagerAdmin
- java.lang.Object
-
- org.infinispan.manager.DefaultCacheManagerAdmin
-
- All Implemented Interfaces:
CacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
,EmbeddedCacheManagerAdmin
public class DefaultCacheManagerAdmin extends Object implements EmbeddedCacheManagerAdmin
The default implementation ofEmbeddedCacheManagerAdmin
- Since:
- 9.2
- Author:
- Tristan Tarrant
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.commons.api.CacheContainerAdmin
CacheContainerAdmin.AdminFlag
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
Cache<K,V>createCache(String cacheName, String template)
Creates a cache on the container using the specified template.<K,V>
Cache<K,V>createCache(String cacheName, Configuration configuration)
Creates a cache across the cluster.void
createTemplate(String name, Configuration configuration)
Creates a template that is replicated across the cluster using the specified configuration.<K,V>
Cache<K,V>getOrCreateCache(String cacheName, String template)
Retrieves an existing cache or creates one using the specified template if it doesn't exist<K,V>
Cache<K,V>getOrCreateCache(String cacheName, Configuration configuration)
Retrieves an existing cache or creates one across the cluster using the specified configuration.Configuration
getOrCreateTemplate(String name, Configuration configuration)
Retrieves an existing template or creates one across the cluster using the specified configuration.void
removeCache(String cacheName)
Removes a cache from the cache container.void
removeTemplate(String name)
Removes a template from the cache container.EmbeddedCacheManagerAdmin
withFlags(EnumSet<CacheContainerAdmin.AdminFlag> flags)
Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations.EmbeddedCacheManagerAdmin
withFlags(CacheContainerAdmin.AdminFlag... flags)
Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations.EmbeddedCacheManagerAdmin
withSubject(Subject subject)
Performs any cache manager operations using the specifiedSubject
.
-
-
-
Method Detail
-
createCache
public <K,V> Cache<K,V> createCache(String cacheName, Configuration configuration)
Description copied from interface:EmbeddedCacheManagerAdmin
Creates a cache across the cluster. The cache will survive topology changes, e.g. when a new node joins the cluster, it will automatically be created there. This method will wait for the cache to be created on all nodes before returning.- Specified by:
createCache
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Specified by:
createCache
in interfaceEmbeddedCacheManagerAdmin
- Type Parameters:
K
- the generic type of the keyV
- the generic type of the value- Parameters:
cacheName
- the name of the cacheconfiguration
- the configuration to use. It must be a clustered configuration (e.g. distributed)- Returns:
- the cache
-
getOrCreateCache
public <K,V> Cache<K,V> getOrCreateCache(String cacheName, Configuration configuration)
Description copied from interface:EmbeddedCacheManagerAdmin
Retrieves an existing cache or creates one across the cluster using the specified configuration. The cache will survive topology changes, e.g. when a new node joins the cluster, it will automatically be created there. This method will wait for the cache to be created on all nodes before returning.- Specified by:
getOrCreateCache
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Specified by:
getOrCreateCache
in interfaceEmbeddedCacheManagerAdmin
- Type Parameters:
K
- the generic type of the keyV
- the generic type of the value- Parameters:
cacheName
- the name of the cacheconfiguration
- the configuration to use. It must be a clustered configuration (e.g. distributed)- Returns:
- the cache
-
createCache
public <K,V> Cache<K,V> createCache(String cacheName, String template)
Description copied from interface:EmbeddedCacheManagerAdmin
Creates a cache on the container using the specified template.- Specified by:
createCache
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Specified by:
createCache
in interfaceEmbeddedCacheManagerAdmin
- Parameters:
cacheName
- the name of the cache to createtemplate
- the template to use for the cache. If null, the configuration marked as default on the container will be used- Returns:
- the cache
-
getOrCreateCache
public <K,V> Cache<K,V> getOrCreateCache(String cacheName, String template)
Description copied from interface:EmbeddedCacheManagerAdmin
Retrieves an existing cache or creates one using the specified template if it doesn't exist- Specified by:
getOrCreateCache
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Specified by:
getOrCreateCache
in interfaceEmbeddedCacheManagerAdmin
- Parameters:
cacheName
- the name of the cache to createtemplate
- the template to use for the cache. If null, the configuration marked as default on the container will be used- Returns:
- the cache
-
createTemplate
public void createTemplate(String name, Configuration configuration)
Description copied from interface:EmbeddedCacheManagerAdmin
Creates a template that is replicated across the cluster using the specified configuration. The template will survive topology changes, e.g. when a new node joins the cluster, it will automatically be created there. This method will wait for the template to be created on all nodes before returning.- Specified by:
createTemplate
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Specified by:
createTemplate
in interfaceEmbeddedCacheManagerAdmin
- Parameters:
name
- the name of the templateconfiguration
- the configuration to use. It must be a clustered configuration (e.g. distributed)
-
getOrCreateTemplate
public Configuration getOrCreateTemplate(String name, Configuration configuration)
Description copied from interface:EmbeddedCacheManagerAdmin
Retrieves an existing template or creates one across the cluster using the specified configuration. The template will survive topology changes, e.g. when a new node joins the cluster, it will automatically be created there. This method will wait for the template to be created on all nodes before returning.- Specified by:
getOrCreateTemplate
in interfaceEmbeddedCacheManagerAdmin
- Parameters:
name
- the name of the templateconfiguration
- the configuration to use. It must be a clustered configuration (e.g. distributed)- Returns:
- the template configuration
-
removeTemplate
public void removeTemplate(String name)
Description copied from interface:EmbeddedCacheManagerAdmin
Removes a template from the cache container. Any persisted data will be cleared.- Specified by:
removeTemplate
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Specified by:
removeTemplate
in interfaceEmbeddedCacheManagerAdmin
- Parameters:
name
- the name of the template to remove
-
removeCache
public void removeCache(String cacheName)
Description copied from interface:CacheContainerAdmin
Removes a cache from the cache container. Any persisted data will be cleared.- Specified by:
removeCache
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Parameters:
cacheName
- the name of the cache to remove
-
withFlags
public EmbeddedCacheManagerAdmin withFlags(CacheContainerAdmin.AdminFlag... flags)
Description copied from interface:CacheContainerAdmin
Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations. Note: whether an operation supports a certain flag or not is dependent on the configuration and environment. If a flag cannot be honored, the operation will fail with an exception.- Specified by:
withFlags
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Returns:
-
withFlags
public EmbeddedCacheManagerAdmin withFlags(EnumSet<CacheContainerAdmin.AdminFlag> flags)
Description copied from interface:CacheContainerAdmin
Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations. Note: whether an operation supports a certain flag or not is dependent on the configuration and environment. If a flag cannot be honored, the operation will fail with an exception.- Specified by:
withFlags
in interfaceCacheContainerAdmin<EmbeddedCacheManagerAdmin,Configuration>
- Returns:
-
withSubject
public EmbeddedCacheManagerAdmin withSubject(Subject subject)
Description copied from interface:EmbeddedCacheManagerAdmin
Performs any cache manager operations using the specifiedSubject
. Only applies to cache managers with authorization enabled (seeGlobalConfigurationBuilder.security()
.- Specified by:
withSubject
in interfaceEmbeddedCacheManagerAdmin
- Returns:
- an
EmbeddedCacheManagerAdmin
instance on which a real operation is to be invoked, using the specified subject
-
-