NASA World Wind

gov.nasa.worldwind.cache
Class BasicDataFileStore.PostProcessor

java.lang.Object
  extended by gov.nasa.worldwind.retrieve.AbstractRetrievalPostProcessor
      extended by gov.nasa.worldwind.cache.BasicDataFileStore.PostProcessor
All Implemented Interfaces:
RetrievalPostProcessor
Enclosing class:
BasicDataFileStore

protected class BasicDataFileStore.PostProcessor
extends AbstractRetrievalPostProcessor


Field Summary
protected  String address
           
protected  URL localFileUrl
           
protected  File outputFile
           
protected  URL retrievalUrl
           
protected  boolean saveInLocalCache
           
 
Fields inherited from class gov.nasa.worldwind.retrieve.AbstractRetrievalPostProcessor
avList, retriever
 
Constructor Summary
BasicDataFileStore.PostProcessor(String address, URL url, boolean saveInLocalCache)
           
 
Method Summary
protected  File doGetOutputFile()
          Abstract method that subclasses must provide to identify the output file for the post-processor's retrieval content.
protected  ByteBuffer handleSuccessfulRetrieval()
          Process the retrieved data if it has been retrieved successfully.
protected  ByteBuffer handleTextContent()
          Handles Text content.
protected  File makeOutputFile()
           
protected  void markResourceAbsent()
          Marks the retrieval target absent.
protected  boolean overwriteExistingFile()
          Indicates whether the retrieved data should be written to the output file if a file of the same name already exists.
protected  boolean saveBuffer()
          Saves the retrieved and possibly transformed data.
 
Methods inherited from class gov.nasa.worldwind.retrieve.AbstractRetrievalPostProcessor
convertToDDS, getFileLock, getOutputFile, getRetriever, handleApplicationContent, handleContent, handleContentException, handleHTMLContent, handleImageContent, handleInvalidResponseCode, handleUnknownContentType, handleUnsuccessfulRetrieval, handleWMSExceptionContent, handleXMLContent, handleZipContent, isDeleteOnExit, isPrimaryContentType, isWMSException, logTextBuffer, run, saveBuffer, saveDDS, transformPixels, validateHTTPResponseCode, validateJarResponseCode, validateResponseCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

address

protected String address

localFileUrl

protected URL localFileUrl

outputFile

protected File outputFile

retrievalUrl

protected URL retrievalUrl

saveInLocalCache

protected boolean saveInLocalCache
Constructor Detail

BasicDataFileStore.PostProcessor

public BasicDataFileStore.PostProcessor(String address,
                                        URL url,
                                        boolean saveInLocalCache)
Method Detail

doGetOutputFile

protected File doGetOutputFile()
Description copied from class: AbstractRetrievalPostProcessor
Abstract method that subclasses must provide to identify the output file for the post-processor's retrieval content.

Specified by:
doGetOutputFile in class AbstractRetrievalPostProcessor
Returns:
the output file.

handleSuccessfulRetrieval

protected ByteBuffer handleSuccessfulRetrieval()
Description copied from class: AbstractRetrievalPostProcessor
Process the retrieved data if it has been retrieved successfully.

Overrides:
handleSuccessfulRetrieval in class AbstractRetrievalPostProcessor
Returns:
a buffer containing the downloaded data, perhaps converted during content handling.

handleTextContent

protected ByteBuffer handleTextContent()
                                throws IOException
Handles Text content. If the content type is text/xml, AbstractRetrievalPostProcessor.handleXMLContent() is called. If the content type is text/html, AbstractRetrievalPostProcessor.handleHTMLContent() is called. For all other sub-types the content is logged as a message with level Level.SEVERE. Overridden to save text files in the cache.

Overrides:
handleTextContent in class AbstractRetrievalPostProcessor
Returns:
a buffer containing the retrieved text.
Throws:
IOException - if an IO error occurs while processing the data.

makeOutputFile

protected File makeOutputFile()

markResourceAbsent

protected void markResourceAbsent()
Description copied from class: AbstractRetrievalPostProcessor
Marks the retrieval target absent. Subclasses should override this method if they keep track of absent-resources. The default implementation does nothing.

Overrides:
markResourceAbsent in class AbstractRetrievalPostProcessor

overwriteExistingFile

protected boolean overwriteExistingFile()
Description copied from class: AbstractRetrievalPostProcessor
Indicates whether the retrieved data should be written to the output file if a file of the same name already exists. The default implementation of this method returns false (files are not overwritten).

Overrides:
overwriteExistingFile in class AbstractRetrievalPostProcessor
Returns:
true if an existing file should be overwritten, otherwise false.

saveBuffer

protected boolean saveBuffer()
                      throws IOException
Description copied from class: AbstractRetrievalPostProcessor
Saves the retrieved and possibly transformed data. The data may have been transformed during content handling.

The default implementation of this method simply calls AbstractRetrievalPostProcessor.saveBuffer(java.nio.ByteBuffer) with an argument of null.

Overrides:
saveBuffer in class AbstractRetrievalPostProcessor
Returns:
true if the buffer was saved, false if the output file could not be determined or already exists and not overwritten.
Throws:
IOException - if an IO error occurs while attempting to save the buffer.

NASA World Wind