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

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

public class MYOSG
extends Object
implements SiteCatalog

This class implements the SiteCatalog interface

Version:
$Revision: 2079 $
Author:
Prasanth Thomas, Karan Vahi

Field Summary
static String DATE_FORMAT
          The date format to be used while passing dates to the URL construction.
static String DEFAULT_GRID
          The default VO to use if none is specified
static String DEFAULT_VO
          The default VO to use if none is specified
static String GRID_KEY
          The name of the key that determines whether we keep the tmp xml file around or not.
static String KEEP_TMP_FILE_KEY
          The name of the key that determines whether we keep the tmp xml file around or not.
private  boolean mConnected
          A boolean variable tracking whether catalog is connected or not
private  String mGrid
          The grid for which to query MYOSG
private  boolean mKeepTmpFile
          A boolean variable that tracks whether to keep the temp xml file or not.
private  LogManager mLogger
          The Logging instance.
private  Map<String,MYOSGSiteInfo> mMYOSGInfo
           
private  SiteStore mSiteStore
          The SiteStore object where information about the sites is stored.
private  String mVO
          The vo for which to query MYOSG
static String VO_KEY
          The name of the key that determines what VO to query for.
 
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
MYOSG()
          The default constructor.
 
Method Summary
 void close()
          Close the connection to back end file.
 boolean connect(Properties props)
          Establishes a connection to the file from the properties.
private  Properties createConnectionURLProperties()
          Creates the properties that are required to compose the HTTP URL to the MYOSG website.
private static String getDateAfter(int days)
          Returns the date after n days formatted as MM/dd/yyyy.
private  String getStartDate()
          Returns the start date formatted as MM/dd/yyyy.
 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

DATE_FORMAT

public static final String DATE_FORMAT
The date format to be used while passing dates to the URL construction.

See Also:
Constant Field Values

DEFAULT_VO

public static final String DEFAULT_VO
The default VO to use if none is specified

See Also:
Constant Field Values

DEFAULT_GRID

public static final String DEFAULT_GRID
The default VO to use if none is specified

See Also:
Constant Field Values

KEEP_TMP_FILE_KEY

public static final String KEEP_TMP_FILE_KEY
The name of the key that determines whether we keep the tmp xml file around or not.

See Also:
Constant Field Values

VO_KEY

public static final String VO_KEY
The name of the key that determines what VO to query for.

See Also:
Constant Field Values

GRID_KEY

public static final String GRID_KEY
The name of the key that determines whether we keep the tmp xml file around or not.

See Also:
Constant Field Values

mMYOSGInfo

private Map<String,MYOSGSiteInfo> mMYOSGInfo

mLogger

private final LogManager mLogger
The Logging instance.


mConnected

private boolean mConnected
A boolean variable tracking whether catalog is connected or not


mKeepTmpFile

private boolean mKeepTmpFile
A boolean variable that tracks whether to keep the temp xml file or not.


mSiteStore

private final SiteStore mSiteStore
The SiteStore object where information about the sites is stored.


mVO

private String mVO
The vo for which to query MYOSG


mGrid

private String mGrid
The grid for which to query MYOSG

Constructor Detail

MYOSG

public MYOSG()
The default constructor.

Method Detail

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.

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.

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:
Exception
Throws:
SiteCatalogException

close

public void close()
Close the connection to back end file.

Specified by:
close in interface Catalog

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

createConnectionURLProperties

private Properties createConnectionURLProperties()
Creates the properties that are required to compose the HTTP URL to the MYOSG website.

Returns:
Properties containing the connection URL Properties

getStartDate

private String getStartDate()
Returns the start date formatted as MM/dd/yyyy.

Returns:
the start date.

getDateAfter

private static String getDateAfter(int days)
Returns the date after n days formatted as MM/dd/yyyy.

Parameters:
days - the days after.
Returns:
the added date

isClosed

public boolean isClosed()
Returns if the connection is closed or not.

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


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