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 PegasusBagmBagThe bag of Pegasus Initialization objectsprivate java.lang.StringmFilenameThe Site Catalog file to be parser.private LogManagermLoggerThe handle to the log manager.private SiteCatalogXMLParsermParserThe handle to parser instance that will parse the site catalog.private SiteStoremSiteStoreStores 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 voidclose()Close the connection to backend file.booleanconnect(java.lang.String filename)Initializes the Site Catalog Parser instance for the file.booleanconnect(java.util.Properties props)Establishes a connection to the file from the properties.intinsert(SiteCatalogEntry entry)Not implemented as yet.booleanisClosed()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.intload(java.util.List<java.lang.String> sites)Loads up the Site Catalog implementation with the sites whose site handles are specified.SiteCatalogEntrylookup(java.lang.String handle)Retrieves theSiteCatalogEntryfor a site.intremove(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 SiteCatalogExceptionEstablishes 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:
connectin 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:
isClosedin interfaceCatalog- Returns:
- boolean
- See Also:
Catalog.close()
-
load
public int load(java.util.List<java.lang.String> sites) throws SiteCatalogExceptionLoads 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:
loadin 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:
insertin interfaceSiteCatalog- Parameters:
entry-- Returns:
- number of entries inserted.
- Throws:
SiteCatalogException
-
list
public java.util.Set<java.lang.String> list() throws SiteCatalogExceptionLists the site handles for all the sites in the Site Catalog.- Specified by:
listin interfaceSiteCatalog- Returns:
- A set of site handles.
- Throws:
SiteCatalogException- in case of error.
-
lookup
public SiteCatalogEntry lookup(java.lang.String handle) throws SiteCatalogException
Retrieves theSiteCatalogEntryfor a site.- Specified by:
lookupin interfaceSiteCatalog- Parameters:
handle- the site handle / identifier.- Returns:
- SiteCatalogEntry in case an entry is found , or
nullif no match is found. - Throws:
SiteCatalogException- in case of error.
-
remove
public int remove(java.lang.String handle) throws SiteCatalogExceptionNot yet implemented as yet.- Specified by:
removein interfaceSiteCatalog- Parameters:
handle-- Returns:
- number of entries removed.
- Throws:
SiteCatalogException
-
-