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
 
Fields inherited from interface org.jwarp.service.work.IWorkService
SERVICE_TYPE
 
Fields inherited from interface org.jwarp.service.IService
SERVICE_STATUS_CREATED, SERVICE_STATUS_NOT_AVAILABLE, SERVICE_STATUS_READY, SERVICE_STATUS_RESUMING, SERVICE_STATUS_RUNNING, SERVICE_STATUS_STARTING, SERVICE_STATUS_STOPPED, SERVICE_STATUS_STOPPING, SERVICE_STATUS_SUSPENDED
 
Constructor Summary
WorkService()
           
 
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
 
Methods inherited from interface org.jwarp.common.IExceptionProvider
addExceptionListener, getExceptionListeners, removeAllExceptionListeners, removeExceptionListener
 

Field Detail

managers

java.util.Hashtable managers
Constructor Detail

WorkService

public WorkService()
Method Detail

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 -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 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 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,
                   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 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 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

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