Interface XmlaOlap4jCache

  • All Known Implementing Classes:
    XmlaOlap4jNamedMemoryCache

    public interface XmlaOlap4jCache
    XMLA driver cache. Implementations will have to declare those methods.

    The XMLA driver will call the cache before each SOAP request to see if it wasn't sent previously and if a SOAP response doesn't already exist in it.

    Any implementations have to declare a constructor which takes a String as a parameter. This string value is the unique name of the connection which triggered the request.

    Author:
    Luc Boudreau
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void flushCache()
      Tells the cache to flush all cached entries.
      byte[] get​(java.lang.String id, java.net.URL url, byte[] request)
      Fetches a SOAP response from the cache.
      void put​(java.lang.String id, java.net.URL url, byte[] request, byte[] response)
      Adds a SOAP response to the cache.
      java.lang.String setParameters​(java.util.Map<java.lang.String,​java.lang.String> config, java.util.Map<java.lang.String,​java.lang.String> props)
      Convenience method to receive custom properties.
    • Method Detail

      • get

        byte[] get​(java.lang.String id,
                   java.net.URL url,
                   byte[] request)
            throws OlapException
        Fetches a SOAP response from the cache. Returns null if there are no cached response corresponding to the SOAP message and the URL.
        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:
        OlapException - when operations to the cache are performed but it hasn't been initialized. Make sure you call the setParameters(Map, Map) method.
      • put

        void put​(java.lang.String id,
                 java.net.URL url,
                 byte[] request,
                 byte[] response)
          throws OlapException
        Adds a SOAP response to the cache. It has to be relative to the URL of the SOAP service.
        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:
        OlapException - when operations to the cache are performed but it hasn't been initialized. Make sure you call the setParameters(Map, Map) method.
      • flushCache

        void flushCache()
        Tells the cache to flush all cached entries.
      • setParameters

        java.lang.String setParameters​(java.util.Map<java.lang.String,​java.lang.String> config,
                                       java.util.Map<java.lang.String,​java.lang.String> props)
        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.

        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.