org.embl.ebi.escience.scufl
Class Processor

java.lang.Object
  extended by org.embl.ebi.escience.scufl.Processor
All Implemented Interfaces:
java.io.Serializable, IProcessor
Direct Known Subclasses:
APProcessor, BiomartProcessor, BiomobyObjectProcessor, BiomobyProcessor, BiomobyProcessor, BSFProcessor, DependencyProcessor, InfernoProcessor, InternalSinkPortHolder, InternalSourcePortHolder, LocalServiceProcessor, MobyParseDatatypeProcessor, NotificationProcessor, RDFGeneratorProcessor, RservProcessor, RshellProcessor, SoaplabProcessor, StringConstantProcessor, TalismanProcessor, WorkflowProcessor, WSDLBasedProcessor

public abstract class Processor
extends java.lang.Object
implements java.io.Serializable, IProcessor

An abstract superclass of the various processor subtypes

Author:
Tom Oinn
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.embl.ebi.escience.scufl.IProcessor
ENACTOR
 
Constructor Summary
Processor(ScuflModel model, java.lang.String name)
          Construct the processor with the given name and parent, complaining if the name doesn't conform to [a-zA-Z_0-9]
 
Method Summary
 void addAlternate(AlternateProcessor ap)
          Add an alternate processor to this processor definition
 void addAnnotationTemplate(AnnotationTemplate theTemplate)
          Add an annotation template to this processor
 void addBreakpoint()
          Add a breakpoint to the processor
 void addPort(Port the_port)
          Add a new port to this processor
 AnnotationTemplate[] defaultAnnotationTemplates()
          Create a standard annotation template for each pair of bound input / output ports, mostly just to test the metadata store and browser functionality.
 void fireModelEvent(ScuflModelEvent event)
          Fire a change event back to the model
 AlternateProcessor[] getAlternatesArray()
          Return the list of AlternateProcessor holders for this primary processor implementation.
 java.util.List getAlternatesList()
          Return the alternates list object to allow addition or reordering of alternate processors
 AnnotationTemplate[] getAnnotationTemplates()
          Return an array containing all annotation templates for this processor
 double getBackoff()
          Return the factor by which the timeout value will be multiplied for each retry after the first.
 InputPort[] getBoundInputPorts()
          Get an array of the input ports that are bound by data constraints defined within this processor
 OutputPort[] getBoundOutputPorts()
          Get an array of all the output ports that are bound by data constraints and defined within this processor
 boolean getCritical()
          Get whether the Processor is critical.
 int getDefaultWorkers()
          Return the default number of workers for an instance of this processor type
 java.lang.String getDescription()
          Get a description of the processor.
 InputPort[] getInputPorts()
          Get an array containing only input ports
 IterationStrategy getIterationStrategy()
          Get the iteration strategy for this processor, or null if the default should be used
 int getLogLevel()
          Get the log level, this is the effective log level of the processor taking into account possible inheritence of the level from the ScuflModel instance.
 int getMaximumWorkers()
          Return the maximum number of task implementations that should be launched for this processor.
 ScuflModel getModel()
          Get the parent model
 java.lang.String getName()
          Get the name for this processor.
 OutputPort[] getOutputPorts()
          Get an array containing only output ports
 Port[] getPorts()
          Get an array of the ports, input or output, defined within this processor.
