g-Eclipse
Release 1.0.0

eu.geclipse.servicejob.parsers
Class GTDLParser

java.lang.Object
  extended by eu.geclipse.servicejob.parsers.GTDLParser

public class GTDLParser
extends java.lang.Object

Parser for non-submittable service job's XML (results).


Field Summary
static java.lang.String INPUT_DATA_ELEMENT
          Service job input element name (in input element) from GTDL XML
static java.lang.String INPUT_ELEMENT
          Input element name from GTDL XML
static java.lang.String INPUT_RESOURCE
          Target resource element form target resources list in GTDL XML.
static java.lang.String INPUT_RESOURCES_LIST
          Target resources list element name (in input element) from GTDL XML
static java.lang.String OUTPUT_RESULT_DATA
          Result data element name (in Result element) from GTDL XML
static java.lang.String OUTPUT_RESULT_DATE
          Date element name (in Result element) from GTDL XML
static java.lang.String OUTPUT_RESULT_ELEMENT
          Result element name (in Output element) from GTDL XML
static java.lang.String OUTPUT_RESULT_ENUM
          BES status (job enumeration result) element name (in Result element) from GTDL XML
static java.lang.String OUTPUT_RESULT_RESOURCE
          Resource element name (in Result element) from GTDL XML
static java.lang.String OUTPUT_RESULT_SERVICE_JOB
          Simple service job element name (in Result element) from GTDL XML
static java.lang.String OUTPUT_RESULT_SUMMARY
          Result summary element name (in Result element) from GTDL XML
static java.lang.String OUTPUT_RESULT_TYPE
          Result type element name (in Result element) from GTDL XML
static java.lang.String PLUGIN_ELEMENT
          Plug-in id element name (in input element) from GTDL XML
static java.lang.String SCHEMA_LANGUAGE
          Name of language used when creating XML schema
static java.lang.String SCHEMA_LOCATION
          Path to location of the XML schema
 
Constructor Summary
GTDLParser()
           
 
Method Summary
static java.lang.String getInputServiceJobData(java.io.File file)
          Gets service job initialization data from GTDL file (text content of service job > input > inputData element)
static java.lang.String getPluginId(java.io.File file)
          Gets plug-in id from GTDL file (text content of service job > input > pluginId element)
static java.util.List<java.lang.String> getServiceJobResources(java.io.File file)
          Method to access list of resource's names form input part of GTDL file.
static java.util.List<ServiceJobResult> getServiceJobResults(java.io.File file)
          Parses GTDL (grid test description language) file for service job results.
static void validateFile(java.io.File xmlFile)
          Method to check if file of type GTDL is compatible with XML schema definition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_LANGUAGE

public static final java.lang.String SCHEMA_LANGUAGE
Name of language used when creating XML schema

See Also:
Constant Field Values

SCHEMA_LOCATION

public static final java.lang.String SCHEMA_LOCATION
Path to location of the XML schema

See Also:
Constant Field Values

INPUT_ELEMENT

public static final java.lang.String INPUT_ELEMENT
Input element name from GTDL XML

See Also:
Constant Field Values

PLUGIN_ELEMENT

public static final java.lang.String PLUGIN_ELEMENT
Plug-in id element name (in input element) from GTDL XML

See Also:
Constant Field Values

INPUT_DATA_ELEMENT

