org.icenigrid.gridsam.client.common
Class ClientSideJobManager

java.lang.Object
  extended by org.icenigrid.gridsam.client.common.ClientSideJobManager
All Implemented Interfaces:
org.icenigrid.gridsam.core.JobManager

public class ClientSideJobManager
extends java.lang.Object
implements org.icenigrid.gridsam.core.JobManager

JobManager implementation that delegates submission functionality to a remote GridSAM web service


Constructor Summary
ClientSideJobManager(java.lang.String pServiceEndpointAddress)
          create a client side job manager that submits job to a GridSAM service running at the given address
ClientSideJobManager(java.lang.String[] pArgs, org.apache.commons.cli.Options pOptions)
          create a client side job manager from a set of standard command-line arguments
 
Method Summary
 org.w3.x2005.x08.addressing.EndpointReferenceDocument[] createActivity(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument[] pDesc)
          submit a job to this JobManager instance
 org.icenigrid.gridsam.core.JobInstance findJobInstance(java.lang.String pID)
           
 org.icenigrid.gridsam.core.JobInstance[] findJobInstance(java.lang.String[] pIDs)
          find a job instance using the job identifier
 org.icenigrid.schema.bes.factory.y2006.m08.GetActivityDocumentsResponseDocument getActivityDocuments(org.icenigrid.schema.bes.factory.y2006.m08.GetActivityDocumentsDocument pIDs)
          terminate the job identified
 org.icenigrid.schema.bes.factory.y2006.m08.GetActivityStatusesResponseDocument getActivityStatuses(org.icenigrid.schema.bes.factory.y2006.m08.GetActivityStatusesDocument pIDs)
          terminate the job identified
 java.lang.String getEndpointAddress()
          get the endpoint address of the remote GridSAM service
 org.icenigrid.schema.bes.factory.y2006.m08.GetFactoryAttributesDocumentResponseDocument getFactoryAttributesDocument(org.icenigrid.schema.bes.factory.y2006.m08.GetFactoryAttributesDocumentDocument1 pInput)
          terminate the job identified
static org.apache.commons.cli.Options getStandardOptions()
          get the set of standard command-line options
protected  void initialise(java.lang.String pTargetEndpointAddress)
          initialise this ClientSideJobManager
static void main(java.lang.String[] args)
           
protected  org.icenigrid.gridsam.core.plugin.persistence.common.DefaultMutableJobInstance populateJobInstance(org.icenigrid.schema.service.gridsam.JobStatusType pStatusDoc, org.icenigrid.gridsam.core.plugin.persistence.common.DefaultMutableJobInstance pInstance)
          create a MutableJobInstance object from a JobStatus document
 void registerChangeListener(java.lang.String pID, org.icenigrid.gridsam.core.JobInstanceChangeListener pChangeListener)
          register a listener to listen to change to job
 org.icenigrid.gridsam.core.JobInstance rerunJob(java.lang.String pJobID, org.icenigrid.gridsam.core.JobState startJobState, org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument pDesc, boolean isSuspend)
          rerun the job
 org.icenigrid.schema.bes.management.y2006.m08.StartAcceptingNewActivitiesResponseDocument startAcceptingNewActivities(org.icenigrid.schema.bes.management.y2006.m08.StartAcceptingNewActivitiesDocument pInput)
           
 org.icenigrid.gridsam.core.JobInstance startJob(java.lang.String pID)
           
 org.icenigrid.gridsam.core.JobInstance[] startJob(java.lang.String[] pIDs)
          terminate the job identified
 org.icenigrid.schema.bes.management.y2006.m08.StopAcceptingNewActivitiesResponseDocument stopAcceptingNewActivities(org.icenigrid.schema.bes.management.y2006.m08.StopAcceptingNewActivitiesDocument pInput)
           
 org.icenigrid.gridsam.core.JobInstance submitJob(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument pDesc)
           
 org.icenigrid.gridsam.core.JobInstance[] submitJob(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument[] pDesc, boolean pStartSuspended)
          submit a job to this JobManager instance
 org.icenigrid.gridsam.core.JobInstance submitJob(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument pDesc, boolean pSuspended)
           
 org.icenigrid.schema.bes.factory.y2006.m08.TerminateActivitiesResponseDocument terminateActivities(org.icenigrid.schema.bes.factory.y2006.m08.TerminateActivitiesDocument pIDs)
          terminate the job identified
 void terminateJob(java.lang.String pID)
           
 void terminateJob(java.lang.String[] pIDs)
          terminate the job identified
 void unregisterChangeListener(java.lang.String pID, org.icenigrid.gridsam.core.JobInstanceChangeListener pChangeListener)
          unregister a previously registered listener with the given job ID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientSideJobManager

