org.gridbus.broker.persistence
Class ActiveSet

java.lang.Object
  |
  +--org.gridbus.broker.persistence.ActiveSet

public class ActiveSet
extends java.lang.Object

The ActiveSet class is used to work with a subset of jobs / servers in the current broker instance. This class retrieves all the info from persistent storage and hence depends on the persistence provider for its functioning. The reader is assumed to return jobs in a sequence order by jobID/serverID. Internally it keeps a pointer (i.e stores the jobID/serverID), of the last retrieved job/server, when retrieving the jobs/servers sequentially (forward-only). Jobs/Servers can be retrieved in a forward-only manner. This pointer is updated whenever a getNextN* method is called. The pointer is *NOT* updated when any other method is called. (such as the getAll* methods).

Author:
krishna

Constructor Summary
ActiveSet(Writer writer, Reader reader)
          The Constructor of the ActiveSet class expects to receive a properly set up writer and reader objects, which are ready to use.
 
Method Summary
 java.util.Collection getAllJobs()
          Returns a collection of all the jobs in the current broker instance.
 java.util.Collection getAllJobs(int jobStatus)
          Returns a collection of all the jobs in the current broker instance.
 java.util.Collection getAllServers()
          Returns a collection of all the servers in the current broker instance.
 java.util.Collection getAllServers(int serverStatus)
          Returns a collection of all the servers in the current broker instance.
 long getJobCount(int jobStatus)
          Returns the total number of jobs with the given status
 java.util.Collection getNextNJobs(int N)
          Gets the next "N" jobs available from the persistent store, This method sequentially goes through the jobs in the database, starting from the first.
 java.util.Collection getNextNJobs(int N, int jobStatus)
          Gets the next "N" jobs available from the persistent store, with the given status
 java.util.Collection getNextNServers(int N)
          Gets the next "N" servers available from the persistent store, This method sequentially goes through the servers in the database, starting from the first.
 java.util.Collection getNextNServers(int N, int serverStatus)
          Gets the next "N" servers available from the persistent store, with the given status If no servers are found, an empty collection is returned.
 long getServerCount(int serverStatus)
          Returns the number of servers with the given status
 long getTotalJobCount()
          Returns the total number of jobs
 long getTotalServerCount()
          Returns the total number of servers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveSet

public ActiveSet(Writer writer,
                 Reader reader)
The Constructor of the ActiveSet class expects to receive a properly set up writer and reader objects, which are ready to use.

Parameters:
writer -
reader -
Method Detail

getAllJobs

public java.util.Collection getAllJobs()
Returns a collection of all the jobs in the current broker instance. If no jobs are found, an empty collection is returned.

Returns:

getTotalJobCount

public long getTotalJobCount()
Returns the total number of jobs

Returns:

getJobCount

public long getJobCount(int jobStatus)
Returns the total number of jobs with the given status

Parameters:
jobStatus -
Returns:

getAllJobs

public java.util.Collection getAllJobs(int jobStatus)
Returns a collection of all the jobs in the current broker instance. If no jobs are found, an empty collection is returned.

Parameters:
jobStatus -
Returns:

getNextNJobs

public java.util.Collection getNextNJobs(int N)
Gets the next "N" jobs available from the persistent store, This method sequentially goes through the jobs in the database, starting from the first. The job list is sorted by id. It remembers the id of last retrieved job, and each successive call to this method returns a collection which contains the next set of N jobs. If not jobs are available, then the collection is empty.

Parameters:
N -
Returns:

getNextNJobs

public java.util.Collection getNextNJobs(int N,
                                         int jobStatus)
Gets the next "N" jobs available from the persistent store, with the given status

Parameters:
N -
jobStatus -
Returns:

getAllServers

public java.util.Collection getAllServers()
Returns a collection of all the servers in the current broker instance.

Returns:

getTotalServerCount

public long getTotalServerCount()
Returns the total number of servers

Returns:

getServerCount

public long getServerCount(int serverStatus)
Returns the number of servers with the given status

Parameters:
serverStatus -
Returns:

getAllServers

public java.util.Collection getAllServers(int serverStatus)
Returns a collection of all the servers in the current broker instance. If no servers are found, an empty collection is returned.

Parameters:
serverStatus -
Returns:

getNextNServers

public java.util.Collection getNextNServers(int N)
Gets the next "N" servers available from the persistent store, This method sequentially goes through the servers in the database, starting from the first. The server list is sorted by id. It remembers the id of last retrieved server, and each successive call to this method returns a collection which contains the next set of N servers. If no servers are available, then the collection is empty.

Parameters:
N -
Returns:

getNextNServers

public java.util.Collection getNextNServers(int N,
                                            int serverStatus)
Gets the next "N" servers available from the persistent store, with the given status If no servers are found, an empty collection is returned.

Parameters:
N -
serverStatus -
Returns: