- Introduction
XMI to Metastorage is a tool written by Peter Howard for converting UML class diagrams defined with the XMI format into component definitions in Metastorage CMPL format.
XMI is a standard format defined by the Object Management Group (OMG) for interchanging metadata about software projects. XMI is commonly used by UML modeling tools to save UML diagram definitions.
- Designing UML class diagrams for conversion
You can use any UML modeling tool that supports exporting project files in the XMI format. If you are using Linux with KDE, you can use for instance the Umbrello UML modeling tool. There are plenty of other free and commercial UML tools for Windows, Linux and other platforms. Most of them save projects in the XMI format.
XMI to Metastorage can convert all the classes in UML class diagrams of projects saved to files in the XMI format.
Often not all classes in a UML class diagram are meant for storing persistent objects. So, it may not be desired to convert all classes defined in a XMI file.
XMI to Metastorage only converts classes that belong to a package named Persistent. This gives some control to the class diagram designer to let him determine which classes are converted by the XMI to Metastorage tool.
Make sure you have created a package named Persistent in your UML project, and that all classes you want to be converted are inside that package. Otherwise, the converted component may appear empty.
- Converting XMI files
XMI to Metastorage can be used to convert XMI files either from the command line or from the Web interface.
- Command line
This tool can be called from the command line by changing the current directory to metal/metastorage/applications/xmi2ms/components/xmi2ms and then executing the script xmi2ms.php.
Use the PHP command line version program like below. The /path/to/my part is the absolute path of the directory of the project.xmi file, the XMI file that you want to convert.
php -q xmi2ms.php /path/to/my/project.xmi
If all goes well, the script creates a Metastorage component file in the CMPL format with the path /path/to/my/project.xml. You may want to rename it to /path/to/my/project.component to make it be found easily by Webstorage, the Metastorage Web interface application.
Web interface
XMI files may also be converted with this tool Web interface.
This is an experimental application that provides access to files available in the Web server computer disk. Therefore, this application is not really meant to run in a public Web server. It is rather a tool meant to be executed in a private Web server running in the developer machine, or in a development server accessible in the local network.
Since it needs to create Metastorage component files as output, PHP should not run in safe mode. The operating system user under which it runs the Web server must have sufficient permissions to access to the Metastorage installation directories.
To start this application, just make the directory metal/metastorage/applications/xmi2ms/web/ accessible inside your local Web server document tree. Then point your browser to the index.php of that directory. If PHP is correctly installed in your Web server, you will see the XMI to Metastorage application welcome page.
The welcome page leads the user to the conversion page. This page exhibits a window with some conversion setup parameters, like the path of the XMI file to be converted. This file can be set using the Change link. The user may also change the converted path directory where converted files will be created.
The user may specify the XMI file in the XMI browsing page. This page shows a directory browser that lets the user navigate on the file system and look for the XMI file that he wants to be compiled.
The files with the name extension .xmi appear with a Choose this link in the front of their listing line entries. Using this link leads the user back to the conversion setup page.
Once the XMI file to convert is set, the conversion setup window displays the button Convert. That button starts the conversion process. This makes a new window appear displaying the converted Metastorage file contents.
A link is also displayed to lead the user to a page of the Webstorage application, in case he wants to immediately try to compile the converted file with Metastorage.
|