startAppMethod

startAppMethod(schemaName:    String;
               appName:       String;
               methodName:    String;
               methodParam:   Object input;
               checkSecurity: Boolean): Process;

The startAppMethod method of the Application class enables your logic to initiate another application on the same node as the initiating application. This method enables you to share transient objects between JADE applications and to specify a method to be invoked on the new application.

The parameters for the startAppMethod method are listed in the following table.

Parameter Description
schemaName Specifies the name of the schema in which the application is located.
appName Specifies the name of the application to start.
methodName Specifies the method that is to be invoked on the application.
methodParam Passed to the method that is invoked.
checkSecurity If set to true, invokes the getAndValidateUser method to validate user codes and passwords. If set to false, inherits the security profile from the invoking application. (If set to false and the invoking application terminates before the start up of the called application has completed, a JADE exception is raised.)

If you use this method to share transient objects between applications (that is, by passing transients in the method specified in the methodName parameter), ensure that the transients are created as shared transient objects. (For details, see "create Instruction", in Chapter 1 of the JADE Developer’s Reference.) The method specified in the methodName parameter must have a signature that contains only the methodParam parameter; that is:

method-name(methodParam: Object);

This method starts only applications of type ApplicationType_Non_GUI_Web, ApplicationType_Non_GUI_Rest, or ApplicationType_Non_GUI if this method is invoked from a server method or server application. (An exception is raised if this method is invoked from a server method or a server application to start an application of a type other than a non-GUI application.)

On a client node, this method starts all types of application. For details about running non-GUI applications in standard (or fat client) mode, see the Application class applicationType property.

You can use the MaxWaitAppStart parameter in the [JadeClient] or [JadeServer] section of the JADE initialization file to increase the time that JADE waits for a GUI or GUI, No Forms application to initiate on another thread before raising an exception, when your system has a large number of applications to start and the default value of 45 seconds may not be sufficient for the loading on the machine during startup. For details, see the JADE Initialization File Reference.

The object that is specified in the methodParam parameter of the startAppMethod method is passed to the method specified in the methodName parameter, as shown in the following example.

okButton_click(btn: Button input) updating;
vars
    count : Integer;
begin
    app.mousePointer := self.MousePointer_Hourglass;
    while count.bump <= number.text.Integer do
        if lockgen.value then
            app.startApplication('LockTest', 'LockGen');
        endif;
        if lockTestOthers.value then
            app.startAppMethod('LockTest', 'LockTestOthers', "otherMethod",
                               Records.firstInstance, false);
        endif;
        if locktest.value then
            app.startApplication('LockTest', 'LockTest');
        endif;
    endwhile;
    app.mousePointer := self.MousePointer_Default;
end;

When multiple applications are initiated, they run independently of each other. The JADE application program switches the context between applications, based on the form or control that is causing an event. If one application is terminated (when all forms of that application are closed), the database remains open, as each application uses the same open instance of that database.

If a client node application creates a shared transient instance, it cannot pass it as a parameter of the startAppMethod method if this method is to be initiated on the server node, as the application will be initiated on the server node. (Shared transient instances belong to a node.)

This method returns the process of the application that was started. The application that calls the method continues executing after JADE has successfully created a new process. If the application is not initiated (for example, because of EnableAppRestrictions security restrictions) an exception is raised in the application requesting the initiation.

The types of application that you can start by using the startAppMethod method on client nodes or server nodes are listed in the following table, which also lists their termination behavior.

Start-up Location GUI Non_GUI and Non_GUI_Web GUI_No_Forms
Client nodes Stays while application has forms Does not stay running Stays while application has forms
  No execution of finalize method No execution of finalize method No execution of finalize method
Server nodes Not available Does not stay running Not available
    No execution of finalize method  

In this table, "Stays while application has forms" indicates that the application is terminated automatically when it has no remaining forms or there is explicit programmatic termination.