|
iPAM Developer Documentation
|
|
- Agent Attributes |
The iPAM framework provides a general way to assign attributes to agents. There are several common attributes that are used by many of the agents as well as scheduling attributes. The framework provides several graphical user interfaces that can display these attributes and allow the user to "post" changes.As of iPAM 2.2, attributes are stored internally in String form. This may change in the future. In anticipation of this change the programming interface to attributes is based on String, Integer, Boolean, Double, String-Enumerated, and Password types.
Below is an example fragment adapted fromorg.mitre.pam.getter.TestPIM1
.
Declaring Attributes
public class TestPIM extends PIMShell1 { private final static String CONTENT = "content"; private final static String DELAY = "delayInSeconds"; public TestPIM () { setDescription("Creates a string product"); metaStringInfo(CONTENT, "content goes here", "This becomes the content of the product"); metaIntegerInfo(DELAY, 2, "Delay (sec's) before returning a product"); } }In this example there are two properties --
content
anddelayInSeconds
. The first is of String type while the second is of Integer type. Older code has both a setProperty() call and a metaXXXInfo() call. As of iPAM 2.4 only the latter is required. The metaXXXInfo() call identifies the type of attribute, name of the attribute, default value, and a short help string for gui's that can display help. The information provided by the metaXXXInfo() methods is used by the BERT gui and is generally available to other gui's.
Agents can detect that an attribute is about to change and can modify the change name or value of the attribute before the change. This is accomplished by overriding the inherited setProperty() method, as in the following code fragment taken fromorg.mitre.pam.putter.FTPFileDIM
:public void setProperty(String attribute, String value) { if (attribute.equalsIgnoreCase("targetSpec")) { attribute = FTP_URL; } super.setProperty(attribute, value); }In this example there has been an attribute name change with a new release of the FTPFileDIM code. To maintain its backward compatibility the code looks for an old attribute named "targetSpec". It changes the name of the attribute before it is passed to super.setProperty(). Thus, when the newer version of iPAM is run any old references to the FTPFileDIM attribute "targetSpec" will be automatically converted to their new name.
The following example shows how an attribute change can cause side effects. A change to the RESET attribute causes two other attributes to be "zeroed." The example is taken fromorg.mitre.pam.aggregator.ProductCounter
.public void setProperty(String property, String value) { if (property.equals(RESET)) { if (value.equalsIgnoreCase("true")) { super.setProperty(COUNTER, 0); super.setProperty(SIZE, 0); } } super.setProperty(property, value); }
The default inherited behavior allows all attributes to be read and written (or changed). To implement a read-only attribute detect the setProperty() call with that attribute's name and do not call super.setProperty() for that attribute. This is a crude mechanism that unfortuneatly may leave some of the gui's out of sync with the configuration. A more elegant mechanism may be implemented in the future by extending the metaXXXInfo() calls.
Revised: 20 September 1999