Class DAXParser3
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- edu.isi.pegasus.planner.parser.Parser
-
- edu.isi.pegasus.planner.parser.StackBasedXMLParser
-
- edu.isi.pegasus.planner.parser.dax.DAXParser3
-
- All Implemented Interfaces:
DAXParser
,org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class DAXParser3 extends StackBasedXMLParser implements DAXParser
This class uses the Xerces SAX2 parser to validate and parse an XML document conforming to the DAX Schema 3.2- Version:
- $Revision$
- Author:
- Karan Vahi vahi@isi.edu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DAXParser3.Arguments
Private class to handle mix data content for arguments tags.
-
Field Summary
Fields Modifier and Type Field Description static long
DAX_VERSION_3_2_0
static long
DAX_VERSION_3_3_0
private java.lang.String
DEFAULT_METADATA_TYPE
Constant denoting default metadata typeprotected Callback
mCallback
Handle to the callbackprotected java.lang.String
mJobPrefix
A job prefix specifed at command line.protected java.util.List<PCRelation>
mParents
List of parents for a child node in the graphstatic java.lang.String
SCHEMA_LOCATION
The "not-so-official" location URL of the Site Catalog Schema.static java.lang.String
SCHEMA_NAMESPACE
uri namespacestatic java.lang.String
UNDEFINED_SITE
Constant denoting an undefined site-
Fields inherited from class edu.isi.pegasus.planner.parser.StackBasedXMLParser
mDepth, mParsingDone, mStack
-
Fields inherited from class edu.isi.pegasus.planner.parser.Parser
DEFAULT_PARSER_NAME, mAdjFName, mLocator, mLogger, mLogMsg, mParser, mProps, mTextContent, mTextString
-
-
Constructor Summary
Constructors Constructor Description DAXParser3(PegasusBag bag)
The overloaded constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
constructJobID(Job j)
Returns the id for a jobjava.util.List<TransformationCatalogEntry>
convertExecutableToTCE(Executable executable)
Converts the executable into transformation catalog entriesjava.lang.Object
createObject(java.lang.String element, java.util.List names, java.util.List values)
Composes theSiteData
object corresponding to the element name in the XML document.Callback
getDAXCallback()
Retuns the DAXCallback for the parserjava.lang.String
getSchemaLocation()
Returns the local path to the XML schema against which to validate.java.lang.String
getSchemaNamespace()
Returns the XML schema namespace that a document being parsed conforms to.static void
main(java.lang.String[] args)
protected void
sanityCheckOnVersion(java.lang.String version)
Sanity check on the version that this parser works on.void
setDAXCallback(Callback c)
Set the DAXCallback for the parser to call out to.boolean
setElementRelation(java.lang.String childElement, java.lang.Object parent, java.lang.Object child)
This method sets the relations between the currently finished XML element(child) and its containing element in terms of Java objects.void
startParser(java.lang.String file)
The main method that starts the parsing.-
Methods inherited from class edu.isi.pegasus.planner.parser.StackBasedXMLParser
attributeNotSupported, complain, endDocument, endElement, log, startElement, unSupportedNestingOfElements
-
Methods inherited from class edu.isi.pegasus.planner.parser.Parser
characters, ignoreWhitespace, ignoreWhitespace, setDocumentLocator, setParserFeature, setSchemaLocations, testForFile
-
-
-
-
Field Detail
-
SCHEMA_LOCATION
public static final java.lang.String SCHEMA_LOCATION
The "not-so-official" location URL of the Site Catalog Schema.- See Also:
- Constant Field Values
-
SCHEMA_NAMESPACE
public static final java.lang.String SCHEMA_NAMESPACE
uri namespace- See Also:
- Constant Field Values
-
UNDEFINED_SITE
public static final java.lang.String UNDEFINED_SITE
Constant denoting an undefined site- See Also:
- Constant Field Values
-
DAX_VERSION_3_2_0
public static final long DAX_VERSION_3_2_0
-
DAX_VERSION_3_3_0
public static final long DAX_VERSION_3_3_0
-
DEFAULT_METADATA_TYPE
private java.lang.String DEFAULT_METADATA_TYPE
Constant denoting default metadata type
-
mParents
protected java.util.List<PCRelation> mParents
List of parents for a child node in the graph
-
mCallback
protected Callback mCallback
Handle to the callback
-
mJobPrefix
protected java.lang.String mJobPrefix
A job prefix specifed at command line.
-
-
Constructor Detail
-
DAXParser3
public DAXParser3(PegasusBag bag)
The overloaded constructor.- Parameters:
properties
- thePegasusProperties
to be used.
-
-
Method Detail
-
setDAXCallback
public void setDAXCallback(Callback c)
Set the DAXCallback for the parser to call out to.- Specified by:
setDAXCallback
in interfaceDAXParser
- Parameters:
c
- the callback
-
getDAXCallback
public Callback getDAXCallback()
Retuns the DAXCallback for the parser- Specified by:
getDAXCallback
in interfaceDAXParser
- Returns:
- the callback
-
startParser
public void startParser(java.lang.String file)
The main method that starts the parsing.- Specified by:
startParser
in classParser
- Parameters:
file
- the XML file to be parsed.
-
getSchemaNamespace
public java.lang.String getSchemaNamespace()
Returns the XML schema namespace that a document being parsed conforms to.- Specified by:
getSchemaNamespace
in classParser
- Returns:
- the schema namespace
-
getSchemaLocation
public java.lang.String getSchemaLocation()
Returns the local path to the XML schema against which to validate.- Specified by:
getSchemaLocation
in classParser
- Returns:
- path to the schema
-
createObject
public java.lang.Object createObject(java.lang.String element, java.util.List names, java.util.List values)
Composes theSiteData
object corresponding to the element name in the XML document.- Specified by:
createObject
in classStackBasedXMLParser
- Parameters:
element
- the element name encountered while parsing.names
- is a list of attribute names, as strings.values
- is a list of attribute values, to match the key list.- Returns:
- the relevant SiteData object, else null if unable to construct.
- Throws:
java.lang.IllegalArgumentException
- if the element name is too short.
-
setElementRelation
public boolean setElementRelation(java.lang.String childElement, java.lang.Object parent, java.lang.Object child)
This method sets the relations between the currently finished XML element(child) and its containing element in terms of Java objects. Usually it involves adding the object to the parent's child object list.- Specified by:
setElementRelation
in classStackBasedXMLParser
- Parameters:
childElement
- name is the the child element nameparent
- is a reference to the parent's Java objectchild
- is the completed child object to connect to the parent- Returns:
- true if the element was added successfully, false, if the child does not match into the parent.
-
convertExecutableToTCE
public java.util.List<TransformationCatalogEntry> convertExecutableToTCE(Executable executable)
Converts the executable into transformation catalog entries- Parameters:
executable
- executable object- Returns:
- transformation catalog entries
-
constructJobID
protected java.lang.String constructJobID(Job j)
Returns the id for a job- Parameters:
j
- the job- Returns:
- the id.
-
sanityCheckOnVersion
protected void sanityCheckOnVersion(java.lang.String version)
Sanity check on the version that this parser works on.- Parameters:
version
- the version as specified in the DAX
-
main
public static void main(java.lang.String[] args)
- Parameters:
args
-
-
-