AbstractBatch (Abstract Class)

Framework Components [com.onepg.bat]

← Back to Class List

Class Information

Package: com.onepg.bat

Class Name: AbstractBatch (Abstract Class)

Description

Base class for batch processing.
  • Provides common processing (logging, exception handling, etc.) for each batch.
  • Subclasses define specific batch processing by implementing the doExecute method.
  • When a subclass calls the callMain method of this class from the main method, the doExecute method is executed.
  • Arguments to the subclass main method are assumed to be passed as-is to the callMain method in URL parameter format.
  • Arguments in URL parameter format are converted to map format and passed to the doExecute method as an IoItems instance.
  • When an error occurs in the subclass doExecute method, it is assumed to throw an Exception.
  • The return value of the callMain method on successful completion is 0.
  • The return value of the callMain method when an Exception is thrown in the doExecute method is 1.
[Implementation Example] public class ExampleBatch extends AbstractBatch {
   public static void main(String[] args) {
     System.exit((new ExampleBatch()).callMain(args));
   }

Constants and Variables

traceCode

protected String traceCode
Trace code.

logger

protected LogWriter logger
Log writer.

Method List

doExecute (Abstract Method)

protected void doExecute(IoItems args)
Main processing.
  • Subclasses implement specific batch processing.

Parameters

Name Type Description
args IoItems arguments

callMain

protected int callMain(String[] args)
Invokes main processing.
  • Converts arguments from URL parameter format to map format, executes log start processing, and then calls the doExecute method.
  • Accepts multiple arguments as an array to handle length limitations per command line argument.
  • The converted arguments are passed to the doExecute method as an IoItems instance.
  • If an Exception is thrown in the doExecute method, the processing is considered to have terminated abnormally.

Parameters

Name Type Description
args String[] arguments

Return Value

int - 0 on successful completion, 1 on abnormal termination