gov.nasa.pds.transport
Class AbstractPdsGetHandler

java.lang.Object
  extended by gov.nasa.pds.transport.AbstractPdsGetHandler
All Implemented Interfaces:
org.apache.oodt.product.handlers.ofsn.metadata.OFSNMetKeys, org.apache.oodt.product.handlers.ofsn.OFSNGetHandler
Direct Known Subclasses:
Pds4TransformerHandler, PdsLabelHandler, ZipFileHandler, ZipSizeFileHandler

public abstract class AbstractPdsGetHandler
extends Object
implements org.apache.oodt.product.handlers.ofsn.OFSNGetHandler, org.apache.oodt.product.handlers.ofsn.metadata.OFSNMetKeys

Abstract superclass of OFSN handlers that generate PDS products. Each subclass should: 1) define the mime type of the output file it generates, specified in the handler XML configuration 2) implement the specific process to generate the output file from the input file in the method getOutputFile()

Author:
Luca Cinquini

Field Summary
protected static Logger LOG
           
 
Fields inherited from interface org.apache.oodt.product.handlers.ofsn.metadata.OFSNMetKeys
GET_CMD, LISTING_CMD, OFSN_COMPUTE_DIR_SIZE, OFSN_COMPUTE_FILE_SIZE, OFSN_XML_CONF_FILE_KEY
 
Constructor Summary
AbstractPdsGetHandler()
           
 
Method Summary
 void configure(Properties properties)
          Configuration method sets the temporary cache directory.
protected  File getCache()
          Returns the directory where products are created.
protected  org.apache.oodt.product.handlers.ofsn.OFSNFileHandlerConfiguration getConfiguration()
          Returns the overall configuration read from file 'ofsn-ps.xml'.
protected abstract  File getOutputFile(String inputFilePath)
          Method to generate the requested product from the given target.
 byte[] retrieveChunk(String inputFilePath, long offset, int length)
          Method that returns the generated product, piece by piece.
 long sizeOf(String inputFilePath)
          Method to establish the size of the product to be returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final Logger LOG
Constructor Detail

AbstractPdsGetHandler

public AbstractPdsGetHandler()
Method Detail

configure

public void configure(Properties properties)
Configuration method sets the temporary cache directory. Overriding subclasses should also invoke this superclass method.

Specified by:
configure in interface org.apache.oodt.product.handlers.ofsn.OFSNGetHandler

retrieveChunk

public byte[] retrieveChunk(String inputFilePath,
                            long offset,
                            int length)
                     throws org.apache.oodt.product.ProductException
Method that returns the generated product, piece by piece. Invoked after the size of the product has been determined.

Specified by:
retrieveChunk in interface org.apache.oodt.product.handlers.ofsn.OFSNGetHandler
Throws:
org.apache.oodt.product.ProductException

sizeOf

public long sizeOf(String inputFilePath)
Method to establish the size of the product to be returned. This method implicitly triggers the creation of the product.

Specified by:
sizeOf in interface org.apache.oodt.product.handlers.ofsn.OFSNGetHandler

getCache

protected File getCache()
Returns the directory where products are created.

Returns:

getConfiguration

protected org.apache.oodt.product.handlers.ofsn.OFSNFileHandlerConfiguration getConfiguration()
Returns the overall configuration read from file 'ofsn-ps.xml'.

Returns:

getOutputFile

protected abstract File getOutputFile(String inputFilePath)
                               throws org.apache.oodt.product.ProductException
Method to generate the requested product from the given target. Must be implemented by subclasses.

Parameters:
inputFile -
Returns:
outputFile
Throws:
org.apache.oodt.product.ProductException


Copyright © 2010-2014 Planetary Data System. All Rights Reserved.