Java Reference
In-Depth Information
The batch.xml configuration file
The
batch.xml
file is an XML file that contains the batch artifacts of the batch ap-
plication. It establishes a correspondence between the batch artifact implementation
and the reference name that is used in the Job XML file. The
batch.xml
file must
be stored in the
META-INF
directory for a portable application. The following code
gives us the contents of the
batch.xml
file for the
inscription-validator-
Job
Job shown in the preceding code.
The following code is an example of
batch.xml
:
<batch-artifacts xmlns="http://xmlns.jcp.org/
xml/ns/javaee">
<ref id="InscriptionReader"
class="com.packt.ch02.batchprocessing.chunk.InscriptionReader"
/>
<ref id="StudentNotifier"
class="com.packt.ch02.batchprocessing.chunk.StudentNotifier"
/>
<ref id="InscriptionProcessor"
class="com.packt.ch02.batchprocessing.chunk.InscriptionProcessor"
/>
</batch-artifacts>
JobOperator
The
JobOperator
instance is accessible through the
getJobOperator()
method
of the
BatchRuntime
class. It provides a set of operations to manage (
start
,
stop
,
restart
and so on) a job and access
JobRepository
(
getJobNames
,
getJobInstances
,
getStepExecutions
, and so on). The following code shows
how to start the
inscription-validator-Job
Job shown earlier without any
specific property. It is important to note that the
inscriptionJob
value that is spe-
cified in the
JobOperator.start
command is the name of the Job XML file (not