com.rhi.architecture.batch
Class AbstractApplication

java.lang.Object
  extended bycom.rhi.architecture.batch.AbstractApplication
All Implemented Interfaces:
Application
Direct Known Subclasses:
BatchApplication

public abstract class AbstractApplication
extends java.lang.Object
implements Application

This class provides a partial implementation of the application interface for use by sub-classes. Basically an execute() method following the Template GOF pattern is used to call the initialization & cleanup methods on the applications object.

Resources should be allocated & configured in the init() method. The same resources should be deallocated in the cleanup() method, and the processing logic should be performed w/in the run() method.

Since:
1.0
Author:
Pete McKinstry

Field Summary
 
Fields inherited from interface com.rhi.architecture.batch.Application
FATAL_EXCEPTION, SUCCESS, SUCCESS_WITH_EXCEPTION
 
Constructor Summary
AbstractApplication()
           
 
Method Summary
protected abstract  void cleanup()
          Perform any cleanup required by the application framework.
 void execute(java.lang.String[] args)
          Start application.
protected abstract  void init(java.lang.String[] args)
          Perform initialization required by the application framework.
 Logger log()
          Logs a msg.
protected abstract  void run()
          The run() method is expected to be overriden by concrete sub-classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractApplication

public AbstractApplication()
Method Detail

execute

public final void execute(java.lang.String[] args)
                   throws ApplicationException
Start application. Initialize any common framework components, and then call the abstract run() method to allow sub-classes to do the real processing.

Specified by:
execute in interface Application
Parameters:
args - commandline arguments.
Throws:
ApplicationException - fatal error
Since:
1.0

init

protected abstract void init(java.lang.String[] args)
                      throws InitializationException
Perform initialization required by the application framework. This should include allocation and configuration of resources if possible.

Parameters:
args - commandline arguments
Throws:
InitializationException - error initializing the process.
Since:
1.0

cleanup

protected abstract void cleanup()
Perform any cleanup required by the application framework.

Since:
1.0

run

protected abstract void run()
                     throws ApplicationException
The run() method is expected to be overriden by concrete sub-classes. This method should include or call the processing logic represented by this application.

Throws:
ApplicationException - a fatal error occured during processing.
Since:
1.0

log

public Logger log()
Logs a msg. Ignores if logger not properly initialized.

Returns:
Logger


Copyright © 2002-2004 Robert Half International. All Rights Reserved.