org.esa.beam.framework.processor
Class DefaultRequestElementFactory

java.lang.Object
  extended by org.esa.beam.framework.processor.DefaultRequestElementFactory
All Implemented Interfaces:
ProcessorConstants, RequestElementFactory

public class DefaultRequestElementFactory
extends Object
implements RequestElementFactory, ProcessorConstants

The request element factory is responsible for creating Parameters with predefined datatypes, validity ranges and appropriate editors (i.e. UI elements). The request element factory is invoked by RequestLoader to assemble Requests and validate the datat coming from a request file.

This class is the default implementation. It does no validation on parameters and only supports default editors. Overwrite this class to perform specific implementation.

Also, this class implements some helper functions for creating standard parameters of type


Field Summary
 
Fields inherited from interface org.esa.beam.framework.processor.ProcessorConstants
INPUT_PRODUCT_DESCRIPTION, INPUT_PRODUCT_LABELTEXT, INPUT_PRODUCT_PARAM_NAME, LOG_FILE_DESCRIPTION, LOG_FILE_LABELTEXT, LOG_FILE_PARAM_NAME, LOG_MSG_FAIL_CREATE_WRITER, LOG_MSG_FINISHED_REQUEST, LOG_MSG_LOAD_REQUEST, LOG_MSG_LOADED_BAND, LOG_MSG_NO_BITMASK, LOG_MSG_NO_INPUT_IN_REQUEST, LOG_MSG_NO_INPUT_TYPE, LOG_MSG_NO_INVALID_PIXEL, LOG_MSG_NO_OUTPUT, LOG_MSG_NO_OUTPUT_FORMAT, LOG_MSG_NO_OUTPUT_IN_REQUEST, LOG_MSG_NO_OUTPUT_NAME, LOG_MSG_PROC_ABORTED, LOG_MSG_PROC_CANCELED, LOG_MSG_PROC_ERROR, LOG_MSG_PROC_SUCCESS, LOG_MSG_PROCESS_ALL, LOG_MSG_REQUEST_MALFORMED, LOG_MSG_START_REQUEST, LOG_MSG_SUCCESS, LOG_MSG_USING, LOG_PREFIX_DESCRIPTION, LOG_PREFIX_LABELTEXT, LOG_PREFIX_PARAM_NAME, LOG_TO_OUTPUT_DESCRIPTION, LOG_TO_OUTPUT_LABELTEXT, LOG_TO_OUTPUT_PARAM_NAME, OUTPUT_FORMAT_DESCRIPTION, OUTPUT_FORMAT_LABELTEXT, OUTPUT_FORMAT_PARAM_NAME, OUTPUT_PRODUCT_DESCRIPTION, OUTPUT_PRODUCT_LABELTEXT, OUTPUT_PRODUCT_PARAM_NAME, PACKAGE_LOGGER_NAME, REQUEST_TYPE_PARAM_NAME, STATUS_ABORTED, STATUS_COMPLETED, STATUS_COMPLETED_WITH_WARNING, STATUS_FAILED, STATUS_STARTED, STATUS_UNKNOWN
 
Constructor Summary
DefaultRequestElementFactory()
           
 
Method Summary
 ParamProperties createBitmaskParamProperties()
          Creates a default parameter info type for parameters of type bitmask expression.
 ParamProperties createBooleanParamProperties()
          Creates default boolean parameter properties.
 ParamProperties createBoundFloatParamProperties()
          Creates a default parameter info type for parameters of type bound float.
 Parameter createDefaultInputProductParameter()
          Creates an input product parameter set to the default path.
 Parameter createDefaultLogPatternParameter(String prefix)
          Creates a default logging pattern parameter set to the prefix passed in.
 Parameter createDefaultOutputProductParameter()
          Creates an output product parameter set to the current user's home directory.
 ParamProperties createFileParamProperties(int fileSelectionMode, Object defaultValue)
          Creates a default ParamProperties for file parameters with given file selection mode and given default value.
 ParamProperties createFloatParamProperties()
          Creates a default parameter info type for parameters of type float
 ProductRef createInputProductRef(File file, String fileFormat, String typeId)
          Creates a new reference to an input product for the current processing request.
 ParamProperties createIntegerParamProperties()
          Creates a default parameter info type for parameters of type float
 Parameter createLogToOutputParameter(String value)
          Creates a logging to output product parameter with the default value true.
 Parameter createOutputFormatParameter()
          Creates an output product format parameter with all the registered product format names
 ProductRef createOutputProductRef(File file, String fileFormat, String typeId)
          Creates a new reference to an output product for the current processing request.
 Parameter createParameter(String name, String value)
          Creates a Parameter of type String with the given name and the given String value.
 ParamProperties createStringArrayParamProperties()
          Creates a string array value parameter information.
 ParamProperties createStringParamProperties()
          Creates default string value parameter properties.
