Class BatchLauncher
java.lang.Object
com.orchestranetworks.service.extensions.BatchLauncher
This class is used to launch
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.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
executeBatch
(Batch aBatch) This method executes the methodBatch.executeBatch(Repository)
.static BatchLauncher
static void
prepareServerLessEnvironment
(File modulesRootDir, File propertiesFile) This method must be called to prepare the environment for batch processing in a server-less environment.
-
Method Details
-
prepareServerLessEnvironment
public static void prepareServerLessEnvironment(File modulesRootDir, File propertiesFile) throws Exception This method must be called to prepare the environment for batch processing in a server-less environment.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 fromTestHelper
is that a batch executes on the repository that is specified by the EBX® main configuration file (the repository must have been previously installed).Limitations
There are some limitations to using a server-less environment:
- D3 is not available
- Data model assistant is not usable since it is a "UI-only" module
Required architecture and configuration
In order to be used, the environment must conform to the following principles:
- A repository cannot be shared by multiple JVMs. If such a situation occurs, it may lead to unpredictable behavior and even to the corruption of repository data. Consequently, if an application server is connected to the same repository during the work day, it is imperative to stop it before using this class. Reciprocally, it is mandatory to ensure that batches are terminated before restarting the application server. It is also imperative to execute a single batch at any given time on a given repository.
- The EBX® root module and all specific modules required
for running tests must be expanded under the designated
directory (see
prepareServerLessEnvironment(File, File)
). - The classpath must declare at least:
- EBX® libraries (core library and webapps libraries)
- JavaMail
- Ant version 1.6.5 or higher
- Libraries used to access the database
executeBatch(Batch)
.- Parameters:
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 namedwebapps
. 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 (predefinedebx-root-1.0
,ebx-manager
and specificmodule-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 tonull
, the system property will be used instead.- Throws:
IllegalStateException
- if called more that once per JVM execution.Exception
-
getBatchLauncher
-
executeBatch
This method executes the methodBatch.executeBatch(Repository)
.Before invoking this method it is mandatory to conform to the required architecture specified in the class comment.
- Throws:
Exception
-