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 athttp://pegasus.isi.edu/schema/sc-3.0.xsd
- Version:
- $Revision$
- Author:
- Karan Vahi
-
-
Field Summary
Fields Modifier and Type Field Description private PegasusBag
mBag
The bag of Pegasus Initialization objectsprivate 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.Catalog
DB_ALL_PREFIX
-
Fields inherited from interface edu.isi.pegasus.planner.catalog.SiteCatalog
c_prefix, VERSION
-
-
Constructor Summary
Constructors Constructor Description XML()
The default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the connection to backend file.boolean
connect(java.lang.String filename)
Initializes the Site Catalog Parser instance for the file.boolean
connect(java.util.Properties props)
Establishes a connection to the file from the properties.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 theSiteCatalogEntry
for a site.int
remove(java.lang.String handle)
Not yet implemented as yet.
-
-
-
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
-
-
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 interfaceCatalog
- 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.
-
isClosed
public boolean isClosed()
Returns if the connection is closed or not.- Specified by:
isClosed
in interfaceCatalog
- 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 interfaceSiteCatalog
- 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 interfaceSiteCatalog
- 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 interfaceSiteCatalog
- Returns:
- A set of site handles.
- Throws:
SiteCatalogException
- in case of error.
-
lookup
public SiteCatalogEntry lookup(java.lang.String handle) throws SiteCatalogException
Retrieves theSiteCatalogEntry
for a site.- Specified by:
lookup
in interfaceSiteCatalog
- 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 interfaceSiteCatalog
- Parameters:
handle
-- Returns:
- number of entries removed.
- Throws:
SiteCatalogException
-
-