static DefaultRequestElementFactory getInstance()
          Retrieve an instance of the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRequestElementFactory

public DefaultRequestElementFactory()
Method Detail

getInstance

public static DefaultRequestElementFactory getInstance()
Retrieve an instance of the factory. This is a singleton object.

Returns:
a reference to the one and only instance of the factory

createInputProductRef

public ProductRef createInputProductRef(File file,
                                        String fileFormat,
                                        String typeId)
                                 throws RequestElementFactoryException
Creates a new reference to an input product for the current processing request.

Specified by:
createInputProductRef in interface RequestElementFactory
Parameters:
file - the input product's file, must not be null
fileFormat - the file format, can be null if not known
typeId - the product type identifier, can be null if not known
Throws:
IllegalArgumentException - if url is null
RequestElementFactoryException - if the element could not be created

createOutputProductRef

public ProductRef createOutputProductRef(File file,
                                         String fileFormat,
                                         String typeId)
                                  throws RequestElementFactoryException
Creates a new reference to an output product for the current processing request.

Specified by:
createOutputProductRef in interface RequestElementFactory
Parameters:
file - the output product's file, must not be null
fileFormat - the file format, can be null if not known
typeId - the product type identifier, can be null if not known
Throws:
IllegalArgumentException - if url is null
RequestElementFactoryException - if the element could not be created

createParameter

public Parameter createParameter(String name,
                                 String value)
                          throws RequestElementFactoryException
Creates a Parameter of type String with the given name and the given String value.

Specified by:
createParameter in interface RequestElementFactory
Parameters:
name - the parameter name
value - the value of the parameter
Throws:
RequestElementFactoryException - if the parameter could not be created or is invalid

createDefaultLogPatternParameter

public Parameter createDefaultLogPatternParameter(String prefix)
Creates a default logging pattern parameter set to the prefix passed in.

Specified by:
createDefaultLogPatternParameter in interface RequestElementFactory
Parameters:
prefix - the default setting for the logging pattern
Returns:
a logging pattern Parameter conforming the system settings

createLogToOutputParameter

public Parameter createLogToOutputParameter(String value)
                                     throws ParamValidateException
Creates a logging to output product parameter with the default value true. The current value is set to the given parameter value.

Specified by:
createLogToOutputParameter in interface RequestElementFactory
Parameters:
value - the value as String this parameter is set to.
Returns:
a logging to output product parameter
Throws:
ParamValidateException

createFileParamProperties

public ParamProperties createFileParamProperties(int fileSelectionMode,
                                                 Object defaultValue)
Creates a default ParamProperties for file parameters with given file selection mode and given default value.

Parameters:
fileSelectionMode - the file selection mode, can be FSM_FILES_ONLY, FSM_DIRECTORIES_ONLY and FSM_FILES_AND_DIRECTORIES defined in ParamProperties.
defaultValue - the default value wich was set at the returned ParamProperties
Throws:
IllegalArgumentException - if the parameter fileSelectionMode is not a valid selection mode: Valid file selection modes are FSM_FILES_ONLY, FSM_DIRECTORIES_ONLY and FSM_FILES_AND_DIRECTORIES

createBitmaskParamProperties

public ParamProperties createBitmaskParamProperties()
Creates a default parameter info type for parameters of type bitmask expression.


createBoundFloatParamProperties

public ParamProperties createBoundFloatParamProperties()
Creates a default parameter info type for parameters of type bound float. These parameters check for the value to value >= 0.f


createIntegerParamProperties

public ParamProperties createIntegerParamProperties()
Creates a default parameter info type for parameters of type float


createFloatParamProperties

public ParamProperties createFloatParamProperties()
Creates a default parameter info type for parameters of type float


createStringArrayParamProperties

public ParamProperties createStringArrayParamProperties()
Creates a string array value parameter information.


createStringParamProperties

public ParamProperties createStringParamProperties()
Creates default string value parameter properties.


createBooleanParamProperties

public ParamProperties createBooleanParamProperties()
Creates default boolean parameter properties.

Returns:
default boolean parameter properties.

createDefaultInputProductParameter

public Parameter createDefaultInputProductParameter()
Creates an input product parameter set to the default path.

Specified by:
createDefaultInputProductParameter in interface RequestElementFactory

createDefaultOutputProductParameter

public Parameter createDefaultOutputProductParameter()
Creates an output product parameter set to the current user's home directory.

Specified by:
createDefaultOutputProductParameter in interface RequestElementFactory

createOutputFormatParameter

public Parameter createOutputFormatParameter()
Creates an output product format parameter with all the registered product format names



Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.