org.embl.ebi.escience.scufl
Class AlternateProcessor

java.lang.Object
  extended by org.embl.ebi.escience.scufl.AlternateProcessor
All Implemented Interfaces:
java.io.Serializable

public class AlternateProcessor
extends java.lang.Object
implements java.io.Serializable

Represents an alternate processor to be used in case of failures in the primary. Contains the Processor object to use as an alternate and two Map objects, these act as translations between the input and output names of the original and substitute processor.

For example, suppose the original processor has inputs as follows :

Name Description Type
inseq Input sequence 'text/plain'
format Desired format 'text/plain'

and the substitute has a similar set of inputs but with slightly different names :

Name Description Type
seq Input sequence 'text/plain'
sformat Desired format 'text/plain'

In this case the inputMapping object would contain the following :

Key Value
inseq seq
format sformat

This allows the task implementation to connect the appropriate inputs to the alternate processor. A similar map would exist for the outputs, again with the original or primary name as the key and alternate name as the value.

See Also:
Serialized Form

Constructor Summary
AlternateProcessor(Processor alternate)
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getInputMapping()
          Get the input mappings, a Map object with keys being the original or primary input names and values being the corresponding names of inputs on the alternate processor this holder class contains.
 Processor getOriginalProcessor()
          Return the processor for which this container holds the alternate implementation.
 java.util.Map<java.lang.String,java.lang.String> getOutputMapping()
          Get the output mappings, a Map object with keys being the original or primary output names and values being the corresponding names of outputs on the alternate processor this holder class contains.
 java.lang.String getPortTranslation(java.lang.String alternatePort)
          For a given port name in this alternate, fetch the original port name.
 Processor getProcessor()
          Return the alternate processor object.
 void setOriginalProcessor(Processor p)
           
 java.lang.String toString()
          Use the toString method of the underlying processor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlternateProcessor

public AlternateProcessor(Processor alternate)
Method Detail

getProcessor

public Processor getProcessor()
Return the alternate processor object. This Processor object will not be bound to the same workflow model instance as the alternate, it will most of the time not be bound to one at all. It is only intended to be used to provide the alternate functionality and not as the primary description. For this reason it is certainly recommended to only use substitute processors which are at least vaguely equivalent in operation, but of course there's no way we either should or could enforce this. Use with care!


getOriginalProcessor

public Processor getOriginalProcessor()
Return the processor for which this container holds the alternate implementation. This will return null if no original processor has been defined for the alternate.


setOriginalProcessor

public void setOriginalProcessor(Processor p)

getInputMapping

public java.util.Map<java.lang.String,java.lang.String> getInputMapping()
Get the input mappings, a Map object with keys being the original or primary input names and values being the corresponding names of inputs on the alternate processor this holder class contains.


getOutputMapping

public java.util.Map<java.lang.String,java.lang.String> getOutputMapping()
Get the output mappings, a Map object with keys being the original or primary output names and values being the corresponding names of outputs on the alternate processor this holder class contains.


toString

public java.lang.String toString()
Use the toString method of the underlying processor

Overrides:
toString in class java.lang.Object

getPortTranslation

public java.lang.String getPortTranslation(java.lang.String alternatePort)
For a given port name in this alternate, fetch the original port name. This is the opposite way around to the stored mapping, but UI components may want this information.

Returns:
null if there is no mapping for the named port or the String name of the original port otherwise.