Programming with the Java API


Java API requirements

To build and run a AR System Java API program on either Windows or UNIX, you need the following environment components:

  • J2SE Software Development Kit (SDK), version 8 (1.8.0_45) or higher
  • Java API files:
    • arapiVerNum.jar
    • arjniVerNum.dll/libarjniVerNum.a
    • arjniVerNum.dll/libarjniVerNum.sl
    • arjniVerNum.dll/libarjniVerNum.so
    • arsys_sample.xml
    • log4j2.xml
    • arlogger-9.1.11-SNAPSHOT.jar
    • websvcjavaVerNum.jar

      Important

      If you are using the latest Java API, the arjni files are not required.


In the aforementioned file names, the placeholder VerNum represents the version number of the release. In some cases, it includes a build number.

The AR System API Open Service Gateway Initiative (OSGI) bundle can be utilized in an OSGI deployment environment.

Important

The AR System Java API also uses a Java Native Interface (JNI) library and the C API library to connect to a pre-7.0.01 AR System server.

You can control when the JNI library is used by setting the jniLoadMode parameter in the Java API configuration file. See the comments in the sample file, arsys_sample.xml.

Writing the Java program

  1. Make sure that your programming environment is set up correctly as described in the Java API requirements section.
  2. Create a Java project in your Integrated Development Environment (IDE).
  3. Include the arapiVerNum.jar and the other required JAR files in the AR System API lib directory in the class path.
  4. Create a new class for the methods that call the Java API.
  5. Import the com.bmc.arsys.api package and other packages you might use in your program.
    The API uses collection classes, so you might need java.util.ArrayList, java.util.List, and java.util.Map.
  6. Instantiate an ARServerUser object and set the user name, password, server, and other connection attributes.
    If the program must interact with different servers or as different users, it can create more than one ARServerUser object.
  7. Use the ARServerUser.login() method to open the connection to the server.
  8. Perform the required operations by using the ARServerUser methods and other API objects and methods.
  9. Use the ARServerUser.(logout) method to close the connection to the server.

For AR System Java API troubleshooting information, see Troubleshooting-the-Java-API.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*