org.gridbus.broker.persistence
Interface Reader

All Known Implementing Classes:
DBReader

public interface Reader

Author:
krishna The Reader class provides the skeleton methods for enabling broker recovery provided it was persisted. It does not specify where the actual storage is, and how the read operations are implemented. It is upto the sub-classes to do that job. A default sub-class, is provided with the broker: the DBReader.

Method Summary
 boolean connect()
           
 boolean disconnect()
           
 GridbusFarmingEngine read(java.lang.Object brokerID)
          Reads all the data related to the invocation of the broker with the given brokerID from storage and returns the FarmingEngine as a State object.
 GridbusFarmingEngine readBrokerInstance(java.lang.Object brokerID)
          Same as the read method without an argument, but reads the instance with the given ID
 DataFile readDataFile(java.lang.Object datafileID, java.lang.Object brokerID)
          Reads the datafile with the specified ID, and brokerID and returns a DataFile object
 java.util.Collection readDataFiles(java.lang.Object brokerID)
          Reads datafiles from the storage and returns a vector of datafile objects with the given brokerID
 DataHost readDataHost(java.lang.Object datahostID, java.lang.Object brokerID)
          Reads the datahost with specified ID and brokerID and returns a DataHost object
 java.util.Collection readDataHosts(java.lang.Object brokerID)
          Reads the datahosts from storage and returns a hashtable containing those hosts, with the given brokerID
 java.lang.Object readEvent(java.lang.Object eventID, java.lang.Object brokerID)
          Reads an event and returns an object containing the event information
 Job readJob(java.lang.Object jobID, java.lang.Object brokerID)
           
 long readJobCount(java.lang.Object brokerID)
           
 long readJobCount(java.lang.Object brokerID, int jobStatus)
           
 long readJobCount(java.lang.String brokerID, int status, java.lang.String serverID)
           
 java.util.Collection readJobs(java.lang.Object brokerID)
          Reads jobs from the persistent storage, and returns a vector (collection) of jobs with the given brokerID
 java.util.Collection readJobs(java.lang.Object brokerID, int jobStatus)
          Reads jobs from the persistent storage with the given status, and returns a vector (collection) of jobs with the given brokerID
 java.util.Vector readJobs(java.lang.Object brokerID, int pageNumber, int pageSize, int jobStatus)
          Reads a page of jobs with the given status.
 java.util.Vector readNextNJobs(java.lang.Object brokerID, int n)
          Returns the first 'N' jobs from the persistent store, if available.
 java.util.Vector readNextNJobs(java.lang.Object brokerID, int n, int jobStatus)
          Returns the first 'N' jobs with the given status from the persistent store, if available.
 ComputeServer readServer(java.lang.Object serverID, java.lang.Object brokerID)
           
 long readServerCount(java.lang.Object brokerID)
           
 long readServerCount(java.lang.Object brokerID, int serverStatus)
           
 java.util.Collection readServers(java.lang.Object brokerID)
          Reads servers from the persistent storage, and returns a vector (collection) of computeservers with the given brokerID
 java.util.Collection readServers(java.lang.Object brokerID, int serverStatus)
          Reads servers from the persistent storage, and returns a vector (collection) of computeservers with the given brokerID
 

Method Detail

readBrokerInstance

GridbusFarmingEngine readBrokerInstance(java.lang.Object brokerID)
                                        throws java.lang.Exception
Same as the read method without an argument, but reads the instance with the given ID

Parameters:
brokerID -
Returns:
Throws:
java.lang.Exception

readJobs

java.util.Collection readJobs(java.lang.Object brokerID)
                              throws java.lang.Exception
Reads jobs from the persistent storage, and returns a vector (collection) of jobs with the given brokerID

Parameters:
brokerID -
Returns:
collection of job objects (or objects of its subclasses)
Throws:
java.lang.Exception

readEvent

java.lang.Object readEvent(java.lang.Object eventID,
                           java.lang.Object brokerID)
                           throws java.lang.Exception
Reads an event and returns an object containing the event information

Parameters:
eventID -
brokerID -
Returns:
Throws:
java.lang.Exception

readJob

Job readJob(java.lang.Object jobID,
            java.lang.Object brokerID)
            throws java.lang.Exception
Parameters:
jobID -
brokerID -
Returns:
Throws:
java.lang.Exception

readServer

ComputeServer readServer(java.lang.Object serverID,
                         java.lang.Object brokerID)
                         throws java.lang.Exception
Parameters:
serverID -
brokerID -
Returns:
Throws:
java.lang.Exception

readServers

java.util.Collection readServers(java.lang.Object brokerID)
                                 throws java.lang.Exception
Reads servers from the persistent storage, and returns a vector (collection) of computeservers with the given brokerID

Parameters:
brokerID -
Returns:
collection of computeserver objects (or objects of its subclasses)
Throws:
java.lang.Exception

readDataFiles

