Go to primary content
Oracle Agile Engineering Data Management Batch Client for Agile
Release e6.2.1.0
E69110-01
  Go To Table Of Contents
Contents

Previous
Previous
 
 

4 Use Cases

The Agile e6.2.1.0 Batch Client supports two modes:

  1. Scenario Mode:

    To implement the Batch Use Cases.

  2. ECI Server Mode:

    To provide an ECI tunnel and client access like file server access.

4.1 Scenario Mode

The scenario mode runs a Groovy script which implements the batch process.

Information about how to design and write a script to implement a Batch use case can be found in this chapter.

4.1.1 Recommended Design of a Batch Control


Note:

With the Agile e6.2.1.0 Batch Client bundle, a set of batch control scripts are available in the examples folder. The LogiView procedures of the examples are available as loader files. In this example the synchronization of the run-time process and the shutdown process is carried out by using an EDM configuration parameter within the database. But you can use any information source which is accessible by both processes, for example, a shutdown job in the job table, a local file, a record in the database, etc.

The Agile e6.2.1.0 Batch Client bundle comes with a set of batch control scripts. These are in the examples folder.

The LgvLoop.groovy script can be used as a template for each job table based batch use case. The script uses a set of LogiView procedures to check, control, and execute the batch functionality. The Agile e6.2.1.0 Batch Client provides a run-time process and a shutdown process. In the provided template, the Agile e6.2.1.0 Batch Client LogiView backbone uses a configuration parameter to report the current state of the batch process and to control the batch process.

The following flowchart shows a command flow of the run-time process.

Surrounding text describes ch6001.jpg.

The Java Wrapper executes the run-time process during start-up. The run-time process sets the current state of the batch job by using the corresponding LogiView procedures, and executes the batch job with the central LogiView procedure. To detect a shutdown request, the run-time progress checks if a shutdown request is available by calling a special LogiView procedure.

In this example, there are several LogiView procedures to report the current state of the run-time process:

  • setRunning

    Called in the start-up phase to report that the batch job is running.

  • shouldShutdown

    Detects a shutdown request.

  • executeOperation

    Executes the batch job.

  1. The run-time process calls setRunning during the start-up.

  2. The run-time process checks if there is a shutdown request available by calling shouldShutdown.

  3. If not, the executeOperation LogiView procedure is called to execute a batch job.

    If a shutdown request is available, the run-time process sets the "stopped" state by calling setStopped and ends the run-time scenario.

The shutdown process uses the following LogiView procedures:

  • shutdown

    Creates a shutdown request.

  • isStopped

    Detects that the run-time process has been stopped.


Note:

The shutdown process waits until the run-time process has been stopped before the shutdown scenario ends.


Note:

The Java Wrapper waits until the shutdown process ends or until the shutdown timeout has been reached. The shutdown timeout can be configured in the Java Wrapper configuration file.

4.1.1.1 Time-Out Value Information

wrapper.jvm_exit.timeout

Defines the time in seconds that is allowed between the time JVM reports that the JVM is stopped and the time that the JVM process actually terminates.

  • Default = 15 seconds

  • No time out = 0 seconds

In a normal operation, the Java side of the Wrapper executes the file System.exit when it has completed its JVM shutdown cycle and is ready to exit. When this timeout is triggered, a message like the following is logged.

wrapper  | Shutdown failed: Timed out waiting for the JVM to terminate.
wrapper | Java Virtual Machine did not exit on request, terminated

If the application has registered its own shutdown hook, which takes some time to complete, you could experience timeouts waiting for the JVM process to terminate. To avoid this problem, it may be necessary to extend the timeout to give the application's shutdown hook time to execute to completion. Be aware that, as a rule, shutdown hooks should always complete almost instantly.

Example: wrapper.jvm_exit.timeout=5


Note:

For further information about the wrapper.jvm please refer to: http://wrapper.tanukisoftware.org/doc/english/prop-jvm-exit-timeout.html

