Class PassThroughCacheConfiguration<K,V>
- java.lang.Object
-
- com.tangosol.coherence.jcache.passthroughcache.PassThroughCacheConfiguration<K,V>
-
- Type Parameters:
K
- the type of theCache
keysV
- the type of theCache
values
- All Implemented Interfaces:
CoherenceBasedConfiguration<K,V>
,Serializable
,javax.cache.configuration.Configuration<K,V>
public class PassThroughCacheConfiguration<K,V> extends Object implements CoherenceBasedConfiguration<K,V>
AConfiguration
for aCache
based on an existing CoherenceNamedCache
.Cache
s produced according to this configuration are not expected to be JCache-compliant. They simply provide a JCache interface (aka: wrapper) over native CoherenceNamedCache
s.- Since:
- Coherence 12.1.3
- Author:
- bo 2013.10.23
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PassThroughCacheConfiguration()
Constructs aPassThroughCacheConfiguration
that defaults to using theCache
name as the underlyingNamedCache
name with Object-based key and value types.PassThroughCacheConfiguration(PassThroughCacheConfiguration<K,V> configuration)
Constructs aPassThroughCacheConfiguration
based on a providedPassThroughCacheConfiguration
.PassThroughCacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> configuration)
Constructs a PassThroughConfiguration based on a JCacheCompleteConfiguration
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoherenceBasedCache<K,V>
createCache(CoherenceBasedCacheManager manager, String sJCacheName)
Creates aCoherenceBasedCache
based on the current state of theCoherenceBasedConfiguration
, to be owned by the specifiedCoherenceBasedCacheManager
.void
destroyCache(CoherenceBasedCacheManager manager, String name)
Destroy aCoherenceBasedCache
implementation.Class<K>
getKeyType()
String
getNamedCacheName()
Obtains the desired mapping of a JCacheCache
name to an CoherenceNamedCache
.Class<V>
getValueType()
boolean
isStoreByValue()
PassThroughCacheConfiguration<K,V>
setNamedCacheName(String sNamedCacheName)
Sets the desired CoherenceNamedCache
name to map to when specifying a JCacheCache
namePassThroughCacheConfiguration<K,V>
setTypes(Class<K> clzKey, Class<V> clzValue)
Sets the expected type of keys and values for aPassThroughCache
configured with thisConfiguration
.
-
-
-
Constructor Detail
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration()
Constructs aPassThroughCacheConfiguration
that defaults to using theCache
name as the underlyingNamedCache
name with Object-based key and value types.
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> configuration)
Constructs a PassThroughConfiguration based on a JCacheCompleteConfiguration
.WARNING: This is a lossy construction and a warning will be emitted when this method is called. Most
CompleteConfiguration
properties are ignored. Native Coherence configuration must be used when usingPassThroughCache
;- Parameters:
configuration
- configuration properties of a JCacheCompleteConfiguration
. Note most of these properties are ignored.
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration(PassThroughCacheConfiguration<K,V> configuration)
Constructs aPassThroughCacheConfiguration
based on a providedPassThroughCacheConfiguration
.- Parameters:
configuration
- thePassThroughCacheConfiguration
-
-
Method Detail
-
setNamedCacheName
public PassThroughCacheConfiguration<K,V> setNamedCacheName(String sNamedCacheName)
Sets the desired CoherenceNamedCache
name to map to when specifying a JCacheCache
name- Parameters:
sNamedCacheName
- the desiredNamedCache
(ornull
to default to the JCache name)- Returns:
- the
PassThroughCacheConfiguration
to support fluent-style calls
-
getNamedCacheName
public String getNamedCacheName()
Obtains the desired mapping of a JCacheCache
name to an CoherenceNamedCache
.- Returns:
- the
NamedCache
name to use
-
setTypes
public PassThroughCacheConfiguration<K,V> setTypes(Class<K> clzKey, Class<V> clzValue)
Sets the expected type of keys and values for aPassThroughCache
configured with thisConfiguration
. Setting both toObject.class
means type-safety checks are not required (which is the default)- Parameters:
clzKey
- the expected key typeclzValue
- the expected value type- Returns:
- the
PassThroughCacheConfiguration
to permit fluent-style method calls - Throws:
NullPointerException
- should the key or value type be null
-
isStoreByValue
public boolean isStoreByValue()
-
createCache
public CoherenceBasedCache<K,V> createCache(CoherenceBasedCacheManager manager, String sJCacheName) throws IllegalArgumentException
Description copied from interface:CoherenceBasedConfiguration
Creates aCoherenceBasedCache
based on the current state of theCoherenceBasedConfiguration
, to be owned by the specifiedCoherenceBasedCacheManager
.- Specified by:
createCache
in interfaceCoherenceBasedConfiguration<K,V>
- Parameters:
manager
- the owningCoherenceBasedCacheManager
sJCacheName
- the name of theCache
to be configured- Returns:
- a
CoherenceBasedCache
- Throws:
IllegalArgumentException
- when aCache
can't be created based on the currentCoherenceBasedConfiguration
-
destroyCache
public void destroyCache(CoherenceBasedCacheManager manager, String name)
Description copied from interface:CoherenceBasedConfiguration
Destroy aCoherenceBasedCache
implementation.- Specified by:
destroyCache
in interfaceCoherenceBasedConfiguration<K,V>
- Parameters:
manager
- the owningCoherenceBasedCacheManager
name
- the name of theCache
to be destroyed
-
-