edu.isi.pegasus.planner.parser

## Class ConfigXmlParser

- java.lang.Object
- - org.xml.sax.helpers.DefaultHandler
  - - edu.isi.pegasus.planner.parser.Parser
    - - edu.isi.pegasus.planner.parser.ConfigXmlParser

All Implemented Interfaces:
  org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class ConfigXmlParser
    extends Parser

This is the parsing class, used to parse the pool config file in xml format.

Version:
  $Revision$
Author:
  Gaurang Mehta gmehta@isi.edu, Karan Vahi vahi@isi.edu

### Field Summary

Fields
`private GridFTPServer` `gftp`
`private java.lang.String` `m_key`
`private java.lang.String` `m_namespace`
`PoolConfig` `m_pconfig`
`private SiteInfo` `m_pool_info`
`static java.lang.String` `SCHEMA_LOCATION` The "not-so-official" location URL of the VDLx schema definition.
`static java.lang.String` `SCHEMA_NAMESPACE` uri namespace

### 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 and Description
`ConfigXmlParser(PegasusProperties properties)` Default Class Constructor.
`ConfigXmlParser(java.lang.String configFileName, PegasusProperties properties)` Class Constructor intializes the parser and turns on validation.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `endDocument()` This is called automatically when the end of the XML file is reached.
`void` `endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)` An empty implementation is provided by DefaultHandler class.
`PoolConfig` `getPoolConfig()` This class returns the reference to the `PooConfig` object containing information about all the pools.
`java.lang.String` `getSchemaLocation()` Helps the load database to locate the XML schema, if available.
`java.lang.String` `getSchemaNamespace()` Returns the XML schema namespace that a document being parsed conforms to.
`private static void` `handleConfigTagEnd()` Handles the end of the Xml files.
`private PoolConfig` `handleConfigTagStart()`
`private static void` `handleGridFtpBandwidthTagEnd()`
`private void` `handleGridFtpBandwidthTagStart(SiteInfo pinfo, org.xml.sax.Attributes attrs)` sk added function to handle gridftpbandwidth tag
`private void` `handleGridFtpTagEnd()` sk made changes to the following function to set GRIDFTPServer instead of setting it in fn handleGridFtpTagStart()
`private void` `handleGridFtpTagStart(SiteInfo pinfo, org.xml.sax.Attributes attrs)`
`private static void` `handleJobManagerTagEnd()` Handles the end of the JobManager Tag
`private static void` `handleJobManagerTagStart(SiteInfo pinfo, org.xml.sax.Attributes attrs)` This method handles the start of a jobmanager tag.
`private static void` `handleLRCTagEnd()` Handles the end of the LRC Tag
`private static void` `handleLRCTagStart(SiteInfo pinfo, org.xml.sax.Attributes attrs)`
`private static void` `handlePoolTagEnd()` Handles the end of the pool tag.
`private SiteInfo` `handlePoolTagStart(PoolConfig pcfg, org.xml.sax.Attributes attrs)`
`private void` `handleProfileTagEnd(SiteInfo pinfo)` Handles the end of the Profile tag.
`private void` `handleProfileTagStart(SiteInfo pinfo, org.xml.sax.Attributes attrs)`
`private void` `handleWorkDirectoryTagEnd(SiteInfo pinfo)` This method handles the Workdirectory tg end.
`private static void` `handleWorkDirectoryTagStart(SiteInfo pinfo, org.xml.sax.Attributes attrs)` Handles the WorkDirectory Tag Start.
`void` `startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)` An empty implementation is provided by DefaultHandler of ContentHandler.
`void` `startParser(java.lang.String configxml)` Start the parser.

### 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 java.lang.String SCHEMA_LOCATION

The "not-so-official" location URL of the VDLx schema definition.

See Also:
  Constant Field Values

#### SCHEMA_NAMESPACE

    public static final java.lang.String SCHEMA_NAMESPACE

uri namespace

See Also:
  Constant Field Values

#### m_pconfig

    public PoolConfig m_pconfig

#### m_pool_info

    private SiteInfo m_pool_info

#### m_namespace

    private java.lang.String m_namespace

#### m_key

    private java.lang.String m_key

#### gftp

    private GridFTPServer gftp

### Constructor Detail

#### ConfigXmlParser

    public ConfigXmlParser(PegasusProperties properties)

Default Class Constructor.

Parameters:
  `properties` - the `PegasusProperties` to be used.

#### ConfigXmlParser

    public ConfigXmlParser(java.lang.String configFileName,
                           PegasusProperties properties)

Class Constructor intializes the parser and turns on validation.

Parameters:
  `configFileName` - The file which you want to parse
  `properties` - the `PegasusProperties` to be used.

### Method Detail

#### startParser

    public void startParser(java.lang.String configxml)

Description copied from class: `Parser`
Start the parser. This starts the parsing of the file by the parser.

Specified by:
  `startParser` in class `Parser`
Parameters:
  `configxml` - the path to the XML file you want to parse.

#### 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 `org.xml.sax.ContentHandler`
Specified by:
  `endDocument` in class `Parser`

#### endElement

    public void endElement(java.lang.String uri,
                           java.lang.String localName,
                           java.lang.String qName)

Description copied from class: `Parser`
An empty implementation is provided by DefaultHandler class. This method is called automatically by the Sax parser when the end tag of an element comes in the xml file. Any parser class should implement this method

Specified by:
  `endElement` in interface `org.xml.sax.ContentHandler`
Specified by:
  `endElement` in class `Parser`

#### startElement

    public void startElement(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String qName,
                             org.xml.sax.Attributes attrs)

