Class BatchLauncher

    • Method Detail

      • 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 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).

        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:

        1. 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.
        2. The EBX® root module and all specific modules required for running tests must be expanded under the designated directory (see prepareServerLessEnvironment(File, File)).
        3. 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
        It has to be called before any batch processing using 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 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.
        Throws:
        IllegalStateException - if called more that once per JVM execution.
        Exception
      • getBatchLauncher

        public static BatchLauncher getBatchLauncher()
      • executeBatch

        public void executeBatch​(Batch aBatch)
                          throws Exception
        This method executes the method Batch.executeBatch(Repository).

        Before invoking this method it is mandatory to conform to the required architecture specified in the class comment.

        Throws:
        Exception