# Accessing configuration data

Within an NMS OAM configuration database on a resource host, a record of configuration information exists for each managed object in the host. The Supervisor component of the NMS OAM service manages the database. Client applications can add, delete, or modify this information using keywords.

Note: The oamsys and oamcfg utilities included with NMS OAM provide an alternate way to access and modify configuration information in the managed objects in the NMS OAM database. For more information about NMS OAM utilities, refer to the NMS OAM System User's Manual.

To access configuration data for a managed object, a client application:

1. Opens the managed object.

2. Retrieves keyword values or qualifiers, or sets values as necessary.

3. Closes the managed object.

## Opening a managed object for editing

To access configuration data for a managed object, a client application opens the object using oamOpenObject. With this function invocation, the application supplies:

- Context handle to the host where the managed object is located.

- Name of the managed object. This name is not case sensitive.

- Opening mode. Valid modes are:

  Mode | Description
  --- | ---
  OAM_READONLY | Opens the object for reading only. The application cannot change keyword values. A managed object can be opened in read-only mode even if it is currently opened in read-only mode by another application.
  OAM_READWRITE | Opens the object for reading and writing. The application can change the values of read and write keywords. A managed object cannot be opened in this mode if any other client application has it currently opened.

If a client application attempts to open a managed object for writing, and the object is currently opened by another application, oamOpenObject fails and OAMERR_ACCESS_DENIED is returned to the application.

An open managed object cannot be deleted by any application other than the application that opened the object.

If the object-opening attempt succeeds, oamOpenObject returns a handle to the object, to be used with subsequent editing functions.

## Retrieving keywords and qualifiers

All configuration data in the configuration database is represented and communicated as keyword name and value pairs:

keyword=value

Example:

AutoStart=YES

This approach is used for every configurable feature of every managed component, including boards, extended management components such as Hot Swap, and the Supervisor itself.

Each keyword has several attributes called qualifiers. For example, the qualifier Type indicates the type of value it accepts (for example, Integer or String). The qualifier ReadOnly indicates that a keyword is read only. Qualifiers are not case sensitive.

Once an object has been opened using oamOpenObject, a client application can retrieve values for the object's keywords using oamGetKeyword. oamGetKeyword takes a keyword name. This name is not case sensitive. If the function invocation is successful, oamGetKeyword returns a buffer containing the string value of the keyword.

A client application can retrieve the value of a keyword qualifier using oamGetQualifier. If the function invocation is successful, oamGetQualifier returns a buffer containing the value of the specified keyword qualifier.

## Setting a keyword value

Once an object has been opened using oamOpenObject, a client application can set the value of a keyword using oamSetKeyword. The object must have been opened in OAM_READWRITE mode. If the function invocation is successful, oamSetKeyword returns SUCCESS.

Most keyword settings are committed when you close the managed object. However, actual operation may not be affected until you restart the board. For details, see the board-specific documentation.

## Closing a managed object

To close a managed object, a client application invokes oamCloseObject. If the function invocation is successful, the object is closed. If the object was opened in read and write mode, any changes are validated and saved. If the object being closed was opened in read-only mode, it remains open from the point of view of any other application.