Java CAPS Management and Monitoring APIs

ProcedureTo Start Using APIs to Create Applications

The following task includes everything a you need to create an application using the Java CAPS APIs. If you are connecting using the Sun Java System Application Server (SJSAS) that you installed during the Java CAPS Installation you do not need any additional JAR files in your working directory. However, if you are connecting remotely, you need the following JAR files in your working directory:

  1. Use this example to connect to the JMX URL


    String hostName = "localhost";
    int jrmpPortNumber = 8686;
    String userName = "admin", password = "adminadmin";
    boolean isRemoteConnection = true;
    String jrmpURLString = "service:jmx:rmi:///jndi/rmi://" + hostName 
         + ":" + jrmpPortNumber + "/jmxrmi";
    CAPSManagementClient managementClient = 
         CAPSManagementClientFactory.getInstance(jrmpURLString, 
         userName, password, isRemoteConnection);
  2. Get the service you need to write your application, for example the AdministrationService.


    // get services
              CAPSAdministrationService administrationService = 
              managementClient.getService(CAPSAdministrationService.class);
  3. After creating the application, for example JBIRuntime, invoke the application.


    // use the service,
              System.out.println("The JBI Runtime is 
              "+(administrationService.isJBIRuntimeEnabled()? 
              "Enabled." : "NOT Enabled."));