6.6.1. Common Launcher

This handler is the starting point for launching a standalone application.

Initialization of the system repository and execution of the handler queue defined in the repository can be performed by direct launch with a java command.

This handler performs the following processes. See the Javadoc given within the parentheses for the processing details.

The process flow is as follows.

../../../../_images/Main_flow.png

6.6.1.2. Module list

<dependency>
  <groupId>com.nablarch.framework</groupId>
  <artifactId>nablarch-fw-standalone</artifactId>
</dependency>

6.6.1.3. Launch the application

Launch the application by specifying Main class.

The following three options must be specified for the framework operation. Terminated immediately if any one of the following options is missing.(Exit code = 127)

-diConfig
Specifies the path of the system repository configuration file. Initializes the system repository using the path specified by this option.
-requestPath

Specifies the action to be executed and the request ID.

Configures a string defined in the following format.

Executable action class name/Request ID

The request path specified by this option is returned by Request#getRequestPath

-userId
Configure the user ID. This value is stored in the session context variable with the name user.id.

An execution example is shown below.

java nablarch.fw.launcher.Main \
  -diConfig file:./batch-config.xml \
  -requestPath admin.DataUnloadBatchAction/BC0012 \
  -userId testUser

6.6.1.4. Configure the options for launching the application

During the launch of Main class an any optional parameter can be specified.

Optional parameters are configured in pairs of “option name” and “option value”.

For example, it is specified as shown below when the option name is optionName and value is optionValue.

java nablarch.fw.launcher.Main \
  -optionName optionValue

To use option in the application, acquire from ExecutionContext .

 @Override
public Result handle(String inputData, ExecutionContext ctx) {
  // Specify the option name in getSessionScopedVar and acquire the value.
  final String value = ctx.getSessionScopedVar("optionName");

  // Process

  return new Result.Success();
}

Tip

Refer to Launch the application for the options that must be specified while launching the application.

6.6.1.5. Processing contents according to the exceptions and errors

This handler returns the following processes and results depending on the contents of the exceptions and errors that are caught.

Exception class Processing contents

Result.Error

(including subclass)

Performs FATAL level log output.

After log output, the following values are returned as the process results of the handler.

When the status code is 0 - 127
Returns the status code without change.
When the status code is other than 0 - 127
Returns 127.
Exception classes other than the above

Performs FATAL level log output.

After log output, returns 127 as the process results of the handler.