org.icenigrid.gridsam.core.plugin
Interface JobContext

All Superinterfaces:
JobManagerContext
All Known Implementing Classes:
DefaultJobContext

public interface JobContext
extends JobManagerContext

Interface defining a context object being passed through the launching pipeline providing useful information about the job and the environment to be launched.

Author:
wwhl

Nested Class Summary
static interface JobContext.ThrowableRunnable
          A runnable-like interface that allows exception to be caught
 
Method Summary
 org.apache.commons.vfs.FileObject getFileSystem()
          get the file system associated with the job context
 MutableJobInstance getJobInstance()
          the job instance associated with this job context
 org.apache.commons.logging.Log getLog()
          get a Log associated with this job.
 boolean isInterrupted()
          test whether this context has been interrupted
 boolean isRecovering()
          test whether this context is recovering from a crash
 boolean runInterruptable(JobContext.ThrowableRunnable pRunnable)
          run a block of code (i.e.
 boolean runInterruptable(java.lang.Runnable pRunnable)
          run a block of code (i.e.
 void schedule(DRMConnector pConnector)
          schedule the given DRMConnector for immediate execution in this job context for the current job
 void schedule(DRMConnector pConnector, long pRepeatInterval)
          schedule the given DRMConnector for repeated execution in this job context for the current job
 void schedule(DRMConnector pConnector, java.lang.String pCronExpression)
          schedule the given DRMConnector for repeated execution in this job context for the current job
 void schedule(java.lang.String pConnectorName)
          schedule the given named DRMConnector for immediate execution in this job context for the current job
 void schedule(java.lang.String pConnectorName, long pRepeatInterval)
          schedule the given named DRMConnector for immediate execution in this job context for the current job
 void schedule(java.lang.String pConnectorName, java.lang.String pCronExpression)
          schedule the given named DRMConnector for immediate execution in this job context for the current job
 
Methods inherited from interface org.icenigrid.gridsam.core.plugin.JobManagerContext
getDRMConnector, getJobInstanceStore, schedule, schedule, schedule, schedule, schedule, schedule, scheduleImmediately, unschedule
 

Method Detail

isInterrupted

boolean isInterrupted()
test whether this context has been interrupted

Returns:
boolean true if interrupted, false otherwise

isRecovering

boolean isRecovering()
test whether this context is recovering from a crash

Returns:
boolean true to indicate this context is recovering from a crash, false to indicate normal execution

getJobInstance

MutableJobInstance getJobInstance()
the job instance associated with this job context

Returns:
MutableJobInstance the job instance associated with this context

runInterruptable

boolean runInterruptable(java.lang.Runnable pRunnable)
run a block of code (i.e. in the Runnable) that can be interrupted (i.e. receive java.lang.InterruptedException) when the Job context is interrutped (i.e. isInterrupted is set to true)

Parameters:
pRunnable - the interruptable code
Returns:
true if the code block has been interrupted

runInterruptable

boolean runInterruptable(JobContext.ThrowableRunnable pRunnable)
                         throws java.lang.Exception
run a block of code (i.e. in the Runnable) that can be interrupted (i.e. receive java.lang.InterruptedException) when the Job context is interrutped (i.e. isInterrupted is set to true)

Parameters:
pRunnable - the interruptable code
Returns:
true if the code block has been interrupted
Throws:
java.lang.Exception - the exception thrown by the ThrowableRunnable

getFileSystem

org.apache.commons.vfs.FileObject getFileSystem()
                                                throws java.io.IOException
get the file system associated with the job context

Returns:
FileObject the root file system for the job context.
Throws:
java.io.IOException - if the file system cannot be retrieved

schedule

void schedule(DRMConnector pConnector)
              throws JobManagerException
schedule the given DRMConnector for immediate execution in this job context for the current job

Parameters:
pConnector - the DRMConnector
Throws:
JobManagerException - if the DRMConnector cannot be scheduled

schedule

void schedule(java.lang.String pConnectorName)
              throws JobManagerException
schedule the given named DRMConnector for immediate execution in this job context for the current job

Parameters:
pConnectorName - the name of the DRMConnector resolvable by the context *
Throws:
JobManagerException - if the DRMConnector cannot be scheduled

schedule

void schedule(DRMConnector pConnector,
              long pRepeatInterval)
              throws JobManagerException
schedule the given DRMConnector for repeated execution in this job context for the current job

Parameters:
pConnector - the DRMConnector
pRepeatInterval - the period between repeated execution
Throws:
JobManagerException - if the DRMConnector cannot be scheduled

schedule

void schedule(java.lang.String pConnectorName,
              long pRepeatInterval)
              throws JobManagerException
schedule the given named DRMConnector for immediate execution in this job context for the current job

Parameters:
pConnectorName - the name of the DRMConnector resolvable by the context
pRepeatInterval - the period between repeated execution
Throws:
JobManagerException - if the DRMConnector cannot be scheduled

schedule

void schedule(DRMConnector pConnector,
              java.lang.String pCronExpression)
              throws java.text.ParseException,
                     JobManagerException
schedule the given DRMConnector for repeated execution in this job context for the current job

Parameters:
pConnector - the DRMConnector
pCronExpression - the CRON job expression to specify the schedule
Throws:
java.text.ParseException - if the cron expression is invalid
JobManagerException - if the DRMConnector cannot be scheduled

schedule

void schedule(java.lang.String pConnectorName,
              java.lang.String pCronExpression)
              throws java.text.ParseException,
                     JobManagerException
schedule the given named DRMConnector for immediate execution in this job context for the current job

Parameters:
pConnectorName - the name of the DRMConnector resolvable by the context
pCronExpression - the CRON job expression to specify the schedule
Throws:
java.text.ParseException - if the cron expression is invalid
JobManagerException - if the DRMConnector cannot be scheduled

getLog

org.apache.commons.logging.Log getLog()
get a Log associated with this job. DRMConnector should use this log to convey meaningful logging information associated with this job.

Returns:
Log the logger instance


Copyright © 2008. All Rights Reserved.