com.groiss.wf.batch
Class BatchManager

java.lang.Object
  extended by com.groiss.wf.batch.BatchManager
All Implemented Interfaces:
TimerTask

public class BatchManager
extends java.lang.Object
implements TimerTask

Starts and Completes BatchJobs. Provides methods for creation of jobs and to mark them as finished.


Constructor Summary
BatchManager()
           
 
Method Summary
 void abort()
          Abort the running timer task.
static void abortBatchJob(com.dec.avw.core.StepInstance si)
           
 void compensate(com.dec.avw.core.StepInstance si)
           
static void exceptionHandlingFinished(java.lang.String id)
           
protected static BatchAdapter getBatchAdapter(java.lang.String adapterClassName)
           
static void markJobError(BatchJob bj, java.lang.Exception ex)
           
static void markJobError(BatchJob bj, int resultCode, java.lang.String resultValue, java.lang.Exception ex)
           
static void markJobFinished(BatchJob bj)
          Mark a BatchJob finished without resultcode and resultstring
static void markJobFinished(BatchJob bj, int resultCode)
          Mark a BatchJob as finished without a result string
static void markJobFinished(BatchJob bj, int resultCode, java.lang.String resultvalues)
          Mark a BatchJob as finished.
 void run(TimerEntry te, java.lang.String args)
          the TimerTask interface
protected static void startJob(BatchJob bj, BatchAdapter adapter)
          Start a BatchJob.
protected static void startJobHere(BatchJob bj, BatchAdapter adapter)
          Start a BatchJob in the current thread.
 void submitJob(java.lang.String adapterClassName)
          Method submitJob submits a BatchJob for later execution.
 void submitJob(java.lang.String adapterClassName, java.lang.String param)
          Method submitJob submits a BatchJob for later execution.
 void submitJob(java.lang.String adapterClassName, java.lang.String params, java.lang.String execModes)
          Method submitJob submits a BatchJob for later execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchManager

public BatchManager()
Method Detail

getBatchAdapter

protected static BatchAdapter getBatchAdapter(java.lang.String adapterClassName)

submitJob

public void submitJob(java.lang.String adapterClassName,
                      java.lang.String params,
                      java.lang.String execModes)
               throws java.lang.Exception
Method submitJob submits a BatchJob for later execution. It creates a new BatchJob and inserts it into the database. After that, method afterCreation of the class with name adapterClassName is called.

Parameters:
adapterClassName - name of a Class implementing BatchAdapter
params - additional params for the execution can be passed in this String
execModes - attributes for behaviour variations
Throws:
java.lang.Exception -

execModes is a string where the behavior modifications of a batchjob can be encoded in the following form: "STARTNOW=1,AUTOFINISH=1,NEWTHREAD=1" Behavior Variations


submitJob

public void submitJob(java.lang.String adapterClassName)
               throws java.lang.Exception
Method submitJob submits a BatchJob for later execution. Calls submitJob with null as params and default execModes

Throws:
java.lang.Exception

submitJob

public void submitJob(java.lang.String adapterClassName,
                      java.lang.String param)
               throws java.lang.Exception
Method submitJob submits a BatchJob for later execution. Calls submitJob with default execModes

Throws:
java.lang.Exception

markJobError

public static void markJobError(BatchJob bj,
                                java.lang.Exception ex)

markJobError

public static void markJobError(BatchJob bj,
                                int resultCode,
                                java.lang.String resultValue,
                                java.lang.Exception ex)

markJobFinished

public static void markJobFinished(BatchJob bj)
                            throws java.lang.Exception
Mark a BatchJob finished without resultcode and resultstring

Parameters:
bj - a BatchJob
Throws:
java.lang.Exception

markJobFinished

public static void markJobFinished(BatchJob bj,
                                   int resultCode)
                            throws java.lang.Exception
Mark a BatchJob as finished without a result string

Parameters:
bj - a BatchJob
resultCode - an int
Throws:
java.lang.Exception

markJobFinished

public static void markJobFinished(BatchJob bj,
                                   int resultCode,
                                   java.lang.String resultvalues)
                            throws java.lang.Exception
Mark a BatchJob as finished. Used from an external execution context. Runs in the same transaction as the caller. Neither resultcode nor result have any special semantics for the BatchManager. Their meaning must be interpreted properly by the corresponding BatchAdapter.

Parameters:
bj - the BatchJob to mark
resultCode - an int to indicate a result condition
resultvalues - a String to transport some results
Throws:
java.lang.Exception

exceptionHandlingFinished

public static void exceptionHandlingFinished(java.lang.String id)

run

public void run(TimerEntry te,
                java.lang.String args)
the TimerTask interface

Specified by:
run in interface TimerTask
Parameters:
te - the persistent timer entry
args - the argument string defined in the timer entry.

abort

public void abort()
Abort the running timer task. This method is not called in the current implementation. Future extensions will allow to abort a running timer task.

Specified by:
abort in interface TimerTask

startJob

protected static void startJob(BatchJob bj,
                               BatchAdapter adapter)
Start a BatchJob. Create a new worker thread for the job if isNewThred of bj returns true. If bj.isAutofinish() returns true, the job is finished and completed also.

Parameters:
bj - the Batchjob to start
adapter - the corresponding adapter

startJobHere

protected static void startJobHere(BatchJob bj,
                                   BatchAdapter adapter)
Start a BatchJob in the current thread. If bj.isAutofinish() returns true, the job is finished and completed also.

Parameters:
bj - the Batchjob to start
adapter - the corresponding adapter

compensate

public void compensate(com.dec.avw.core.StepInstance si)

abortBatchJob

public static void abortBatchJob(com.dec.avw.core.StepInstance si)


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.