|
iPAM Developer Documentation
|
|
- Developing a new Output Agent |
iPAM output agents are tasked to send products to file systems or services external to iPAM. Products are in iPAM's internal product format. Many output agents establish an output connection to an external service every time a new product must be sent. However, it is possible to write output agents that maintain a connection across invocations.The executive ensures that output agents are only tasked to do one thing at a time. If an output agent is connected to multiple agents it is possible to have simultaneous requests for output. The executive maintains a common output agent (DIM) queue on which it holds the extra output requests until the current task completes. Using a common queue may not work for all situations. For this reason it is possible to develop output agents that have individual queues.
The sections below present how one would write three different kinds of output agents:
The basic output agent extends the classorg.mitre.pam.putter.DIMShell1
. The constructor for the output agent provides a string that describes what this agent does. It also defines agent attributes and default values that may be interrogated later when the agent is invoked to output product. The agent can have any number of attributes that will be availble for modification through various user interfaces. There is oneputProduct()
method that implements the output agent's function.
Skeleton for A Basic Output Agent
package MyPackage; package org.mitre.pam.putter; import org.mitre.pam.interfaces.Product; import org.mitre.pam.putter.DIMShell1; public class MyOutputAgent extends DIMShell1 { static final String MY_ONE_PROPERTY = "anOutputPropertyName"; static final String DEFAULT_VALUE = "the default string value"; public MyOutputAgent() { setDescription("sends output to my service or file system"); setProperty(MY_ONE_PROPERTY, DEFAULT_VALUE); metaStringInfo(MY_ONE_PROPERTY, DEFAULT_VALUE,"Help text for the one property"); } /** * Output a product. */ public void putProduct(Product prod) { /* fill in code here to take the product, render it into some meaningful external form, and then send or publish it */ } }
There is a lot of overhead associated with opening and closing connections to some output services. It may be beneficial to open a connection once and then keep the connection open for multiple invocations of the output agent. This behavior can be acheived by implementing the AsynchronousAgent interface. An example can be found here.
An output agent can be written that has its own input queue. The queue will have its own budget and priority. This is accomplished by subclassing from the base classorg.mitre.pam.putter.QueuedDIMShell
. The queue effectively decouples the sending agents from the output agent, so that even if it takes a long time to output a product, the sending agent is released (and it's task is treated as complete) as soon as the product is placed on the input queue. The agent must implement the methodputQueuedProduct()
instead ofputProduct()
.An example of such an agent is
org.mitre.pam.putter.TestQueuedDIM
.
Revised: 27 May 1999