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
doExecutemethod. - When a subclass calls the
callMainmethod of this class from themainmethod, thedoExecutemethod is executed. - Arguments to the subclass
mainmethod are assumed to be passed as-is to thecallMainmethod in URL parameter format. - Arguments in URL parameter format are converted to map format and passed to the
doExecutemethod as anIoItemsinstance. - When an error occurs in the subclass
doExecutemethod, it is assumed to throw an Exception. - The return value of the
callMainmethod on successful completion is 0. - The return value of the
callMainmethod when an Exception is thrown in thedoExecutemethod 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
doExecutemethod. - Accepts multiple arguments as an array to handle length limitations per command line argument.
- The converted arguments are passed to the
doExecutemethod as anIoItemsinstance. - If an Exception is thrown in the
doExecutemethod, 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