Business Objects and Data Sources > States > Managing States

This section explains how to change and withdraw the states associated with JViews TGO objects, by showing how to use the state dictionaries. The next section shows you how to handle alarms.

Before delving into the details on how to program states, we are first going to introduce the object state classes and explain the naming principles of the states listed in the dictionaries.

State Values, State Classes, and State Systems

The Java classes introduced by JViews TGO to implement the concepts in state models are IltState and IltStateSystem.

State classes are subclasses of IltState. Their instances are the state values that will be used to describe the state and alarm condition of a telecom object. Examples of state values are: the primary state of a telecom object, each of its secondary states, or its alarm state.

The state dictionaries are embodied by instances of IltStateSystem, which gather the related state classes as nested classes.

JViews TGO includes seven state systems:

Composite state values, such as the OSI primary state triplet, or the Alarm collection of integers and Boolean values, are normal Java objects. All other state values are statically allocated Java objects implementing symbolic state values. They include:

The names of the static data members storing the state values are listed in the tables in Appendix A, Reference Tables for State Visuals.

Object States

The state of a telecom object is described by an Ilt ObjectState instance stored in the telecom object. This instance is called the object state of the telecom object. It contains state values corresponding to the primary state, the secondary states, and the alarm or trap state of the telecom object.

When the object state is modified to reflect a change in the telecom equipment state, the graphic representation of the telecom object is automatically recomputed and redisplayed.

Object State Classes

There are seven subclasses of IltObjectState in JViews TGO. Subclasses are based on the OSI, Bellcore, SNMP and SONET state systems as illustrated in Figure 12.9.

Figure 12.9 shows that each type of object state can hold states and alarms. Alarms systematically complement states with the class IltAlarmObjectState, dedicated to the objects to which only alarms, and no states, are assigned. Figure 12.9 also shows that each type of object state can hold states and traps. Traps systematically complement states with the class IltTrapObjectState, dedicated to the objects to which only traps, and no states, are assigned.

images/tgo_object_state46.png

Figure 12.9 Object State Classes

Depending on the state systems (OSI, Bellcore, SNMP, SONET, Alarm, Trap, Misc) that compose the object state, state modeling is performed differently. For example, there are three state attributes in the SONET state system, whereas there are only two in the other state systems. The terminology employed, as well as the structure of the state models themselves, is developed in the next section.

Dictionaries and Object States

To choose the set of state dictionaries used to describe the state and alarm condition of a telecom object, select a subclass of IltObjectState to store the object state. The seven subclasses of IltObjectState - already shown in Figure 2.1 and Figure 12.9 - are listed below with the state dictionaries that they gather.

The object state system is supplied as an argument to the constructor of the telecom business object, as in the following code example.

How to Supply the State System to the Business Object
IltNetworkElement berlin =
  new IltNetworkElement
                     ("Berlin",
                      IltNetworkElement.Type.NE,
                      IltNetworkElement.Function.TransportCrossConnect,
                      IltNetworkElement.Family.OC12,
                      new IltBellcoreObjectState());

The Object State Classes

A description of how states are structured and named using the OSI, Bellcore, SNMP, Misc, SONET, Alarm, and Trap object state classes is provided in the following sections.

The OSI-Based Object State Class

IltOSIObjectState is an object state class that provides an OSI primary state, a set of secondary states to be taken from the OSI, Misc, and Performance state dictionaries, and an alarm state from the Alarm state dictionary.

An instance of IltOSIObjectState thus holds:

The Bellcore-Based Object State Class

IltBellcoreObjectState is an object state class that provides a Bellcore primary state, a set of secondary states to be taken from the Bellcore, Performance, and Misc state dictionaries, and an alarm state from the Alarm state dictionary.

An instance of IltBellcoreObjectState thus holds:

The SNMP-Based Object State Class

IltSNMPObjectState is an object state class that provides an SNMP primary state, a set of secondary states to be taken from the SNMP, Performance and Misc state dictionaries, and a trap state from the Trap state dictionary.

An instance of IltSNMPObjectState thus holds:

The SONET-Based Object State Class

IltSONETObjectState and IltBiSONET ObjectState are object state classes that provide one or two SONET primary states respectively, two sets of protection switch request indicators, a secondary state taken from the Performance state dictionary if needed and one alarm state. They are dedicated to links, typically links in SONET rings.

