org.ourgrid.mygrid.ui
Interface UIManager

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
MyGridUIManager

public interface UIManager
extends java.rmi.Remote

Interface of Mygrid API.

To use the API, applications must add ourgrid.jar to their classpath. The application command line must include a definition to the MGROOT variable (i.e. add -DMGROOT=/mygrid/installation/directory to the Java VM command line).

Before calling methods, an application must obtain a reference to Mygrid's UI Manager by calling MyGridUIManager.getInstance()


Method Summary
 int addJob(JobSpec theJob)
          Adds a job to be executed by Mygrid.
 int addJob(java.lang.String descriptionFilePath)
          Deprecated. 
 void cancelJob(int jobId)
          Asks Mygrid to cancel a job
 void cleanFinishedJobs()
          Erases all jobs that are not running anymore
 java.util.Collection<GridManagerEntry> getGumEntries(GridManagerListenerRemote newListener)
          Obtains a collection with the gums that are currently in use by Mygrid.
 java.util.Collection<GumSpec> getGumSpecs()
          Obtains a collection with the gums that are currently in use by Mygrid
 java.util.Collection<JobEntry> getJobs(JobManagerListenerRemote newListener)
          Obtains a collection with the jobs that are currently added to Mygrid, no matter the jobs states.
 java.util.Collection<PeerEntry> getPeerEntries(GridManagerListenerRemote newListener)
          Obtains a collection with the peers that are currently set on Mygrid.
 boolean isMyGridRunning()
          Checks if Mygrid is running
 void removeGridManagerListener(GridManagerListenerRemote listener)
          Unregisters a Grid Manager listener
 void removeJob(int jobId)
          Erases a specific job if it is not running.
 void removeJobManagerListener(JobManagerListenerRemote listener)
          Unregisters a Job Manager listener
 void setPeers(java.util.Collection<PeerSpec> peerSpecs)
          Adds a list of peers that will work as a machine provider to Mygrid.
 void setPeers(java.lang.String descriptionFilePath)
          Deprecated. 
 void startMyGridService()
          Start MyGrid service.
 void stopMyGridService(boolean callExit)
          Stop MyGrid service.
 void stopMyGridService(boolean wait, boolean callExit)
          Stop MyGrid service.
 void waitForJob(int jobId)
          The caller will block until the specified job finishes, fails or is cancelled.
 

Method Detail

addJob

int addJob(JobSpec theJob)
           throws java.rmi.RemoteException,
                  CouldNotAddJobOutsideHomeMachineException
Adds a job to be executed by Mygrid. The JobSpec obtained by compiling a JDF (job description file) with Ourgrid compiler.

Parameters:
theJob - a job specification generated by the Ourgrid compiler from a JDF
Returns:
the job ID
Throws:
java.rmi.RemoteException - if a communication problem occurs
CouldNotAddJobOutsideHomeMachineException - it is only possible to add a job when running on the same machine as Mygrid

addJob

@Deprecated
int addJob(java.lang.String descriptionFilePath)
           throws java.rmi.RemoteException,
                  CompilerException,
                  CouldNotAddJobOutsideHomeMachineException
Deprecated. 

Replaced by addJob(JobSpec).

Parameters:
descriptionFilePath - the path of a JDF to be compiled
Returns:
the generated job ID
Throws:
java.rmi.RemoteException - if a communication problem occurs
CompilerException - if compiler error occurs
CouldNotAddJobOutsideHomeMachineException - it is only possible to add a job when running on the same machine as Mygrid

cancelJob

void cancelJob(int jobId)
               throws JobNotFoundException,
                      java.rmi.RemoteException,
                      JobCouldNotBeCancelledException
Asks Mygrid to cancel a job

Parameters:
jobId - the job to cancel
Throws:
JobNotFoundException - the job does not exist
java.rmi.RemoteException - if a communication problem occurs
JobCouldNotBeCancelledException - if some error occurs when trying to cancel the job

cleanFinishedJobs

void cleanFinishedJobs()
                       throws java.rmi.RemoteException
Erases all jobs that are not running anymore

Throws:
java.rmi.RemoteException - if a communication problem occurs

getGumEntries

java.util.Collection<GridManagerEntry> getGumEntries(GridManagerListenerRemote newListener)
                                                     throws java.rmi.RemoteException
Obtains a collection with the gums that are currently in use by Mygrid. Includes an option of becoming a listener of Mygrid's Grid Manager to receive updates about the state of machines. This listener will be notified whenever a new machine is received or currently owned machines are disposed.

Parameters:
newListener - a reference to the listener that is interested on receiving updates about machines
Returns:
a collection with the gums that are currently in use by Mygrid
Throws:
java.rmi.RemoteException - if a communication problem occurs

getGumSpecs

java.util.Collection<GumSpec> getGumSpecs()
                                          throws java.rmi.RemoteException
Obtains a collection with the gums that are currently in use by Mygrid

Returns:
a collection with the gums that are currently in use by Mygrid
Throws:
java.rmi.RemoteException - if a communication problem occurs

getJobs

