iPAM Developer Documentation

- Developing a new Handler or Juggler Agent

iPAM agents with inputs and outputs are known as Handlers and Jugglers, depending on the context. Like other iPAM agents they may have attributes that define and refine their operation (See Agent Attributes).

Handlers have no schedule, but, Jugglers may have a schedule. The differences between these are mostly implemented by the two base classes:

It is recommended that you subclass from one of these.

Handlers - Non-schedulable agents

A handler has no schedule of its own. It is given an input which it may accept, reject, or modify. This is accomplished by implementing the method buildProduct() as shown in the example below. The method buildProduct() has a Product as the single arguement and returns a Product as its result. buildProduct() is free to return:

 

 

Skeleton for A Basic Handler

package MyPackage;
      
import org.mitre.pam.interfaces.Product;
import org.mitre.pam.aggregator.NoSchedBase;
      
public class SimpleHandler extends NoSchedBase {
      
	public SimpleHandler () {
		/* attribute declarations ommitted */
	}
      
	protected Product buildProduct(Product p) {
		/* code body omitted */
    
	}
}

      	

Jugglers - Agents with their own schedule

Jugglers can have a schedule. Most of the work to deal with scheduling is handled by the base class org.mitre.pam.aggregator.ChanSchedBase. For this reason it is just as easy to write a Juggler as it is to write a Handler. The Juggler also has a buildProduct() method that must be implemented. The example below is the source code for the passThru agent provided as one of the standard iPAM agents.

Source code for org.mitre.pam.aggregator.PassThru

package org.mitre.pam.aggregator;
                  
import java.util.*;
                  
import org.mitre.pam.interfaces.Product;
                  
/**
* A basic Juggler that does little other than accept the composite product
* and stamp product attributes on the product.
*
* @author Nazario Irizarry, Jr.
*/
public class PassThru extends ChanSchedBase {
	
	public PassThru () {
		super();
		setPeriod(60);
	}
/**
* This channel builds a composite product from the product that it's sources provide.
* It augments the topic vector of the source product -- which is wrong when two channels
* end up using the same product, but this will have to do for now.
*/
	protected Product buildProduct(Product inputProduct) {
		return inputProduct;
	}
}
                  
      
                  

 

  Revised: 27 April 1999