4.1.1.2 Run-time Process (Batch Job Loop)

The following is the Groovy script of the Batch Job Loop.

/**
* Batchclient example script to demonstrate the basic implementation of a batch service.
* $Id: LgvLoop.groovy,v 34.2 2009/06/21 15:51:21 schwera1 Exp $
*/
package com.agile.LgvLoop;
import com.agile.testclient.*;
/**
* Each scenario needs to extend the Scenario class.
* The Scenario class provides the execution environment.
*/
public class LgvLoop extends Scenario {
/**
* The run() method is called by the framework to start the scenario.
*/
public void run() {
System.out.println("Starting BatchExample/LgvProd");
     getTestClient().callNativeUsx("lgv_nosel_run","BatchExample/setRunning"); 
     while(!shouldShutdown()) {
getTestClient().callNativeUsx("lgv_nosel_run","BatchExample/executeOperation"); 
       sleepSeconds(10);
     }
getTestClient().callNativeUsx("lgv_nosel_run","BatchExample/setStopped"); 
     System.out.println("Done BatchExample/LgvProd");
   }
/**
* Checks if the batch client should shutdown.
* The method checks the DTV default "EDB-BATCH-CONTROL" to receive a shutdown request.
* @return true if the batch client should shutdown else false
*/
   private boolean shouldShutdown() {
     int result = getTestClient().callNativeUsx("lgv_nosel_run","BatchExample/shouldShutdown"); 
     return result == 1;
   }
 }

The script uses the following methods to implement the run-time process:

  • callNativeUsx

    Calls LogiView procedures.

  • sleepSeconds

    Sleeps for some seconds to wait.

  • println

    Print information into the log file.

The script calls 4 LogiView procedures to set the current process state, to execute the batch job, and to check for shutdown requests. Here are the LogiView procedures used by the batch use case:

4.1.1.3 BatchExample/setRunning

This LogiView procedure sets the batch process control variable (configuration parameter: EDB-BATCH-EXAMPLE-CONTROL) to the value "RUNNING".

EDB_BATCH_VALUE = "RUNNING"
update(EDB_BATCH_VALUE)
 where("T_CFG_DAT.EDB_ID" = "EDB-BATCH-EXAMPLE-CONTROL")
 exec_update()
  • The configuration parameter EDB-BATCH-EXAMPLE-CONTROL

    Can be used to check if the Agile e6.2.1.0 Batch Client is online or not. If your batch process does not allow running more than one Agile e6.2.1.0 Batch Client, you can add another LogiView call to check the current state of the batch process.

  • The Logiview procedure BatchExample/isRunning

    Checks if there is another batch process already active. Thus, starting a new Agile e6.2.1.0 Batch Client can be prevented by checking the current state and implementing the batch script to exit in that case.

4.1.1.4 BatchExample/shouldShutdown

LogiView procedure to check the configuration parameter EDB-BATCH-EXAMPLE-CONTROL for a shutdown request. You can also use different variables to reflect the current state and to control the batch process. LogiView reports a shutdown request if the configuration parameter EDB-BATCH-EXAMPLE-CONTROL is set to "STOP" or if the configuration parameter is not present in the system.