java.util.Collection readDataFiles(java.lang.Object brokerID)
                                   throws java.lang.Exception
Reads datafiles from the storage and returns a vector of datafile objects with the given brokerID

Parameters:
brokerID -
Returns:
collection of datafile objects
Throws:
java.lang.Exception

readDataFile

DataFile readDataFile(java.lang.Object datafileID,
                      java.lang.Object brokerID)
                      throws java.lang.Exception
Reads the datafile with the specified ID, and brokerID and returns a DataFile object

Parameters:
datafileID -
brokerID -
Returns:
Throws:
java.lang.Exception

readDataHosts

java.util.Collection readDataHosts(java.lang.Object brokerID)
                                   throws java.lang.Exception
Reads the datahosts from storage and returns a hashtable containing those hosts, with the given brokerID

Parameters:
brokerID -
Returns:
hashtable containing the datahost names as keys and datahost objects as values
Throws:
java.lang.Exception

readDataHost

DataHost readDataHost(java.lang.Object datahostID,
                      java.lang.Object brokerID)
                      throws java.lang.Exception
Reads the datahost with specified ID and brokerID and returns a DataHost object

Parameters:
datahostID -
brokerID -
Returns:
Throws:
java.lang.Exception

read

GridbusFarmingEngine read(java.lang.Object brokerID)
                          throws java.lang.Exception
Reads all the data related to the invocation of the broker with the given brokerID from storage and returns the FarmingEngine as a State object. It is the job of the caller to ensure that the objects are in a consistent state.

Parameters:
brokerID -
Returns:
Throws:
java.lang.Exception

readJobCount

long readJobCount(java.lang.Object brokerID)
                  throws java.lang.Exception
Parameters:
brokerID -
Returns:
the total number of jobs
Throws:
java.lang.Exception

readJobCount

long readJobCount(java.lang.Object brokerID,
                  int jobStatus)
                  throws java.lang.Exception
Parameters:
brokerID -
jobStatus -
Returns:
the number of jobs with the given status
Throws:
java.lang.Exception

readJobs

java.util.Collection readJobs(java.lang.Object brokerID,
                              int jobStatus)
                              throws java.lang.Exception
Reads jobs from the persistent storage with the given status, and returns a vector (collection) of jobs with the given brokerID

Parameters:
brokerID -
jobStatus -
Returns:
collection of job objects (or objects of its subclasses)
Throws:
java.lang.Exception

readServers

java.util.Collection readServers(java.lang.Object brokerID,
                                 int serverStatus)
                                 throws java.lang.Exception
Reads servers from the persistent storage, and returns a vector (collection) of computeservers with the given brokerID

Parameters:
brokerID -
serverStatus -
Returns:
collection of computeserver objects (or objects of its subclasses)
Throws:
java.lang.Exception

readServerCount

long readServerCount(java.lang.Object brokerID)
                     throws java.lang.Exception
Parameters:
brokerID -
Returns:
the total number of servers
Throws:
java.lang.Exception

readServerCount

long readServerCount(java.lang.Object brokerID,
                     int serverStatus)
                     throws java.lang.Exception
Parameters:
brokerID -
serverStatus -
Returns:
the number of servers with the given status
Throws:
java.lang.Exception

readNextNJobs

java.util.Vector readNextNJobs(java.lang.Object brokerID,
                               int n)
                               throws java.lang.Exception
Returns the first 'N' jobs from the persistent store, if available. If no jobs are available, an empty vector is returned.

Parameters:
brokerID -
lastJobID - (the ID of the job that was most recently retrieved). If this is null, then it starts from the first job
n -
Returns:
Throws:
java.lang.Exception

readNextNJobs

java.util.Vector readNextNJobs(java.lang.Object brokerID,
                               int n,
                               int jobStatus)
                               throws java.lang.Exception
Returns the first 'N' jobs with the given status from the persistent store, if available. If no jobs are available, an empty vector is returned.

Parameters:
brokerID -
n -
jobStatus -
Returns:
Throws:
java.lang.Exception

readJobs

java.util.Vector readJobs(java.lang.Object brokerID,
                          int pageNumber,
                          int pageSize,
                          int jobStatus)
                          throws java.lang.Exception
Reads a page of jobs with the given status. Returns an empty collection if there are no jobs corresponding to the given page number / size.

Parameters:
brokerID -
pageNumber -
pageSize -
jobStatus -
Returns:
Throws:
java.lang.Exception

connect

boolean connect()
                throws java.lang.Exception
Returns:
Throws:
java.lang.Exception

disconnect

boolean disconnect()
                   throws java.lang.Exception
Returns:
Throws:
java.lang.Exception

readJobCount

long readJobCount(java.lang.String brokerID,
                  int status,
                  java.lang.String serverID)
                  throws java.lang.Exception
Parameters:
brokerID -
status -
cs -
Returns:
Throws:
java.lang.Exception