Package de.dlr.proseo.basewrap
Class BaseWrapper
java.lang.Object
de.dlr.proseo.basewrap.BaseWrapper
prosEO Base Processor Wrapper - for processors conforming to ESA's "Generic
IPF Interface Specification" (MMFI-GSEG-EOPG-TN-07-0003, V.1.8)
- Author:
- Hubert Asamer, Dr. Thomas Bassler *
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumEnumeration with valid environment variable names (available for wrapper subclasses).static classClass for raising wrapper-generated runtime exceptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringAuto-created path/filename of JobOrderFile within container (according to Generic IPF Interface Specifications)protected static final StringDirectory prefix of produced output data (available for wrapper subclasses)protected StringVariables to control max cycles and wait time to check file size of fetched input filesprotected Stringprotected StringHTTP endpoint for Ingestor callback (available for wrapper subclasses)protected StringThe Job Order File format version to be usedprotected StringMount point of shared local file system (available for wrapper subclasses)protected StringName of the Processing Facility this wrapper is running in (available for wrapper subclasses)protected StringShell command to run the processor (with path to Job Order File as sole parameter)protected StringPassword for prosEO Control Instance (available for wrapper subclasses)protected StringUser name for prosEO Control Instance (available for wrapper subclasses)protected static final intOrder ID for job order file (according to Generic IPF Interface Specifications, sec. 4.2.2); limited to 31 bits (int), because some IPFs cannot handle larger order IDs (apparently they take the word "integer" literally)protected Stringprotected static final longDeprecated.protected StringDirectory for temporary/output files created by this wrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IngestorProductcreateIngestorProduct(Path outputFilePath) Create a REST interface product for product ingestion from the given output file path; sets attributes mountPoint, filePath, productFileName, fileSize, checksum and checksumTimeprotected StringextractProseoMessage(HttpResponseInfo responseInfo) Extracts the prosEO-compliant message from the "Warning" header, if anyprotected voidingestProduct(IngestorProduct product) Ingest the given product into the prosEO metadata database and into the backend storagestatic voidMain routine: Run BaseWrapperprotected voidpostFetchInputHook(JobOrder jobOrderDoc) Hook for mission-specific modifications to the job order document after fetching input data Intended for override by mission-specific wrapper classes, NO-OP in BaseWrapper.protected voidpostProcessingHook(JobOrder joWork) Hook for mission-specific modifications to the final job order document after execution of the processor (before push of results).protected voidpreFetchInputHook(JobOrder jobOrderDoc) Hook for mission-specific modifications to the job order document before fetching input data Intended for override by mission-specific wrapper classes, NO-OP in BaseWrapper.protected RestProductretrieveProductMetadata(InputOutput output) Get the product metadata for a given output elementfinal intrun()Perform processing: check parameters, parse JobOrder file, fetch input files, process, push output filesprotected voidupdateProductMetadata(InputOutput output, RestProduct productMetadata) Update the metadata for the product denoted in the given output element
-
Field Details
-
JOB_ORDER_ID
protected static final int JOB_ORDER_IDOrder ID for job order file (according to Generic IPF Interface Specifications, sec. 4.2.2); limited to 31 bits (int), because some IPFs cannot handle larger order IDs (apparently they take the word "integer" literally) -
WRAPPER_TIMESTAMP
Deprecated.Current timestamp used for output-file prefixes -
CONTAINER_JOF_PATH
Auto-created path/filename of JobOrderFile within container (according to Generic IPF Interface Specifications) -
REL_CONTAINER_JOF_PATH
-
CONTAINER_OUTPUTS_PATH_PREFIX
Directory prefix of produced output data (available for wrapper subclasses) -
ENV_JOBORDER_VERSION
The Job Order File format version to be used -
ENV_LOCAL_FS_MOUNT
Mount point of shared local file system (available for wrapper subclasses) -
wrapperDataDirectory
Directory for temporary/output files created by this wrapper -
ENV_PROSEO_USER
User name for prosEO Control Instance (available for wrapper subclasses) -
ENV_PROSEO_PW
Password for prosEO Control Instance (available for wrapper subclasses) -
ENV_FILECHECK_MAX_CYCLES
Variables to control max cycles and wait time to check file size of fetched input files -
ENV_FILECHECK_WAIT_TIME
-
ENV_PROCESSING_FACILITY_NAME
Name of the Processing Facility this wrapper is running in (available for wrapper subclasses) -
ENV_INGESTOR_ENDPOINT
HTTP endpoint for Ingestor callback (available for wrapper subclasses) -
ENV_PROCESSOR_SHELL_COMMAND
Shell command to run the processor (with path to Job Order File as sole parameter)
-
-
Constructor Details
-
BaseWrapper
public BaseWrapper()
-
-
Method Details
-
extractProseoMessage
Extracts the prosEO-compliant message from the "Warning" header, if any- Parameters:
responseInfo- the response info object received from RestOps::restApiCall- Returns:
- the prosEO-compliant message, if there is one, or the unchanged warning header, if there is one, or null otherwise
-
retrieveProductMetadata
protected RestProduct retrieveProductMetadata(InputOutput output) throws BaseWrapper.WrapperException Get the product metadata for a given output element- Parameters:
output- the output element from the Job Order file to get the metadata for- Returns:
- a REST interface product
- Throws:
BaseWrapper.WrapperException- if an error occurs in the communication to the Ingestor, or the output element does not contain a product ID, or the product cannot be found
-
updateProductMetadata
protected void updateProductMetadata(InputOutput output, RestProduct productMetadata) throws BaseWrapper.WrapperException Update the metadata for the product denoted in the given output element- Parameters:
output- the output element from the Job Order file to update the metadata forproductMetadata- a REST interface product specifying the updated metadata- Throws:
BaseWrapper.WrapperException- if an error occurs in the communication to the Ingestor, or the output element does not contain a product ID
-
createIngestorProduct
Create a REST interface product for product ingestion from the given output file path; sets attributes mountPoint, filePath, productFileName, fileSize, checksum and checksumTime- Parameters:
outputFilePath- path to the output file- Returns:
- a REST interface product for ingestion with ingestion information set
-
ingestProduct
Ingest the given product into the prosEO metadata database and into the backend storage- Parameters:
product- a REST interface product for product ingestion- Throws:
BaseWrapper.WrapperException- if an error occurs in the communication to the Ingestor
-
preFetchInputHook
Hook for mission-specific modifications to the job order document before fetching input data Intended for override by mission-specific wrapper classes, NO-OP in BaseWrapper.- Parameters:
jobOrderDoc- the job order document to modify- Throws:
BaseWrapper.WrapperException- if some error occurred which forces wrapper termination
-
postFetchInputHook
Hook for mission-specific modifications to the job order document after fetching input data Intended for override by mission-specific wrapper classes, NO-OP in BaseWrapper.- Parameters:
jobOrderDoc- the job order document to modify- Throws:
BaseWrapper.WrapperException- if some error occurred which forces wrapper termination
-
postProcessingHook
Hook for mission-specific modifications to the final job order document after execution of the processor (before push of results). Intended for- Adding additional output files to the output list as desired (e. g. log files, job order file)
- Packaging multiple files into a single ZIP file for delivery via the PRIP if desired (add an output file with File_Name_Type "Archive", using Java constant InputOutput.FN_TYPE_ARCHIVE)
- Parameters:
joWork- the job order document to modify- Throws:
BaseWrapper.WrapperException- if some error occurred which forces wrapper termination
-
run
public final int run()Perform processing: check parameters, parse JobOrder file, fetch input files, process, push output files- Returns:
- the program exit code (OK or FAILURE)
-
main
Main routine: Run BaseWrapper- Parameters:
args- first string argument is class name of actual Wrapper class (must be a subclass of BaseWrapper or BaseWrapper itself; default is to use BaseWrapper)
-