edu.isi.pegasus.planner.catalog.site.impl.myosg.util
Class MYOSGSiteCatalogParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by edu.isi.pegasus.planner.parser.Parser
          extended by edu.isi.pegasus.planner.catalog.site.impl.myosg.util.MYOSGSiteCatalogParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class MYOSGSiteCatalogParser
extends Parser

This class uses the Xerces SAX2 parser to validate and parse an XML.

Author:
prasanth

Field Summary
(package private)  Stack<AbstractSiteCatalogResource> elementStack
           
static String ENV_TAG
           
private  int mDepth
           
private  boolean mLoadAll
          A boolean indicating whether to load all sites.
private  LogManager mLogger
          The handle to the log manager.
private  Set<String> mSites
          The set of sites that need to be parsed.
static String RESOURCE_GROUP_TAG
           
static String RESOURCE_TAG
           
static String SERVICE_TAG
           
(package private)  List<AbstractSiteCatalogResource> siteList
           
static String VO_OWNERSHIP_TAG
           
 
Fields inherited from class edu.isi.pegasus.planner.parser.Parser
DEFAULT_PARSER_NAME, mAdjFName, mLocator, mLogMsg, mParser, mProps, mTextContent, mTextString
 
Constructor Summary
MYOSGSiteCatalogParser()
          The default Constructor.
MYOSGSiteCatalogParser(List<String> sites)
           
MYOSGSiteCatalogParser(PegasusProperties properties, List<String> sites)
           
 
Method Summary
 void endDocument()
          This is called automatically when the end of the XML file is reached.
 void endElement(String uri, String localName, String name)
          The parser is at the end of an element.
 int getNumberOfSites()
          Returns the number of sites parsed
 String getSchemaLocation()
          Helps the load database to locate the XML schema, if available.
 String getSchemaNamespace()
          Returns the XML schema namespace that a document being parsed conforms to.
 List getSites()
          Returns the site's list
private  boolean isStackedElement(String name)
           
private  boolean loadSite(AbstractSiteCatalogResource site)
          Whether to laod a site or not in the SiteStore
 void startElement(String uri, String local, String name, Attributes attrs)
          This method defines the action to take when the parser begins to parse an element.
 void startParser(String file)
          The main method that starts the parsing.
 
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

RESOURCE_GROUP_TAG

public static final String RESOURCE_GROUP_TAG
See Also:
Constant Field Values

SERVICE_TAG

public static final String SERVICE_TAG
See Also:
Constant Field Values

RESOURCE_TAG

public static final String RESOURCE_TAG
See Also:
Constant Field Values

ENV_TAG

public static final String ENV_TAG
See Also:
Constant Field Values

VO_OWNERSHIP_TAG

public static final String VO_OWNERSHIP_TAG
See Also:
Constant Field Values

mDepth

private int mDepth

elementStack

Stack<AbstractSiteCatalogResource> elementStack

siteList

List<AbstractSiteCatalogResource> siteList

mLogger

private LogManager mLogger
The handle to the log manager.


mSites

private Set<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

MYOSGSiteCatalogParser

public MYOSGSiteCatalogParser()
The default Constructor.


MYOSGSiteCatalogParser

public MYOSGSiteCatalogParser(List<String> sites)

MYOSGSiteCatalogParser

public MYOSGSiteCatalogParser(PegasusProperties properties,
                              List<String> sites)
Method Detail

endDocument

public void endDocument()
Description copied from class: Parser
This is called automatically when the end of the XML file is reached.

Specified by:
endDocument in interface ContentHandler
Specified by:
endDocument in class Parser

endElement

public void endElement(String uri,
                       String localName,
                       String name)
                throws SAXException
The parser is at the end of an element. Triggers the association of the child elements with the appropriate parent elements.

Specified by:
endElement in interface ContentHandler
Specified by:
endElement in class Parser
Parameters:
uri - is the URI of the namespace for the element
localName - is the element name without namespace
name - is the element name as it appears in the docment
Throws:
SAXException

isStackedElement

private boolean isStackedElement(String name)

loadSite

private boolean loadSite(AbstractSiteCatalogResource site)
Whether to laod a site or not in the SiteStore

Parameters:
site - the SiteCatalogEntry object.
Returns:
boolean

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()
Description copied from class: Parser
Helps the load database to locate the XML schema, if available. Please note that the schema location URL in the instance document is only a hint, and may be overriden by the findings of this method.

Specified by:
getSchemaLocation in class Parser
Returns:
a location pointing to a definition document of the XML schema that can read VDLx. Result may be null, if such a document is unknown or unspecified.

startElement

public void startElement(String uri,
                         String local,
                         String name,
                         Attributes attrs)
                  throws SAXException
This method defines the action to take when the parser begins to parse an element.

Specified by:
startElement in interface ContentHandler
Specified by:
startElement in class Parser
Parameters:
uri - is the URI of the namespace for the element
local - is the element name without namespace
name - is the element name as it appears in the docment
attrs - has the names and values of all the attributes
Throws:
SAXException

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.

getSites

public List getSites()
Returns the site's list

Returns:
site's list

getNumberOfSites

public int getNumberOfSites()
Returns the number of sites parsed

Returns:
number of sites


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