Business Objects and Data Sources > States > Defining States in XML > Trap States

The class IltTrapObjectStateSAXInfo is the XML serialization class that allows you to read and write traps in the XML format.

The following table describes the XML elements that can be used.

Table 12.15 XML Elements in the Trap State System 
XML Element 
Attributes 
Possible Values 
Description 
<traps> 
None 

 
Delimits trap state definition 
<new> 

 

 
Structural element that lets you specify new traps for an object 

 
type 
ColdStart, WarmStart, LinkFailure, AuthenticationFailure, EGPNeighborLoss 
This attribute is mandatory. It defines the type of the new trap to be set. 

 
operation 
set, add, remove 
This attribute is optional. It specifies whether the trap should be set, added to or removed from the object state. The default value is set indicating that the trap will be set in the object state. This attribute is used within an <updateState> element. 
<ack> 

 

 
Structural element that lets you specify acknowledged traps for an object 

 
type 
ColdStart, WarmStart, LinkFailure, AuthenticationFailure, EGPNeighborLoss 
This attribute is mandatory. It defines the severity of the acknowledged trap to be set. 

 
operation 
set, add, remove 
This attribute is optional. It specifies whether the trap should be set, added to or removed from the object state. The default value is set indicating that the trap will be set in the object state. This attribute is used within an <updateState> element. 

How to Add a Network Element with Traps defined in XML
<addObject id="NE2">
  <class>ilog.tgo.model.IltNetworkElement</class>
  <attribute name="name">NE2</attribute>
  <attribute name="type">Mainframe</attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
    <x>229</x>  <y>126</y>
  </attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSNMPObjectState">
    <state>Up</state>
    <traps>
      <new type="LinkFailure">5</new>
      <ack type="AuthenticationFailure">2</ack>
    </traps>
  </attribute>
</addObject>
How to Set Traps to an Existing Object using XML

The following example shows how to set traps to an object that already exists in the data source. You can achieve this by using the XML tag <updateObject> to modify the attribute objectState:

<updateObject id="NE1">
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSNMPObjectState">
    <state>Up</state>
    <traps>
      <new type="LinkFailure">2</new>
      <ack type="AuthenticationFailure">3</ack>
    </traps>
  </attribute>
</updateObject>
How to Update Traps Incrementally using XML
<updateObject id="NE1">
  <updateState>
    <traps>
      <new type="ColdStart">1</new>
      <new type="LinkFailure" operation="remove">1</new>
      <new type="AuthenticationFailure" operation="add">1</new>
      <ack severity="LinkFailure" operation="add">1</ack>
      <ack severity="AuthenticationFailure" operation="remove">3</ack>
    </traps>
  </updateState>
</updateObject>