Solstice Enterprise Manager 4.1 Developing CORBA Applications | ![]() ![]() ![]() ![]() ![]() |
Translating Data
The translation of data in SEM CORBA Gateway is in compliance with the JIDM Specification Translation document.
The data translation (IDL to ASN1 and vice-versa) is based on the IDL files ASN1Types.idl and ASN1Limits.idl, which contain the base definition and classes.
CORBA client applications can use Metadata Gateway (MGW) to access the ASN1 type information of the attributes or events, and to traverse the Management Information Tree (MIT) in Solstice Enterprise Manager (Solstice EM). The basic design of MGW is independent of the JIDM standards and can therefore be accessed by any client, even a non-JIDM client.
This chapter describes the following topics:
- Section 5.1 Metadata Gateway Interface
- Section 5.2 Encoding and Decoding Attribute Values
- Section 5.3 Decoding Events and Responses
5.1 Metadata Gateway Interface
The MGW interface that is exposed to clients is a singleton CORBA object. The UNIX dæmon process, MGW, implements this object and provides the following functionality:
- Get ASN1 type given module name and label
- Look up Node by name, given the object type, GDMO document name, and attribute name
- Get OID by name
- Get name by OID
- Get GDMO document list
- Get managed object class (MOC) list
- Get MOC attributes by OID
- Get MOC attributes by name
- Get MOC notifications by OID
- Get MOC notifications by name
Some of the above functionality is supported in both textual representation and binary representation.
5.2 Encoding and Decoding Attribute Values
Management requests sent by CORBA client applications to the SEM CORBA Gateway are converted from IDL format to the PMI's ASN1 values and conversely responses received by the SEM CORBA Gateway are converted from ASN1 values back to IDL format.
When a CORBA application sends a complex data type (for example, the action_info attribute in cmis_action) the application must encode the value represented by the complex data type in IDL format.
When a CORBA application receives an attribute value represented by a complex data type (for example, CORBA:Any) it must decode this value to extract the information the value contains.
The SEM CORBA Gateway facilitates this by using a set of conversion libraries and the Solstice EM Metadata interface.
The following table gives some sample mappings between ASN1 types and IDL types. For more information on IDL mappings of ASN1 types refer Appendix A.
The following figure shows the encoding/decoding done by the CORBA Request Gateway (RGW).
FIGURE 5-1 Encoding/Decoding Done by RGW![]()
Some of the complex IDL to ASN1 mappings are described in the following paragraphs:
- The ASN1 SEQUENCE is mapped to sequence<any>
- CHOICE is mapped to typedef sequence<any> ASN1_Seq
The following code segment gives the ASN1Type syntax of FileAttribute and CurrentAttributes.
FileAttribute ::= CHOICE {date-last-used INTEGER,file-name VisibleString}CurrentAttributes ::= SEQUENCE {date-last-used FileAttribute,file-name FileAttribute}CODE EXAMPLE 5-1 shows how to encode CORBA::Any corresponding to CurrentAttributes. In the following code example, the CORBA application is attempting to set an attribute fooFile of type CurrentAttributes, with values (100, "filename String" ).
CODE EXAMPLE 5-1 Encoding of CORBA::Any Corresponding to CurrentAttributes
ASN1_Seq aseq(2); aseq[0] <<= CORBA::Long(100); aseq[1] <<= "filename String" ; CORBA::Any any_sel; any_sel <<= aseq ;In the cmis_set request the encoded value any_sel will be passed to the attribute value.
CODE EXAMPLE 5-2 shows that the user is receiving a CORBA::any corresponding to CurrentAttribute as a reply from a get request for an attribute that needs to be decoded.
CODE EXAMPLE 5-3 gives the mapping of data from CORBA IDL format to GDMO format. This following code represents CORBA data in a variable foo of type ASN1_Seq.
CODE EXAMPLE 5-3 Mapping data from CORBA IDL Format to GDMO Format
ASN1_Seq foo(2); long counter=2; string message=""; CORBA::Any corba_any1, corba_any2 ; corba_any1 <<= counter ; corba_any2 <<= message ; foo[0] = corba_any1 ; foo[1] = corba_any2 ;The following table gives the steps for mapping CORBA IDL data to GDMO format.
TABLE 5-2 Steps for Mapping CORBA IDL Data to GDMO Format 1 ASN1_Seq SEQUENCE 2 ASN1_Seq foo(2) foo ::=SEQUENCE {----}3 foo[0] = corba_any1 foo ::=SEQUENCE {any--}4 foo[0] = corba_any2 foo::= SEQUENCE {anyany}5 corba_any1 <<= counter foo ::= SEQUENCE {INTEGER counter,any}6 corba_any2 <<= message foo::= SEQUENCE {INTEGER counter,VisibleString message}
5.3 Decoding Events and Responses
The following two code segments denote the two formats in which events will be received from a CORBA Gateway:
struct EventReport {string event_type;string object_class;string object_name;string event_time;any event_info;};
struct TextEventReport {string event_type;string object_class;string object_name;string event_time;string event_info;};The event_info contains attributes of type Notification. In the EventReport structure, event_info contains a sequence of attributes that is defined for the event_type, and corresponds to the ASN1 type defined in the GDMO document.
The following code example gives the attributeValueChange Notification as defined in dmi.gdmo document.
CODE EXAMPLE 5-4 Definition of attributeValueChange Notification
attributeValueChange NOTIFICATIONBEHAVIOUR attributeValueChangeBehaviour;WITH INFORMATION SYNTAX Notification-ASN1Module.AttributeValueChangeInfoAND ATTRIBUTE IDSsourceIndicator sourceIndicator,attributeIdentifierList attributeIdentifierList,attributeValueChangeDefinition attributeValueChangeDefinition,notificationIdentifier notificationIdentifier,correlatedNotifications correlatedNotifications,additionalText additionalText,additionalInformation additionalInformation;REGISTERED AS {joint-iso-ccitt ms(9) smi(3) part2(2) notification(10) 1};When an attributeChange event occurs, the event information corresponds to the AttributeValueChangeInfo, which is defined as follows:
AttributeValueChangeInfo ::= SEQUENCE {sourceIndicator SourceIndicator OPTIONAL,attributeIdentifierList [1] AttributeIdentifierList OPTIONAL,attributeValueChangeDefinition AttributeValueChangeDefinition,notificationIdentifier NotificationIdentifier OPTIONAL,correlatedNotifications [2] CorrelatedNotifications OPTIONAL,additionalText AdditionalText OPTIONAL,additionalInformation [3] AdditionalInformation OPTIONAL}The event report for the attributeValueChange event is as follows:
sequence <attributes> sourceIndicator attributeIdentifierList attributeValueChangeDefinition notificationIdentifier correlatedNotifications additionalText additionalInformationHere each attribute is expanded based on the types defined in the dmi.gdmo document.
The ASN1 type definitions for the attributes as defined in dmi.asn1 document is as follows:
AttributeIdentifierList ::= SET OF AttributeId AttributeId ::= CHOICE { globalForm OBJECT IDENTIFIER, localForm INTEGER } AdditionalText ::= GraphicString AdditionalInformation ::= SET OF ManagementExtension AttributeValueChangeDefinition::= SET OF SEQUENCE { attributeID AttributeId, oldAttributeValue [1] ANY DEFINED BY attributeID OPTIONAL, newAttributeValue [2] ANY DEFINED BY attributeID} NotificationIdentifier ::= INTEGER CorrelatedNotifications ::= SET OF SEQUENCE { correlatedNotifications SET OF NotificationIdentifier, sourceObjectInst ObjectInstance OPTIONAL }In the following code segment, only the AttributeIdList is expanded; other attributes also are expanded in the same manner.
AttributeIdentifierList sequence <AttributeId> struct ASN1_Choice { unsigned short selector any value localForm Integer
Sun Microsystems, Inc. Copyright information. All rights reserved. |
Doc Set | Contents | Previous | Next | Index |