Java is tantamount with the web and the internet. Countless websites use Java and J2EE to process and store transactions related to any number of different needs. Websites will capture data, process it using Java/J2EE to a backend database for storage. These websites exist in all kinds of different market verticals including retail, manufacturing, insurance, financial markets and banking. Yet, the majority of a website's processing is still handled by batch oriented processing. Batch jobs running behind the scenes, not even connected to the Web UI, are reading and processing data from the website's database or a mirror database. So, while there are lots of containers, standards, policies and procedures on websites and J2EE, almost nothing exist for the batch processing arena. The Java Batch Job Framework, hereinafter referred to as JBJF, provides a java component framework that you can write Java batch jobs with. By virtue of being a component, the JBJF enforces a standard approach to creating Java batch jobs. This standard leads to reuse, easier maintainence and faster development.
JBJF is based on a simple task-list concept that provides a fixed pattern for each task within the batch job. The developer analyzes the batch process they need to implement and breaks that batch process down into individual tasks. Each task can then be programmed into a single class that extends the JBJF AbstractTask. The collection of tasks as a whole constitutes the batch job. Once all your tasks are written, you then define the batch job using an XML configuration file, commonly referred to as the JBJF Batch Definition file, or simply definition file. The JBJF Definition file is written in XML and provides data, parameters and external resources to the batch job. Once all the pieces are coded, you compile, package and run your job using a standard Java command line syntax.
As you'll see when working with JBJF, building a batch job stream is easy, simple and fast. The reusable concept stretches beyond JBJF as well and represents the real ROI for JBJF. Tasks developed for one JBJF job will be usable in other JBJF jobs. As more tasks are developed you can start to share, reuse even publish these tasks in a code repository. Because we use Java, the library is Platform independent, thus JBJF works on Unix, Linux, Windows or almost any OS that runs a JVM.
JBJF was developed to solve some common sense issues seen in batch jobs. These include the following:
Reuse - How many times have you seen business logic within Java Beans and EJBs that had to be duplicated in SQL, PL/SQL in order to support a batch process. A website written in Java/J2EE with a batch process written in Perl, Korn, bash or Windows CMD/BAT. The batch language can't "reuse" the Bean/EJB because it can't reach the Bean or there is a great deal of coding and effort to make it reach the Bean. So the business logic is duplicated in SQL or PL/SQL to support the batch process.
Another example is the batch job you've copied a fourth time to once again change the functions or order of the functions to meet a new business process. You're copying another SQL function and putting in a new SQL function to get different data.
JBJF addresses Reuse and Reusability by standardizing all steps in a batch process to a Task. Each Task accepts parameters called "resources" that define key input/output resources. Because the Task is driven by data, it can be easily reused, just change the "resources" for it. Beans written for a website are now easily reached because both the website and the batch are the same language.
Maintenance - Maintenance is a big part of batch processing. The 20/80 rule does apply, 20% effort to develop the batch process, and 80% effort to support and maintain it through it's lifecycle. A database may have been migrated and the name changed. A password gets changed, which means you need to change the batch process variable that stores it. Or you've switched from SQL Server to Oracle, now all the batch processes need to change. All of these seem simple changes by themselves, but add them together and you've got some moderate time and effort on your hands. Both time and effort grow exponentially if you've got 3 environments (development, test and production) to make changes in. Throw in some Change Management and you've got a full scale Project now.
JBJF addresses maintenance by abstracting a great deal of the common batch parameters into a single XML "Batch Definition" file. The batch job is driven by data and parameters within the XML file. Thus, simple changes to a batch process can be controlled and in many cases solved just by changing a simple XML file...no code needs to be touched. Deployments are a simple Copy and Paste of the new XML file.
Timeliness - Probably one of the largest deterrents to adoption of Java for batch processing is Timeliness or turnaround time. Most Java development for batch processing is hindered by the lack of existing code or availability of examples. Most batch jobs are created by first copying an existing process that closly resembles your current needs, then changing it to meet your needs. However, the library of existing Java batch jobs is small when compared to other languages such as Korn or Perl. In many cases, the batch job you copy isn't at all close to your needs, meaning you need to re-code much of it. The turnaround time becomes lengthy and the effot longer than you wanted.
JBJF will help in this area as well. Because individual Tasks are driven by data and parameters. They can easily be reused, simply by changing the parameters. The same class that Exports SQL results in one batch process can be reused in another batch process for the same exporting of data, no code changes are needed, only different parameters. Each new batch job you create also creates more Tasks. As your library of Tasks grows, you can setup a repository of Tasks to choose from. Each batch job becomes simpiler and quicker to create as you reuse more of your Tasks. Customization of a new Task can be easily accomplished by extending an existing Task and customizing it. In short, the more you use JBJF, the more you gain...