NASA World Wind

gov.nasa.worldwind.util
Class SessionCacheUtils

java.lang.Object
  extended by gov.nasa.worldwind.util.SessionCacheUtils

public class SessionCacheUtils
extends Object

A collection of utility methods for retrieving and managing data in the SessionCache.


Constructor Summary
SessionCacheUtils()
           
 
Method Summary
static Capabilities getOrRetrieveSessionCapabilities(URL url, RetrievalService retrievalService, SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName)
          Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a Capabilities document.
static Capabilities getSessionCapabilities(SessionCache cache, Object cacheKey, String name)
          Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a Capabilities document.
protected static InputStream inputStreamFromSource(Object source)
           
protected static Capabilities parseCapabilities(Object source, String name)
           
static void retrieveSessionData(URL url, RetrievalService retrievalService, SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName)
          Asynchronously retrieves the contents of a specified URL using a specified RetrievalService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionCacheUtils

public SessionCacheUtils()
Method Detail

getOrRetrieveSessionCapabilities

public static Capabilities getOrRetrieveSessionCapabilities(URL url,
                                                            RetrievalService retrievalService,
                                                            SessionCache cache,
                                                            Object cacheKey,
                                                            AbsentResourceList absentResourceList,
                                                            long resourceID,
                                                            PropertyChangeListener propertyListener,
                                                            String propertyName)
Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a Capabilities 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.
retrievalService - the retrieval service to use.
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:
IllegalArgumentException - if either the url, retrieval service, cache or cache key are null.

getSessionCapabilities

public static Capabilities getSessionCapabilities(SessionCache cache,
                                                  Object cacheKey,
                                                  String name)
Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a Capabilities 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:
IllegalArgumentException - if either the cache or cache key are null.

inputStreamFromSource

protected static InputStream inputStreamFromSource(Object source)

parseCapabilities

protected static Capabilities parseCapabilities(Object source,
                                                String name)

retrieveSessionData

public static void retrieveSessionData(URL url,
                                       RetrievalService retrievalService,
                                       SessionCache cache,
                                       Object cacheKey,
                                       AbsentResourceList absentResourceList,
                                       long resourceID,
                                       PropertyChangeListener propertyListener,
                                       String propertyName)
Asynchronously retrieves the contents of a specified URL using a specified RetrievalService. 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.
retrievalService - the retrieval service to use.
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:
IllegalArgumentException - if any of the url, retrieval service, cache, or cache key are null.

NASA World Wind

Hosted by docs.bugaco.com