public ClientSideJobManager(java.lang.String pServiceEndpointAddress)
                     throws org.icenigrid.gridsam.core.ConfigurationException
create a client side job manager that submits job to a GridSAM service running at the given address

Parameters:
pServiceEndpointAddress - the service endpoint address
Throws:
org.icenigrid.gridsam.core.ConfigurationException

ClientSideJobManager

public ClientSideJobManager(java.lang.String[] pArgs,
                            org.apache.commons.cli.Options pOptions)
                     throws org.icenigrid.gridsam.core.ConfigurationException
create a client side job manager from a set of standard command-line arguments

Parameters:
pArgs - command-line arguments
pOptions - the command-line options (must contain ALL standard options retrieved from getStandardOptions())
Throws:
org.icenigrid.gridsam.core.ConfigurationException
See Also:
getStandardOptions()
Method Detail

getStandardOptions

public static final org.apache.commons.cli.Options getStandardOptions()
get the set of standard command-line options

Returns:
Options the standard options

getEndpointAddress

public java.lang.String getEndpointAddress()
get the endpoint address of the remote GridSAM service


initialise

protected void initialise(java.lang.String pTargetEndpointAddress)
initialise this ClientSideJobManager

Parameters:
pTargetEndpointAddress - the network address of the GridSAM web service to be invoked

rerunJob

public org.icenigrid.gridsam.core.JobInstance rerunJob(java.lang.String pJobID,
                                                       org.icenigrid.gridsam.core.JobState startJobState,
                                                       org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument pDesc,
                                                       boolean isSuspend)
                                                throws org.icenigrid.gridsam.core.JobManagerException
rerun the job

Specified by:
rerunJob in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pJobID - is the jobid
startJobState - job will rerun at this state. It should be "pending", "staged-in", "executed".
pDesc - the job description
isSuspend - suspend job or not when rerun job.
Throws:
org.icenigrid.gridsam.core.JobManagerException

submitJob

public org.icenigrid.gridsam.core.JobInstance[] submitJob(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument[] pDesc,
                                                          boolean pStartSuspended)
                                                   throws org.icenigrid.gridsam.core.JobManagerException,
                                                          org.icenigrid.gridsam.core.SubmissionException,
                                                          org.icenigrid.gridsam.core.UnsupportedFeatureException
submit a job to this JobManager instance

Specified by:
submitJob in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pDesc - the job description
Returns:
JobInstance the job instance
Throws:
org.icenigrid.gridsam.core.SubmissionException - if the job cannot be submitted
org.icenigrid.gridsam.core.UnsupportedFeatureException - if the job description contains a feature this JobManager does not common
org.icenigrid.gridsam.core.JobManagerException

submitJob

public org.icenigrid.gridsam.core.JobInstance submitJob(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument pDesc,
                                                        boolean pSuspended)
                                                 throws org.icenigrid.gridsam.core.JobManagerException,
                                                        org.icenigrid.gridsam.core.SubmissionException,
                                                        org.icenigrid.gridsam.core.UnsupportedFeatureException
Specified by:
submitJob in interface org.icenigrid.gridsam.core.JobManager
Throws:
org.icenigrid.gridsam.core.JobManagerException
org.icenigrid.gridsam.core.SubmissionException
org.icenigrid.gridsam.core.UnsupportedFeatureException

submitJob

public org.icenigrid.gridsam.core.JobInstance submitJob(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument pDesc)
                                                 throws org.icenigrid.gridsam.core.JobManagerException,
                                                        org.icenigrid.gridsam.core.SubmissionException,
                                                        org.icenigrid.gridsam.core.UnsupportedFeatureException
Specified by:
submitJob in interface org.icenigrid.gridsam.core.JobManager
Throws:
org.icenigrid.gridsam.core.JobManagerException
org.icenigrid.gridsam.core.SubmissionException
org.icenigrid.gridsam.core.UnsupportedFeatureException

findJobInstance

public org.icenigrid.gridsam.core.JobInstance[] findJobInstance(java.lang.String[] pIDs)
                                                         throws org.icenigrid.gridsam.core.JobManagerException,
                                                                org.icenigrid.gridsam.core.UnknownJobException
