Class GalaxyToolXMLParserUtils
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.galaxytools.GalaxyToolXMLParserUtils
-
public final class GalaxyToolXMLParserUtils extends Object
This class define static utils methods to extract data in Galaxy tool XML file.- Since:
- 2.0
- Author:
- Sandrine Perrin
-
-
Constructor Summary
Constructors Constructor Description GalaxyToolXMLParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
extractCheetahScript(Document doc)
Extract command tag in string.static List<Element>
extractChildElementsByTagName(Element parentElement, String elementName)
Extract child elements by tag name.static Map<String,ToolElement>
extractConditionalParamElement(ToolInfo toolInfo, Element parent)
Extract conditional param element.static Map<String,ToolElement>
extractConditionalParamElement(ToolInfo toolInfo, Element parent, Map<String,Parameter> stepParameters)
Extract conditional param element.static String
extractDescription(Document doc)
Extract description tag in string.static String
extractDockerImage(Document doc)
Extract docker image attribute in string.static List<Element>
extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName)
Extract elements by tag name.static List<Element>
extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName, int expectedCount)
Extract elements by tag name.static List<Element>
extractElementsByTagName(Element parent, String tagName)
Extract elements by tag name.static List<Element>
extractElementsByTagName(Element parent, String tagName, int expectedCount)
Extract elements by tag name.static Map<String,ToolElement>
extractInputs(ToolInfo toolInfo, Document doc, Map<String,Parameter> stepParameters)
Extract all input parameters define in document.static List<String>
extractInterpreters(Document doc)
Extract interpreter attribute in string.static Map<String,ToolElement>
extractOutputs(ToolInfo toolInfo, Document doc, Map<String,Parameter> stepParameters)
Extract all output parameters define in document.static Map<String,ToolElement>
extractParamElement(ToolInfo toolInfo, Element parent, String elementName)
Extract parameter elements.static Map<String,ToolElement>
extractParamElement(ToolInfo toolInfo, Element parent, String elementName, Map<String,Parameter> stepParameters)
Extract parameter elements.static String
extractToolID(Document doc)
Extract tool id tag in string.static String
extractToolName(Document doc)
Extract tool name tag in string.static String
extractToolVersion(Document doc)
Extract tool version attribute in string.static String
extractValueFromElement(Document doc, String elementName, int index, String attributeName)
Extract text from DOM from tag name, at the index place.static EoulsanException
newEoulsanException(ToolInfo toolInfo, String message)
Create an EoulsanException.static EoulsanException
newEoulsanException(ToolInfo toolInfo, String parameterName, String message)
Create an EoulsanException.static void
setElementValue(ToolElement toolElement, Map<String,Parameter> stepParameters)
Set the tool element value.
-
-
-
Method Detail
-
extractParamElement
public static Map<String,ToolElement> extractParamElement(ToolInfo toolInfo, Element parent, String elementName) throws EoulsanException
Extract parameter elements.- Parameters:
toolInfo
- the ToolInfo objectparent
- the parentelementName
- the element name- Returns:
- a map with the Galaxy tool elements
- Throws:
EoulsanException
- the Eoulsan exception
-
extractParamElement
public static Map<String,ToolElement> extractParamElement(ToolInfo toolInfo, Element parent, String elementName, Map<String,Parameter> stepParameters) throws EoulsanException
Extract parameter elements.- Parameters:
toolInfo
- the ToolInfo objectparent
- the parentelementName
- the element namestepParameters
- step parameters- Returns:
- a map with the Galaxy tool elements
- Throws:
EoulsanException
- the Eoulsan exception
-
setElementValue
public static void setElementValue(ToolElement toolElement, Map<String,Parameter> stepParameters) throws EoulsanException
Set the tool element value.- Parameters:
toolElement
- tool elementstepParameters
- step parameters- Throws:
EoulsanException
- if an error occurs while setting the value
-
extractConditionalParamElement
public static Map<String,ToolElement> extractConditionalParamElement(ToolInfo toolInfo, Element parent) throws EoulsanException
Extract conditional param element.- Parameters:
parent
- the parent- Returns:
- the map
- Throws:
EoulsanException
- the Eoulsan exception
-
extractConditionalParamElement
public static Map<String,ToolElement> extractConditionalParamElement(ToolInfo toolInfo, Element parent, Map<String,Parameter> stepParameters) throws EoulsanException
Extract conditional param element.- Parameters:
parent
- the parentstepParameters
- the step parameters- Returns:
- the map
- Throws:
EoulsanException
- the Eoulsan exception
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName) throws EoulsanException
Extract elements by tag name.- Parameters:
doc
- the doctagName
- the tag name- Returns:
- the list
- Throws:
EoulsanException
- the Eoulsan exception
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName, int expectedCount) throws EoulsanException
Extract elements by tag name.- Parameters:
toolInfo
- ToolInfo objectdoc
- the doctagName
- the tag nameexpectedCount
- the expected count- Returns:
- the list
- Throws:
EoulsanException
- the Eoulsan exception
-
newEoulsanException
public static EoulsanException newEoulsanException(ToolInfo toolInfo, String message) throws EoulsanException
Create an EoulsanException.- Parameters:
toolInfo
- toolInfo objectmessage
- error message- Throws:
EoulsanException
- in any case
-
newEoulsanException
public static EoulsanException newEoulsanException(ToolInfo toolInfo, String parameterName, String message) throws EoulsanException
Create an EoulsanException.- Parameters:
toolInfo
- toolInfo objectparameterName
- parameter namemessage
- error message- Throws:
EoulsanException
- in any case
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(Element parent, String tagName) throws EoulsanException
Extract elements by tag name.- Parameters:
parent
- the parenttagName
- the tag name- Returns:
- the list
- Throws:
EoulsanException
- the Eoulsan exception
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(Element parent, String tagName, int expectedCount) throws EoulsanException
Extract elements by tag name.- Parameters:
parent
- the parenttagName
- the tag nameexpectedCount
- the expected count- Returns:
- the list
- Throws:
EoulsanException
- the Eoulsan exception
-
extractChildElementsByTagName
public static List<Element> extractChildElementsByTagName(Element parentElement, String elementName)
Extract child elements by tag name.- Parameters:
parentElement
- the parent elementelementName
- the element name- Returns:
- the list
-
extractOutputs
public static Map<String,ToolElement> extractOutputs(ToolInfo toolInfo, Document doc, Map<String,Parameter> stepParameters) throws EoulsanException
Extract all output parameters define in document.- Parameters:
toolInfo
- the tool informationdoc
- document represented tool xmlstepParameters
- parameters for analysis- Returns:
- all output parameters
- Throws:
EoulsanException
- if none output parameter found
-
extractInputs
public static Map<String,ToolElement> extractInputs(ToolInfo toolInfo, Document doc, Map<String,Parameter> stepParameters) throws EoulsanException
Extract all input parameters define in document.- Parameters:
toolInfo
- the tool informationdoc
- document represented tool xmlstepParameters
- parameters for analysis- Returns:
- all input parameters
- Throws:
EoulsanException
- if none input parameter found
-
extractCheetahScript
public static String extractCheetahScript(Document doc)
Extract command tag in string.- Parameters:
doc
- document represented tool xml- Returns:
- command string
-
extractInterpreters
public static List<String> extractInterpreters(Document doc)
Extract interpreter attribute in string.- Parameters:
doc
- document represented tool xml- Returns:
- interpreter names
-
extractDockerImage
public static String extractDockerImage(Document doc)
Extract docker image attribute in string.- Parameters:
doc
- document represented tool xml- Returns:
- the docker image name
-
extractDescription
public static String extractDescription(Document doc)
Extract description tag in string.- Parameters:
doc
- document represented tool xml- Returns:
- description
-
extractToolVersion
public static String extractToolVersion(Document doc)
Extract tool version attribute in string.- Parameters:
doc
- document represented tool xml- Returns:
- tool version string
-
extractToolName
public static String extractToolName(Document doc)
Extract tool name tag in string.- Parameters:
doc
- document represented tool xml- Returns:
- tool name string
-
extractToolID
public static String extractToolID(Document doc)
Extract tool id tag in string.- Parameters:
doc
- document represented tool xml- Returns:
- tool id string
-
extractValueFromElement
public static String extractValueFromElement(Document doc, String elementName, int index, String attributeName)
Extract text from DOM from tag name, at the index place. If attribute name defined return value attribute, otherwise return content text of element.- Parameters:
doc
- document represented tool xmlelementName
- element name to extractindex
- index of element name to extractattributeName
- attribute name from element name to extract- Returns:
- value corresponding to element name content or attribute of element name. Return null, if none corresponding element or attribute found.
-
-