Interpretation of UML model elements by UML-to-CORBA transformations

The Common Object Request Broker Architecture (CORBA) Interface Definition Language (IDL) that the transformation generates depends on the source UML model elements and their characteristics.

Model

A model does not map directly to a CORBA element. The transformation does not generate CORBA elements if there are no components in the source model.

Component

The transformation generates a single CORBA IDL file from a component. The IDL file contains the CORBA elements that the component owns.

Primitive types

The transformation generates a CORBA basic type or a CORBA native type from a primitive type. The CORBA Types model library contains UML primitive types that correspond to CORBA basic types. Alternatively, you can create a primitive type in the source model that has the same name as a CORBA basic type. The following list shows the types that the CORBA basic types library contains:

A primitive type in the source model that is not in the preceding list represents a CORBA native type. For CORBA native types, the transformation generates the native definition in the IDL file.

Packages

The transformation generates CORBA modules from packages of a component. The transformation ignores packages that are not in a component.

Interfaces

The transformation generates a CORBA interface from an interface in the source model. A generalization of an interface corresponds to the inheritance of a CORBA interface. The following table lists the UML property of the source model element and the corresponding CORBA element that the transformation generates.
UML property Transformation output
Name New CORBA interface in the IDL with the specified name, with illegal characters removed
Visibility, public Normal interface
Visibility, private Local interface
Abstract Abstract CORBA interface
Leaf Ignored

Attributes and associations

The transformation generates CORBA attributes from attributes and associations. The following table lists the UML properties of the source model element and the corresponding CORBA element that the transformation generates.
UML property Transformation output
Name CORBA attribute with the same name
Type (association property) CORBA attribute with the type as the supplier of this association
Type (attribute property) CORBA attribute with the specified basic type
"Is Static" and "default" value CORBA constant
Read only Read-only CORBA attribute
Ordering IDL order
«switch» stereotype applied to attributes in classes that have the «CORBAUnion» stereotype applied switch statement in an IDL union

Each case in the switch statement corresponds to a UML attribute that has the «switch» stereotype applied

Operations

The transformation generates an IDL operation from an operation that is declared in an interface or in a class that has the «CORBAValue» stereotype applied to it. The following table lists the UML property of the source model element and the corresponding CORBA element that the transformation generates.
UML property Transformation output
Name New CORBA operation with the specified name
Return type Return type of the CORBA operation
All other properties Ignored
Operation with «CORBAOneway» stereotype One-way IDL operation
«create» stereotype on operation in «CORBAValue» class Maps to a CORBA value initializer operation
context property in the «CORBAOperation» stereotype, which is applied to an operation A set of string values that map to the identifiers that are part of the operation call

The transformation generates the following code fragment from a UML model that contains an interface named Interface1 that contains an operation named Operation1, whose context property contains the values "sys_time" and "sys_location":

module Module1 {
	interface Interface1 {
		long Operation1() context ("sys_time", "sys_location");
	};
};

Parameters

From a UML parameter, the transformation generates an IDL operation. The following table lists the UML property of the source model element and the corresponding CORBA element that the transformation generates.
UML property Transformation output
Name New parameter with the specified name
Direction (in, out, inout) Corresponding parameter in IDL
Type Parameter with the specified type
Visibility Ignored

Enumerations

The transformation generates a CORBA enumeration from a UML enumeration. An enumeration can contain only enumeration literals.

Class with the «CORBAUnion» stereotype

The transformation generates a CORBA union, which is a constructed value, from a class that has the «CORBAUnion» stereotype applied.

Consider the following example, which assumes a UML model that contains the following items:
  • A component named ComponentIDL1
  • The ComponentIDL1 component contains a UML package named Module1
  • The Module1 module contains a class named Union1
  • The Union1 class has the «CORBAUnion» stereotype applied, with the switchType property set to long
  • The class contains three attributes of types long, string, and char, respectively; each attribute has the «switch» stereotype applied
  • The first and second attributes have their case property set to 1 and 2 respectively; the third attribute has the isDefault property set to true
The transformation generates the following union in the ComponentIDL1.idl file, in the Module1 module, as shown in the following code fragment:
module Module1 {
    		union Union1 switch(long) {
			case 1: long u1;
			case 2: string u2;
			default: char u3;
    		};
    
};

Class with the «CORBAValue» stereotype

The transformation generates a CORBA value type from a class that has the «CORBAValue» stereotype applied to it. The «CORBAValue» stereotype has a property called specification. The specification property is an enumeration with the value none, custom, or boxed. The default value is none.

A CORBA value type is an entity that has an optional state and an initializer method that are separate from the properties of an interface. The attributes of the «CORBAState» stereotype represent the state members of a CORBA value type. The «create» stereotype represents the initializer methods of a CORBA value type.

The following table lists the UML property of the source model element and the corresponding CORBA element that the transformation generates.

UML property Transformation output
Stereotype «CORBAValue»
Name New value type with the specified name
Visibility Ignored
Abstract Abstract value type
Attributes with the «CORBAState» with public or private visibility CORBA state member of the CORBA value type, with public or private visibility
Operation with «create» stereotype CORBA factory method of the non-abstract value type
Generalization relationship with the «CORBAtruncatable» stereotype applied; the relationship must be between two classes that have the «CORBAValue» stereotype applied Indicates truncatable inheritance between two classes

Static attribute

A CORBA constant declaration can appear in the scope of an IDL file, a module, an interface, or a value type. In the source model, a static attribute in an interface or a class can represent a CORBA constant that exists in the scope of an interface or value type.

A CORBA constant in the scope of a CORBA module or an IDL file must be an attribute in a class that has the «CORBAConstants» stereotype. The class must be in a package for a module scope constant or in a component for an IDL scope constant. The transformation ignores the name of the class. Each attribute of the class that has the «CORBAConstants» stereotype represents a constant declaration.

Class with the «CORBAStruct» stereotype

The transformation generates a CORBA struct from a class that has the «CORBAStruct» stereotype. The class should only have attributes and no operations. The attributes or associations of the class represent the members of the struct.

Class with the «CORBAException» stereotype

The transformation generates a CORBA exception from a class that has the «CORBAException» stereotype. The class can contain attributes.

Class with the «CORBATypedef» stereotype

The transformation uses the «CORBATypedef» stereotype to assign a new name to an existing CORBA type. A class with the «CORBATypedef» stereotype corresponds to the CORBA typedef. A substitution relationship from the class to the existing CORBA type represents the CORBA typedef.

Generalization relationship with the «CORBATruncatable» stereotype

The transformation generates code for a truncatable value type inheritance.

Consider the following example, which assumes a UML model that contains the following items:
  • A component named ComponentIDL1
  • The ComponentIDL1 component contains a UML package named Module1
  • The Module1 module contains two classes, named Class1 and Class2
  • A generalization relationship exists from Class1 to Class2, and the «CORBATruncatable» stereotype is applied to the relationship
The transformation generates the following code in the ComponentIDL1.idl file, in the Module1 module, as shown in the following code fragment:
module Module1 {
    		valuetype Class2 {
			};
			valuetype Class1 : truncatable Class2 {
			};    
};

Feedback