Description copied from class: `Parser`
An empty implementation is provided by DefaultHandler of ContentHandler. This method receives the notification from the sacks parser when start tag of an element comes. Any parser class must implement this method.

Specified by:
  `startElement` in interface `org.xml.sax.ContentHandler`
Specified by:
  `startElement` in class `Parser`

#### getSchemaNamespace

    public java.lang.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 java.lang.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.

#### handleConfigTagStart

    private PoolConfig handleConfigTagStart()

Returns:
  PoolConfig Returns a new `PoolConfig`object when it encounters start of XML.``
See Also:
  `org.griphyn.cPlanner.classes.PoolConfig`

#### handlePoolTagStart

    private SiteInfo handlePoolTagStart(PoolConfig pcfg,
                                        org.xml.sax.Attributes attrs)
                                 throws java.lang.Exception

Parameters:
  `pcfg` - Takes the PoolConfig class.
  `attrs` - Takes the atrributes returned in XML.
Returns:
  SiteInfo returns the reference to the PooInfo ojject
Throws:
  `java.lang.Exception`
See Also:
  `org.griphyn.cPlanner.classes.SiteInfo`, `org.griphyn.cPlanner.classes.PoolConfig`

#### handleProfileTagStart

    private void handleProfileTagStart(SiteInfo pinfo,
                                       org.xml.sax.Attributes attrs)
                                throws java.lang.Exception

Parameters:
  `pinfo` - Poolinfo object that is to be populated
  `attrs` - Attributes for the element
Throws:
  `java.lang.Exception`

#### handleLRCTagStart

    private static void handleLRCTagStart(SiteInfo pinfo,
                                          org.xml.sax.Attributes attrs)
                                   throws java.lang.Exception

Parameters:
  `pinfo` - Poolinfo object that is to be populated
  `attrs` - Attributes for the element
Throws:
  `java.lang.Exception`

#### handleGridFtpTagStart

    private void handleGridFtpTagStart(SiteInfo pinfo,
                                       org.xml.sax.Attributes attrs)
                                throws java.lang.Exception

Parameters:
  `pinfo` - Poolinfo object that is to be populated
  `attrs` - Attributes for the element
Throws:
  `java.lang.Exception`

#### handleGridFtpBandwidthTagStart

    private void handleGridFtpBandwidthTagStart(SiteInfo pinfo,
                                                org.xml.sax.Attributes attrs)
                                         throws java.lang.Exception

sk added function to handle gridftpbandwidth tag

Parameters:
  `pinfo` - Poolinfo object that is to be populated
  `attrs` - Attributes for the element
Throws:
  `java.lang.Exception`

#### handleJobManagerTagStart

    private static void handleJobManagerTagStart(SiteInfo pinfo,
                                                 org.xml.sax.Attributes attrs)
                                          throws java.lang.Exception

This method handles the start of a jobmanager tag.

Parameters:
  `pinfo` - The `PoolInfo` object which will hold the jobmanager information
  `attrs` - The attributes about the jobmanager tag returned from the XML.
Throws:
  `java.lang.Exception`
See Also:
  `org.griphyn.cPlanner.classes.SiteInfo`

#### handleWorkDirectoryTagStart

    private static void handleWorkDirectoryTagStart(SiteInfo pinfo,
                                                    org.xml.sax.Attributes attrs)
                                             throws java.lang.Exception

Handles the WorkDirectory Tag Start.

Parameters:
  `pinfo` - Takes a SiteInfo object for which the work directory is.
  `attrs` - Takes the attributes returned from the XML by the parser.
Throws:
  `java.lang.Exception`
See Also:
  `org.griphyn.cPlanner.classes.SiteInfo`

#### handleConfigTagEnd

    private static void handleConfigTagEnd()

Handles the end of the Xml files.

#### handlePoolTagEnd

    private static void handlePoolTagEnd()

Handles the end of the pool tag.

#### handleProfileTagEnd

    private void handleProfileTagEnd(SiteInfo pinfo)
                              throws java.lang.RuntimeException

Handles the end of the Profile tag.

Parameters:
  `pinfo` - `PoolInfo` object for which the profiles are collected.
Throws:
  `java.lang.Exception`
  `java.lang.RuntimeException`
See Also:
  `org.griphyn.cPlanner.classes.SiteInfo`

#### handleLRCTagEnd

    private static void handleLRCTagEnd()

Handles the end of the LRC Tag

#### handleGridFtpTagEnd

    private void handleGridFtpTagEnd()
                              throws java.lang.RuntimeException

sk made changes to the following function to set GRIDFTPServer instead of setting it in fn handleGridFtpTagStart()

Throws:
  `java.lang.RuntimeException`

#### handleGridFtpBandwidthTagEnd

    private static void handleGridFtpBandwidthTagEnd()

#### handleJobManagerTagEnd

    private static void handleJobManagerTagEnd()

Handles the end of the JobManager Tag

#### handleWorkDirectoryTagEnd

    private void handleWorkDirectoryTagEnd(SiteInfo pinfo)
                                    throws java.lang.RuntimeException

This method handles the Workdirectory tg end.

Parameters:
  `pinfo` - Takes the PoolInfo object.
Throws:
  `java.lang.Exception`
  `java.lang.RuntimeException`
See Also:
  `org.griphyn.cPlanner.classes.SiteInfo`

#### getPoolConfig

    public PoolConfig getPoolConfig()

This class returns the reference to the `PooConfig` object containing information about all the pools.

Returns:
  returns a reference to the `PoolConfig` object which contains all the pools.
See Also:
  `org.griphyn.cPlanner.classes.PoolConfig`