Package org.esa.snap.core.gpf.descriptor
Class ToolAdapterOperatorDescriptor
- java.lang.Object
-
- org.esa.snap.core.gpf.descriptor.ToolAdapterOperatorDescriptor
-
- All Implemented Interfaces:
ElementDescriptor
,OperatorDescriptor
public class ToolAdapterOperatorDescriptor extends Object implements OperatorDescriptor
Operator descriptor class for ToolAdapterOp.
-
-
Field Summary
Fields Modifier and Type Field Description static Class[]
annotatedClasses
static String
SOURCE_PACKAGE
static String
SOURCE_USER
-
Constructor Summary
Constructors Constructor Description ToolAdapterOperatorDescriptor(String name, Class<? extends Operator> operatorClass)
ToolAdapterOperatorDescriptor(String name, Class<? extends Operator> operatorClass, String alias, String label, String version, String description, String authors, String copyright, String menuLocation)
ToolAdapterOperatorDescriptor(ToolAdapterOperatorDescriptor obj)
Copy constructorToolAdapterOperatorDescriptor(ToolAdapterOperatorDescriptor obj, String newName, String newAlias)
Variant of the copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVariable(SystemVariable variable)
Adds a user-defined system variableToolAdapterOperatorDescriptor
createCopy()
Creates a deep copy of this operator.static ToolAdapterOperatorDescriptor
fromXml(File file, ClassLoader classLoader)
Loads an operator descriptor from an XML document.static ToolAdapterOperatorDescriptor
fromXml(Reader reader, String resourceName, ClassLoader classLoader)
Loads an operator descriptor from an XML document.static ToolAdapterOperatorDescriptor
fromXml(URL url, ClassLoader classLoader)
Loads an operator descriptor from an XML document.String
getAlias()
String
getAuthors()
Bundle
getBundle()
Bundle
getBundle(OSFamily osFamily)
Map<OSFamily,Bundle>
getBundles()
String
getCopyright()
String
getDescription()
String
getErrorPattern()
Getter for the Error Pattern fieldString
getHelpID()
String
getLabel()
Bundle
getLinuxBundle()
Bundle
getMacosxBundle()
String
getMainToolFileLocation()
Getter for the Tool File Location fieldString
getMenuLocation()
Getter for the Menu Location fieldString
getName()
Class<? extends Operator>
getOperatorClass()
ParameterDescriptor[]
getParameterDescriptors()
String
getPreprocessorExternalTool()
Getter for the Pre-processing External Tool fieldBoolean
getPreprocessTool()
Getter for the Has Pre-processing External Tool fieldString
getProcessingWriter()
Getter for the Pre-processing Writer fieldString
getProgressPattern()
Getter for the Progress Pattern fieldString
getSource()
Getter for the source of the descriptor.int
getSourceProductCount()
Returns the number of source productsSourceProductDescriptor[]
getSourceProductDescriptors()
SourceProductsDescriptor
getSourceProductsDescriptor()
String
getStepPattern()
Getter for the Step progress Pattern fieldTargetProductDescriptor
getTargetProductDescriptor()
TargetPropertyDescriptor[]
getTargetPropertyDescriptors()
FileTemplate
getTemplate()
Getter for the Template File Location fieldTemplateEngine
getTemplateEngine()
List<ToolParameterDescriptor>
getToolParameterDescriptors()
Gets all the parameter descriptorsList<SystemVariable>
getVariables()
Gets the list of user-defined system variablesString
getVariableValue(String key)
String
getVersion()
Bundle
getWindowsBundle()
String
getWorkingDir()
Getter for the Working Directory fieldboolean
isAutoWriteDisabled()
The GPF framework usually writes the target product of either single operators or processing graphs to the file system when executed from the GPT command-line interface or the operator GUI.boolean
isFromPackage()
Determines if the source of this descriptor is from a package or creadet/modified by user.boolean
isHandlingOutputName()
Determines if the tool would produce by itself the name of the output product.boolean
isInternal()
void
removeParamDescriptor(ToolParameterDescriptor descriptor)
Removes the given parameter descriptor from the internal parameter descriptor listvoid
removeParamDescriptors(List<ToolParameterDescriptor> descriptors)
Removes the given descriptors from the internal parameter descriptor listFile
resolveVariables(File file)
File
resolveVariables(String location)
void
setAlias(String alias)
Setter for the Alias fieldvoid
setAuthors(String authors)
Setter for the Authors fieldvoid
setBundles(Map<OSFamily,Bundle> bundles)
void
setCopyright(String copyright)
Setter for the Copyright fieldvoid
setDescription(String description)
Setter for the Description fieldvoid
setErrorPattern(String pattern)
Setter for the Error Pattern field.void
setHandlingOutputName(boolean value)
Setter for the isHandlingOutputName member.void
setHelpID(String value)
void
setLabel(String label)
Setter for the Label fieldvoid
setLinuxBundle(Bundle bundle)
void
setMacosxBundle(Bundle bundle)
void
setMainToolFileLocation(String mainToolFileLocation)
Setter for the Tool File Location fieldvoid
setMenuLocation(String value)
Setter for the Menu Location fieldvoid
setName(String name)
Setter for the Name fieldvoid
setOperatorClass(Class<? extends Operator> operatorClass)
Setter for the operator classvoid
setPreprocessorExternalTool(String preprocessorExternalTool)
Setter for the Pre-processing External Tool fieldvoid
setPreprocessTool(Boolean preprocessTool)
Setter for the Has Pre-processing External Tool fieldvoid
setProcessingWriter(String processingWriter)
Setter for the Pre-processing Writer fieldvoid
setProgressPattern(String pattern)
Setter for the Progress Pattern field.void
setSource(String value)
Setter for the Source field.void
setSourceProductCount(int value)
Sets the number of source products.void
setStepPattern(String pattern)
Setter for the Step progress Pattern field.void
setTemplate(FileTemplate value)
Setter for the Template File Location fieldvoid
setWindowsBundle(Bundle bundle)
void
setWorkingDir(String workingDir)
Setter for the Working Directory fieldvoid
seVersion(String version)
Setter for the Version fieldBoolean
shouldWriteBeforeProcessing()
Getter for the Write Before Processing fieldString
toXml(ClassLoader classLoader)
Converts an operator descriptor to XML.void
writeBeforeProcessing(Boolean writeForProcessing)
Setter for the Write Before Processing field
-
-
-
Field Detail
-
SOURCE_PACKAGE
public static final String SOURCE_PACKAGE
- See Also:
- Constant Field Values
-
SOURCE_USER
public static final String SOURCE_USER
- See Also:
- Constant Field Values
-
annotatedClasses
public static final Class[] annotatedClasses
-
-
Constructor Detail
-
ToolAdapterOperatorDescriptor
public ToolAdapterOperatorDescriptor(String name, Class<? extends Operator> operatorClass)
-
ToolAdapterOperatorDescriptor
public ToolAdapterOperatorDescriptor(String name, Class<? extends Operator> operatorClass, String alias, String label, String version, String description, String authors, String copyright, String menuLocation)
-
ToolAdapterOperatorDescriptor
public ToolAdapterOperatorDescriptor(ToolAdapterOperatorDescriptor obj)
Copy constructor- Parameters:
obj
- The descriptor to be copied
-
ToolAdapterOperatorDescriptor
public ToolAdapterOperatorDescriptor(ToolAdapterOperatorDescriptor obj, String newName, String newAlias)
Variant of the copy constructor- Parameters:
obj
- The descriptor to be copiednewName
- The new name of the operatornewAlias
- The new alias of the operator
-
-
Method Detail
-
removeParamDescriptor
public void removeParamDescriptor(ToolParameterDescriptor descriptor)
Removes the given parameter descriptor from the internal parameter descriptor list- Parameters:
descriptor
- The descriptor to be removed
-
removeParamDescriptors
public void removeParamDescriptors(List<ToolParameterDescriptor> descriptors)
Removes the given descriptors from the internal parameter descriptor list- Parameters:
descriptors
- The list of descriptors to be removed
-
getToolParameterDescriptors
public List<ToolParameterDescriptor> getToolParameterDescriptors()
Gets all the parameter descriptors- Returns:
- The list of parameter descriptors
-
getTemplateEngine
public TemplateEngine getTemplateEngine()
-
setAlias
public void setAlias(String alias)
Setter for the Alias field
-
setLabel
public void setLabel(String label)
Setter for the Label field
-
seVersion
public void seVersion(String version)
Setter for the Version field
-
setDescription
public void setDescription(String description)
Setter for the Description field
-
setAuthors
public void setAuthors(String authors)
Setter for the Authors field
-
setCopyright
public void setCopyright(String copyright)
Setter for the Copyright field
-
setName
public void setName(String name)
Setter for the Name field
-
setOperatorClass
public void setOperatorClass(Class<? extends Operator> operatorClass)
Setter for the operator class
-
getVersion
public String getVersion()
- Specified by:
getVersion
in interfaceOperatorDescriptor
- Returns:
- The version of the operator, or
null
if not declared.
-
getAuthors
public String getAuthors()
- Specified by:
getAuthors
in interfaceOperatorDescriptor
- Returns:
- The author(s) of the operator, or
null
if not declared.
-
getCopyright
public String getCopyright()
- Specified by:
getCopyright
in interfaceOperatorDescriptor
- Returns:
- The copyright notice for the operator code, or
null
if not declared.
-
isInternal
public boolean isInternal()
- Specified by:
isInternal
in interfaceOperatorDescriptor
- Returns:
- If
true
, this operator is considered for internal use only and thus may not be exposed in user interfaces. The default isfalse
.
-
isAutoWriteDisabled
public boolean isAutoWriteDisabled()
Description copied from interface:OperatorDescriptor
The GPF framework usually writes the target product of either single operators or processing graphs to the file system when executed from the GPT command-line interface or the operator GUI.If the
autoWriteDisabled
property is set, this default behaviour is switched off and hence, the operator or graph is responsible for outputting any computed results.Setting this property on an operator will only be useful, if it either does not generate a new target
Product
and/or if it does its own outputting of non-Product
targets to external files.- Specified by:
isAutoWriteDisabled
in interfaceOperatorDescriptor
- Returns:
- If
true
, the framework will prevent automatic writing of the target product to the file system.
-
getName
public String getName()
- Specified by:
getName
in interfaceElementDescriptor
- Returns:
- The symbolic name used to unambiguously identify this element. E.g. the fully qualified name of a Java class.
-
getAlias
public String getAlias()
- Specified by:
getAlias
in interfaceElementDescriptor
- Returns:
- A short form of the symbolic name, or
null
if not declared.
-
getLabel
public String getLabel()
- Specified by:
getLabel
in interfaceElementDescriptor
- Returns:
- A human-readable version of the symbolic name to be used in user interfaces, or
null
if not declared.
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceElementDescriptor
- Returns:
- A short description, or
null
if not declared.
-
getMenuLocation
public String getMenuLocation()
Getter for the Menu Location field
-
setMenuLocation
public void setMenuLocation(String value)
Setter for the Menu Location field
-
getSource
public String getSource()
Getter for the source of the descriptor. The source can be either "package" (coming from a nbm package) or "user" (user-defined).
-
setSource
public void setSource(String value)
Setter for the Source field.
-
isFromPackage
public boolean isFromPackage()
Determines if the source of this descriptor is from a package or creadet/modified by user.
-
isHandlingOutputName
public boolean isHandlingOutputName()
Determines if the tool would produce by itself the name of the output product.
-
setHandlingOutputName
public void setHandlingOutputName(boolean value)
Setter for the isHandlingOutputName member.
-
getHelpID
public String getHelpID()
-
setHelpID
public void setHelpID(String value)
-
getOperatorClass
public Class<? extends Operator> getOperatorClass()
- Specified by:
getOperatorClass
in interfaceOperatorDescriptor
- Returns:
- The operator implementation class.
-
getSourceProductDescriptors
public SourceProductDescriptor[] getSourceProductDescriptors()
- Specified by:
getSourceProductDescriptors
in interfaceOperatorDescriptor
- Returns:
- The source product descriptors. The array will be empty if the operator does not have any source products.
-
getSourceProductsDescriptor
public SourceProductsDescriptor getSourceProductsDescriptor()
- Specified by:
getSourceProductsDescriptor
in interfaceOperatorDescriptor
- Returns:
- The source products descriptor, or
null
if none is declared.
-
getParameterDescriptors
public ParameterDescriptor[] getParameterDescriptors()
- Specified by:
getParameterDescriptors
in interfaceOperatorDescriptor
- Returns:
- The parameter descriptors. The array will be empty if the operator does not have any parameters.
-
getTargetPropertyDescriptors
public TargetPropertyDescriptor[] getTargetPropertyDescriptors()
- Specified by:
getTargetPropertyDescriptors
in interfaceOperatorDescriptor
- Returns:
- The target property descriptors. The array will be empty if the operator does not produce any target properties.
-
getTargetProductDescriptor
public TargetProductDescriptor getTargetProductDescriptor()
- Specified by:
getTargetProductDescriptor
in interfaceOperatorDescriptor
- Returns:
- The target product descriptor, or
null
if none is declared.
-
getTemplate
public FileTemplate getTemplate()
Getter for the Template File Location field
-
setTemplate
public void setTemplate(FileTemplate value) throws TemplateException
Setter for the Template File Location field- Throws:
TemplateException
-
getWorkingDir
public String getWorkingDir()
Getter for the Working Directory field
-
setWorkingDir
public void setWorkingDir(String workingDir)
Setter for the Working Directory field
-
getMainToolFileLocation
public String getMainToolFileLocation()
Getter for the Tool File Location field
-
setMainToolFileLocation
public void setMainToolFileLocation(String mainToolFileLocation)
Setter for the Tool File Location field
-
setProgressPattern
public void setProgressPattern(String pattern)
Setter for the Progress Pattern field. The pattern is a regular expression.
-
getProgressPattern
public String getProgressPattern()
Getter for the Progress Pattern field
-
setErrorPattern
public void setErrorPattern(String pattern)
Setter for the Error Pattern field. The pattern is a regular expression.
-
getErrorPattern
public String getErrorPattern()
Getter for the Error Pattern field
-
setStepPattern
public void setStepPattern(String pattern)
Setter for the Step progress Pattern field. The pattern is a regular expression.
-
getStepPattern
public String getStepPattern()
Getter for the Step progress Pattern field
-
getProcessingWriter
public String getProcessingWriter()
Getter for the Pre-processing Writer field
-
setProcessingWriter
public void setProcessingWriter(String processingWriter)
Setter for the Pre-processing Writer field
-
shouldWriteBeforeProcessing
public Boolean shouldWriteBeforeProcessing()
Getter for the Write Before Processing field
-
writeBeforeProcessing
public void writeBeforeProcessing(Boolean writeForProcessing)
Setter for the Write Before Processing field
-
getPreprocessorExternalTool
public String getPreprocessorExternalTool()
Getter for the Pre-processing External Tool field
-
setPreprocessorExternalTool
public void setPreprocessorExternalTool(String preprocessorExternalTool)
Setter for the Pre-processing External Tool field
-
getPreprocessTool
public Boolean getPreprocessTool()
Getter for the Has Pre-processing External Tool field
-
setPreprocessTool
public void setPreprocessTool(Boolean preprocessTool)
Setter for the Has Pre-processing External Tool field
-
getWindowsBundle
public Bundle getWindowsBundle()
-
setWindowsBundle
public void setWindowsBundle(Bundle bundle)
-
getLinuxBundle
public Bundle getLinuxBundle()
-
setLinuxBundle
public void setLinuxBundle(Bundle bundle)
-
getMacosxBundle
public Bundle getMacosxBundle()
-
setMacosxBundle
public void setMacosxBundle(Bundle bundle)
-
getBundle
public Bundle getBundle()
-
getVariables
public List<SystemVariable> getVariables()
Gets the list of user-defined system variables
-
getSourceProductCount
public int getSourceProductCount()
Returns the number of source products
-
setSourceProductCount
public void setSourceProductCount(int value)
Sets the number of source products. It re-dimensions internally thesourceProductDescriptors
array. This is useful in the execution dialog, because it dictates how many selectors should be rendered.
-
addVariable
public void addVariable(SystemVariable variable)
Adds a user-defined system variable- Parameters:
variable
- The variable to be added
-
createCopy
public ToolAdapterOperatorDescriptor createCopy()
Creates a deep copy of this operator.
-
fromXml
public static ToolAdapterOperatorDescriptor fromXml(URL url, ClassLoader classLoader)
Loads an operator descriptor from an XML document.- Parameters:
url
- The URL pointing to a valid operator descriptor XML document.classLoader
- The class loader is used to load classed specified in the xml. For example the class defined by theoperatorClass
tag.- Returns:
- A new operator descriptor.
-
fromXml
public static ToolAdapterOperatorDescriptor fromXml(File file, ClassLoader classLoader) throws OperatorException
Loads an operator descriptor from an XML document.- Parameters:
file
- The file containing a valid operator descriptor XML document.classLoader
- The class loader is used to load classed specified in the xml. For example the class defined by theoperatorClass
tag.- Returns:
- A new operator descriptor.
- Throws:
OperatorException
-
fromXml
public static ToolAdapterOperatorDescriptor fromXml(Reader reader, String resourceName, ClassLoader classLoader) throws OperatorException
Loads an operator descriptor from an XML document.- Parameters:
reader
- The reader providing a valid operator descriptor XML document.resourceName
- Used in error messagesclassLoader
- The class loader is used to load classed specified in the xml. For example the class defined by theoperatorClass
tag.- Returns:
- A new operator descriptor.
- Throws:
OperatorException
-
toXml
public String toXml(ClassLoader classLoader)
Converts an operator descriptor to XML.- Parameters:
classLoader
- The class loader is used to load classed specified in the xml. For example the class defined by theoperatorClass
tag.- Returns:
- A string containing valid operator descriptor XML.
-
-