org.jmonks.batch.framework
Class Main

java.lang.Object
  extended byorg.jmonks.batch.framework.Main

public final class Main
extends java.lang.Object

Main is the entry point to the batch framework. This provides the methods to accept the information to identify the job and kicks off the job. The framework can be executed either through command line as an independent program or from any other java program. The information on how to kickoff using these two methods available in main(String[]) and process(java.util.Map) methods of this class.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Field Summary
static java.lang.String JOB_NAME_KEY_NAME
          Name of the parameter key holds the job name in configuration map which is job-name.
 
Method Summary
static void main(java.lang.String[] args)
           This method provides the interface to execute the jobs from command line.
static ErrorCode process(java.util.Map configMap)
           This method provides the interface to execute the job from another java program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOB_NAME_KEY_NAME

public static final java.lang.String JOB_NAME_KEY_NAME
Name of the parameter key holds the job name in configuration map which is job-name.

See Also:
Constant Field Values
Method Detail

process

public static ErrorCode process(java.util.Map configMap)

This method provides the interface to execute the job from another java program. This accepts the job name and additional configuration information relate to this job as a key value pairs in the map. Among these entries in the map, there should be a job-name parameter key available to identify the job to be executed.

 	Map configMap=new HashMap();
 	configMap.put("job-name","process_file_abc");
 	configMap.put("config-name1","config-value1");
 	configMap.put("config-name2","config-value2");
 
 	ErrorCode exitCode=Main.process(configMap);
 	System.out.println("Job exited with return code : " + exitCode.getCode());
 


Whatever the configuration passed here can be retrived from the JobContext instance passed to all the jobs either through initialize methods or process methods.


Parameters:
configMap - Map object consist of all the properties needed to kick off this batch job.
Returns:
Returns ErrorCode provides the status of the batch job.
Throws:
java.lang.IllegalArgumentException - If input configMap is null.

main

public static void main(java.lang.String[] args)

This method provides the interface to execute the jobs from command line. This accepts the job name and additional configuration information related to this job as a command line parameters. Each parameter passed through command line should be in the format name=value. Among these, job-name=process_file_abc property should exist to identify the job to kick off. The ErrorCode's code value will be returned as exit code.

The format to invoke the job using this interface is as follows.
java org.jmonks.batch.framework.Main job-name=process_file_abc config-name1=config-value1 config-name2=config-value2

Whatever the configuration paremters passed here can be retrieved using the JobContext reference passed to all the jobs either using their initialize methods or process methods.

Parameters:
args - Configuration details in command line params as name=value format