edu.isi.pegasus.planner.parser.dax
Class DAXParser3

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by edu.isi.pegasus.planner.parser.Parser
          extended by edu.isi.pegasus.planner.parser.StackBasedXMLParser
              extended by edu.isi.pegasus.planner.parser.dax.DAXParser3
All Implemented Interfaces:
DAXParser, ContentHandler, DTDHandler, EntityResolver, 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: 4507 $
Author:
Karan Vahi vahi@isi.edu

Nested Class Summary
private  class DAXParser3.Arguments
          Private class to handle mix data content for arguments tags.
 
Field Summary
static long DAX_VERSION_3_2_0
           
static long DAX_VERSION_3_3_0
           
private  String DEFAULT_METADATA_TYPE
          Constant denoting default metadata type
protected  Callback mCallback
          Handle to the callback
protected  String mJobPrefix
          A job prefix specifed at command line.
protected  List<PCRelation> mParents
          List of parents for a child node in the graph
static String SCHEMA_LOCATION
          The "not-so-official" location URL of the Site Catalog Schema.
static String SCHEMA_NAMESPACE
          uri namespace
static 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
DAXParser3(PegasusBag bag)
          The overloaded constructor.
 
Method Summary
protected  String constructJobID(Job j)
          Returns the id for a job
 List<TransformationCatalogEntry> convertExecutableToTCE(Executable executable)
          Converts the executable into transformation catalog entries
 Object createObject(String element, List names, List values)
          Composes the SiteData object corresponding to the element name in the XML document.
 Callback getDAXCallback()
          Retuns the DAXCallback for the parser
 String getSchemaLocation()
          Returns the local path to the XML schema against which to validate.
 String getSchemaNamespace()
          Returns the XML schema namespace that a document being parsed conforms to.
static void main(String[] args)
           
protected  void sanityCheckOnVersion(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(String childElement, Object parent, 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(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
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_LOCATION

public static final String SCHEMA_LOCATION
The "not-so-official" location URL of the Site Catalog Schema.

See Also:
Constant Field Values

SCHEMA_NAMESPACE

public static final String SCHEMA_NAMESPACE
uri namespace

See Also:
Constant Field Values

UNDEFINED_SITE

public static final 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 String DEFAULT_METADATA_TYPE
Constant denoting default metadata type


mParents

protected List<PCRelation> mParents
List of parents for a child node in the graph


mCallback

protected Callback mCallback
Handle to the callback


mJobPrefix

protected String mJobPrefix
A job prefix specifed at command line.

Constructor Detail

DAXParser3

public DAXParser3(PegasusBag bag)
The overloaded constructor.

Parameters:
properties - the PegasusProperties 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 interface DAXParser
Parameters:
c - the callback

getDAXCallback

public Callback getDAXCallback()
Retuns the DAXCallback for the parser

Specified by:
getDAXCallback in interface DAXParser
Returns:
the callback

startParser

public void startParser(String file)
The main method that starts the parsing.

Specified by:
startParser in class Parser
Parameters:
file - the XML file to be parsed.

getSchemaNamespace

public String getSchemaNamespace()
Returns the XML schema namespace that a document being parsed conforms to.

Specified by:
getSchemaNamespace in class Parser
Returns:
the schema namespace

getSchemaLocation

public String getSchemaLocation()
Returns the local path to the XML schema against which to validate.

Specified by:
getSchemaLocation in class Parser
Returns:
path to the schema

createObject

public Object createObject(String element,
                           List names,
                           List values)
Composes the SiteData object corresponding to the element name in the XML document.

Specified by:
createObject in class StackBasedXMLParser
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:
IllegalArgumentException - if the element name is too short.

setElementRelation

public boolean setElementRelation(String childElement,
                                  Object parent,
                                  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 class StackBasedXMLParser
Parameters:
childElement - name is the the child element name
parent - is a reference to the parent's Java object
child - 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 List<TransformationCatalogEntry> convertExecutableToTCE(Executable executable)
Converts the executable into transformation catalog entries

Parameters:
executable - executable object
Returns:
transformation catalog entries

constructJobID

protected String constructJobID(Job j)
Returns the id for a job

Parameters:
j - the job
Returns:
the id.

sanityCheckOnVersion

protected void sanityCheckOnVersion(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(String[] args)
Parameters:
args -


Copyright © 2011 The University of Southern California. All Rights Reserved.