Architecture - Object Identifier

The class discussed here is org.friendlysnmp.FID or for short FID.

FriendlySNMP API deals with objects declared in a MIB. These objects are often named nodes because they could be viewed as nodes and leaves in the MIB tree. Each node in this tree has a unique identifier. This identifier is a sequence of integers on the path leading from the root of the tree to a named object.

Three fundamental node objects exposed by FriendlySNMP are Scalar, Table and Notification. Each of them is referred by node object identifier org.friendlysnmp.FID.

This FID class is an immutable wrapper which hides internally used object of the org.snmp4j.smi.OID class or for short OID from SNMP4J package.

The SNMP4J OID class is a powerful and convenient to use class but it has a catch for a developer. This class is mutable. It is very easy for developer to accidentally modify OID value in an object of this class. The class org.friendlysnmp.FID is safe. It gives a developer access to a copy of an internal OID value thus preserving original OID value intact.

The class org.friendlysnmp.FID has another friendly feature which extends OID functionality: a node name. Consider example when you display a message or log event in the form:

The scalar has a new value.

This extremely not user friendly message is not easy to comprehend. The same message could use a scalar name in user friendly form:

The scalar imageSize has a new value.

It is a developer's choice what FID value to use in the message, OID or name or both.