[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs

SMIT Object Classes

A System Management Interface Tool (SMIT) object class created with the Object Data Manager (ODM) defines a common format or record data type for all individual objects that are instances of that object class. Therefore a SMIT object class is basically a record data type and a SMIT object is a particular record of that type.

SMIT menu, selector, and dialog screens are described by objects that are instances of one of four object classes:

The following table shows the objects used to create each screen type:

SMIT Classes
Screen Type Object Class Object's Use (typical case)
Menu sm_menu_opt 1 for title of screen

sm_menu_opt 1 for first item

sm_menu_opt 1 for second item

... ...

sm_menu_opt 1 for last item
Selector sm_name_hdr 1 for title of screen and other attributes

sm_cmd_opt 1 for entry field or pop-up list
Dialog sm_cmd_hdr 1 for title of screen and command string

sm_cmd_opt 1 for first entry field

sm_cmd_opt 1 for second entry field

... ...

sm_cmd_opt 1 for last entry field

Each object consists of a sequence of named fields and associated values. These are represented in stanza format in ASCII files that can be used by the odmadd command to initialize or extend SMIT databases. Stanzas in a file should be separated with one or more blank lines.

Note: Comments in an ODM input file (ASCII stanza file) used by the odmadd command must be alone on a line beginning with a # (pound sign) or an * (asterisk) in column one. Only an * (asterisk) comment can be on the same line as a line of the stanza, and must be after the descriptor value.

The following is an example of a stanza for an sm_menu_opt object:

sm_menu_opt:                   *name of object class
  id             = "top_menu"  *object's (menu screen) name
  id_seq_num     = "050"
  next_id        = "commo"     *id of objects for next menu screen
  text           = "Communications Applications & Services"
  text_msg_file  = ""
  text_msg_set   = 0
  text_msg_id    = 0
  next_type      = "m"         *next_id specified another menu
  alias          = ""
  help_msg_id    = ""
  help_msg_loc   = ""
  help_msg_base  = ""
  help_msg_book  = "" 

The notation ObjectClass.Descriptor is commonly used to describe the value of the fields of an object. For instance, in the preceding sm_menu_opt object, the value of sm_menu_opt.id is top_menu.

See "sm_menu_opt (SMIT Menu) Object Class" for a detailed explanation of each field in the sm_menu_opt object class.

The following is an example of a stanza for an sm_name_hdr object:

sm_name_hdr:              *---- used for selector screens
  id                      = ""  *the name of this selector screen
  next_id                 = ""  *next sm_name_hdr or sm_cmd_hdr
  option_id               = ""  *specifies one associated sm_cmd_opt
  has_name_select         = ""
  name                    = ""  *title for this screen
  name_msg_file           = ""
  name_msg_id             = 0
  type                    = ""
  ghost                   = ""
  cmd_to_classify         = ""
  cmd_to_classify_postfix = ""
  raw_field_name          = ""
  cooked_field_name       = ""
  next_type               = ""
  help_msg_id             = ""
  help_msg_loc            = ""
  help_msg_base = ""
  help_msg_book = "" 

See the "sm_name_hdr (SMIT Selector Header) Object Class" for a detailed explanation of each field in the sm_name_hdr object class.

The following is an example of a stanza for an sm_cmd_hdr object:

sm_cmd_hdr:                      *---- used for dialog screens
  id                     = ""    *the name of this dialog screen
  option_id     = "" *defines associated set of sm_cmd_opt objects
  has_name_select        = ""
  name                   = ""    *title for this screen
  name_msg_file          = ""
  name_msg_set           = 0
  name_msg_id            = 0
  cmd_to_exec            = ""
  ask                    = ""
  exec_mode              = ""
  ghost                  = ""
  cmd_to_discover        = ""
  cmd_to_discover_postfix         = ""
  name_size              = 0
  value_size             = 0
  help_msg_id            = ""
  help_msg_loc           = ""
  help_msg_base   = ""
  help_msg_book   = "" 

See the "sm_cmd_hdr (SMIT Dialog Header) Object Class" for a detailed explanation of each field in the sm_cmd_hdr object class.

The following is an example of a stanza for an sm_cmd_opt object:

sm_cmd_opt:              *---- used for selector and dialog screens
  id                     = ""      *name of this object
  id_seq_num    = ""     *"0" if associated with selector screen
  disc_field_name        = ""
  name                   = ""      *text describing this entry
  name_msg_file          = ""
  name_msg_set           = 0
  name_msg_id            = 0
  op_type                = ""
  entry_type             = ""
  entry_size             = 0
  required               = ""
  prefix                 = ""
  cmd_to_list_mode       = ""
  cmd_to_list            = ""
  cmd_to_list_postfix    = ""
  multi_select           = ""
  value_index            = 0
  disp_values            = ""
  values_msg_file        = ""
  values_msg_set         = 0
  values_msg_id          = 0
  aix_values             = ""
  help_msg_id            = ""
  help_msg_loc           = ""
  help_msg_base   = ""
  help_msg_book   = "" 

See "sm_cmd_opt (SMIT Dialog/Selector Command Option) Object Class" for a detailed explanation of each field in the sm_cmd_opt object class.

All SMIT objects have an id field that provides a name used for looking up that object. The sm_menu_opt objects used for menu titles are also looked up using their next_id field. The sm_menu_opt and sm_name_hdr objects also have next_id fields that point to the id fields of other objects. These are how the links between screens are represented in the SMIT database. Likewise, there is an option_id field in sm_name_hdr and sm_cmd_hdr objects that points to the id fields of their associated sm_cmd_opt object(s).

The Hierarchy of sm_menu_opt Objects and Displayed Screens figure shows a hierarchy of sm_menu_opt objects and the menu screens displayed for these objects. Note that the value of each sm_menu_opt.id field that is part of the same menu screen is equal to the value of the immediately preceding sm_menu_opt.next_id field (and this object serves as the title). This field provides a link between a menu item and the item in a menu that immediately follows selection of the item.

The Dialog Using One sm_cmd_hdr Object and Three sm_cmd_opt Objects figure shows a dialog using a sm_cmd_hdr object and three sm_cmd_opt objects, and the resulting dialog screen. Note that the sm_cmd_hdr.option_id object field is equal to each sm_cmd_opt.id object field; this defines the link between the sm_cmd_hdr object and its associated sm_cmd_opt objects.

Two or more dialogs can share common sm_cmd_opt objects since SMIT uses the ODM LIKE operator to look up objects with the same sm_cmd_opt.id field values. SMIT allows up to five IDs (separated by commas) to be specified in a sm_cmd_hdr.option_id field, so that sm_cmd_opt objects with any of five different sm_cmd_opt.id field values can be associated with the sm_cmd_hdr object.

The following table shows how the value of an sm_cmd_hdr.option_id field relates to the values of the sm_cmd_opt.id and sm_cmd_opt.id_seq_num fields.

Note: The values in the sm_cmd_opt.id_seq_num fields are used to sort the retrieved objects for screen display.
SMIT Objects
IDs of Objects to Retrieve (sm_cmd_hdr.option_id) Objects Retrieved (sm_cmd_opt.id) Display Sequence of Retrieved Objects (sm_cmd_opt.id_seq_num)
"demo.[AB]" "demo.A" "10"

"demo.B" "20"

"demo.A" "30"

"demo.A "40"
"demo.[ACD]" "demo.A" "10"

"demo.C" "20"

"demo.A" "30"

"demo.A" "40"

"demo.D" "50"
"demo.X,demo.Y,demo.Z" "demo.Y" "20"

"demo.Z" "40"

"demo.X" "60"

"demo.X" "80"

The SMIT Database

SMIT objects are generated with ODM creation facilities and stored in files in a designated database. The default SMIT database consists of eight files:

The files are stored by default in the /usr/lib/objrepos directory. They should always be saved and restored together.

Related Information

System Management Interface Tool (SMIT) Overview for Programmers

Understanding SMIT Screen Types, Understanding SMIT Aliases and FastPaths, Understanding SMIT Information Command Descriptors, and Understanding SMIT Command Generation and Execution

Adding Tasks to the SMIT Database, Debugging SMIT Database Extensions, Creating SMIT Help Information for a NewTask

Object Data Manager (ODM) Overview for Programmers

SMIT Example Program

odmadd command, smit command

sm_cmd_hdr (SMIT Dialog Header) Object Class, sm_cmd_opt (SMIT Dialog/Selector Command Option) Object Class, sm_menu_opt (SMIT Menu) Object Class, sm_name_hdr (SMIT Selector Header) object class


[ Previous | Next | Contents | Glossary | Home | Search ]