find a job instance using the job identifier

Specified by:
findJobInstance in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pID - job identifier
Returns:
JobInstance the job instance
Throws:
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found
org.icenigrid.gridsam.core.JobManagerException

findJobInstance

public org.icenigrid.gridsam.core.JobInstance findJobInstance(java.lang.String pID)
                                                       throws org.icenigrid.gridsam.core.JobManagerException,
                                                              org.icenigrid.gridsam.core.UnknownJobException
Specified by:
findJobInstance in interface org.icenigrid.gridsam.core.JobManager
Throws:
org.icenigrid.gridsam.core.JobManagerException
org.icenigrid.gridsam.core.UnknownJobException

terminateJob

public void terminateJob(java.lang.String[] pIDs)
                  throws org.icenigrid.gridsam.core.JobManagerException,
                         org.icenigrid.gridsam.core.ControlException,
                         org.icenigrid.gridsam.core.UnknownJobException
terminate the job identified

Specified by:
terminateJob in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pID -
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager is at fault
org.icenigrid.gridsam.core.ControlException - if the job cannot be terminated
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found

terminateJob

public void terminateJob(java.lang.String pID)
                  throws org.icenigrid.gridsam.core.JobManagerException,
                         org.icenigrid.gridsam.core.ControlException,
                         org.icenigrid.gridsam.core.UnknownJobException
Specified by:
terminateJob in interface org.icenigrid.gridsam.core.JobManager
Throws:
org.icenigrid.gridsam.core.JobManagerException
org.icenigrid.gridsam.core.ControlException
org.icenigrid.gridsam.core.UnknownJobException

startJob

public org.icenigrid.gridsam.core.JobInstance[] startJob(java.lang.String[] pIDs)
                                                  throws org.icenigrid.gridsam.core.JobManagerException,
                                                         org.icenigrid.gridsam.core.UnknownJobException,
                                                         org.icenigrid.gridsam.core.SubmissionException
terminate the job identified

Specified by:
startJob in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pID -
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager is at fault
org.icenigrid.gridsam.core.ControlException - if the job cannot be terminated
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found
org.icenigrid.gridsam.core.SubmissionException

startJob

public org.icenigrid.gridsam.core.JobInstance startJob(java.lang.String pID)
                                                throws org.icenigrid.gridsam.core.JobManagerException,
                                                       org.icenigrid.gridsam.core.UnknownJobException,
                                                       org.icenigrid.gridsam.core.SubmissionException
Specified by:
startJob in interface org.icenigrid.gridsam.core.JobManager
Throws:
org.icenigrid.gridsam.core.JobManagerException
org.icenigrid.gridsam.core.UnknownJobException
org.icenigrid.gridsam.core.SubmissionException

createActivity

public org.w3.x2005.x08.addressing.EndpointReferenceDocument[] createActivity(org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument[] pDesc)
                                                                       throws java.lang.IllegalArgumentException,
                                                                              org.icenigrid.gridsam.core.SubmissionException,
                                                                              java.lang.Exception
submit a job to this JobManager instance

Parameters:
pDesc - the job description
Returns:
JobInstance the job instance
Throws:
org.icenigrid.gridsam.core.SubmissionException - if the job cannot be submitted
org.icenigrid.gridsam.core.UnsupportedFeatureException - if the job description contains a feature this JobManager does not common
java.lang.IllegalArgumentException
java.lang.Exception

terminateActivities

public org.icenigrid.schema.bes.factory.y2006.m08.TerminateActivitiesResponseDocument terminateActivities(org.icenigrid.schema.bes.factory.y2006.m08.TerminateActivitiesDocument pIDs)
                                                                                                   throws java.lang.IllegalArgumentException,
                                                                                                          org.icenigrid.gridsam.core.ControlException,
                                                                                                          java.lang.Exception
terminate the job identified

Parameters:
pID -
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager is at fault
org.icenigrid.gridsam.core.ControlException - if the job cannot be terminated
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found
java.lang.IllegalArgumentException
java.lang.Exception

getActivityStatuses

public org.icenigrid.schema.bes.factory.y2006.m08.GetActivityStatusesResponseDocument getActivityStatuses(org.icenigrid.schema.bes.factory.y2006.m08.GetActivityStatusesDocument pIDs)
                                                                                                   throws java.lang.IllegalArgumentException,
                                                                                                          org.icenigrid.gridsam.core.ControlException,
                                                                                                          java.lang.Exception
terminate the job identified

