Package gov.nasa.worldwind.util
Class SessionCacheRetrievalPostProcessor
- java.lang.Object
-
- gov.nasa.worldwind.util.SessionCacheRetrievalPostProcessor
-
- All Implemented Interfaces:
RetrievalPostProcessor
public class SessionCacheRetrievalPostProcessor extends java.lang.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected AbsentResourceListabsentResourceListprotected SessionCachecacheprotected java.lang.ObjectcacheKeyprotected java.lang.Stringnameprotected java.beans.PropertyChangeListenerpropertyListenerprotected java.lang.StringpropertyNameprotected longresourceID
-
Constructor Summary
Constructors Constructor Description SessionCacheRetrievalPostProcessor(SessionCache cache, java.lang.Object cacheKey, AbsentResourceList absentResourceList, long resourceID, java.beans.PropertyChangeListener propertyListener, java.lang.String propertyName)Constructs a SessionCachePostProcessor with a specified cache and cache key, and an optional property listener and property name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbsentResourceListgetAbsentResourceList()Returns the absent resource list that is updated when the retrieval completes.SessionCachegetCache()Returns the session cache that receives the retrieved data.java.lang.ObjectgetCacheKey()Returns the cache key which identifies where the retrieved data is placed in the session cache.java.lang.StringgetName()Returns this post processor's name, or null if this post processor doesn't have a name.java.beans.PropertyChangeListenergetPropertyListener()Returns the property change listener which is fired when the retrieved data is available.java.lang.StringgetPropertyName()Returns the property name to use in the property change event fired when retrieved data is available.longgetResourceID()Returns the resource ID to use in the absent resource list.protected voidhandleContent(Retriever retriever)protected voidhandleContentException(Retriever retriever, java.lang.Exception e)protected voidhandleUnknownContent(Retriever retriever)protected voidhandleWMSCapabilitiesContent(Retriever retriever)protected voidonRetrievalFailed(Retriever retriever)protected voidonRetrievalSuceeded(Retriever retriever)java.nio.ByteBufferrun(Retriever retriever)Inspect the results of a retrieval for success or failure.voidsetName(java.lang.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 voidsignalRetrievalComplete()java.lang.StringtoString()If the post processor has a non-null String name, this returns that name.protected java.lang.Stringvalidate(Retriever retriever)
-
-
-
Field Detail
-
name
protected java.lang.String name
-
cache
protected final SessionCache cache
-
cacheKey
protected final java.lang.Object cacheKey
-
absentResourceList
protected final AbsentResourceList absentResourceList
-
resourceID
protected final long resourceID
-
propertyListener
protected final java.beans.PropertyChangeListener propertyListener
-
propertyName
protected final java.lang.String propertyName
-
-
Constructor Detail
-
SessionCacheRetrievalPostProcessor
public SessionCacheRetrievalPostProcessor(SessionCache cache, java.lang.Object cacheKey, AbsentResourceList absentResourceList, long resourceID, java.beans.PropertyChangeListener propertyListener, java.lang.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
-
getName
public java.lang.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.
-
setName
public void setName(java.lang.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.
-
getCache
public final SessionCache getCache()
Returns the session cache that receives the retrieved data.- Returns:
- the session cache that receives data.
-
getCacheKey
public final java.lang.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.
-
getAbsentResourceList
public final AbsentResourceList getAbsentResourceList()
Returns the absent resource list that is updated when the retrieval completes.- Returns:
- the absent resource list.
-
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.
-
getPropertyListener
public final java.beans.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 java.lang.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.
-
run
public java.nio.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:
runin interfaceRetrievalPostProcessor- Parameters:
retriever- the Retriever which has either succeeded or failed in fetching the data.- Returns:
- the retrieved data.
-
onRetrievalSuceeded
protected void onRetrievalSuceeded(Retriever retriever)
-
onRetrievalFailed
protected void onRetrievalFailed(Retriever retriever)
-
validate
protected java.lang.String validate(Retriever retriever)
-
signalRetrievalComplete
protected void signalRetrievalComplete()
-
handleContent
protected void handleContent(Retriever retriever) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleWMSCapabilitiesContent
protected void handleWMSCapabilitiesContent(Retriever retriever) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleUnknownContent
protected void handleUnknownContent(Retriever retriever) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleContentException
protected void handleContentException(Retriever retriever, java.lang.Exception e)
-
toString
public java.lang.String toString()
If the post processor has a non-null String name, this returns that name. Otherwise, this returns the superclass' toString().- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation of this post processor.
-
-