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 AbsentResourceList
absentResourceList
protected SessionCache
cache
protected java.lang.Object
cacheKey
protected java.lang.String
name
protected java.beans.PropertyChangeListener
propertyListener
protected java.lang.String
propertyName
protected long
resourceID
-
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 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.java.lang.Object
getCacheKey()
Returns the cache key which identifies where the retrieved data is placed in the session cache.java.lang.String
getName()
Returns this post processor's name, or null if this post processor doesn't have a name.java.beans.PropertyChangeListener
getPropertyListener()
Returns the property change listener which is fired when the retrieved data is available.java.lang.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
handleContent(Retriever retriever)
protected void
handleContentException(Retriever retriever, java.lang.Exception e)
protected void
handleUnknownContent(Retriever retriever)
protected void
handleWMSCapabilitiesContent(Retriever retriever)
protected void
onRetrievalFailed(Retriever retriever)
protected void
onRetrievalSuceeded(Retriever retriever)
java.nio.ByteBuffer
run(Retriever retriever)
Inspect the results of a retrieval for success or failure.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.protected void
signalRetrievalComplete()
java.lang.String
toString()
If the post processor has a non-null String name, this returns that name.protected java.lang.String
validate(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:
run
in 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:
toString
in classjava.lang.Object
- Returns:
- String representation of this post processor.
-
-