Parameters:
pID -
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager is at fault
org.icenigrid.gridsam.core.ControlException - if the job cannot be terminated
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found
java.lang.IllegalArgumentException
java.lang.Exception

getActivityDocuments

public org.icenigrid.schema.bes.factory.y2006.m08.GetActivityDocumentsResponseDocument getActivityDocuments(org.icenigrid.schema.bes.factory.y2006.m08.GetActivityDocumentsDocument pIDs)
                                                                                                     throws java.lang.IllegalArgumentException,
                                                                                                            org.icenigrid.gridsam.core.ControlException,
                                                                                                            java.lang.Exception
terminate the job identified

Parameters:
pID -
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager is at fault
org.icenigrid.gridsam.core.ControlException - if the job cannot be terminated
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found
java.lang.IllegalArgumentException
java.lang.Exception

getFactoryAttributesDocument

public org.icenigrid.schema.bes.factory.y2006.m08.GetFactoryAttributesDocumentResponseDocument getFactoryAttributesDocument(org.icenigrid.schema.bes.factory.y2006.m08.GetFactoryAttributesDocumentDocument1 pInput)
                                                                                                                     throws java.lang.IllegalArgumentException,
                                                                                                                            java.lang.Exception
terminate the job identified

Parameters:
pID -
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager is at fault
org.icenigrid.gridsam.core.ControlException - if the job cannot be terminated
org.icenigrid.gridsam.core.UnknownJobException - if the job instance cannot be found
java.lang.IllegalArgumentException
java.lang.Exception

stopAcceptingNewActivities

public org.icenigrid.schema.bes.management.y2006.m08.StopAcceptingNewActivitiesResponseDocument stopAcceptingNewActivities(org.icenigrid.schema.bes.management.y2006.m08.StopAcceptingNewActivitiesDocument pInput)
                                                                                                                    throws java.lang.IllegalArgumentException,
                                                                                                                           org.icenigrid.gridsam.core.ControlException,
                                                                                                                           java.lang.Exception
Parameters:
pInput - the input message
Returns:
Document the output message
Throws:
java.rmi.RemoteException
java.lang.IllegalArgumentException
org.icenigrid.gridsam.core.ControlException
java.lang.Exception

startAcceptingNewActivities

public org.icenigrid.schema.bes.management.y2006.m08.StartAcceptingNewActivitiesResponseDocument startAcceptingNewActivities(org.icenigrid.schema.bes.management.y2006.m08.StartAcceptingNewActivitiesDocument pInput)
                                                                                                                      throws java.lang.IllegalArgumentException,
                                                                                                                             org.icenigrid.gridsam.core.ControlException,
                                                                                                                             java.lang.Exception
Parameters:
pInput - the input message
Returns:
Document the output message
Throws:
java.rmi.RemoteException
java.lang.IllegalArgumentException
org.icenigrid.gridsam.core.ControlException
java.lang.Exception

registerChangeListener

public void registerChangeListener(java.lang.String pID,
                                   org.icenigrid.gridsam.core.JobInstanceChangeListener pChangeListener)
                            throws org.icenigrid.gridsam.core.JobManagerException
register a listener to listen to change to job

Specified by:
registerChangeListener in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pID - the job id
pChangeListener - the listener
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager cannot register the listener

unregisterChangeListener

public void unregisterChangeListener(java.lang.String pID,
                                     org.icenigrid.gridsam.core.JobInstanceChangeListener pChangeListener)
                              throws org.icenigrid.gridsam.core.JobManagerException
unregister a previously registered listener with the given job ID

Specified by:
unregisterChangeListener in interface org.icenigrid.gridsam.core.JobManager
Parameters:
pID - the job id
pChangeListener - the listener previously registered with registerChangeListener()
Throws:
org.icenigrid.gridsam.core.JobManagerException - if the job manager cannot register the listener

populateJobInstance

protected org.icenigrid.gridsam.core.plugin.persistence.common.DefaultMutableJobInstance populateJobInstance(org.icenigrid.schema.service.gridsam.JobStatusType pStatusDoc,
                                                                                                             org.icenigrid.gridsam.core.plugin.persistence.common.DefaultMutableJobInstance pInstance)
create a MutableJobInstance object from a JobStatus document

Parameters:
pStatusDoc - the status document
pInstance - instance to be populated
Returns:
MutableJobInstance job instance

main

public static void main(java.lang.String[] args)


Copyright © 2009. All Rights Reserved.