public static final java.lang.String INPUT_DATA_ELEMENT
Service job input element name (in input element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_ELEMENT

public static final java.lang.String OUTPUT_RESULT_ELEMENT
Result element name (in Output element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_RESOURCE

public static final java.lang.String OUTPUT_RESULT_RESOURCE
Resource element name (in Result element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_DATE

public static final java.lang.String OUTPUT_RESULT_DATE
Date element name (in Result element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_SERVICE_JOB

public static final java.lang.String OUTPUT_RESULT_SERVICE_JOB
Simple service job element name (in Result element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_DATA

public static final java.lang.String OUTPUT_RESULT_DATA
Result data element name (in Result element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_SUMMARY

public static final java.lang.String OUTPUT_RESULT_SUMMARY
Result summary element name (in Result element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_ENUM

public static final java.lang.String OUTPUT_RESULT_ENUM
BES status (job enumeration result) element name (in Result element) from GTDL XML

See Also:
Constant Field Values

OUTPUT_RESULT_TYPE

public static final java.lang.String OUTPUT_RESULT_TYPE
Result type element name (in Result element) from GTDL XML

See Also:
Constant Field Values

INPUT_RESOURCES_LIST

public static final java.lang.String INPUT_RESOURCES_LIST
Target resources list element name (in input element) from GTDL XML

See Also:
Constant Field Values

INPUT_RESOURCE

public static final java.lang.String INPUT_RESOURCE
Target resource element form target resources list in GTDL XML.

See Also:
Constant Field Values
Constructor Detail

GTDLParser

public GTDLParser()
Method Detail

validateFile

public static void validateFile(java.io.File xmlFile)
                         throws org.xml.sax.SAXException,
                                java.io.IOException
Method to check if file of type GTDL is compatible with XML schema definition.

Parameters:
xmlFile - XML file to parse
Throws:
org.xml.sax.SAXException - in case XML or XML schema file could not be parsed
java.io.IOException - in case there are problems with reading XML or XML schema file

getPluginId

public static java.lang.String getPluginId(java.io.File file)
                                    throws javax.xml.parsers.ParserConfigurationException,
                                           org.xml.sax.SAXException,
                                           java.io.IOException
Gets plug-in id from GTDL file (text content of service job > input > pluginId element)

Parameters:
file - GTDL file to parse.
Returns:
Plug-in id (responsible for handling service job data from GTDL file).
Throws:
javax.xml.parsers.ParserConfigurationException - In case parser could not be initialized.
org.xml.sax.SAXException - In case file could not be parsed.
java.io.IOException - In case there were problems when reading XML file.

getInputServiceJobData

public static java.lang.String getInputServiceJobData(java.io.File file)
                                               throws javax.xml.parsers.ParserConfigurationException,
                                                      org.xml.sax.SAXException,
                                                      java.io.IOException
Gets service job initialization data from GTDL file (text content of service job > input > inputData element)

Parameters:
file - GTDL file to parse.
Returns:
Plug-in id (responsible for handling service job data from GTDL file).
Throws:
javax.xml.parsers.ParserConfigurationException - In case parser could not be initialized.
org.xml.sax.SAXException - In case file could not be parsed.
java.io.IOException - In case there were problems when reading XML file.

getServiceJobResults

public static java.util.List<ServiceJobResult> getServiceJobResults(java.io.File file)
                                                             throws javax.xml.parsers.ParserConfigurationException,
                                                                    org.xml.sax.SAXException,
                                                                    java.io.IOException,
                                                                    org.w3c.dom.DOMException,
                                                                    java.text.ParseException
Parses GTDL (grid test description language) file for service job results. List of results that were found and parsed is returned. List elements are instances of ServiceJobResult - which means that they have String taken directly from XML as a service job's result. Only plug-in calling this method knows what to do with this String (available also as a InputStream - IServiceJob.getInputStreamForResult(IServiceJobResult)). This all means that data returned by this method has to modified by plug-in that called this method!

Parameters:
file - XML file (GTDL).
Returns:
List of ServiceJobResult representing data in XML file.
Throws:
javax.xml.parsers.ParserConfigurationException - In case parser could not be initialized.
org.xml.sax.SAXException - In case file could not be parsed.
java.io.IOException - In case there were problems when reading XML file.
org.w3c.dom.DOMException - In case parser could not read text content of XML's elements.
java.text.ParseException - In case DateFormat class could not parse date contained in XML.

getServiceJobResources

public static java.util.List<java.lang.String> getServiceJobResources(java.io.File file)
                                                               throws javax.xml.parsers.ParserConfigurationException,
                                                                      org.xml.sax.SAXException,
                                                                      java.io.IOException
Method to access list of resource's names form input part of GTDL file.

Parameters:
file - GTDL file to parse.
Returns:
List of names of resources on which this service job should run.
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

g-Eclipse
Release 1.0.0