com.ace.moab.api.jobs
Class Jobs

java.lang.Object
  extended by com.ace.moab.api.jobs.Jobs
All Implemented Interfaces:
java.lang.Iterable<MoabJob>

public class Jobs
extends java.lang.Object
implements java.lang.Iterable<MoabJob>

This class represents a collection of Jobs found in Moab. This groups multiple jobs into one object to allow group wide operations to be done on Jobs such as adding and deleting and searching for jobs.

Author:
Brady Kimball

Constructor Summary
Jobs()
          Initializes an empty collection of jobs.
Jobs(java.util.Collection<MoabJob> jobs)
          Initialize the collection of jobs based on the collection of jobs given.
 
Method Summary
 void addJob(MoabJob job)
          Adds a job to the collection.
 MoabJob findJob(java.lang.String jobName)
          Attempts to find a job with the respective job name.
 boolean hasDynamicJobs()
          Determines if any dynamic jobs exist in the collection
 boolean hasRunningJobs()
          Determines if at least one job exists in the collection that currently running on one or more nodes.
 boolean isEmpty()
          Returns true if no jobs are in the collection.
 java.util.Iterator<MoabJob> iterator()
          
 void removeJob(MoabJob job)
          Attempts to remove a job from the collection.
 void removeJob(java.lang.String jobName)
          Attempts to remove a job from the collection.
 java.util.List<MoabJob> toList()
          Converts the collection of jobs into a list of job objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jobs

public Jobs()
Initializes an empty collection of jobs.


Jobs

public Jobs(java.util.Collection<MoabJob> jobs)
Initialize the collection of jobs based on the collection of jobs given. If the jobs passed in is null, an empty collection is initialized.

Parameters:
jobs - the jobs to store in the collection.
Method Detail

addJob

public void addJob(MoabJob job)
Adds a job to the collection. If the job already exists, then the add call is simply ignored.

Parameters:
job - the job to be added.

findJob

public MoabJob findJob(java.lang.String jobName)
Attempts to find a job with the respective job name. If the job name is null, null is returned. Similarly, if the job cannot be found, null is returned.

Parameters:
jobName - the name of the job to search for.
Returns:
the respective job object that matches the job name.

removeJob

public void removeJob(MoabJob job)
Attempts to remove a job from the collection. If the job cannot be found, the removal request is simply ignored.

Parameters:
job - the job to be removed.

removeJob

public void removeJob(java.lang.String jobName)
Attempts to remove a job from the collection. If the job with the respective name cannot be found, the removal request is simply ignored.

Parameters:
jobName - the name of the job to be removed.

toList

public java.util.List<MoabJob> toList()
Converts the collection of jobs into a list of job objects.

Returns:
a list of jobs in the collection.

hasDynamicJobs

public boolean hasDynamicJobs()
Determines if any dynamic jobs exist in the collection

Returns:
true if any dynamic jobs exist; false, otherwise.

iterator

public java.util.Iterator<MoabJob> iterator()

Specified by:
iterator in interface java.lang.Iterable<MoabJob>

hasRunningJobs

public boolean hasRunningJobs()
Determines if at least one job exists in the collection that currently running on one or more nodes.

Returns:
true if at least one job exists in the collection that currently running on one or more nodes.

isEmpty

public boolean isEmpty()
Returns true if no jobs are in the collection.

Returns:
if true, no jobs are in the collection.


Copyright © 2001-2009 Cluster Resources, Inc. All Rights Reserved.