org.olap4j.driver.xmla.cache
Class XmlaOlap4jNamedMemoryCache

java.lang.Object
  extended by org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache
All Implemented Interfaces:
XmlaOlap4jCache

public class XmlaOlap4jNamedMemoryCache
extends Object
implements XmlaOlap4jCache

Implementation of the XMLA SOAP cache that places its cache entries in memory for later use. It is thread safe and at static class level.

It supports cache sharing through the Name property.

All parameters are optional.

Version:
$Id: XmlaOlap4jNamedMemoryCache.java 482 2012-01-05 23:27:27Z jhyde $
See Also:
XmlaOlap4jNamedMemoryCache.Property

Nested Class Summary
static class XmlaOlap4jNamedMemoryCache.Mode
          Defines the supported eviction modes.
static class XmlaOlap4jNamedMemoryCache.Property
          Properties which will be considered for configuration.
 
Constructor Summary
XmlaOlap4jNamedMemoryCache()
          Default constructor which instantiates the concurrent hash map.
 
Method Summary
 void flushCache()
          Tells the cache to flush all cached entries.
 byte[] get(String id, URL url, byte[] request)
          Fetches a SOAP response from the cache.
 void put(String id, URL url, byte[] request, byte[] response)
          Adds a SOAP response to the cache.
 String setParameters(Map<String,String> config, Map<String,String> props)
          Convenience method to receive custom properties.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlaOlap4jNamedMemoryCache

public XmlaOlap4jNamedMemoryCache()
Default constructor which instantiates the concurrent hash map.

Method Detail

setParameters

public String setParameters(Map<String,String> config,
                            Map<String,String> props)
Description copied from interface: XmlaOlap4jCache
Convenience method to receive custom properties.

The XMLA driver takes cache properties as "Cache.[property name]=[value]" in its JDBC url. All those properties should be striped of their "Cache." prefix and sent to this method as the props parameter.

Also, the complete map of the current connection should be passed as the config parameter.

Specified by:
setParameters in interface XmlaOlap4jCache
Parameters:
config - The complete configuration parameters which were used to create the current connection.
props - The properties received from the JDBC url.
Returns:
Returns a string object which gives a reference id to the caller for future use. This id has to be passed along with any future get and put requests.

get

public byte[] get(String id,
                  URL url,
                  byte[] request)
           throws XmlaOlap4jInvalidStateException
Description copied from interface: XmlaOlap4jCache
Fetches a SOAP response from the cache. Returns null if there are no cached response corresponding to the SOAP message and the URL.

Specified by:
get in interface XmlaOlap4jCache
Parameters:
id - The connection unique name which called this cache.
url - The URL where the SOAP message was sent.
request - The SOAP complete message.
Returns:
The SOAP response, null if there are no corresponding response in the cache.
Throws:
XmlaOlap4jInvalidStateException

put

public void put(String id,
                URL url,
                byte[] request,
                byte[] response)
         throws XmlaOlap4jInvalidStateException
Description copied from interface: XmlaOlap4jCache
Adds a SOAP response to the cache. It has to be relative to the URL of the SOAP service.

Specified by:
put in interface XmlaOlap4jCache
Parameters:
id - The connection unique name which called this cache.
url - The URL of the SOAP endpoint.
request - The full SOAP message from which we want to cache its response.
response - The response to cache.
Throws:
XmlaOlap4jInvalidStateException

flushCache

public void flushCache()
Description copied from interface: XmlaOlap4jCache
Tells the cache to flush all cached entries.

Specified by:
flushCache in interface XmlaOlap4jCache

SourceForge.net_Logo