Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


XMI : Exchanging Models and Interchanging Ideas Using UML : Page 2

As the official OMG specification for exchanging model information between tools and repositories, XMI will have a huge impact on architects and developers. Find out how to use this spec to make your model metadata agnostic and portable for the future.




Application Security Testing: An Integral Part of DevOps

Adding UML Tags
For the example in this section I added some tags describing the server's attributes (see Figure 2).

If you look at the XMI listing (shown below) you'll find it the same as it was before with the addition of the UML:TaggedValue elements. The tag attribute and value matches the UML tags one for one. Each element also has its own unique ID.

<UML:TaggedValue tag="Disk Space" xmi.id="EAID_2E7D09AA_FE20_4b37_8028_D7FD427469A8" value="80 G" modelElement="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0"/> <UML:TaggedValue tag="machine" xmi.id="EAID_00AE1C27_012C_4326_AAF6_E282FAA47A99" value="Compaq Proliant DL380" modelElement="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0"/> <UML:TaggedValue tag="memory" xmi.id="EAID_B16D65AF_FE10_4ea7_A3B9_C6901047A9B9" value="1 GB" modelElement="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0"/> <UML:TaggedValue tag="processor" xmi.id="EAID_B37A03D3_EC2A_4c60_9821_A3B3F84C6101" value="Intel Xeon 3.6 Ghz/800 Mhz - 2 MB L2" modelElement="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0"/>

Figure 2. Tags for the Leasing Server. In this case the Leasing Server is a Compaq server with an Intel Xeon processor, 1GB of internal memory and 80GB of disk storage.
The key attribute to notice is the modelElement attribute, which is the unique ID of the node that the attribute is applied to. Even if there are two nodes with the same tags each node will have its own XMI elements. Any modeling tool that supports the same version of XMI model should be able to import these attributes.

Adding Inheritance
In larger server environments or when modeling disaster recovery it's useful to deal with a typical model and then declare instances of that server. In a typical configuration, the Leasing server in this example may represent one or more other servers, each having the same UML tags. In this case (see Figure 3), Fleet Management is an instance of a server that is a Leasing type of server, where each instance is a Compaq Proliant DL380 server with 1GB of memory, 80GB of hard disk space, and with a Xeon 3.6 GHz processor.

Figure 3. An Instance of the Leasing Server. Fleet Management is one of the Leasing servers with each server being the same machine type, memory size, have the same processor and disk space.

One use for inheritance in modeling is for virtual servers such as VMWare. VMWare is a tool where each software VM instance is treated as if it were a separate client or server. In testing it is common to run different tests on the same machine configurations. VMWare will have multiple virtual machines with the same configuration for each test instance.

The original VMWare machine might be called Master Tester and could be modeled the same as the Leasing Node. Each instance using Master Tester as its base would be modeled the same as the Fleet Management node but with a unique name.

<UML:Node name="Fleet Management" xmi.id="EAID_23DA8020_AF46_409b_91EF_45774B761ED7" visibility="public" namespace="EAPK_0DE50B6C_9EF5_492d_8D81_45B0B8A68599" isRoot="false" isLeaf="false" isAbstract="false"> </UML:Node> <UML:Node name="Leasing" xmi.id="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0" visibility="public" namespace="EAPK_0DE50B6C_9EF5_492d_8D81_45B0B8A68599" isRoot="false" isLeaf="false" isAbstract="false">

In the XMI file above the two UML nodes are represented by the same type of element. In other words there is no difference between the node instance and the node! Enterprise Architect provides the answer. When the XMI is generated in Enterprise Architect, non-standard tags can also be generated to help identify a node instance. Here are the Enterprise Architect-specific elements:

<UML:ModelElement.taggedValue> <UML:TaggedValue tag="classifier" value="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0"/> <UML:TaggedValue tag="classname" value="Leasing"/> </UML:ModelElement.taggedValue>

In the code above, the tag TaggedValue is added under the Fleet Management node. The tag attribute and its value is the ID for the Leasing node from which it inherits the UML tags. Another UML:TaggedValue adds the original node's name. By using these tags I can navigate between a node instance and its associated node by attaching the same UML tags to each node instance. In the case that a node instance does not have a node to refer to, Enterprise Architect will create a default node in the diagram. MagicDraw has different XMI tags for node and node instances and a tag classifier that refers to the ID of the node for a node instance.

Adding Links Between Nodes
In deployment diagrams the servers all have connections between them. In UML we refer to these connections as links. The link is the physical connection between two pieces of hardware. Each link usually contains the protocol used to pass information between the two machines (see Figure 4).

Figure 4. The Link between Selling and Leasing. Notice that the link has a stereotype <<TCP/IP>> which refers to the protocol used to send information from one server to the other.

A Link is modeled as an association with two endpoints and represents the physical link between the two servers. In this example the only name the association has is xmi.id. Associations can be named but for the most part they aren't. Notice in the code below that the type for each AssociationEnd is the GUID for one of the servers.

<UML:Association xmi.id="EAID_1D1E160E_EAC2_4019_8DA4_396896ECC56A" visibility="public" isRoot="false" isLeaf="false" isAbstract="false"> <UML:ModelElement.stereotype> <UML:Stereotype name="TCP/IP"/> </UML:ModelElement.stereotype> <UML:ModelElement.taggedValue/> <UML:Association.connection> <UML:AssociationEnd visibility="public" aggregation="none" isOrdered="false" isNavigable="true" type="EAID_7ABC85CD_256B_4983_ABB6_640D6D9AC56C"> <UML:ModelElement.taggedValue/> </UML:AssociationEnd> <UML:AssociationEnd visibility="public" aggregation="none" isOrdered="false" isNavigable="true" type="EAID_9F5BF905_DA21_43b3_9369_1AE6E02690F0"> <UML:ModelElement.taggedValue/> </UML:AssociationEnd> </UML:Association.connection> </UML:Association>

The stereotype <<TCP/IP>> is represented the same as for any UML element and is encapsulated in the XMI association.

So there you have it—the 15-minute explanation to XMI. The unfortunate part of learning XMI is that there is so little information about it that one must poke around the XMI files a bit, adding different UML elements and associations, in order to learn. Even the standard doesn't help, but if you're interested, all the versions of the standard are available at the OMG Web site. But don't worry. I will delve further into XMI in subsequent articles on DevX. Stay tuned.

Mark Goetsch is an Enterprise Software Architect with Wheels, Inc, and has more than fifteen years of experience in software development, enterprise modeling, and software architecture. He has another seven years experience as a trader, dealer, Broker, and an expert in e-trading. He was one of the enterprise modelers of the Tapestry Project at ABNAMRO, one of the most extensive uses of UML component and deployment diagrams to date. He is the lead architect for the MAP (Meta-Architectural Processes) framework, which is a framework for mapping the role of the software architect into software development processes. Mark is certified in Intermediate UML with the OMG and a member of WWISA. He also has a Masters in Distributed Systems from DePaul University.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date