java.util.Collection<JobEntry> getJobs(JobManagerListenerRemote newListener)
                                       throws java.rmi.RemoteException
Obtains a collection with the jobs that are currently added to Mygrid, no matter the jobs states. Includes an option of becoming a listener of Mygrid's Job Manager to receive updates about the state of jobs. This listener will be notified whenever there is a change on the state of jobs.

Parameters:
newListener - a reference to the listener that is interested on receiving updates about jobs
Returns:
a collection with the jobs currently added to Mygrid
Throws:
java.rmi.RemoteException - if a communication problem occurs

getPeerEntries

java.util.Collection<PeerEntry> getPeerEntries(GridManagerListenerRemote newListener)
                                               throws java.rmi.RemoteException
Obtains a collection with the peers that are currently set on Mygrid. Includes an option of becoming a listener of Mygrid's Grid Manager to receive updates about the state of peers. This listener will be notified whenever there is a change on the state of peers.

Parameters:
newListener - a reference to the listener that is interested on receiving updates about peers
Returns:
a collection with the peers currently set on Mygrid
Throws:
java.rmi.RemoteException - if a communication problem occurs

isMyGridRunning

boolean isMyGridRunning()
                        throws java.rmi.RemoteException
Checks if Mygrid is running

Returns:
true if Mygrid is running
Throws:
java.rmi.RemoteException - if a communication problem occurs

removeGridManagerListener

void removeGridManagerListener(GridManagerListenerRemote listener)
                               throws java.rmi.RemoteException
Unregisters a Grid Manager listener

Parameters:
listener - listener a reference to the listener that will be unregistered
Throws:
java.rmi.RemoteException - if a communication problem occurs

removeJob

void removeJob(int jobId)
               throws java.rmi.RemoteException,
                      JobCannotBeRemovedException
Erases a specific job if it is not running.

Parameters:
jobId - id of the job to be removed
Throws:
java.rmi.RemoteException - if a communication problem occurs
JobCannotBeRemovedException - if the jobs is still running

removeJobManagerListener

void removeJobManagerListener(JobManagerListenerRemote listener)
                              throws java.rmi.RemoteException
Unregisters a Job Manager listener

Parameters:
listener - a reference to the listener that will be unregistered
Throws:
java.rmi.RemoteException - if a communication problem occurs

setPeers

void setPeers(java.util.Collection<PeerSpec> peerSpecs)
              throws java.rmi.RemoteException
Adds a list of peers that will work as a machine provider to Mygrid. A list of PeerSpec is obtained by compiling a SDF (site description file) with Ourgrid compiler.

Parameters:
peerSpecs - a collection of peer specification generated by the compiler
Throws:
java.rmi.RemoteException - if a communication problem occurs
See Also:
DescriptionFileCompile.compileSDF(String)

setPeers

@Deprecated
void setPeers(java.lang.String descriptionFilePath)
              throws java.rmi.RemoteException,
                     CompilerException
Deprecated. 

Replaced by setPeers(Collection).

Parameters:
descriptionFilePath - the path to a SDF to be compiled
Throws:
java.rmi.RemoteException - if a communication problem occurs
CompilerException - if compiler error occurs

startMyGridService

void startMyGridService()
                        throws java.rmi.RemoteException,
                               NotExecutingInHomeMachine,
                               MyGridIsAlreadyRunningException,
                               StartingMyGridException,
                               ConfigException
Start MyGrid service. The service will be initiated on the same JVM of the calling application

Throws:
java.rmi.RemoteException - if a communication problem occurs
NotExecutingInHomeMachine - if Mygrid is starting on a different machine than that specified in the Mygrid configuration file
MyGridIsAlreadyRunningException - if Mygrid is already running
StartingMyGridException - if Mygrid was unable to start correctly
ConfigException - if a configuration problem exists

stopMyGridService

void stopMyGridService(boolean callExit)
                       throws java.rmi.RemoteException,
                              MyGridIsNotRunningException
Stop MyGrid service. This method does waits for MyGrid to shutdown nicely.

Parameters:
callExit - if is desired to call System.exit() terminating the JVM (which may be the same of a user's application)
Throws:
java.rmi.RemoteException - if a communication problem occurs
MyGridIsNotRunningException - if trying to stop a Mygrid that was not started

stopMyGridService

void stopMyGridService(boolean wait,
                       boolean callExit)
                       throws java.rmi.RemoteException,
                              MyGridIsNotRunningException
Stop MyGrid service. This method presents an option of waiting Mygrid to stop nicely or forcing Mygrid to stop.

Parameters:
wait - if is desired to wait for Mygrid to stop nicely.
callExit - if is desired to call System.exit() terminating the JVM (which may be the same of a user's application)
Throws:
java.rmi.RemoteException - if a communication problem occurs
MyGridIsNotRunningException - if trying contact a Mygrid that is not running

waitForJob

void waitForJob(int jobId)
                throws java.rmi.RemoteException,
                       JobNotFoundException
The caller will block until the specified job finishes, fails or is cancelled.

Parameters:
jobId - the job to wait
Throws:
java.rmi.RemoteException - if a communication problem occurs
JobNotFoundException - if the job does not exist