| Business Objects and Data Sources > States > Trap States > Defining Trap States with the API |
Defining Trap States with the API |
INDEX
PREVIOUS
NEXT
|
Traps carried by telecom objects are described in the same way as states. Traps are held by one of the IltObjectState object attributes and are modeled using an instance of the class IltTrap.State, which is a subclass of IltState.
For each trap type, the alarm object includes the following information:
The trap model is the alarm representation for SNMP-based objects. To retrieve the information about traps, you should use the method IltObject.getTrapState.
The following code shows how traps are managed on the paris network element. The API for managing traps is directly available from the IltObject class.
The following code line retrieves the object state corresponding to the alarms for Paris:
IltTrap.State alarms = paris.getTrapState();
The following code line shows how to set new alarms on the object.
alarms.setNewAlarmCount(IltTrap.Type.LinkFailure, 2);
To set acknowledged traps, use the following code:
alarms.setAcknowledgedAlarmCount(IltTrap.Type.LinkFailure, 2);
Traps can be set either directly as shown above, or incrementally as in the following code sample, where a new Link Failure trap is added to the same network element.
alarms.addNewAlarm(IltTrap.Type.LinkFailure);
System.out.println("Link Failure traps on Paris: "
+ alarms.getNewAlarmCount(IltTrap.Type.LinkFailure));
The printed output is the following:
Link Failure traps on Paris: 3 new
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |