Package edu.isi.pegasus.planner.parser
Class SiteCatalogXMLParser3
- 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.SiteCatalogXMLParser3
-
- All Implemented Interfaces:
SiteCatalogXMLParser
,org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class SiteCatalogXMLParser3 extends StackBasedXMLParser implements SiteCatalogXMLParser
This class uses the Xerces SAX2 parser to validate and parse an XML document conforming to the Site Catalog schema v3.0- Version:
- $Revision$
- Author:
- Karan Vahi vahi@isi.edu
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
mLoadAll
A boolean indicating whether to load all sites.private SiteStore
mResult
The final result constructed.private java.util.Set<java.lang.String>
mSites
The set of sites that need to be parsed.static java.lang.String
SCHEMA_LOCATION
The "not-so-official" location URL of the Site Catalog Schema.static java.lang.String
SCHEMA_NAMESPACE
uri namespace-
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 SiteCatalogXMLParser3(PegasusBag bag, java.util.List<java.lang.String> sites)
The overloaded constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.java.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.SiteStore
getSiteStore()
Returns the constructed site store objectprivate boolean
loadSite(SiteCatalogEntry3 site)
Whether to laod a site or not in theSiteStore
static void
main(java.lang.String[] args)
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 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
-
mResult
private SiteStore mResult
The final result constructed.
-
mSites
private java.util.Set<java.lang.String> mSites
The set of sites that need to be parsed.
-
mLoadAll
private boolean mLoadAll
A boolean indicating whether to load all sites.
-
-
Constructor Detail
-
SiteCatalogXMLParser3
public SiteCatalogXMLParser3(PegasusBag bag, java.util.List<java.lang.String> sites)
The overloaded constructor.- Parameters:
bag
- the bag of initialization objects.sites
- the list of sites that need to be parsed. * means all.
-
-
Method Detail
-
getSiteStore
public SiteStore getSiteStore()
Returns the constructed site store object- Specified by:
getSiteStore
in interfaceSiteCatalogXMLParser
- Returns:
SiteStore
if parsing completed
-
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.
-
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.
-
loadSite
private boolean loadSite(SiteCatalogEntry3 site)
Whether to laod a site or not in theSiteStore
- Parameters:
site
- theSiteCatalogEntry
object.- Returns:
- boolean
-
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 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.
-
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
-
main
public static void main(java.lang.String[] args)
- Parameters:
args
-
-
-