|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
public abstract class ALDOperator
This is the abstract super class for all Alida operators. Alida opertators facilitate automatic logging of the processing historys and automatic generation of user interfaces.
The interface consisting of all parameters needs to be define by annotating
the corresponding fields (i.e. member variables) using the Parameter
annotation. The direction of a parameter may be input (IN), output (OUT), or
both input and output (INOUT). A Parameter may be declared to be
supplemental. Supplemental parapeters, e.g., control output of debugging
information or return intermediate results. The outputs of the operator are
expected to be independent of the value of these supplemental values which
are not stored in the processing history. A parameter with direction IN or
INOUT which is not supplemental may be declared to be required. For OUT
parameter and supplemental parameters the required field is ignored. If a
parameter of an operator is expected to be documented in the data flow of the
processing history, it may be of any Java class where the instances are by
references. This excludes only primitive data types, interned strings, and
cached numerical objects. If the parameter is not be part of the data flow
all classes are acceptable.
Values of parameters and inputs have to be set prior to invoking the operator
via runOp()
and the resulting outputs may be retrieved from the
operator after return from runOp()
.
A default constructor without arguments has to be implemented for all
features of code generation and generic execution to be available. For
generic execution the operator has to be annotated with
ALDAOperator
with
allowGenericExecution
set to true.
The method operate()
implements the processing of this operator
and has to be overridden when implementing non-abstract operators. All
information passed into and back from the operator are passed via the member
variables of the operator which are properly annotated. This method should by
no means be used to invoke processing of the operator directly, rather
runOp()
is to be used.
The method runOp()
is called by the user of an operator to
invoke processing. runOp()
first checks if all required
parameters and inputs are set to non-null values and subsequently check the
validity of parameters and inputs as defined by the method
validateCustom
which has to be overridden when implementing an
operator.
Refer to the Alida manual for more details and examples.
Nested Class Summary | |
---|---|
static class |
ALDOperator.HidingMode
Determines the visibility of an operator invocation via runOp() in
the processing history. |
Field Summary | |
---|---|
protected boolean |
completeDAG
Does this operator prefer a complete DAG or a data dependency DAG. |
java.lang.String |
name
Name of the operator |
protected static ALDPortHashAccess |
portHashAccess
Access to the central port hash. |
protected java.lang.Boolean |
verbose
Verbose flag to be inherited by all operators. |
protected ALDVersionProvider |
versionProvider
Instance of a class providing version information. |
Constructor Summary | |
---|---|
ALDOperator()
This constructor initializes an operator. |
Method Summary | |
---|---|
ALDOperator |
deserializeFromXmlFile(java.lang.String filename)
Deserializes an operator state from the given file. |
protected boolean |
fieldContained(java.lang.String key)
Does any hash table contain the key, i.e. this field? |
static ALDPortHashAccess |
getALDPortHashAccessKey()
Get a reference to the port hash access object. |
static int |
getConstructionMode()
Return the current mode of implicit construction constructionMode . |
java.util.Collection<java.lang.String> |
getInInoutNames()
Get the names of in or inout parameters. |
java.util.Collection<java.lang.String> |
getInInoutNames(java.lang.Boolean useRequired)
Get the names of in or inout parameters. |
java.util.Collection<java.lang.String> |
getInNames(java.lang.Boolean useRequired)
Get the names of in parameters. |
java.util.Collection<java.lang.String> |
getInOutNames(java.lang.Boolean useRequired)
Get the names of inout parameters. |
java.util.List<java.lang.String> |
getMissingRequiredInputs()
Deprecated. |
java.lang.String |
getName()
Get the name of this operator |
int |
getNumParameters()
Get the number of parameters |
java.util.Collection<java.lang.String> |
getOutInoutNames()
Get the names of out or inout parameters |
java.util.Collection<java.lang.String> |
getOutNames()
Get the names of out parameters |
java.lang.Object |
getParameter(java.lang.String name)
Get the value of a parameter specified by name. |
ALDOpParameterDescriptor |
getParameterDescriptor(java.lang.String name)
Get the parameter descriptor for given name. |
java.util.Collection<java.lang.String> |
getParameterNames()
Get the names of all parameters |
java.util.Collection<java.lang.String> |
getSupplementalNames()
Get the names of supplemental parameters |
java.lang.Boolean |
getVerbose()
Return the verbose state of this opertor. |
java.lang.String |
getVersion()
Get the version of this operator |
boolean |
isConfigured()
Returns true if the object is properly configured. |
protected abstract void |
operate()
This method does the actual work and needs to be implemented by every subclass. |
org.apache.xmlbeans.XmlObject |
parametersToXmlObject()
Parse the parameter values to an XmlObject. |
void |
print()
Print some information of the current state this operator to System.out. |
void |
print(java.io.PrintStream outfile)
Print some information the current state of this operator to outfile . |
protected void |
print(java.io.PrintStream outfile,
boolean printValue)
Print information of the interface and values of this operator to outfile . |
void |
printInterface()
Print information of the interface of this operator to System.out. |
void |
printInterface(java.io.PrintStream outfile)
Print information of the interface of this operator to outfile . |
static void |
readHistory(java.lang.Object obj,
java.lang.String filename)
Reads and set the history graph of the given object from file. |
protected java.lang.Object |
readResolve()
Init function for deserialized objects. |
void |
reinitializeParameterDescriptors()
Reinitialize the field member of all parameter descriptors. |
void |
runOp()
A legal method to invoke the operator and handles everything necessary to protocol the processing history. |
void |
runOp(ALDOperator.HidingMode hidingMode)
A legal method to invoke the operator and handles everything necessary to protocol the processing history. |
void |
runOp(boolean hidden)
A legal method to invoke the operator and handles everything necessary to protocol the processing history. |
void |
serializeToXmlFile(java.lang.String filename)
Serializes the operator to an XML file. |
static void |
setConstructionMode(int constructionMode)
Set the mode of implicit construction of the processing graph. |
protected void |
setName(java.lang.String name)
Set the name of this operator |
void |
setParameter(java.lang.String name,
java.lang.Object value)
Set the value of a parameter specified by name. |
java.lang.String |
setParametersFromXml(java.lang.String filename)
Set the parameter values as read from an Xml file. |
java.lang.String |
setParametersFromXml(java.lang.String filename,
java.lang.String className,
java.lang.String packageName)
Set the parameter values as read from an Xml file. |
void |
setVerbose(java.lang.Boolean verbose)
Set the verbose state of this opertor. |
java.lang.String |
toStringVerbose()
Returns a string containing printable information about this operator including parameters. |
java.util.List<java.lang.String> |
unconfiguredItems()
Returns all required IN an INOUT parameters which have a null value |
void |
validate()
Validates the parameters and inputs of this operator. |
void |
validateCustom()
Operator specific validation of parameters and inputs. |
void |
validateGeneric()
Generic validation of the in and inout parameters of this operator. |
static void |
writeHistory(java.lang.Object obj,
java.lang.String filename)
Write the processing history if any to a graphml file. |
static void |
writeHistory(java.lang.Object obj,
java.lang.String filename,
ALDProcessingDAG.HistoryType historyType)
Write the processing history if any to a graphml file. |
static void |
writeHistory(java.lang.Object obj,
java.lang.String filename,
ALDProcessingDAG.HistoryType historyType,
boolean ignoreHiding)
Write the processing history if any to a graphml file. |
void |
writeParametersToXml(java.lang.String filename)
Write the parameter values to an xml file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.lang.String name
@Parameter(label="Verbose", supplemental=true, direction=IN, description="Verbose flag") protected java.lang.Boolean verbose
protected boolean completeDAG
protected static ALDPortHashAccess portHashAccess
protected ALDVersionProvider versionProvider
Constructor Detail |
---|
public ALDOperator() throws ALDOperatorException
ALDOperatorException
Method Detail |
---|
public static int getConstructionMode()
constructionMode
.
public static void setConstructionMode(int constructionMode)
constructionMode
- the constructionMode to setprotected abstract void operate() throws ALDOperatorException, ALDProcessingDAGException
ALDOperatorException
ALDProcessingDAGException
public final java.lang.String getName()
protected void setName(java.lang.String name)
public final java.lang.String getVersion()
public static ALDPortHashAccess getALDPortHashAccessKey()
public final int getNumParameters()
public final java.util.Collection<java.lang.String> getInInoutNames()
public final java.util.Collection<java.lang.String> getInInoutNames(java.lang.Boolean useRequired)
useRequired
- If true return only required in or inout parameters, if false
return only not required in or inout parameters. If
null
then return all in or inout parameters.
public final java.util.Collection<java.lang.String> getOutInoutNames()
public final java.util.Collection<java.lang.String> getInNames(java.lang.Boolean useRequired)
useRequired
- If true return only required in parameters, if false return
only not required in parameters. If null
then
return all in parameters.
public final java.util.Collection<java.lang.String> getOutNames()
public final java.util.Collection<java.lang.String> getInOutNames(java.lang.Boolean useRequired)
useRequired
- If true return only required inout parameters, if false return
only not required inout parameters. If null
then
return all inout parameters.
public final java.util.Collection<java.lang.String> getSupplementalNames()
public final java.util.Collection<java.lang.String> getParameterNames()
public final ALDOpParameterDescriptor getParameterDescriptor(java.lang.String name) throws ALDOperatorException
name
- Name of the parameter to get the new value for
ALDOperatorException
public java.lang.Object getParameter(java.lang.String name) throws ALDOperatorException
name
- Name of the parameter to get the new value for
ALDOperatorException
public void setParameter(java.lang.String name, java.lang.Object value) throws ALDOperatorException
name
- Name of the parameter to set a new value forvalue
- new value
ALDOperatorException
protected java.lang.Object readResolve()
This function is called on an instance of this class being deserialized from file, prior to handing the instance over to the user. It takes care of a proper initialization of transient member variables as they are not initialized to the default values during deserialization.
public void reinitializeParameterDescriptors()
public final void runOp() throws ALDOperatorException, ALDProcessingDAGException
runOp( HidingMode.VISIBLE)
, i.e. runs the operator as visible in the history.
ALDOperatorException
ALDProcessingDAGException
runOp(boolean)
public final void runOp(boolean hidden) throws ALDOperatorException, ALDProcessingDAGException
hidden
is true this call has the same effect as
runOp( HidingMode.HIDDEN)
, i.e. runs the operator as hidden.
If hidden
is false this call has the same effect as
runOp( HidingMode.VISIBLE)
, i.e. runs the operator as visible.
ALDOperatorException
ALDProcessingDAGException
runOp(boolean)
public final void runOp(ALDOperator.HidingMode hidingMode) throws ALDOperatorException, ALDProcessingDAGException
runOp
, all
IN and INOUT parameters have to be set. When called runOp
first validates the parameters. Validity requires for all operators, that
all required IN and INOUT parameters to have non null values. In addition
the implementation of an operator may impose further constrains defined
by the method validateCustom
which e.g. may restrict the
interval of numerical parameters.
After successful validation the operate
method is called to
do the actuall processing of this operator. Upon return from
runOp
, resulting output data may be retrieved from the
operator object.
hidingMode
determines the visibility of this invocation in the processing history.
If hidingMode
equals null
this is equivalent to
hidingMode
equal VISIBLE
(for backward compatibility).
hidingMode
- Determines the visibility of this invocation in the processing history
ALDOperatorException
ALDProcessingDAGException
public final void validate() throws ALDOperatorException
validateCustom
. An
ALDOperatorException is thrown if either validation fails.
ALDOperatorException
public final void validateGeneric() throws ALDOperatorException
ALDOperatorException
@Deprecated public java.util.List<java.lang.String> getMissingRequiredInputs()
public java.util.List<java.lang.String> unconfiguredItems()
unconfiguredItems
in interface ALDConfigurationValidator
public void validateCustom() throws ALDOperatorException
ALDOperatorException
public boolean isConfigured()
ALDConfigurationValidator
isConfigured
in interface ALDConfigurationValidator
public void setVerbose(java.lang.Boolean verbose) throws ALDOperatorException
verbose
- New verbose state
ALDOperatorException
public java.lang.Boolean getVerbose() throws ALDOperatorException
ALDOperatorException
public static void readHistory(java.lang.Object obj, java.lang.String filename)
obj
- Object for which the history is to be read.filename
- File from where the history is to be read.ALDPortHashAccess.readHistory(Object,String)
public static void writeHistory(java.lang.Object obj, java.lang.String filename) throws ALDProcessingDAGException, ALDOperatorException
writeHistory(obj, filename, ALDProcessingDAG.HistoryType.OPNODETYPE, false)
obj
- Object for which the history to write for.filename
- Filename to write the processing history into.
ALDProcessingDAGException
ALDOperatorException
public static void writeHistory(java.lang.Object obj, java.lang.String filename, ALDProcessingDAG.HistoryType historyType) throws ALDProcessingDAGException, ALDOperatorException
writeHistory(obj, filename, historyType, false)
obj
- Object for which the history to write for.filename
- Filename to write the processing history into.historyType
- Type/mode of the history.
ALDProcessingDAGException
ALDOperatorException
public static void writeHistory(java.lang.Object obj, java.lang.String filename, ALDProcessingDAG.HistoryType historyType, boolean ignoreHiding) throws ALDProcessingDAGException, ALDOperatorException
obj
- Object for which the history to write for.filename
- Filename to write the processing history into. (as graphml/XML
file)historyType
- Type/mode of the history.ignoreHiding
- If true, hiding of opNodes is ignored.
ALDProcessingDAGException
ALDOperatorException
ALDPortHashAccess.writeHistory(Object,String,ALDProcessingDAG.HistoryType,boolean)
public void writeParametersToXml(java.lang.String filename)
filename
- filename of the xml file to write topublic org.apache.xmlbeans.XmlObject parametersToXmlObject() throws org.apache.xmlbeans.XmlException
org.apache.xmlbeans.XmlException
public java.lang.String setParametersFromXml(java.lang.String filename)
filename
- filename of the xml file to read from
setParametersFromXml(String,String,String)
public java.lang.String setParametersFromXml(java.lang.String filename, java.lang.String className, java.lang.String packageName)
className
and
packageName
respectively. If one of these names is
null
any name in the Xml file is accepted.
filename
- filename of the xml file to read fromclassName
- class name expected in the Xml file or nullpackageName
- package name expected in the Xml file or null
public void serializeToXmlFile(java.lang.String filename)
Note that all member variables, i.e. the complete state of the object at the time of serialization is saved. Only transient members are ignored.
filename
- File where to save the data.public ALDOperator deserializeFromXmlFile(java.lang.String filename)
Only transient members are ignored.
filename
- File from where to read the data.public void print()
public void print(java.io.PrintStream outfile)
outfile
.
outfile
- Stream to print onpublic void printInterface()
public void printInterface(java.io.PrintStream outfile)
outfile
.
outfile
- Stream to print onprotected void print(java.io.PrintStream outfile, boolean printValue)
outfile
. If printValue is true, additional the current value
is printed. This method note intended for public use.
outfile
- Stream to print onprintValue
- public java.lang.String toStringVerbose()
protected boolean fieldContained(java.lang.String key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |