org.jwarp.service.work
Class WorkService
java.lang.Object
|
+--org.jwarp.service.AService
|
+--org.jwarp.service.work.WorkService
- All Implemented Interfaces:
- IConfigurable, IExceptionProvider, IReferenceable, IService, IWorkService
- public class WorkService
- extends AService
- implements IWorkService
This is the servie interface for work items.
|
Field Summary |
(package private) java.util.Hashtable |
managers
|
| Fields inherited from class org.jwarp.service.AService |
context, createdDate, dependencies, emptyProperties, exceptionListeners, log, resumedDate, serviceName, serviceStatus, serviceType, startedDate, stoppedDate, suspendedDate, systemTicket |
|
Method Summary |
void |
addJob(IJob job,
java.lang.String managerName,
int priority,
ITicket user)
Add a new job. |
IJob |
addJob(java.lang.String toolName,
int userID,
java.lang.String ref,
java.lang.String managerName,
Parameter[] data,
long maxRuntime,
ITicket user)
Add a new job. |
boolean |
anonymousJobsAllowed(java.lang.String managerName)
A flag id anonymous jobs are allowed or an exception will be raised when traing to register such a job. |
void |
cancelJob(IJob job,
java.lang.String managerName,
boolean forceStop,
ITicket user)
Removes the job with the given id from the manager. |
void |
configure(org.jdom.Element config)
Pass the Configuration to the Configurable
class. |
IJob |
getJob(int job,
java.lang.String managerName,
ITicket user)
Return a job's execution status |
IToolManager |
getToolManager(java.lang.String managerName,
ITicket user)
Get the underlying tool manager. |
java.util.Iterator |
searchJobs(int jobID,
java.lang.String toolName,
int userID,
java.lang.String ref,
java.lang.String managerName,
short status,
ITicket user)
This is the main acecess metho for searching within the manager's job db. |
void |
stop(java.lang.String managerName,
ITicket user)
Stops the internal thread pol immedeately |
| Methods inherited from class org.jwarp.service.AService |
addExceptionListener, checkContext, createLogFromXML, getContext, getCreationDate, getDependencies, getExceptionListeners, getLog, getLogLevel, getName, getReference, getResumedDate, getShutDownDate, getStartDate, getStatus, getSuspendedDate, getType, removeAllExceptionListeners, removeExceptionListener, resume, sendExceptionEvent, setContext, setDependencies, setLogLevel, setName, shutdown, start, suspend |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jwarp.service.IService |
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel, shutdown, start, suspend |
managers
java.util.Hashtable managers
WorkService
public WorkService()
configure
public void configure(org.jdom.Element config)
throws ConfigurationException
- Description copied from interface:
IConfigurable
- Pass the
Configuration to the Configurable
class. This method must always be called after the constructor and before any other method.
- Specified by:
configure in interface IConfigurable- Overrides:
configure in class AService
- 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,
java.lang.String managerName,
short status,
ITicket user)
throws java.lang.SecurityException,
NotFoundException
- This is the main acecess metho for searching within the manager's job db.
- Specified by:
searchJobs in interface IWorkService
- Parameters:
jobID - The job's id or -1toolName - The job's tool nameThe - userID or -1The - jobs status or IJob.STATUS_ANYowner - The owning objectuser - The user who triggers the request- Returns:
- iterator with all found jobs
addJob
public IJob addJob(java.lang.String toolName,
int userID,
java.lang.String ref,
java.lang.String managerName,
Parameter[] data,
long maxRuntime,
ITicket user)
throws NotFoundException,
NotAvailableException,
ConfigurationException,
java.lang.SecurityException
- Add a new job.
- Specified by:
addJob in interface IWorkService
- Parameters:
toolName - The name of the tool to be executedactivity - The activity whos triggering the jobuserID - The user who's triggering the jobdata - 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,
java.lang.String managerName,
int priority,
ITicket user)
throws ThreadPoolStoppedException,
NotFoundException,
java.lang.SecurityException
- Add a new job.
- Specified by:
addJob in interface IWorkService
- Parameters:
toolName - The name of the tool to be executedactivity - The activity whos triggering the jobuserID - The user who's triggering the jobdata - The parameters to be passed to the executing tool.- Throws:
NotAvailableException - if the requested tool is temporarely not available
getJob
public IJob getJob(int job,
java.lang.String managerName,
ITicket user)
throws NotFoundException,
java.lang.SecurityException
- Return a job's execution status
- Specified by:
getJob in interface IWorkService
cancelJob
public void cancelJob(IJob job,
java.lang.String managerName,
boolean forceStop,
ITicket user)
throws NotFoundException,
java.lang.SecurityException
- 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.
- Specified by:
cancelJob in interface IWorkService
- Parameters:
id - The job's id.forecStop - Should a yet running job stopped immedeately
anonymousJobsAllowed
public boolean anonymousJobsAllowed(java.lang.String managerName)
throws NotFoundException
- A flag id anonymous jobs are allowed or an exception will be raised when traing to register such a job.
- Specified by:
anonymousJobsAllowed in interface IWorkService
- Returns:
- the flag
getToolManager
public IToolManager getToolManager(java.lang.String managerName,
ITicket user)
throws NotFoundException,
java.lang.SecurityException
- Get the underlying tool manager.
- Specified by:
getToolManager in interface IWorkService
- Returns:
- The tool manager instance
stop
public void stop(java.lang.String managerName,
ITicket user)
throws NotFoundException,
java.lang.SecurityException
- Stops the internal thread pol immedeately
- Specified by:
stop in interface IWorkService