select(EDB_BATCH_VALUE)
where("T_CFG_DAT.EDB_ID" = "EDB-BATCH-EXAMPLE-CONTROL")
 RES = exec_select(1)
 if (RES == 1
   if (EDB_BATCH_VALUE == "STOP")
     exit()
   endif
 else
   exit()
 endif

4.1.1.5 BatchExample/executeOperation

The procedure checks if there is a batch job available and executes that job, or it returns the message that the Agile e6.2.1.0 Batch Client can sleep for some seconds and try again later. You can also use these messages to trace the actions of the batch job in the client trace.

4.1.1.6 BatchExample/setStopped

The batch process checks in every loop if a shutdown request is pending. Before the Agile e6.2.1.0 Batch Client shuts down, the LogiView procedure BatchExample/setStopped is called to set the current state of the batch process.

All LogiView sample procedures are available as loader files within the Agile e6.2.1.0 Batch Client bundle.

4.1.2 ECI Server Mode

The Agile e6.2.1.0 Batch Client can be used as an ECI Server which tunnels the ECI calls of an ECI client to the EDM Server. Additionally to that tunnel functionality, the Agile e6.2.1.0 Batch Client provides some callables to start external programs or to interact with the FMS Client for file operations.

So a "simple" ECI client can be enabled to check in or check out files from the file vault without an interactive Java Client.

The following picture shows an overview of an Agile e6.2.1.0 Batch Client in ECI server mode.

Surrounding text describes ch6002.jpg.

The Agile e6.2.1.0 Batch Client in ECI Server mode uses the Java Wrapper to enable the service features, as it does in the Scenario mode.

The external ECI client can be, for example, a CAD integration which normally uses a Java Client to gain access to the file within a vault.

The Agile e6.2.1.0 Batch Client allows multi connections from several ECI clients.

To shutdown the Agile e6.2.1.0 Batch Client, the ECI client can call the eci_stp_edb ECI function.

4.1.2.1 Wrapper Configuration Settings

To start the Agile e6.2.1.0 Batch Client in ECI Server mode, some wrapper configuration settings have to be changed as follows:

Java Environment:

The Java environment has to be set to a Java 8 or higher version.

  • In Windows

    Adapt the ECI server.cmd shell script for the Agile e6.2.1.0 Batch Client in ECI server mode.

    Example: set JAVA_HOME="C:\Program Files\Java\jre1.8.0_<update_number>"

  • In UNIX

    Adapt the ECI Server shell script.

    Example: JAVA_HOME=/usr/local/java/jjre1.8.0_<update_number>

4.1.3 ECI Server Settings

The configuration of the Agile e6.2.1.0 Batch Client in ECI server mode is similar to the Agile e6.2.1.0 Batch Client in scenario mode with some small differences which are described here.

The ECI server mode does not need a scenario script, but the ECI server settings have to be configured.

Here are the additional settings within the Agile e6.2.1.0 Batch Client properties file:

varenv.EciServer.Port=44444 The port to use, a number > 1024, or 0 for any free port
varenv.EciServer.Encoding=UTF-8 The encoding to use for client connections. A client can switch the encoding by calling "eci_set_enc" after the connection has been established, or by specifying the desired encoding in the EciConParam object (in case of the Java-ECI).
varenv.EciServer.Secure=true Check for authentication? Setting this to "false" will disable the password protection of the client. If set to "false", any program can execute PLM functions on behalf of the user's account as long as the client is connected to the PLM system.This should only be set to "false" if an e6 integration explicitly requires it.
varenv.EciServer.StartupImmediately=true Startup mode. Controls the startup behavior of the ECI server. If set to false, incoming client requests are not answered until the connection to the Agile e6 server has been made. If set to true, the client may execute local ECI calls, but calls to the server are rejected.
varenv.EciServer.ConnectionDelay=100 Delay between two incoming ECI connection requests in milliseconds
varenv.EciServer.CallablePackage.1=<custom_callable_package> Once the necessary wrapper configuration settings have been modified, you can use EciServer.cmd - c to start the Agile e6.2.1.0 Batch Client in console mode and check with the command eci_test if the Agile e6.2.1.0 Batch Client works properly.

4.1.4 Office Suite PDF Service

For detailed information on the Office Suite PDF Service, refer to the Administration Guide for Agile e6 > Office Suite - PDF Generator Installation.

4.1.5 AutoVue Offline Metafile Cache Service

For detailed information on the AutoVue Offline Metafile Cache Service, refer to the AutoVue Integration Installation and Administration Guide for Agile e6.