org.jwarp.service.work
Class DBWorkManager

java.lang.Object
  |
  +--org.jwarp.service.work.AWorkManager
        |
        +--org.jwarp.service.work.DBWorkManager
All Implemented Interfaces:
IConfigurable, IWorkManager

public class DBWorkManager
extends AWorkManager


Field Summary
protected  org.exolab.castor.jdo.JDO jdo
           
protected  java.util.Hashtable jobs
           
protected static java.lang.String OQLgetOpenJobs
           
protected  PersistentObjectPool pool
           
 
Fields inherited from class org.jwarp.service.work.AWorkManager
anonymousJobsAllowed, name, threadPool, toolManager, workManagerListeners
 
Constructor Summary
DBWorkManager()
           
DBWorkManager(org.exolab.castor.jdo.JDO jdo)
           
DBWorkManager(org.exolab.castor.jdo.JDO jdo, java.lang.String name)
           
DBWorkManager(java.lang.String name)
           
 
Method Summary
 void addJob(IJob job, int priority)
          Add a new job.
 IJob addJob(java.lang.String toolName, int user, java.lang.String reference, Parameter[] data, long maxRuntime)
          Add a new job.
 void cancelJob(IJob job, boolean forceStop)
          Removes the job with the given id from the manager.
 void configure(org.jdom.Element config)
          Creates a new work manager object ...
 IJob getJob(int jobID)
          Return a job's execution status
 java.util.Iterator searchJobs(int jobID, java.lang.String toolName, int userID, java.lang.String ref, short status)
          This is the main acecess metho for searching within the manager's job db.
 void setJDO(org.exolab.castor.jdo.JDO jdo)
           
 
Methods inherited from class org.jwarp.service.work.AWorkManager
addWorkManagerListener, anonymousJobsAllowed, fireWorkManagerEvent, getName, getToolManager, removeWorkManagerListener, setName, stop
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OQLgetOpenJobs

protected static java.lang.String OQLgetOpenJobs

jobs

protected java.util.Hashtable jobs

pool

protected PersistentObjectPool pool

jdo

protected org.exolab.castor.jdo.JDO jdo
Constructor Detail

DBWorkManager

public DBWorkManager()

DBWorkManager

public DBWorkManager(java.lang.String name)

DBWorkManager

public DBWorkManager(org.exolab.castor.jdo.JDO jdo,
                     java.lang.String name)

DBWorkManager

public DBWorkManager(org.exolab.castor.jdo.JDO jdo)
Method Detail

setJDO

public void setJDO(org.exolab.castor.jdo.JDO jdo)

configure

public void configure(org.jdom.Element config)
               throws ConfigurationException
Description copied from class: AWorkManager
Creates a new work manager object ...
Overrides:
configure in class AWorkManager
Following copied from interface: org.jwarp.service.configuration.IConfigurable
Parameters:
configuration - the class configurations.

searchJobs

public java.util.Iterator searchJobs(int jobID,
                                     java.lang.String toolName,
                                     int userID,
                                     java.lang.String ref,
                                     short status)
Description copied from interface: IWorkManager
This is the main acecess metho for searching within the manager's job db.
Following copied from interface: org.jwarp.service.work.IWorkManager
Parameters:
jobID - The job's id or -1
toolName - The job's tool name
The - userID or -1
The - jobs status or IJob.STATUS_ANY
owner - The owning object
user - The user who triggers the request
Returns:
iterator with all found jobs

addJob

public IJob addJob(java.lang.String toolName,
                   int user,
                   java.lang.String reference,
                   Parameter[] data,
                   long maxRuntime)
            throws NotFoundException,
                   NotAvailableException,
                   ConfigurationException
Description copied from interface: IWorkManager
Add a new job.
Following copied from interface: org.jwarp.service.work.IWorkManager
Parameters:
toolName - The name of the tool to be executed
activity - The activity whos triggering the job
userID - The user who's triggering the job
data - The parameters to be passed to the executing tool.
Throws:
NotAvailableException - if the requested tool is temporarely not available

addJob

public void addJob(IJob job,
                   int priority)
            throws ThreadPoolStoppedException
Description copied from interface: IWorkManager
Add a new job.
Following copied from interface: org.jwarp.service.work.IWorkManager
Parameters:
toolName - The name of the tool to be executed
activity - The activity whos triggering the job
userID - The user who's triggering the job
data - The parameters to be passed to the executing tool.
Throws:
NotAvailableException - if the requested tool is temporarely not available

getJob

public IJob getJob(int jobID)
            throws NotFoundException
Description copied from interface: IWorkManager
Return a job's execution status

cancelJob

public void cancelJob(IJob job,
                      boolean forceStop)
               throws NotFoundException
Description copied from interface: IWorkManager
Removes the job with the given id from the manager. If the job is executed yet a NotFoundException will be raised. If the job is running yet (but not finished) the behaviour depends on the orceStop flag. If set the curent thread will be forced to stop immedeately. If not set the job will be finished executing.
Following copied from interface: org.jwarp.service.work.IWorkManager
Parameters:
id - The job's id.
forecStop - Should a yet running job stopped immedeately

©   O R C A   S y s t e m s