edu.isi.pegasus.planner.catalog.site.impl

## Class XML

- java.lang.Object
- - edu.isi.pegasus.planner.catalog.site.impl.XML

All Implemented Interfaces:
  Catalog, SiteCatalog

    public class XML
    extends java.lang.Object
    implements SiteCatalog

An implementation of the Site Catalog interface that is backed up by an XML file conforming to site catalog xml schema version 3. The schema can be found online at

      http://pegasus.isi.edu/schema/sc-3.0.xsd

Version:
  $Revision$
Author:
  Karan Vahi

### Field Summary

Fields
`private PegasusBag` `mBag` The bag of Pegasus Initialization objects
`private java.lang.String` `mFilename` The Site Catalog file to be parser.
`private LogManager` `mLogger` The handle to the log manager.
`private SiteCatalogXMLParser` `mParser` The handle to parser instance that will parse the site catalog.
`private SiteStore` `mSiteStore` Stores sites in memory

### Fields inherited from interface edu.isi.pegasus.planner.catalog.SiteCatalog

`c_prefix, VERSION`

### Fields inherited from interface edu.isi.pegasus.planner.catalog.Catalog

`DB_ALL_PREFIX`

### Constructor Summary

Constructors
Constructor and Description
`XML()` The default constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close the connection to backend file.
`boolean` `connect(java.util.Properties props)` Establishes a connection to the file from the properties.
`boolean` `connect(java.lang.String filename)` Initializes the Site Catalog Parser instance for the file.
`int` `insert(SiteCatalogEntry entry)` Not implemented as yet.
`boolean` `isClosed()` Returns if the connection is closed or not.
`java.util.Set<java.lang.String>` `list()` Lists the site handles for all the sites in the Site Catalog.
`int` `load(java.util.List<java.lang.String> sites)` Loads up the Site Catalog implementation with the sites whose site handles are specified.
`SiteCatalogEntry` `lookup(java.lang.String handle)` Retrieves the `SiteCatalogEntry` for a site.
`int` `remove(java.lang.String handle)` Not yet implemented as yet.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mParser

    private SiteCatalogXMLParser mParser

The handle to parser instance that will parse the site catalog.

#### mSiteStore

    private SiteStore mSiteStore

Stores sites in memory

#### mFilename

    private java.lang.String mFilename

The Site Catalog file to be parser.

#### mLogger

    private LogManager mLogger

The handle to the log manager.

#### mBag

    private PegasusBag mBag

The bag of Pegasus Initialization objects

### Constructor Detail

#### XML

    public XML()

The default constructor.

### Method Detail

#### connect

    public boolean connect(java.util.Properties props)
                    throws SiteCatalogException

Establishes a connection to the file from the properties. You will need to specify a "file" property to point to the location of the on-disk instance.

Specified by:
  `connect` in interface `Catalog`
Parameters:
  `props` - is the property table with sufficient settings to to connect to the implementation.
Returns:
  true if connected, false if failed to connect.
Throws:
  `SiteCatalogException`

#### connect

    public boolean connect(java.lang.String filename)

Initializes the Site Catalog Parser instance for the file.

Parameters:
  `filename` - is the name of the file to read.
Returns:
  true,

#### close

    public void close()

Close the connection to backend file.

Specified by:
  `close` in interface `Catalog`

#### isClosed

    public boolean isClosed()

Returns if the connection is closed or not.

Specified by:
  `isClosed` in interface `Catalog`
Returns:
  boolean
See Also:
  `Catalog.close()`

#### load

    public int load(java.util.List<java.lang.String> sites)
             throws SiteCatalogException

Loads up the Site Catalog implementation with the sites whose site handles are specified. This is a convenience method, that can allow the backend implementations to maintain soft state if required. If the implementation chooses not to implement this, just do an empty implementation. The site handle * is a special handle designating all sites are to be loaded.

Specified by:
  `load` in interface `SiteCatalog`
Parameters:
  `sites` - the list of sites to be loaded.
Returns:
  the number of sites loaded.
Throws:
  `SiteCatalogException` - in case of error.

#### insert

    public int insert(SiteCatalogEntry entry)
               throws SiteCatalogException

Not implemented as yet.

Specified by:
  `insert` in interface `SiteCatalog`
Parameters:
  `entry` -
Returns:
  number of entries inserted.
Throws:
  `SiteCatalogException`

#### list

    public java.util.Set<java.lang.String> list()
                                         throws SiteCatalogException

Lists the site handles for all the sites in the Site Catalog.

Specified by:
  `list` in interface `SiteCatalog`
Returns:
  A set of site handles.
Throws:
  `SiteCatalogException` - in case of error.

#### lookup

    public SiteCatalogEntry lookup(java.lang.String handle)
                            throws SiteCatalogException

Retrieves the `SiteCatalogEntry` for a site.

Specified by:
  `lookup` in interface `SiteCatalog`
Parameters:
  `handle` - the site handle / identifier.
Returns:
  SiteCatalogEntry in case an entry is found , or `null` if no match is found.
Throws:
  `SiteCatalogException` - in case of error.

#### remove

    public int remove(java.lang.String handle)
               throws SiteCatalogException

Not yet implemented as yet.

Specified by:
  `remove` in interface `SiteCatalog`
Parameters:
  `handle` -
Returns:
  number of entries removed.
Throws:
  `SiteCatalogException`