Projects: XmiTransform, convert XMI to source code

The concept

XMI Transform is a tool written in PHP (5) to convert XMI file to source code or source code to XMI file.The purpose is to provides a simple access to source code generation, which is, in general, the first thing we need in a MDA approach.

To do so, XMI Transform is based on XSL transformation and a “rule descriptor” in XML that simply helps to make a link between severals xsl stylesheets (one that enerate package name, one that build classes source code, etc.)

However, transforming is a two step work and xsl stylesheet are the first step.The next step is to make use of what the stylesheer provides (eg, make directories or write files).
This step is not as easy as transformation because it needs to be developed using PHP code. Such a thing is called an “engine”. For simple XMI to source transformations, the “Generic” engine will do the job fine. Nevertheless, if you need to handle merge over existing source code, or any other job others than making dir or writing file, you will need to write your own engine.
But don’t be affraid, the main philosophy of XMI Transform is to keep things simple or users and developers. The code is fully object oriented and well documented.

Today status

XMI Transform is very young, but source code generation works fine. It is easily possible to make your own code generator.

Transforming Source code to XMI is not working for now. But as it needs to parsesource code, specific read engines will be required for each language.

Changes in latest release

  • better php_zend model
    • cleaned up the model code and splitted classContent.xsl in 3 files. It’s a little better now.
    • added support for implicit dependency from extended class or implemented interface
    • added support for BOUML ‘entity’ stereotype to php_zend_model. They generate automatically zend_db_table_abstract
    • derived classes with composition support (generate $_dependentTable and $_referenceMap, still need testing…)
    • added support for BOUML ‘control’ stereotype to php_zend_model. They generate automatically zend_controller_action
    • derived classes with naming convention respect (XxxController)
    • added support for BOUML ‘action’ method’s stereotype to php_zend_model (handle “Action” suffix for controllers’ methods)
    • added support for BOUML ‘exception’ stereotype to php_zend_model. They generate automatically Exception derived classes
    • added support for BOUML ‘form’ and ‘dojoform’ stereotype to php_zend_model.
    • added support for multi-line comments and descriptions in classes and methods header (xmi must contains 
 entity, not CR)
    • corrected ZendLoader to Zend_Loader
  • Xslt compiler errors are now trapped and converted to exception. So xtwr is now able to output a usable error message.
  • various comments corrections
  • some corrections in the ReadMe file.


Next things to be done (non exhaustive):

  • enhance php_zend model: add unit tests generation, support methods’ params comments
  • Make a simple java a C++ generator to give other examples
  • write a first reader engine to be able to convert PHP source to XMI
  • write a merge capable php writer engine
  • add log support and little more verbose code
  • add a check for needed php extensions

The project is hosted at sourceforge

Leave a Reply

Your email address will not be published. Required fields are marked *