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()
           
 State 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.
 State 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)
           
 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 readNextNJobs(java.lang.Object brokerID, java.lang.String lastJobID, int n)
          Returns the next 'N' jobs in sequence from the persistent store, if available.
 java.util.Vector readNextNJobs(java.lang.Object brokerID, java.lang.String lastJobID, int n, int jobStatus)
          Returns the next 'N' jobs in sequence from the persistent store, if available.
 java.util.Vector readNextNServers(java.lang.String brokerID, java.lang.String lastServer, int n)
          Returns the next 'N' servers in sequence from the persistent store, if available.
 java.util.Vector readNextNServers(java.lang.String brokerID, java.lang.String lastServer, int n, int serverStatus)
          Returns the next 'N' servers with the given status, in sequence 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
 Task readTask(java.lang.Object taskID, java.lang.Object brokerID)
          Reads the task with the given taskID and returns a Task object
 java.util.Collection readTasks(java.lang.Object brokerID)
          Reads the tasks associated with the given brokerID
 Variable readVariable(java.lang.Object varID, java.lang.Object brokerID)
           
 java.util.Collection readVariables(java.lang.Object brokerID)
          Reads the variables associated with the given brokerID
 

Method Detail

readBrokerInstance

public State 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

readTasks

public java.util.Collection readTasks(java.lang.Object brokerID)
                               throws java.lang.Exception
Reads the tasks associated with the given brokerID

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

readTask

public Task readTask(java.lang.Object taskID,
                     java.lang.Object brokerID)
              throws java.lang.Exception
Reads the task with the given taskID and returns a Task object

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

readVariables

public java.util.Collection readVariables(java.lang.Object brokerID)
                                   throws java.lang.Exception
Reads the variables associated with the given brokerID

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

readJobs

public 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

public 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

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

readServer

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

readVariable

public Variable readVariable(java.lang.Object varID,
                             java.lang.Object brokerID)
                      throws java.lang.Exception
Parameters:
varID -
brokerID -
Returns:
Throws:
java.lang.Exception

readServers

public 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

public 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

public 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

public 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

public 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

public State 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

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

readJobCount

public 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

public 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

public 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

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

readServerCount

public 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

public java.util.Vector readNextNJobs(java.lang.Object brokerID,
                                      java.lang.String lastJobID,
                                      int n)
                               throws java.lang.Exception
Returns the next 'N' jobs in sequence 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

public java.util.Vector readNextNJobs(java.lang.Object brokerID,
                                      java.lang.String lastJobID,
                                      int n,
                                      int jobStatus)
                               throws java.lang.Exception
Returns the next 'N' jobs in sequence 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 -
jobStatus -
Returns:
Throws:
java.lang.Exception

readNextNServers

public java.util.Vector readNextNServers(java.lang.String brokerID,
                                         java.lang.String lastServer,
                                         int n)
                                  throws java.lang.Exception
Returns the next 'N' servers in sequence from the persistent store, if available. If no servers are available, an empty vector is returned.

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

readNextNServers

public java.util.Vector readNextNServers(java.lang.String brokerID,
                                         java.lang.String lastServer,
                                         int n,
                                         int serverStatus)
                                  throws java.lang.Exception
Returns the next 'N' servers with the given status, in sequence from the persistent store, if available. If no servers are available, an empty vector is returned.

Parameters:
brokerID -
lastServer -
n -
serverStatus -
Returns:
Throws:
java.lang.Exception

connect

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

disconnect

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