Overview

To load objects with states defined in the XML format, all you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file containing the object description to the parse method of the data source, as shown below:
dataSource = new IltDefaultDataSource();
dataSource.parse("OSIXMLFile.xml");
To define states when you add predefined business objects to the data source, set the value of attribute objectState to one of the JViews TGO object states:
  • IltOSIObjectState
  • IltBellcoreObjectState
  • IltSNMPObjectState
  • IltSONETObjectState
  • IltBiSONETObjectState
  • IltAlarmObjectState
  • IltTrapObjectState

How to create a predefined business object with states and alarms using XML

The following example shows an XML extract that you can load in a data source to create a rectangular group. States and alarms can be set in this object by declaring the value of attribute objectState when adding the business object:
<addObject id="RectGroup">
  <class>ilog.tgo.model.IltRectGroup</class>
  <attribute name="name">RectGroup</attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpRect">
     <x>489</x>  <y>356</y>   <width>80</width>  <height>60</height>
  </attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltOSIObjectState">
    <state>
      <administrative>Locked</administrative>
      <operational>Enabled</operational>
      <usage>Idle</usage>
    </state>
    <availability>PowerOff</availability>
    <control>ReservedForTest</control>
    <alarms>
      <new severity="Raw.Critical">5</new>
      <ack severity="Raw.Warning">12</ack>
    </alarms>
  </attribute>
</addObject>

How to set states and alarms to an existing object using XML

The following example shows how to set the states and alarms of 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="RectGroup">
  <attribute name="objectState" javaClass="ilog.tgo.model.IltOSIObjectState">
    <state>
      <administrative>ShuttingDown</administrative>
      <operational>Enabled</operational>
      <usage>Busy</usage>
    </state>
    <availability>PowerOff</availability>
    <misc>HighTemperatureWarning</misc>
    <alarms>
      <new severity="Raw.Critical">2</new>
    </alarms>
  </attribute>
</updateObject>
The <attribute> tag is used to modify the value of an attribute in a business object. When you use it to modify the value of attribute objectState , the old object state definition is completely replaced by the new one.
JViews TGO also provides support to update the object state of a predefined business object to allow you to perform incremental changes. This support is made available through the tag <updateState> :
Within an <updateState> block, you can modify the states, alarms and traps present in the business object state, adding and removing states, adding, removing and setting alarms and traps.

How to update states and alarms incrementally using XML

<updateObject id="NE1">
  <updateState>
    <state>
      <operational>Enabled</operational>
      <usage>Active</usage>
    </state>
    <procedural operation="remove">Initializing</procedural>
    <misc operation="remove">DoorAjar</misc>
    <alarms>
      <new severity="Raw.Critical" operation="set">2</new>
      <new severity="Raw.Major" operation="add">1</new>
      <ack severity="Raw.Warning" operation="remove">5</ack>
    </alarms>
  </updateState>
</updateObject>
The tables in this section list, for each state system, the XML elements that you can use to describe states in the XML format.