While implementing and using the CCM metamodel library we encountered a few errors, typos, and shortcomings in the specification. This section lists these difficulties and describes our attempts to solve them for our project.
Our work with the library so far has only taken place in the context of implementing a series of code generators, so we have been approaching the library and CCM metamodel specification from only a few angles (IDL3 parsing and C++ code generation). These problems reflect our singular points of view only and are mentioned here in the spirit of making the CCM metamodel specification a solid, practical, complete standard. This is not intended to be a complete bug list for the CCM metamodel specification, but rather a simple list of some points that have come up during our work.
The CCM metamodel specification provides classes for representing fields in structures and unions; these Field and UnionField classes are insufficient for model navigation. The CCM Tools implemented these classes as MFieldDef and MUnionFieldDef, respectively. Along with this change, we needed to add DK_FIELD and DK_UNIONFIELD to the DefinitionKind enumeration. The reasoning in these two cases basically involves the following two points:
As implemented in the CCM Tools, a 1-to-many correspondence exists between components and homes. That is, each component might have 1 or more homes, and a home must have exactly one component. However, navigation in the CCM MOF specification is only possible from homes to their corresponding components (via the getComponent and setComponent functions).
For this 1-to-many correspondence to make more practical sense, the CCM Tools add a series of functions to MComponentDef to allow direct navigation to associated home(s). These functions are similar to the set of component supports functions already in a component (but see section 2.4.4 for notes about component supports).
The DefinitionKind enumeration makes little sense in the context of the rest of the CCM metamodel specification. There are two major points of interest here:
These two issues are addressed below.
To solve the first item, the CCM Tools introduced a definitionKind class variable into the following classes:
The definitionKind variable is declared private final static because it is not variable for a given class. Each class has an associated getDefinitionKind function that returns the definitionKind constant.
The second point was easy enough to fix, but any solution will cause a small disturbance in the force, given the separation between the Base IDL and Component IDL metamodels. The DefinitionKind enumeration as specified has many inconsistencies:
All of these classes inherit only from the Typed or IDLType classes (which have no identifier member variables). So, for example, MParameterDef has an identifier variable and an associated DefinitionKind value. FieldDef and UnionFieldDef also have identifier member variables (indicating that a library user might be able to use the lookupName functions to look for instances of these classes), but there are no corresponding DefinitionKind values.
This seems to have been a simple oversight, as all of these types should be treated equally in this regard.
someContainer.lookup("someHome")But it is not clear where to put the DefinitionKind values in this case.
Our solution to the first two problems was to add the missing values to the MDefinitionKind enumeration implementation (see the tables below). Our solution to the third problem was also to add the missing values to the MDefinitionKind enumeration class in the Base IDL library. However, this removes the strict subset/superset relationship between the two parts of the library: the Base IDL is no longer a logical proper subset of the Component IDL.
Nonetheless, we felt this was the best solution: the best alternative is to create an empty MDefinitionKind interface in the Base IDL, and then implement that interface with an MDefinitionKindImpl class in the Base IDL and a second MDefinitionKindImpl class in the Component IDL. The alternative requires excessive typecasting (for a Java, C, or C++ implementation) and would be difficult to maintain. The maintenance difficulty is especially true in the sense of coordinating integer values between the two implementations. As further justification for our solution, this maintenance requirement for the two-implementation solution also removes the proper subset relationship between the two metamodels, so the solution we chose follows the path of least disturbance.
The CCM metamodel specification includes an insufficient method for modeling supported interfaces of components. MComponentDef class instances contain a set of functions for getting, setting, adding, and removing supported interfaces. However, the CCM specification provides no way of representing the fact that these interfaces are supported by the component. This is particularly problematic during code generation, since a component's supported interfaces look to a code generator just like normal interfaces; that is, they have no special semantics in a metamodel.
To remedy this, the CCM Tools introduced an MSupportsDef interface and associated MSupportsDefImpl class implementation. This class functions almost exactly like the MUsesDef and MProvidesDef classes; it simply provides a thin wrapper around the supported interface. This wrapper signals the fact that the associated interface is supported by a component. This is hopefully analogous to the MUsesDef and MProvidesDef classes, which indicate that the associated interface is a receptacle or facet.
One further difficulty exists, though: both homes and components can have supported interfaces. The CCM Tools contain a simple workaround for this problem by including both getHome/setHome and getComponent/setComponent access functions. If the supports node is the child of a home class, the getComponent function will return null, and vice versa.
The MWstringDefImpl and MStringDefImpl classes need to have a kind data member, just like the MPrimitiveDefImpl class. The MPrimitiveKind enumeration class contains values for wide and normal strings (PK_WSTRING and PK_STRING, respectively), so it seems like these types should behave similarly to the other primitive kind data types.
This section describes some difficulties or inconsistencies encountered with the language mappings.
The language mapping template for event publishers in the OMG document is difficult to read. In addition, the template appears to contain the same text two times, with different indentation.
2003-11-09