Step 4 : ARM 4.0 Java Hello World example

Description

Now that we have a transaction factory instance we can begin creating all necessary ARM objects to communicate with the ARM agent: We create an ArmApplicationDefinition instance using the newApplicationDefinition() method of the ArmTransactionFactory interface representing our application and pass the following parameters:

  1. our application name
  2. null object reference for the ArmID parameter so the agent generates an ID for us.
  3. null object reference for the ArmIdentityProperties parameter because there are no additional identity properties.

Code

01: import org.opengroup.arm40.transaction.*;
02: 
03: public class HelloWorld  {
04: 
05:     public static void main(String argv[]) throws Exception {
06: 
07:         ArmTransactionFactory tranFactory;
08:         if ((tranFactory = getTranFactory())==null) {
09:             System.exit(-1);
10:         }
11:         ArmApplicationDefinition appDef = 
12:             tranFactory.newArmApplicationDefinition("HelloTranApp", 
13:                                                     null, null);
14:         System.out.println("Hello world!");
15:         System.exit(0);
16:     }
17: }