SBAL can be customized, especially:
These 2 goals are reached by extending the BatchLauncher class.
You need to create a class that implements the LogConfigurator interface. The method
public void configure(File confDir, String jobName)
allows you to configure log4j.
Sample: see net.sf.spring.batch.impl.Log4jConfigurator.
You need to create a class that implements the PropertiesLoader interface.
The following methods:
public abstract Properties loadProperties(File confDir, String batchName) public abstract Properties loadProperties(File confDir, String batchName, String globalPropertyFile)
allows you to load properties files.
Sample: see net.sf.spring.batch.impl.DefaultPropertiesLoader.
Once you have customized your properties loader, and log4j configuration you need to create a class that extends BatchLauncher class and re-implement the main method.
public class MyBatchLauncher extends BatchLauncher { public static void main(String[] args) { MyBatchLauncher batchLauncher = new MyBatchLauncher(); batchLauncher.setLog4jConfigurator(new Log4jConfigurator()); batchLauncher.setPropertiesLoader(new DefaultPropertiesLoader()); int result = batchLauncher.init(args); if (result == STOP) batchLauncher.exit(0); if (result == ERROR) batchLauncher.exit(-9999); result = batchLauncher.run(); batchLauncher.exit(result); } }