Writing a SCOadmin manager

Remote object calls

A special naming attribute which is valid for all objects is the systemId attribute, which specifies the system on which the object is located. This is the method by which networked object operations are performed under SCOadmin. Normally, the second argument of the object call contains a list of objects by their names, but when these objects are located on other machines, the object designation must contain the systemId attribute. An example of this is shown below, in which the home directory of the user forbin on the system colossus is found:

   ObjectGet {sco user} {{{systemId colossus} forbin}} pw_dir
Which outputs:
   {get {sco user} forbin {{pw_dir /u/forbin}} {} {} {}}
See ``Host menu'' for information on obtaining host names.

The availability of options also depends on the class definition. The filter option can sift an object list based on the values of attributes (or on the object's class), so its use depends on what attributes an object has. The scope operator can only be used for objects which can contain other objects. A containment relationship is defined between two classes when objects of one class can contain objects of another class. An example of this is a hard disk object containing partitions.

When scoping and filtering are used together, the scope operator is applied, then the filter.

Below is an example of scoping, in which an ObjectGet is performed on all the objects contained by the all object in the {sco StorageDevices} class. The foreach statement is used to print each object returned by ObjectGet on a separate line for legibility:

   osavtcl> foreach obj [ObjectGet -scope 1 \
   	{sco StorageDevices} all Name] {echo $obj}
Which outputs:
   {get {sco StorageDevice} SCSIDisk0 {{Name SCSIDisk0}} {} {} {}}
   {get {sco StorageDevice} FloppyDisk0 {{Name FloppyDisk0}} {} {} {}}
The {sco StorageDevices} class is a special class which defines a pseudo-object that doesn't correspond to any real entity. This object's sole purpose is to contain all the objects of type {sco StorageDevice} on the system. This sort of class is useful for finding all objects of some other class.

The following example is the same as the previous example except that it adds a filter to select only removable storage devices:

ObjectGet -scope 1 -filter {IsRemovable eq true} {sco StorageDevices} all Name
Which outputs:
   {get {sco StorageDevice} FloppyDisk0 {{Name
   FloppyDisk0}} {} {} {}}
The SCOadmin utility library contains a number of helper routines that act as front ends to object calls in order to perform commonly-used tasks:
Previous topic: Object call example

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003