abstract  java.util.Properties getProperties()
          Return a properties object containing the processor specific properties for this processor type instance.
 int getRealLogLevel()
          Get the real log level set by this processor, this can be -1 in which case the getLogLevel method will return the log level of the ScuflModel that 'owns' this processor
 java.lang.String getResourceHost()
          If meaningful, obtain the host that the resource is based in.
 int getRetries()
          Return the number of retries after the initial invocation attempt.
 int getRetryDelay()
          Get the number of milliseconds to wait before first retrying an invocation of the task this processor represents.
 int getTimeout()
          Return the time in milliseconds after which an instance of this processor should be regarded as having failed with a timeout.
 int getWorkers()
          Return the number of workers for this instance
 boolean hasBreakpoint()
          Check for a breakpoint
 boolean isBoring()
          Is this processor boring? If so it shouldn't show up by default in the status display
 boolean isOffline()
          Are we in offline mode?
 Port locatePort(java.lang.String port_name)
          Find a particular named port
 Port locatePort(java.lang.String port_name, boolean isInputPort)
          Find a particular named port, input port if boolean flag is true
 void removeAlternate(AlternateProcessor ap)
          Delete an alternate processor from this processor definition
 void removeAnnotationTemplate(AnnotationTemplate theTemplate)
          Remove an annotation template from this processor
 void removePort(Port the_port)
          Remove a port from a processor (only really applicable to the workflow source and sink ports, so be careful when you're using it)
 void rmvBreakpoint()
          Remove a breakpoint to the processor
 void setBackoff(double backoff)
          Set the backoff factor
 void setBoring(boolean boring)
          Set whether this processor is boring
 void setCritical(boolean critical)
          Set whether the Processor is critical.
 void setDescription(java.lang.String the_description)
          Set the description for the processor.
 void setIterationStrategy(IterationStrategy i)
          Set the iteration strategy
 void setLogLevel(int level)
          Set the log level
 void setName(java.lang.String newName)
          Set the name, providing that names doesn't exist within the current workflow that this processor is bound to.
 void setOffline()
           
 void setOnline()
          Allow subclasses to intercept requests to go offline and online, allows e.g.
 void setRetries(int retries)
          Set the number of retries
 void setRetryDelay(int delay)
          Set the retry delay
 void setTimeout(int timeout)
          Set the timeout parameter
 void setWorkers(int workers)
          Set the number of workers
 java.lang.String toString()
          Return the processor's name in the toString()
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Processor

public Processor(ScuflModel model,
                 java.lang.String name)
          throws ProcessorCreationException,
                 DuplicateProcessorNameException
Construct the processor with the given name and parent, complaining if the name doesn't conform to [a-zA-Z_0-9]

Throws:
ProcessorCreationException
DuplicateProcessorNameException
Method Detail

isBoring

public boolean isBoring()
Is this processor boring? If so it shouldn't show up by default in the status display

Specified by:
isBoring in interface IProcessor

setBoring

public void setBoring(boolean boring)
Set whether this processor is boring

Specified by:
setBoring in interface IProcessor

setOnline

public void setOnline()
Allow subclasses to intercept requests to go offline and online, allows e.g. the workflow processor to delegate this to the child workflow

Specified by:
setOnline in interface IProcessor

setOffline

public void setOffline()
Specified by:
setOffline in interface IProcessor

hasBreakpoint

public boolean hasBreakpoint()
Check for a breakpoint

Specified by:
hasBreakpoint in interface IProcessor

addBreakpoint

public void addBreakpoint()
Add a breakpoint to the processor

Specified by:
addBreakpoint in interface IProcessor

rmvBreakpoint

public void rmvBreakpoint()
Remove a breakpoint to the processor

Specified by:
rmvBreakpoint in interface IProcessor

getResourceHost

public java.lang.String getResourceHost()
If meaningful, obtain the host that the resource is based in. Of course, not all processor implementations are service based so this may return the string Processor.ENACTOR instead to represent this, and this is the default.

Specified by:
getResourceHost in interface IProcessor

getMaximumWorkers

public int getMaximumWorkers()
Return the maximum number of task implementations that should be launched for this processor. This is ignored unless the processor is being iterated over in which case a number of threads up to the value specified are created to process the information. You must be particularly careful that the task implementation is thread safe before changing this from the default specified here, at the current time the web service processor is not thread safe!

Specified by:
getMaximumWorkers in interface IProcessor

getDefaultWorkers

public int getDefaultWorkers()
Return the default number of workers for an instance of this processor type

Specified by:
getDefaultWorkers in interface IProcessor

getWorkers

public final int getWorkers()
Return the number of workers for this instance

Specified by:
getWorkers in interface IProcessor

setWorkers

public final void setWorkers(int workers)
Set the number of workers

Specified by:
setWorkers in interface IProcessor

setName

public void setName(java.lang.String newName)
Set the name, providing that names doesn't exist within the current workflow that this processor is bound to. If it does then do nothing

Specified by:
setName in interface IProcessor

getIterationStrategy

public IterationStrategy getIterationStrategy()
Get the iteration strategy for this processor, or null if the default should be used

Specified by:
getIterationStrategy in interface IProcessor

setIterationStrategy

public void setIterationStrategy(IterationStrategy i)
Set the iteration strategy

Specified by:
setIterationStrategy in interface IProcessor

getAnnotationTemplates

public AnnotationTemplate[] getAnnotationTemplates()
Return an array containing all annotation templates for this processor

Specified by:
getAnnotationTemplates in interface IProcessor

addAnnotationTemplate

public void addAnnotationTemplate(AnnotationTemplate theTemplate)
Add an annotation template to this processor

Specified by:
addAnnotationTemplate in interface IProcessor

removeAnnotationTemplate

public void removeAnnotationTemplate(AnnotationTemplate theTemplate)
Remove an annotation template from this processor

Specified by:
removeAnnotationTemplate in interface IProcessor

defaultAnnotationTemplates

public AnnotationTemplate[] defaultAnnotationTemplates()
Create a standard annotation template for each pair of bound input / output ports, mostly just to test the metadata store and browser functionality. Removes any existing template definitions!

Specified by:
defaultAnnotationTemplates in interface IProcessor

getAlternatesArray

public AlternateProcessor[] getAlternatesArray()
Return the list of AlternateProcessor holders for this primary processor implementation.

Specified by:
getAlternatesArray in interface IProcessor

getAlternatesList

public java.util.List getAlternatesList()
Return the alternates list object to allow addition or reordering of alternate processors

Specified by:
getAlternatesList in interface IProcessor

addAlternate

public void addAlternate(AlternateProcessor ap)
Add an alternate processor to this processor definition

Specified by:
addAlternate in interface IProcessor

removeAlternate

public void removeAlternate(AlternateProcessor ap)
Delete an alternate processor from this processor definition

Specified by:
removeAlternate in interface IProcessor

getTimeout

public int getTimeout()
Return the time in milliseconds after which an instance of this processor should be regarded as having failed with a timeout. If this value is set to zero then no timeout applies.

Specified by:
getTimeout in interface IProcessor

setTimeout

public void setTimeout(int timeout)
Set the timeout parameter

Specified by:
setTimeout in interface IProcessor

getRetries

public int getRetries()
Return the number of retries after the initial invocation attempt. If set to zero then retry behaviour is disabled.

Specified by:
getRetries in interface IProcessor

setRetries

public void setRetries(int retries)
Set the number of retries

Specified by:
setRetries in interface IProcessor

getRetryDelay

public int getRetryDelay()
Get the number of milliseconds to wait before first retrying an invocation of the task this processor represents.

Specified by:
getRetryDelay in interface IProcessor

setRetryDelay

public void setRetryDelay(int delay)
Set the retry delay

Specified by:
setRetryDelay in interface IProcessor

getBackoff

public double getBackoff()
Return the factor by which the timeout value will be multiplied for each retry after the first. This allows for exponential backoff from failing service instances.

Specified by:
getBackoff in interface IProcessor

setBackoff

public void setBackoff(double backoff)
Set the backoff factor

Specified by:
setBackoff in interface IProcessor

getCritical

public boolean getCritical()
Get whether the Processor is critical. This is true if its execution failure will cause its containing workflow to fail.

Specified by:
getCritical in interface IProcessor

setCritical

public void setCritical(boolean critical)
Set whether the Processor is critical. When a critical Processor's execution fails, its containing workflow is halted and fails. In contrast, the containing workflow will ignore failures of non-critical Processors and will continue to run.

Specified by:
setCritical in interface IProcessor

getLogLevel

public int getLogLevel()
Get the log level, this is the effective log level of the processor taking into account possible inheritence of the level from the ScuflModel instance.

Specified by:
getLogLevel in interface IProcessor

getRealLogLevel

public int getRealLogLevel()
Get the real log level set by this processor, this can be -1 in which case the getLogLevel method will return the log level of the ScuflModel that 'owns' this processor

Specified by:
getRealLogLevel in interface IProcessor

setLogLevel

public void setLogLevel(int level)
Set the log level

Specified by:
setLogLevel in interface IProcessor

getProperties

public abstract java.util.Properties getProperties()
Return a properties object containing the processor specific properties for this processor type instance. This is used by the user interface code to display additional properties for each processor and should be implemented by the subclasses to display useful information.

Specified by:
getProperties in interface IProcessor
Returns:
a Properties instance containing all processor-specific properties, or optinally null if there are none

getName

public java.lang.String getName()
Get the name for this processor. There is no corresponding set method because names are immutable once created.

Specified by:
getName in interface IProcessor

getDescription

public java.lang.String getDescription()
Get a description of the processor.

Specified by:
getDescription in interface IProcessor

setDescription

public void setDescription(java.lang.String the_description)
Set the description for the processor.

Specified by:
setDescription in interface IProcessor

getPorts

public Port[] getPorts()
Get an array of the ports, input or output, defined within this processor.

Specified by:
getPorts in interface IProcessor

getBoundInputPorts

public InputPort[] getBoundInputPorts()
Get an array of the input ports that are bound by data constraints defined within this processor

Specified by:
getBoundInputPorts in interface IProcessor

getBoundOutputPorts

public OutputPort[] getBoundOutputPorts()
Get an array of all the output ports that are bound by data constraints and defined within this processor

Specified by:
getBoundOutputPorts in interface IProcessor

locatePort

public Port locatePort(java.lang.String port_name)
                throws UnknownPortException
Find a particular named port

Specified by:
locatePort in interface IProcessor
Throws:
UnknownPortException

locatePort

public Port locatePort(java.lang.String port_name,
                       boolean isInputPort)
                throws UnknownPortException
Find a particular named port, input port if boolean flag is true

Specified by:
locatePort in interface IProcessor
Throws:
UnknownPortException

getInputPorts

public InputPort[] getInputPorts()
Get an array containing only input ports

Specified by:
getInputPorts in interface IProcessor

getOutputPorts

public OutputPort[] getOutputPorts()
Get an array containing only output ports

Specified by:
getOutputPorts in interface IProcessor

addPort

public void addPort(Port the_port)
Add a new port to this processor

Specified by:
addPort in interface IProcessor

removePort

public void removePort(Port the_port)
Remove a port from a processor (only really applicable to the workflow source and sink ports, so be careful when you're using it)

Specified by:
removePort in interface IProcessor

getModel

public ScuflModel getModel()
Get the parent model

Specified by:
getModel in interface IProcessor

fireModelEvent

public void fireModelEvent(ScuflModelEvent event)
Fire a change event back to the model

Specified by:
fireModelEvent in interface IProcessor

toString

public java.lang.String toString()
Return the processor's name in the toString()

Overrides:
toString in class java.lang.Object

isOffline

public boolean isOffline()
Description copied from interface: IProcessor
Are we in offline mode?

Specified by:
isOffline in interface IProcessor