|
iPAM Developer Documentation
|
|
- Building an iPAM "Bean" |
As of iPAM 2.2 (build 61) it is possible to package a set of agents into a .zip or .jar file in such a way that iPAM will recognize them without having to recompile the basic iPAM distribution. This "plugin" capability follows some of the concepts developed for Java Beans and utilizes some of the reflection capability of Java. The description below is based on iPAM 2.2 (build 61). This capability is expected to evolve in future builds.
The iPAM executive classifies agents based mostly on the types of interfaces that they implement. This allows the executive to identify the four basic types of agents, input agents, Jugglers, output agents, and Daemons. This also allows the executive to identify asynchronous agents. This identification is not based on base classes but on interfaces. Thus it is possible to build your own Java classes in your own Java packages while subclassing from an appropriate base class.Most of the information that the executive needs to know about an agent can be determined by querying the agent itself. However, the exec must know which agents to query and what user-legible name (or alias) to assign to an agent. Thus you are free to name the source class anything you want and to assign a more user-friendly name later.
While you are free to chose any name you want for the .zip or .jar file you must avoid conflicts with existing .zip or .jar files. The basic iPAM distribution already uses PAMCore.zip and PAMStandard.zip. Your choice of file name is significant because iPAM uses this name to search for a special iPAM initialization class that defines the unique agents that are part of your iPAM plugin.If your plugin is named MyIPamAgents.jar, then you will need to write a special class called MyIPamAgents (in the default package) which is included in your .jar file. MyIPamAgents.java must follow the skeleton listed below.
iPAM plugins are determined by scanning the Java CLASSPATH variable when iPAM is run. Plugins are activated in the order that they appear int he CLASSPATH line.
For a more extensive example of a plugin definition class see the source file
PAMStandard.java
.
Template for iPAM "plugin" definition class. |
---|
import java.util.Properties; import java.io.File; import org.mitre.pam.interfaces.IPamPlugin; import org.mitre.pam.interfaces.ExecToController; import org.mitre.pam.executive.Exec; /** * A Template for an iPAM plugin */ public class MyIPamAgents implements IPamPlugin { /** * Define the mapping between module aliases and java classes. */ public static void defineModules(ExecToController exec) { // exec.defineModuleAlias("myAgent", "myPackage.MyAgent"); } /** * Define new gui's that will be listed * by the toolpicker */ public static void defineGUIs(ExecToController exec) { // exec.addAdminTool("org.mitre.pam.monitor.watcher.Watcher","Configuration monitor"); // 5 } /** * Define any additional servlets here */ public static void defineServlets(ExecToController exec){ // exec.addServlet("/PAM/myquery", new MyServlet()); } /** * Allows you to check for necessary preconditions before * loading the package. * @return false if the package cannot load */ static public boolean isOkToLoad(ExecToController exec, String[] cmdLineArgs) { return true; } } |
Revised: 27 April 1999