Class SessionCacheUtils


  • public class SessionCacheUtils
    extends java.lang.Object
    A collection of utility methods for retrieving and managing data in the SessionCache.
    • Constructor Detail

      • SessionCacheUtils

        public SessionCacheUtils()
    • Method Detail

      • retrieveSessionData

        public static void retrieveSessionData​(java.net.URL url,
                                               SessionCache cache,
                                               java.lang.Object cacheKey,
                                               AbsentResourceList absentResourceList,
                                               long resourceID,
                                               java.beans.PropertyChangeListener propertyListener,
                                               java.lang.String propertyName)
        Retrieves the contents of a specified URL. If successful, this places the URL contents in a specified session cache with a specified key. This either marks the resource as available or missing, depending on whether the retrieval succeeds or fails. Finally, this optionally notifies the caller that the retrieval has succeeded by firing a property change event. If either the property listener or property name are null, that functionality is disabled.
        Parameters:
        url - the URL contents to retrieve.
        cache - the cache which receives the retrieved data.
        cacheKey - the cache key which identifies where the retrieved data is placed in the session cache.
        absentResourceList - the absent resource list to update.
        resourceID - the resource ID to use in the absent resource list.
        propertyListener - the property change listener which is fired when the retrieved data is available.
        propertyName - the property name to fire when retrieved data is available.
        Throws:
        java.lang.IllegalArgumentException - if any of the url, retrieval service, cache, or cache key are null.
      • getSessionCapabilities

        public static WMSCapabilities getSessionCapabilities​(SessionCache cache,
                                                             java.lang.Object cacheKey,
                                                             java.lang.String name)
        Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a WMSCapabilities document. If the key does not exist in the cache, or the cache entry cannot be interpreted as a Capabilities document, this returns null. If the entry exists, but must be converted to a Capabilities document, this overrides the previous cache entry with the the newly converted Capabilities.
        Parameters:
        cache - the session cache.
        cacheKey - the key to identify the object in the session cache.
        name - the name to use in logging messages.
        Returns:
        the Capabilities document in the session cache, or null if either the key does not match an entry in the cache, or that entry cannot be interpreted as a Capabilities document.
        Throws:
        java.lang.IllegalArgumentException - if either the cache or cache key are null.
      • getOrRetrieveSessionCapabilities

        public static WMSCapabilities getOrRetrieveSessionCapabilities​(java.net.URL url,
                                                                       SessionCache cache,
                                                                       java.lang.Object cacheKey,
                                                                       AbsentResourceList absentResourceList,
                                                                       long resourceID,
                                                                       java.beans.PropertyChangeListener propertyListener,
                                                                       java.lang.String propertyName)
        Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a WMSCapabilities document. If the key does not map to a Capabilities document for any reason, this attempts to asynchronously retrieve the Capabilities from a specified URL, and returns null.
        Parameters:
        url - the URL contents to retrieve.
        cache - the session cache.
        cacheKey - the key to identify the object in the session cache.
        absentResourceList - the absent resource list to update.
        resourceID - the resource ID to use in the absent resource list.
        propertyListener - the property change listener which is fired when the retrieved data is available.
        propertyName - the property name to fire when retrieved data is available.
        Returns:
        the Capabilities document in the session cache, or null if the document is not in the cache.
        Throws:
        java.lang.IllegalArgumentException - if either the url, retrieval service, cache or cache key are null.