Inhalt
Topic:.readme_Java2XMI.
pStyle=std tableStyle=stdTable
What is Java2XMI
The ZBNF-Script in zbnfjax/zbnf/Java2C.zbnf (internet: Java2C.zbnf) was created and is used in the Java2C-Project. There Java-Sourcecode is parsed using ZBNF and converted with Algorithm written in Java to C-Language-programs.
The same script is used to parse Java-code to generate XMI-Code. The XSL-Scripts to generate the XMI are located in zbnfjax/xsl/Java2xmiTypes.xsl and .../Java2xmi.xslp. Using this scripts it is able to convert normal Java-Sourcecodes to an XMI-Model for UML.
Look at this graphic:
This UML-class diagramm shows the class associations within the ZBNF-parser. This class diagramm is created using the XMI-File of this example, imported in the Rhapsody-UML-Tool. The XMI images the repository of the UML-model, the creation of this class diagramm uses the model informations of the XMI-file. No additional informations are stored there, only the informations produced with the Java2XMI-converter. The graphic positions are tuned manually. But it needs only about one hour to get this diagramm. The time to spend is used to position the classes, correct layout of the dependency-lines, choose the attributes and methods to show in the class body (only the most important) and so on. It is a work of documentation. The base data to do this work is the repository got from the XMI-import.
The graphic may detect unoptimal associations etc, which may correct in the source code. It is a recursion of documentation and source writing. This class-diagramm may be optimal, because the software is optimal.
The example contains:
Zbnf2XMI_zmake.bat: Windows-batch file, which contains a call of the Zmake-processing. To use this example, you should adapt the content of the file .../zbnfjax/setZBNFJAX_HOME.bat to set, where the environment (SAXON, JAVA) is located. The script generates the XMI-Model inside a tmp-directory.
tmp.reference.zip: A zip file which contains the content of the tmp-directory which will be created calling the batchfile.
ZBNF_XMI.rpy and ZBNF_XMI_rpy: Rhapsody project with its directory which contains a Rhapsody project to input the XMI-File. This project is depleted itself.
The XMI-File should be inputted in Rhapsody calling its XMI-input-tool. It should need an extra licence of Rhapsody. Rhapsody
is a commercial tool, see its internet page. You can download a evaluation licence to test it. But you can use another tool
too. The XMI-File generates XMI-version 1.3, which is supported from Rhapsody currently. It isn't the newest version, because
the development of the Java2XMI-scripts are done in the past (2007/2008). Newer versions may be supported in future.
ZBNF.rpy and ZBNF_rpy: Another Rhapsody project and directory which contains a Rhapsody project to work with the model. It contains the shown graphic.
The necessity of 2 models are need because the following context:
Rhapsody uses GUID-strings to designate its UML-Model-elements. The advantage is: Changing of names of model elements don't change its coherence.
The XMI-Model is created new anytime if it is called. Rhapsody should thought, there are new model elements. It doesn't recognize
the replacement of existing elements. Therefore new GUID-idents are created. That is done in the ZBNF_XMI.rpy-Model.
After creation the new model elements from import XMI, there are saved, and the other ZMAKE.rpy-Project should be opened. There an add-to-model-operation should be done. This operation accepts, that adequate (same name in package) model elements are replaced by the
new imported content. Thereby the existing GUID-numbers are used, respectively the imported elements replaces the exiting
elements which same names at the same package positions. With this tricky operation the consitence of the imported XMI-content
with other existing classes or diagrams is realized. There is also a possibility to support renaming in the Java-sources:
You should done the renaming or package change of classes in this Rhapsody-projekt too, after them import it.
Work for future:
Give feedback if newer XMI-version are supported, the XSL-scripts should be corrected.
Give feedback if other UML-tools are tested with the XMI.