NASA World Wind

gov.nasa.worldwind.util
Class SessionCacheRetrievalPostProcessor

java.lang.Object
  extended by gov.nasa.worldwind.util.SessionCacheRetrievalPostProcessor
All Implemented Interfaces:
RetrievalPostProcessor

public class SessionCacheRetrievalPostProcessor
extends Object
implements RetrievalPostProcessor

SessionCache inspects the results of a retrieval for success or failure. If the retrieval succeeded, this places the retrieved data in a specified session cache with a specified cache key, and marks the resource as available. If the retrieval failed, this logs the cause and marks the resource as missing. Finally, this optionally fires a property change event signalling that the retrieval is complete.


Constructor Summary
SessionCacheRetrievalPostProcessor(SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName)
          Constructs a SessionCachePostProcessor with a specified cache and cache key, and an optional property listener and property name.
 
Method Summary
 AbsentResourceList getAbsentResourceList()
          Returns the absent resource list that is updated when the retrieval completes.
 SessionCache getCache()
          Returns the session cache that receives the retrieved data.
 Object getCacheKey()
          Returns the cache key which identifies where the retrieved data is placed in the session cache.
 String getName()
          Returns this post processor's name, or null if this post processor doesn't have a name.
 PropertyChangeListener getPropertyListener()
          Returns the property change listener which is fired when the retrieved data is available.
 String getPropertyName()
          Returns the property name to use in the property change event fired when retrieved data is available.
 long getResourceID()
          Returns the resource ID to use in the absent resource list.
protected  void onRetrievalFailed(Retriever retriever)
           
protected  void onRetrievalSuceeded(Retriever retriever)
           
 ByteBuffer run(Retriever retriever)
          Inspect the results of a retrieval for success or failure.
 void setName(String name)
          Sets this post processor's name to a specified String value, or null to specify that the post processor does not have a name.
protected  void signalRetrievalComplete()
           
 String toString()
          If the post processor has a non-null String name, this returns that name.
protected  String validate(Retriever retriever)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SessionCacheRetrievalPostProcessor

public SessionCacheRetrievalPostProcessor(SessionCache cache,
                                          Object cacheKey,
                                          AbsentResourceList absentResourceList,
                                          long resourceID,
                                          PropertyChangeListener propertyListener,
                                          String propertyName)
Constructs a SessionCachePostProcessor with a specified cache and cache key, and an optional property listener and property name.

Parameters:
cache - cache that receives the retrieved data.
cacheKey - cache key to place the retrieved data under.
absentResourceList - the absent resource list to update.
resourceID - the resource ID to use in the absent resource list.
propertyListener - property listener to notify when the data is available. Can be null.
propertyName - property name to use for the property event when the data is available. Can be null.
Method Detail

getAbsentResourceList

public final AbsentResourceList getAbsentResourceList()
Returns the absent resource list that is updated when the retrieval completes.

Returns:
the absent resource list.

getCache

public final SessionCache getCache()
Returns the session cache that receives the retrieved data.

Returns:
the session cache that receives data.

getCacheKey

public final Object getCacheKey()
Returns the cache key which identifies where the retrieved data is placed in the session cache.

Returns:
cache key for the retrieved data.

getName

public String getName()
Returns this post processor's name, or null if this post processor doesn't have a name.

Returns:
this post processor's name. May be null.

getPropertyListener

public final PropertyChangeListener getPropertyListener()
Returns the property change listener which is fired when the retrieved data is available. A null value indicates that no property event is fired.

Returns:
property change listener to fire when retrieved data is available.

getPropertyName

public final String getPropertyName()
Returns the property name to use in the property change event fired when retrieved data is available. A null value indicates that no property event is fired.

Returns:
property name to fire when retrieved data is available.

getResourceID

public final long getResourceID()
Returns the resource ID to use in the absent resource list.

Returns:
resource ID to use in the absent resource list.

onRetrievalFailed

protected void onRetrievalFailed(Retriever retriever)

onRetrievalSuceeded

protected void onRetrievalSuceeded(Retriever retriever)

run

public ByteBuffer run(Retriever retriever)
Inspect the results of a retrieval for success or failure. If the retrieval succeeded, this places the retrieved data in the session cache with the specified cache key and marks the resource as available. If the retrieval failed, this logs the cause and marks the resource as missing. Finally, this optionally fires a property change event signalling that the retrieval is complete.

Specified by:
run in interface RetrievalPostProcessor
Parameters:
retriever - the Retriever which has either succeeded or failed in fetching the data.
Returns:
the retrieved data.

setName

public void setName(String name)
Sets this post processor's name to a specified String value, or null to specify that the post processor does not have a name.

Parameters:
name - this post processor's name. May be null.

signalRetrievalComplete

protected void signalRetrievalComplete()

toString

public String toString()
If the post processor has a non-null String name, this returns that name. Otherwise, this returns the superclass' toString().

Overrides:
toString in class Object
Returns:
String representation of this post processor.

validate

protected String validate(Retriever retriever)

NASA World Wind

Hosted by docs.bugaco.com