[as2api-dev] as2api > UML out
David Holroyd
dave at badgers-in-foil.co.uk
Wed Jun 13 20:48:21 UTC 2007
On Wed, Jun 13, 2007 at 09:48:16PM +0200, ali Benabdelaziz wrote:
> I looked at the code of as2api though I don't know anything about ruby.
> Well the code looks clear, but there is no doc inside.
> My idea was just to add an output plugin to export to XMI
> meaning reverse engineer my own code to make graphs and extend it.
Cool! If you're willing to get up to speed with Ruby, and understand
how to compose XMI, it should be possible to reuse the guts of as2api
for this task.
Grab the source from subversion[1] and look at lib/ui/cli.rb
The key stuff is in the 'main' method near the end of the file. You'll
see that having done all the code parsing work, one of three functions
is called and passed the 'type_agregator' reference. Each of these
can generates a different output from the parsed API (one of these is
the normal HTML API doc).
The 'api_export' function (which just invokes the 'generate_api_dump'
function defined in lib/output/diff/api_dump.rb) already generates XML
output from the API so that as2api can later compare XML dumps of two
different releases of an API, and generate a report on what changed
(this is a feature that I never properly finished, inspired by the jdiff
tool). So, here are two options:
1) Use the code from lib/output/diff (api_serializer.rb in particular)
as an example to create your own code for XMI generation, and hook
it in to the existing CLI stuff.
2) Evaluate the existing XML output to see if it would be easier to
transform this into XMI using a language you are already familiar
with. The (undocumented) XML export bits can be enabled by adding
the --api-export option to the as2api command line.
Hope that helps. If you have any questions, please ask!
dave
[1] http://svn.badgers-in-foil.co.uk/as2api/trunk/as2api
--
http://david.holroyd.me.uk/
More information about the as2api-dev
mailing list