org.ofbiz.service.job
Class GenericServiceJob

java.lang.Object
  extended by org.ofbiz.service.job.AbstractJob
      extended by org.ofbiz.service.job.GenericServiceJob
All Implemented Interfaces:
java.io.Serializable, Job
Direct Known Subclasses:
PersistedServiceJob

public class GenericServiceJob
extends AbstractJob

Generic Service Job - A generic async-service Job.

See Also:
Serialized Form

Field Summary
protected  DispatchContext dctx
           
static java.lang.String module
           
protected  GenericRequester requester
           
 
Fields inherited from class org.ofbiz.service.job.AbstractJob
runtime, sequence
 
Constructor Summary
  GenericServiceJob(DispatchContext dctx, java.lang.String jobId, java.lang.String jobName, java.lang.String service, java.util.Map<java.lang.String,java.lang.Object> context, GenericRequester req)
           
protected GenericServiceJob(java.lang.String jobId, java.lang.String jobName)
           
 
Method Summary
 void exec()
          Invokes the service.
protected  void failed(java.lang.Throwable t)
          Method is called when the service fails.
protected  void finish()
          Method is called after the service has finished.
protected  java.util.Map<java.lang.String,java.lang.Object> getContext()
          Gets the context for the service invocation.
protected  java.lang.String getServiceName()
          Gets the name of the service as defined in the definition file.
protected  void init()
          Method is called prior to running the service.
 
Methods inherited from class org.ofbiz.service.job.AbstractJob
getJobId, getJobName, getRuntime, isValid, queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

requester

protected transient GenericRequester requester

dctx

protected transient DispatchContext dctx
Constructor Detail

GenericServiceJob

public GenericServiceJob(DispatchContext dctx,
                         java.lang.String jobId,
                         java.lang.String jobName,
                         java.lang.String service,
                         java.util.Map<java.lang.String,java.lang.Object> context,
                         GenericRequester req)

GenericServiceJob

protected GenericServiceJob(java.lang.String jobId,
                            java.lang.String jobName)
Method Detail

exec

public void exec()
          throws InvalidJobException
Invokes the service.

Specified by:
exec in interface Job
Specified by:
exec in class AbstractJob
Throws:
InvalidJobException

init

protected void init()
             throws InvalidJobException
Method is called prior to running the service.

Throws:
InvalidJobException

finish

protected void finish()
               throws InvalidJobException
Method is called after the service has finished.

Throws:
InvalidJobException

failed

protected void failed(java.lang.Throwable t)
               throws InvalidJobException
Method is called when the service fails.

Parameters:
t - Throwable
Throws:
InvalidJobException

getContext

protected java.util.Map<java.lang.String,java.lang.Object> getContext()
                                                               throws InvalidJobException
Gets the context for the service invocation.

Returns:
Map of name value pairs making up the service context.
Throws:
InvalidJobException

getServiceName

protected java.lang.String getServiceName()
                                   throws InvalidJobException
Gets the name of the service as defined in the definition file.

Returns:
The name of the service to be invoked.
Throws:
InvalidJobException