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

java.lang.Object
  extended by edu.isi.pegasus.planner.catalog.site.impl.XML3
All Implemented Interfaces:
Catalog, SiteCatalog

public class XML3
extends 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: 2622 $
Author:
Karan Vahi

Field Summary
private  PegasusBag mBag
          The bag of Pegasus Initialization objects
private  String mFilename
          The Site Catalog file to be parser.
private  LogManager mLogger
          The handle to the log manager.
private  SiteCatalogParser 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
XML3()
          The default constructor.
 
Method Summary
 void close()
          Close the connection to backend file.
 boolean connect(Properties props)
          Establishes a connection to the file from the properties.
 boolean connect(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.
 Set<String> list()
          Lists the site handles for all the sites in the Site Catalog.
 int load(List<String> sites)
          Loads up the Site Catalog implementation with the sites whose site handles are specified.
 SiteCatalogEntry lookup(String handle)
          Retrieves the SiteCatalogEntry for a site.
 int remove(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 SiteCatalogParser mParser
The handle to parser instance that will parse the site catalog.


mSiteStore

private SiteStore mSiteStore
Stores sites in memory


mFilename

private 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

XML3

public XML3()
The default constructor.

Method Detail

connect

public boolean connect(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(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(List<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 Set<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(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(String handle)
           throws SiteCatalogException
Not yet implemented as yet.

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


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