DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
OSA reference

Example Operation Definition Tables (ODT)

For each operation, the table defines a corresponding procedure and indicates whether that procedure is to be applied to an object instance or an attribute. See also ``Operation definition table (ODT)''.

This example defines the seven standard operations, plus action, filter, and list. The operations create, delete, action, and list will be called once per object. The other operations will be called once for each attribute listed on the command line.

ODT example (Tcl)

set users(operations) {
        {get        {{function {user_get}}     {granularity {perAttribute}}}}
        {replace    {{function {user_replace}} {granularity {perAttribute}}}}
        {replaceWithDefault
                    {{function {user_replace}} {granularity {perAttribute}}}}
        {add        {{function {user_add}}     {granularity {perAttribute}}}}
        {remove     {{function {user_remove}}  {granularity {perAttribute}}}}
        {create     {{function {user_create}}  {granularity {perObject}}}}
        {delete     {{function {user_delete}}  {granularity {perObject}}}}
        {action     {{function {user_action}}  {granularity {perObject}}}}
        {filter     {{function {user_filter}}  {granularity {perAttribute}}}}
        {list       {{function {user_list}}    {granularity {perObject}}}}
}

ODT example (C/C++)

/*
 *   o function - the name of the function that will take care of handling
 *                the viewing or altering of the object instance. Each function
 *                will take the following two arguments:
 *     o errStatus_cl * - a pointer to the errStatus struct the OSA/Object API
 *       is currently using.
 *     o OSAArgDesc_t - a pointer to a structure which describes everything
 *       about the invocation of the execution procedure, and pointers to
 *       structure used to return information to the Object API:
 *         o className_pt - a pointer to the class containing the operation.
 *         o objectName_pt - a pointer to the string representing the object.
 *         o operationName_pt - a pointer to the string representing the
 *                              operation.
 *         o attributeToken_t - a token representing the current attribute
 *                              being worked on. When being called on a
 *                              operation that is working on a per-object
 *                              rather than a per-attribute-per-object basis
 *                              this will contain the value NO_ATTR (0).
 *         o int - a value representing the amount of data that is included in
 *           the next field (an array of attributeValue_t).
 *         o attributeValue_t * - a pointer to the list of all the values
 *           to be evaluated by a filter execution procedure, or an action
 *           operation. If the execution procedure is neither a filter or
 *           and action this value will be NULL.
 *         o ofParameterList_cl * - a pointer to the list of attributes and
 *           their values that was passed by the command line. There will be
 *           helper routines accessible in the Object API by your OSA to
 *           interpret this list.
 *         o ofParameterList_cl * - if you have to pass any values back (the
 *           get or action operations, or a filter) then you can do so
 *           using this list and the helper routines mentioned above.
 */

OSAOp_t op[] = { {"get", user_get, OP_PER_ATTR}, {"replace", user_set, OP_PER_ATTR}, {"replaceWithDefault", user_set, OP_PER_ATTR}, {"add", user_add, OP_PER_ATTR}, {"remove", user_remove, OP_PER_ATTR}, {"create", user_create, OP_PER_OBJECT}, {"delete", user_delete, OP_PER_OBJECT}, {"action", user_action, OP_PER_OBJECT}, {"filter", user_filter, OP_PER_ATTR} {"list", user_list, OP_PER_OBJECT} };


Next topic: Example Group Definition Tables (GDT)
Previous topic: Example Attribute Definition Tables (ADT)

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004