An instance of IltSONETObjectState thus holds:

An instance of IltBiSONETObjectState holds:

On a link with a BiSONET object state, the inherited primary state is considered to be the state of the direct direction and is graphically represented by the inner part of the link base and the "to" arrow. The reverse state is represented by the outer part of the link base and the "from" arrow.

The Alarm-Only Object State Class

IltAlarmObjectState is an object state class that provides only an alarm state from the Alarm state dictionary. It is intended for objects with no states.

An instance of IltAlarmObjectState thus holds only an instance of IltAlarm.State.

The Trap-Only Object State Class

IltTrapObjectState is an object state class that provides only a trap state from the Trap state dictionary. It is intended for objects with no states.

An instance of IltTrapObjectState thus holds only an instance of IltTrap.State.

Modifying States and Statuses

This section provides examples illustrating how to manage the states and statuses for network elements and links.

Setting a Network Element State in the OSI State System

The following code shows how to modify the usage state of the neast node and set it to the active value:

neast.setState(IltOSI.State.Usage.Active);

The IltOSI.State.Usage.Active symbol is the name of a global variable that contains a state value. This value is an instance of the IltOSI.State.Usage class (which is itself an IltState subclass).

Setting Network Element States in the Bellcore State System

The following code fragment shows how to change the primary state of the berlin node to EnabledActive and how to set the Busy secondary state on this node:

berlin.setState(IltBellcore.State.EnabledActive);
berlin.setState(IltBellcore.SecState.Busy);

Note that the use of the functional interface is the same for all the telecom object classes and the state systems.

Setting Network Element States in the SNMP State System

The following code fragment shows how to change the primary state of the berlin node to Shutdown and how to set the Interface.InOctets secondary state on this node. This code is an extract from the snmp sample in the distribution.

How to Change the Primary State of a Node and Set the Secondary State
berlin.setState(IltSNMP.State.Shutdown);
berlin.setState (IltMisc.SecState.TestFailed);
berlin.set (IltSNMP.Interface.InOctets, new Integer (123));

In the SNMP state dictionary, most of the states have numeric values. In order to set the values for these states you can use either IltSNMPObjectState or IltObject. Both of these APIs provide methods to set and retrieve the values of numeric states.

Besides the numeric and Boolean states present in the SNMP state dictionary, there is also a set of information that is related to the system being managed and that is defined in the MIB-II System Group. The information in the group is displayed in a System window (explained in detail in System Window). The graphical representation of this information is an icon that, when clicked, opens the System window containing the list of all the attributes set in the telecom object. For information regarding the insertion of new attributes, see Creating a New Attribute in the System Group in the Styling documentation.

The following code extract shows how to change the values of the attributes defined by the System Group.

How to Change the Attribute Values Defined by the System Group
IltSNMPObjectState objstate = (IltSNMPObjectState) berlin.getObjectState();
IltSNMP.SystemInfo sysinfo = objstate.getSystemInfo();
Sysinfo.setDescription ("Berlin station");
Sysinfo.setContact ("John Doe");

Setting Link States

In this example, we modify the berlin_west link, which uses the SONET state system.

How to Set Link States
berlin_west.setState(IltSONET.State.Active);

Accessing and Removing States

In addition to the API used to assert states, another API is available for accessing and removing states. Most of the functions for accessing states are available from the class IltObject.

For example, the Boolean predicate hasState can be used to verify whether the telecom object is in a given state. In all the following examples, neast is the variable that contains the network element North East.

neast.hasState(IltOSI.State.Usage.Idle);

Sometimes, specific accesses are granted using the functional interfaces on the classes IltObjectState and IltState. The following code shows how to access the state object and then set the accessors for retrieving a given state.

How to Access a State Object and Set Accessors for Retrieving a State
IltOSIObjectState osiObjectState = 
          (IltOSIObjectState)neast.getObjectState();
IltOSI.State osiState = osiObjectState.getState();
osiState.getOperationalState();
osiState.getUsageState();
osiState.getAdministrativeState();

When primary or secondary states are added, the same functional interface is used, but with different consequences. The primary state is unique (in the OSI state system, it is a triplet; in the Bellcore state system, it is a single value), as opposed to secondary states (for example, the values associated with the Misc dictionary can be added without limitation). Consequently, when the member function setState is used, this function replaces the primary state, although it adds one more secondary state. There are two ways to remove states created in this way: