Running a Non-GUI Client Application using jadclient

The jadclient executable program enables you to automate the running of non-GUI client applications. You can run a non‑GUI client JADE application (defined as application type Non‑GUI in the Define Application dialog) as a service under Windows Enterprise (that is, Windows 10, Windows 8, Windows 7, Windows Server 2016, Windows Server 2012, or Windows Server 2008) or you can run it from the command line, to add processing nodes to your JADE network.

To debug a non-GUI application, you must first change the application type to GUI, No Forms (by using the Application Type combo box in the Application sheet of the Define Application dialog).

The jadclient executable program uses the specified schema and app values, in conjunction with the optional signonUser and signonPassword values, to sign on to the JADE database. It performs no user logic in this sign‑on process and it signs off as soon as it has issued an Application class startApplication or startApplicationWithParameter method call, which is the process that actually runs the user logic.

The jadclient executable program will not run server applications specified in a JADE initialization file ServerApplication<application-number> parameter when it is running an application defined in a system schema (for example, user‑defined server applications are not started when schema=RootSchema and app=JadeReorgApp).

If you are a standard user, you cannot install or remove an application as a service, as you do not have the necessary privileges. (For details, see "Service Management", in the JADE Platform Differences Guide.)

The jadclient executable starts the application specified in the app argument. The specified application may start other applications or they may be started by the ServerApplication<application-number> parameter in the [NonGuiClient] section of the JADE initialization file. jadclient waits for all running applications to terminate before exiting back to the command line prompt, which allows application A to start B, then have A terminate but B to continue until it has performed the tasks for which it was written.

Run the non‑GUI client program (for example, from a command script), specifying the following.

jadclient schema=schema-name
          app=application-name
          path=database-path
          ini=JADE-initialization-file-path
          [server=multiUser|singleUser]
          [causeEventOnSystem=[cause-event-number]]
          [host=host-server-node-name or host-IP-address]
          [port=host-port-name or host-port-number]
          [interface=client-TCP/IP-name or client-IP-address]
          [localport=client-port-name or client-port-number]
          [service=install|remove|cmdline]
          [nodeName=name-of-service]
          [nodeNameDescription="descriptive-name-of-service"]
          [noReorgRecovery=true|false]
          [delta=delta-name]
          [executeClass=class-name]
          [executeMethod=method-name]
          [executeParam=string]
          [executeSchema=schema-name]
          [executeScript=file-name]
          [executeTransient=true|false]
          [executeTypeMethod=true|false]
          [signonPassword=password]
          [signonUser=user-name]
          [startAppParameters [user-defined-arguments] [endAppParameters]]
          [endJade [user-defined-arguments]]

The jadclient program treats processing arguments enclosed in double (" ") or single (' ') quotation marks after the startAppParameters or the endJade argument as single-string entries in the huge string array. The handling of strings in this huge string array is application‑specific. For example, path= "program files" is treated as a two‑string entry and "path= program files" is treated as a one‑string entry. How these entries are handled is determined by your application.

All subsequent arguments up to the endAppParameters argument or the end of the command line are collected into a HugeStringArray and passed to the initialize method. Support for the endJade argument is maintained to provide backward compatibility for existing applications. It is recommended that your applications use the startAppParameters and endAppParameters arguments.

You can call the Node class or Process class getCommandLine method to return a string containing the current command line of the respective node or process of the receiver.

The following are examples of the command prompt that runs a non‑GUI client application.

jadclient schema=ASchema app=NonGUIApp ini=c:\jade\test\jade.ini path=c:\jade\system delta=foxtrot
jadclient schema=ASchema app=CSharpGenerator ini=c:\jade\test\jade.ini path=c:\jade\system delta=foxtrot

The following example specifies the non‑GUI client executable (jadclient.exe) command line for the GUI No Forms JadeUnitTestGuiNoForms application.

jadclient path=c:\jade\system schema=TestUnitTestSchema ini=c:\jade\system\jade.ini app=JadeUnitTestGuiNoForms startAppParameters c:\jade\unittest.xml DailyTests codecoverage=true output=true profile=true c:\jade\logs\unittest.log endAppParameters

You can run the ExtractAllExposures application from the jadclient command prompt to generate C# code for all classes in a schema. The generated code for each class contains get and set methods for every property in every class. (Note that methods and constants are not included in this generation.) The following is an example of the command prompt that generates code for the .NET interface.

jadclient path=c:\jade\system ini=c:\jade\system\jade.ini app=ExtractAllExposures schema=JadeSchema startAppParameters FCSchema FCSchema e:\temp\fcschema endAppParameters

The parameters following the startAppParameters argument specify the schema name, the namespace, and the folder to which the .NET exposures are extracted. The ExtractAllExposures application exit code returns:

For details about .NET exposures, see "Extracting a C# Exposure", in Chapter 17 of the JADE Development Environment User’s Guide.

The following is an example of the command prompt that installs a non‑GUI client application as a service.

jadclient service=install nodeName=bgapp1 nodeNameDescription="NonGuiApp in 
ASchema on c:\jade\system" schema=ASchema app=NonGUIApp ini=c:\jade\test\jade.ini 
path=c:\jade\system

The following is an example of the command prompt that removes a non‑GUI client application service.

jadclient ini=c:\jade\test\jade.ini service=remove nodeName=bgapp1

The following is an example of the command prompt that externally causes an event on the JADE System object.

jadclient path=c:\jade\system ini=c:\jade\test\jade.ini causeEventOnSystem=12345

A progress report is created as the server node initializes. Standard initialization information is output to stdout and error information is output to stderr. For details about displaying and redirecting the output from JADE batch utilities, see the DisplayApplicationMessages, LogServer, and UseLogServer parameters under "JADE Log Section [JadeLog]", in the JADE Initialization File Reference.

Use the ReadWriteStdio parameter in the [NonGuiClient] section of the JADE initialization file to specify how JADE read and write instructions are handled when running the non‑GUI client application. By default, Jade Interpreter Output Viewer and User Input windows are not displayed, and the output of write statements is directed to the Windows Command window. Set the parameter to false if you want the Jade Interpreter Output Viewer and User Input windows displayed as for a standard GUI application.

If the jadclient program fails, a non‑zero exit code is returned and an error message is displayed; for example, if the schema is invalid or you attempt to run a GUI application.

The jadclient program uses the parameters in the JADE initialization file [NonGuiClient] section.

If you have installed your non‑GUI client application as a service, you can control it by using standard Windows features. (For details, see "Controlling Non-GUI Client Application Services", later in this chapter.)

If you are a standard user, you cannot install or remove an application as a service, as you do not have the necessary privileges. (For details, see "Service Management", in the JADE Platform Differences Guide.)

You can also initiate a non‑GUI application when the server is initiated or at a specific time. For details, see "ServerApplication<application-number>" under "JADE Non‑GUI Client Section [NonGuiClient]", in the JADE Initialization File Reference.

The non‑GUI client program arguments are described in the following subsections.

For details about using non‑GUI client (jadclient) applications to:

See also "Running a JADE Non-GUI Client Application with Parameters", "Passing Parameters to Non-GUI Applications using jadclient", "Inserting a Schema into the Schema Hierarchy", "Reblocking Collection Class Maps", "Ad Hoc Index Batch Interface", "Stripping Method Source Code", and "Unloading All Report Writer Data to a Single File", later in this section.

If you reimplement the Global class getAndValidateUser and isUserValid methods for user validation, consider that these methods will be called in non‑GUI applications. Creating and attempting to show forms in non‑GUI applications raises an exception unless the application is in exception state.