Package nl.nn.adapterframework.cache
Class CacheAdapterBase<V>
- java.lang.Object
-
- nl.nn.adapterframework.cache.CacheAdapterBase<V>
-
- All Implemented Interfaces:
ICache<String,V>
,IConfigurationAware
,IScopeProvider
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
EhCache
public abstract class CacheAdapterBase<V> extends Object implements ICache<String,V>, IConfigurationAware
Baseclass for caching. Provides key transformation functionality.- Since:
- 4.11
- Author:
- Gerrit van Brakel
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Constructor Description CacheAdapterBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(String ownerName)
V
get(String key)
Obtain a potentially cached value, set by put().org.springframework.context.ApplicationContext
getApplicationContext()
ClassLoader
getConfigurationClassLoader()
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.protected abstract V
getElement(String key)
String
getKeyInputSessionKey()
String
getKeyNamespaceDefs()
String
getKeyStyleSheet()
String
getKeyXPath()
TransformerPool.OutputType
getKeyXPathOutputType()
String
getLogPrefix()
String
getName()
String
getValueInputSessionKey()
String
getValueNamespaceDefs()
String
getValueStyleSheet()
String
getValueXPath()
TransformerPool.OutputType
getValueXPathOutputType()
boolean
isCacheEmptyKeys()
boolean
isCacheEmptyValues()
void
put(String key, V value)
store a value in the cache, that can be retrieved later using get().protected abstract void
putElement(String key, V value)
boolean
remove(String key)
protected abstract boolean
removeElement(Object key)
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setCacheEmptyKeys(boolean cacheEmptyKeys)
controls whether empty keys are used for caching.void
setCacheEmptyValues(boolean cacheEmptyValues)
controls whether empty values will be cached.void
setKeyInputSessionKey(String keyInputSessionKey)
session key to use as input for transformation of request message to key by keyxpath or keystylesheetvoid
setKeyNamespaceDefs(String keyNamespaceDefs)
namespace defintions for keyxpath.void
setKeyStyleSheet(String keyStyleSheet)
stylesheet to extract cache key from request message.void
setKeyXPath(String keyXPath)
xpath expression to extract cache key from request messagevoid
setKeyXPathOutputType(TransformerPool.OutputType keyXPathOutputType)
output type of xpath expression to extract cache key from request messagevoid
setName(String name)
name of the cache, will be lowercasedvoid
setValueInputSessionKey(String valueInputSessionKey)
session key to use as input for transformation of response message to cached value by valuexpath or valuestylesheetvoid
setValueNamespaceDefs(String valueNamespaceDefs)
namespace defintions for valuexpath.void
setValueStyleSheet(String valueStyleSheet)
stylesheet to extract value to be cached from response messagevoid
setValueXPath(String valueXPath)
xpath expression to extract value to be cached key from response message.void
setValueXPathOutputType(TransformerPool.OutputType valueXPathOutputType)
protected abstract V
toValue(Message value)
String
transformKey(String input, PipeLineSession session)
Transform the the current request message to a key in the cache-map.V
transformValue(Message value, PipeLineSession session)
Transform the the current response message to a value in the cache-map.
-
-
-
Method Detail
-
configure
public void configure(String ownerName) throws ConfigurationException
- Specified by:
configure
in interfaceICache<String,V>
- Throws:
ConfigurationException
-
removeElement
protected abstract boolean removeElement(Object key)
-
transformKey
public String transformKey(String input, PipeLineSession session)
Description copied from interface:ICache
Transform the the current request message to a key in the cache-map. Allows for instance XPath translations.- Specified by:
transformKey
in interfaceICache<String,V>
-
transformValue
public V transformValue(Message value, PipeLineSession session)
Description copied from interface:ICache
Transform the the current response message to a value in the cache-map. Allows for instance XPath translations.- Specified by:
transformValue
in interfaceICache<String,V>
-
get
public V get(String key)
Description copied from interface:ICache
Obtain a potentially cached value, set by put().
-
put
public void put(String key, V value)
Description copied from interface:ICache
store a value in the cache, that can be retrieved later using get().
-
remove
public boolean remove(String key)
-
setName
public void setName(String name)
name of the cache, will be lowercased- Default value
<ownerName>
_cache
-
getLogPrefix
public String getLogPrefix()
-
setKeyXPath
public void setKeyXPath(String keyXPath)
xpath expression to extract cache key from request message
-
setKeyXPathOutputType
public void setKeyXPathOutputType(TransformerPool.OutputType keyXPathOutputType)
output type of xpath expression to extract cache key from request message- Default value
- text
-
setKeyNamespaceDefs
public void setKeyNamespaceDefs(String keyNamespaceDefs)
namespace defintions for keyxpath. must be in the form of a comma or space separated list ofprefix=namespaceuri
-definitions
-
setKeyStyleSheet
public void setKeyStyleSheet(String keyStyleSheet)
stylesheet to extract cache key from request message. Use in combination withcacheEmptyKeys
to inhibit caching for certain groups of request messages
-
setKeyInputSessionKey
public void setKeyInputSessionKey(String keyInputSessionKey)
session key to use as input for transformation of request message to key by keyxpath or keystylesheet
-
setCacheEmptyKeys
public void setCacheEmptyKeys(boolean cacheEmptyKeys)
controls whether empty keys are used for caching. when set true, cache entries with empty keys can exist.- Default value
- false
-
setValueXPath
public void setValueXPath(String valueXPath)
xpath expression to extract value to be cached key from response message. Use in combination withcacheEmptyValues
to inhibit caching for certain groups of response messages
-
setValueXPathOutputType
public void setValueXPathOutputType(TransformerPool.OutputType valueXPathOutputType)
-
setValueNamespaceDefs
public void setValueNamespaceDefs(String valueNamespaceDefs)
namespace defintions for valuexpath. must be in the form of a comma or space separated list ofprefix=namespaceuri
-definitions
-
setValueStyleSheet
public void setValueStyleSheet(String valueStyleSheet)
stylesheet to extract value to be cached from response message
-
setValueInputSessionKey
public void setValueInputSessionKey(String valueInputSessionKey)
session key to use as input for transformation of response message to cached value by valuexpath or valuestylesheet
-
setCacheEmptyValues
public void setCacheEmptyValues(boolean cacheEmptyValues)
controls whether empty values will be cached. when set true, empty cache entries can exist for any key.- Default value
- false
-
getConfigurationClassLoader
public ClassLoader getConfigurationClassLoader()
Description copied from interface:IScopeProvider
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.- Specified by:
getConfigurationClassLoader
in interfaceIScopeProvider
- Returns:
- returns the ClassLoader created by the
ClassLoaderManager
.
-
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext()
- Specified by:
getApplicationContext
in interfaceIConfigurationAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
getName
public String getName()
- Specified by:
getName
in interfaceIConfigurationAware
-
getKeyXPath
public String getKeyXPath()
-
getKeyXPathOutputType
public TransformerPool.OutputType getKeyXPathOutputType()
-
getKeyNamespaceDefs
public String getKeyNamespaceDefs()
-
getKeyStyleSheet
public String getKeyStyleSheet()
-
getKeyInputSessionKey
public String getKeyInputSessionKey()
-
isCacheEmptyKeys
public boolean isCacheEmptyKeys()
-
getValueXPath
public String getValueXPath()
-
getValueXPathOutputType
public TransformerPool.OutputType getValueXPathOutputType()
-
getValueNamespaceDefs
public String getValueNamespaceDefs()
-
getValueStyleSheet
public String getValueStyleSheet()
-
getValueInputSessionKey
public String getValueInputSessionKey()
-
isCacheEmptyValues
public boolean isCacheEmptyValues()
-
-