Writing a Java plug-in
This topic explains how to write a Java plug-in.
To write a Java plug-in
- Make sure your programming environment is set up correctly. You need:
- Java Development Kit (JDK) 6 Update 17.
- AR System Java plug-in API files. (See Installed plug-in components for installation and verification.)
- AR System Java API files. (See Installed plug-in components for installation and verification.)
- Create a Java project in your IDE.
- Include the arpluginsvrVerNum.jar file in the AR System API library directory in the CLASSPATH. (For the directory location, see Installed plug-in components.)
- Create a new class that will implement one of the interfaces listed in Creating Java plug-ins, or extend one of the abstract classes listed in that section.
- Import the com.bmc.arsys.pluginsvr.plugins and com.bmc.arsys.api.* packages and other packages, such as java.util.List, into your program.
- Implement the methods of the interface or abstract class you are using. See the Java plug-in API online documentation located at ARSystemServerInstallDir\ARserver\api\javaplugins\arpluginsdocVerNum.jar for details, and consider these tips:
- When implementing the init() and initialize() methods, do not put the plug-in into a long loop to wait to connect to the AR System server or another server. Such loops prevent the Java plug-in server from finishing its initialization. To determine whether the plug-in has been instantiated inside the plug-in server, the plug-in server must receive either a return from init() or initialize(), or an exception. If the plug-in server learns that the method failed to instantiate the plug-in, it can still instantiate its other plug-ins and complete its initialization. The failed plug-in, however, will be unable to receive calls.
- If a plug-in must perform a long process, such as establishing a database connection, before the plug-in can accept a call, create a separate thread for the process so that the init() and initialize() methods are not blocked. If the plug-in receives any call other than init() and initialize() before it completes the process, the plug-in can generate an ARException to notify the caller that it is not ready and to tell the caller its current state. When it is ready, it can process the call.
- To enable the Java plug-in server to load and instantiate all plug-ins inside the plug-in server, a plug-in should not throw a runtime exception or an ARException from the init() and initialize() methods for non-fatal errors.
- Add an entry that identifies the plug-in to the plug-in server configuration file. See Configuring the Java plug-in server.
- If the Java plug-in uses native libraries:
- Include the native libraries in the PATH variable. On UNIX only, include the native libraries in the LD_LIBRARY_PATH (Solaris and Linux) or LIBPATH (AIX) environment variable.
- If the libraries need to know the remote host character set, call the getRemoteHostCharSet() method of the ARPluginContext object. For details, see the Java plug-in API online documentation located at ARSystemServerInstallDir\ARserver\api\javaplugins\arpluginsdocVerNum.jar.
Comments