Step 5 : ARM 4.0 Java Hello World example

Description

After creating an ARM application definition instance we need such an instance for our transaction. So we pass the following parameters to the newArmTransactionDefinition() of the ArmTransactionFactory interface:

  1. appDef - the ARM application definition instance we created so that ARM knows for which application class this transaction executes.
  2. transaction name - the name of our transaction.
  3. null - object reference for ArmID parameter so the agent generates an ID for us.
  4. null - object reference for ArmIdentityPropertiesTransaction parameter instance 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:         ArmTransactionDefinition tranDef =
15:             tranFactory.newArmTransactionDefinition(appDef, "HelloWorldJava",
16:                                                     null, null);
17:         System.out.println("Hello world!");
18:         System.exit(0);
19:     }
20: }