public final class BatchLauncher extends Object
Batch
.
It can be used in a JEE container or in a server-less mode.
When using it in server-less mode, the method prepareServerLessEnvironment(File, File)
must be called once
per JVM execution.ProgrammaticService
Modifier and Type | Method and Description |
---|---|
void |
executeBatch(Batch aBatch)
This method executes the method
Batch.executeBatch(Repository) . |
static BatchLauncher |
getBatchLauncher() |
static void |
prepareServerLessEnvironment(File modulesRootDir,
File propertiesFile)
This method must be called to prepare the environment for batch processing in a server-less environment.
|
public static void prepareServerLessEnvironment(File modulesRootDir, File propertiesFile) throws Exception
Like TestHelper
, it provides a "server-less" environment for executing EBX®
(the Java Virtual Machine does not require a running application server).
The main difference from TestHelper
is that a batch executes
on the repository that is specified by the
EBX® main configuration file
(the repository must have been previously installed).
There are some limitations to using a server-less environment:
In order to be used, the environment must conform to the following principles:
prepareServerLessEnvironment(File, File)
).executeBatch(Batch)
.modulesRootDir
- indicates the root directory in which to look for EBX® modules to be
registered.
The search is recursively executed under the specified directory,
according to the following regexp: */webapps/*
.
This means that every required EBX® module, including the root module and the
manager module,
must be placed in a directory named webapps
.
Additionally, all modules must be expanded
(they must not remain packaged as WAR files).
Here is an example of a directory tree structure with two
modules (predefined ebx-root-1.0
, ebx-manager
and
specific module-sample
) and where modulesRootDir is the "Root" directory :
Root `-- test-project `-- webapps |-- ebx-root-1.0 | |-- META-INF | | `-- MANIFEST.MF | |-- WEB-INF | | |-- ebx | | | |-- ... | | | |-- module.xml | | | `-- ... | | |-- lib | | | `-- ebx-root-1.0.jar | | `-- web.xml | `-- www | `-- common | `-- ... |-- ebx-manager | `-- ... `-- module-sample `-- WEB-INF |-- ebx | |-- module.xml | `-- schema | `-- sample-many-simple-tables-100.xsd `-- web.xml
propertiesFile
- the path to the EBX® main configuration file.
if set to null
, the system property will be used instead.IllegalStateException
- if called more that once per JVM execution.Exception
public static BatchLauncher getBatchLauncher()
public void executeBatch(Batch aBatch) throws Exception
Batch.executeBatch(Repository)
.
Before invoking this method it is mandatory to conform to the required architecture specified in the class comment.
Exception