org.globus.gatekeeper.jobmanager
Class AbstractJobManager

java.lang.Object
  extended by org.globus.gatekeeper.jobmanager.AbstractJobManager
All Implemented Interfaces:
JobManager
Direct Known Subclasses:
ForkJobManager, ShellJobManager

public abstract class AbstractJobManager
extends Object
implements JobManager

AbstractJobManager is a base class from which all specific job managers should inherit from. It provides all the basic functionality required for a job manager.


Field Summary
protected  Hashtable _callbackUrl
           
protected  GSSCredential _credential
           
protected  int _failureCode
           
protected  String _id
           
protected  JobDoneListener _jobDoneListener
          called only when job is done or failed and all after other listeners were notified of the state
protected  org.apache.log4j.Logger _jobLogger
           
protected  Tail _outputFollower
           
protected  int _status
           
protected  Properties _symbolTable
           
protected  boolean allowStdioUrls
           
protected  boolean appendStdout
           
protected  List fileList
           
 
Constructor Summary
AbstractJobManager()
           
 
Method Summary
 void addJobStatusListener(JobStatusListener jobStatusListener)
           
protected  void dispose()
           
 void fireStatusUpdate()
           
 GSSCredential getCredentials()
           
 String[] getEnvArray()
           
 String[] getEnvArray(Map map)
           
 Map getEnvironment()
           
 int getFailureCode()
          Provides the failure code or exit code of the job.
 String getID()
           
protected  String getPath(String localFile, File dir)
           
 int getStatus()
          Provides the status of the job.
 Properties getSymbolTable()
           
protected  void initJobLogger()
           
protected  void initSymbolTable()
           
protected  OutputStream openUrl(GlobusURL url)
           
protected  OutputStream openUrl(String file, int err)
           
protected  String redirectThruFile(String file, int err)
           
 void removeJobStatusListener(JobStatusListener jobStatusListener)
           
 void removeJobStatusListenerByID(String jobStatusListenerID)
           
abstract  void request(JobRequest request)
           
 void request(String rslRequest)
           
protected  void saveDelegatedCredentials()
           
 void setCredentials(GSSCredential credentials)
           
static void setGlobusProperties(Map map)
           
 void setID(String id)
           
 void setLogFile()
           
 void setLogFile(String file)
           
 void setLogger(org.apache.log4j.Logger logger)
           
 void setStatus(int status)
          changes the old status to the new status and calls any required status updates which are registered.
 void signal(int signal, String args)
          Sends a signal to the JobManager.
 String stageExecutable(String url)
           
protected  String stageFile(String url)
           
 String stageStdin(String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.globus.gatekeeper.jobmanager.JobManager
cancel
 

Field Detail

appendStdout

protected boolean appendStdout

fileList

protected List fileList

_credential

protected GSSCredential _credential

_status

protected int _status

_failureCode

protected int _failureCode

_callbackUrl

protected Hashtable _callbackUrl

allowStdioUrls

protected boolean allowStdioUrls

_outputFollower

protected Tail _outputFollower

_id

protected String _id

_symbolTable

protected Properties _symbolTable

_jobDoneListener

protected JobDoneListener _jobDoneListener
called only when job is done or failed and all after other listeners were notified of the state


_jobLogger

protected org.apache.log4j.Logger _jobLogger
Constructor Detail

AbstractJobManager

public AbstractJobManager()
Method Detail

initJobLogger

protected void initJobLogger()

setLogFile

public void setLogFile()

setLogFile

public void setLogFile(String file)

setLogger

public void setLogger(org.apache.log4j.Logger logger)

setCredentials

public void setCredentials(GSSCredential credentials)
Specified by:
setCredentials in interface JobManager

getCredentials

public GSSCredential getCredentials()
Specified by:
getCredentials in interface JobManager

getID

public String getID()
Specified by:
getID in interface JobManager

setID

public void setID(String id)
Specified by:
setID in interface JobManager

initSymbolTable

protected void initSymbolTable()

setGlobusProperties

public static void setGlobusProperties(Map map)

getSymbolTable

public Properties getSymbolTable()
Specified by:
getSymbolTable in interface JobManager

getEnvironment

public Map getEnvironment()

getEnvArray

public String[] getEnvArray()

getEnvArray

public String[] getEnvArray(Map map)

saveDelegatedCredentials

protected void saveDelegatedCredentials()
                                 throws JobManagerException
Throws:
JobManagerException

request

public void request(String rslRequest)
             throws JobManagerException
Specified by:
request in interface JobManager
Throws:
JobManagerException

request

public abstract void request(JobRequest request)
                      throws JobManagerException
Throws:
JobManagerException

redirectThruFile

protected String redirectThruFile(String file,
                                  int err)
                           throws JobManagerException
Throws:
JobManagerException

openUrl

protected OutputStream openUrl(String file,
                               int err)
                        throws JobManagerException
Throws:
JobManagerException

getPath

protected String getPath(String localFile,
                         File dir)

openUrl

protected OutputStream openUrl(GlobusURL url)
                        throws Exception
Throws:
Exception

signal

public void signal(int signal,
                   String args)
            throws JobManagerException
Description copied from interface: JobManager
Sends a signal to the JobManager.

Specified by:
signal in interface JobManager
Throws:
JobManagerException

addJobStatusListener

public void addJobStatusListener(JobStatusListener jobStatusListener)
Specified by:
addJobStatusListener in interface JobManager

removeJobStatusListener

public void removeJobStatusListener(JobStatusListener jobStatusListener)
                             throws JobManagerException
Specified by:
removeJobStatusListener in interface JobManager
Throws:
JobManagerException

removeJobStatusListenerByID

public void removeJobStatusListenerByID(String jobStatusListenerID)
                                 throws JobManagerException
Specified by:
removeJobStatusListenerByID in interface JobManager
Throws:
JobManagerException

getStatus

public int getStatus()
Provides the status of the job.

Specified by:
getStatus in interface JobManager
Returns:
the status of the job.

getFailureCode

public int getFailureCode()
Provides the failure code or exit code of the job.

Specified by:
getFailureCode in interface JobManager
Returns:
the failure code or exit code of the job.

setStatus

public void setStatus(int status)
changes the old status to the new status and calls any required status updates which are registered.

Parameters:
status - the new status of the process.

fireStatusUpdate

public void fireStatusUpdate()

dispose

protected void dispose()

stageExecutable

public String stageExecutable(String url)
                       throws JobManagerException
Throws:
JobManagerException

stageStdin

public String stageStdin(String url)
                  throws JobManagerException
Throws:
JobManagerException

stageFile

protected String stageFile(String url)
                    throws MalformedURLException,
                           IOException,
                           UrlCopyException
Throws:
MalformedURLException
IOException
UrlCopyException