Step 6 : ARM 4.0 Java Hello World example
Description
Now we are ready to create all definition objects we need the
appropriate runtime objects. Here we create the ArmApplication
object representing our running application instance using the
newArmApplication() method of the ArmTransactionFactory interface:
- appDef - passing the application definition object we created before
so the agent knows which type of application we are running.
- "Example" - passing a group name for this running application so at
analysis stage any "Example" application can be found.
- null - string object reference for our specific application
instance (no instance used in this example).
- null - string array object reference for additional application context
value (none used in this example).
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: ArmApplication app =
18: tranFactory.newArmApplication(appDef, "Examples", null, null); |
19: System.out.println("Hello world!");
20: System.exit(0);
21: }
22: } |
|