org.embl.ebi.escience.scuflworkers.java
Class XMLInputSplitter

java.lang.Object
  extended by org.embl.ebi.escience.scuflworkers.java.XMLInputSplitter
All Implemented Interfaces:
LocalWorker, LocalWorkerWithPorts, XMLExtensible

public class XMLInputSplitter
extends java.lang.Object
implements LocalWorkerWithPorts, XMLExtensible

A LocalWorker that takes a given input port for a complex type, and splits it to a single level generating an array of simple type inputs. Nested complex types remain as type/xml and can be split further by adding additional XMLInputSplitter processors.


Field Summary
 
Fields inherited from interface org.embl.ebi.escience.scuflworkers.java.LocalWorker
BINARY, BINARY_ARRAY, HTML, HTML_ARRAY, PNG_IMAGE, PNG_IMAGE_ARRAY, STRING, STRING_ARRAY, UNTYPED, UNTYPED_ARRAY
 
Constructor Summary
XMLInputSplitter()
           
 
Method Summary
 void consumeXML(org.jdom.Element element)
          Generates the TypeDescriptor structure, and then the relevant inputs from the XML element provided.
 java.util.Map execute(java.util.Map inputMap)
          Takes the inputs and generates an XML output based upon these inputs.
 java.lang.String[] inputNames()
          Get an array of the names of input ports for this processor
 java.util.List<InputPort> inputPorts(LocalServiceProcessor processor)
          The InputPorts for this localworker, to be used by LocalServiceProcessor
 java.lang.String[] inputTypes()
          Get an array of the string types for the inputs defined by the inputNames() method, these should probably use the constants defined in this interface but may use any valid Baclava data type specifier.
static boolean isSplittable(InputPort input)
          Determines whether the given input port supports being splitted
 java.lang.String[] outputNames()
          Names of the output ports
 java.util.List<OutputPort> outputPorts(LocalServiceProcessor processor)
          The OutputPorts for this localworker, to be used by LocalServiceProcessor
 java.lang.String[] outputTypes()
          Types of the output ports
 org.jdom.Element provideXML()
          Generates the XML that describes the TypeDescriptor, and therefore the inputs for this worker, to allow it to be reconstructed using consumeXML.
 void setUpInputs(InputPort portToSplit)
          Dynamically generates the inputNames and inputTypes according to the TypeDescriptor associated with the supplied InputPort.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLInputSplitter

public XMLInputSplitter()
Method Detail

inputNames

public java.lang.String[] inputNames()
Description copied from interface: LocalWorker
Get an array of the names of input ports for this processor

Specified by:
inputNames in interface LocalWorker

inputTypes

public java.lang.String[] inputTypes()
Description copied from interface: LocalWorker
Get an array of the string types for the inputs defined by the inputNames() method, these should probably use the constants defined in this interface but may use any valid Baclava data type specifier.

Specified by:
inputTypes in interface LocalWorker

outputNames

public java.lang.String[] outputNames()
Description copied from interface: LocalWorker
Names of the output ports

Specified by:
outputNames in interface LocalWorker

outputTypes

public java.lang.String[] outputTypes()
Description copied from interface: LocalWorker
Types of the output ports

Specified by:
outputTypes in interface LocalWorker

execute

public java.util.Map execute(java.util.Map inputMap)
                      throws TaskExecutionException
Takes the inputs and generates an XML output based upon these inputs. Only inputs provided are included as tags within the resulting XML.

Specified by:
execute in interface LocalWorker
Throws:
TaskExecutionException - thrown if there is an error during invocation of the task.

isSplittable

public static boolean isSplittable(InputPort input)
Determines whether the given input port supports being splitted

Parameters:
input -
Returns:

setUpInputs

public void setUpInputs(InputPort portToSplit)
Dynamically generates the inputNames and inputTypes according to the TypeDescriptor associated with the supplied InputPort.

Parameters:
portToSplit -

consumeXML

public void consumeXML(org.jdom.Element element)
Generates the TypeDescriptor structure, and then the relevant inputs from the XML element provided. This assumes that the root of the structure is . This will be the same xml generated by provideXML.

Specified by:
consumeXML in interface XMLExtensible

provideXML

public org.jdom.Element provideXML()
Generates the XML that describes the TypeDescriptor, and therefore the inputs for this worker, to allow it to be reconstructed using consumeXML.

Specified by:
provideXML in interface XMLExtensible

inputPorts

public java.util.List<InputPort> inputPorts(LocalServiceProcessor processor)
                                     throws DuplicatePortNameException,
                                            PortCreationException
Description copied from interface: LocalWorkerWithPorts
The InputPorts for this localworker, to be used by LocalServiceProcessor

Specified by:
inputPorts in interface LocalWorkerWithPorts
Throws:
DuplicatePortNameException
PortCreationException

outputPorts

public java.util.List<OutputPort> outputPorts(LocalServiceProcessor processor)
                                       throws DuplicatePortNameException,
                                              PortCreationException
Description copied from interface: LocalWorkerWithPorts
The OutputPorts for this localworker, to be used by LocalServiceProcessor

Specified by:
outputPorts in interface LocalWorkerWithPorts
Throws:
DuplicatePortNameException
PortCreationException