Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Culpers on October 15, 2008, 12:50:19 am

Title: Automate export of XMI
Post by: Culpers on October 15, 2008, 12:50:19 am
Is there a way of using the automation interface to export one or more packages as XMI similar to the function found in the EA application?
If so, can this be run from the command line rather than via an add-in?

Any help gratefully received.
Title: Re: Automate export of XMI
Post by: «Midnight» on October 15, 2008, 01:38:08 pm
Yes, using the Project.ExportPackageXMI method.

No, not as yet.
Title: Re: Automate export of XMI
Post by: Frank Horn on October 15, 2008, 07:32:07 pm
Quote
No, not as yet.

Why not? You can make a command line application with anything that understands COM, create a new EA.Repository, open a project with its OpenFile method and then iterate through the packages and export e.g. the ones with names matching command line parameters.
Title: Re: Automate export of XMI
Post by: Oliver F. on October 15, 2008, 08:52:22 pm
Quote
Quote
No, not as yet.

Why not? You can make a command line application with anything that understands COM, create a new EA.Repository, open a project with its OpenFile method and then iterate through the packages and export e.g. the ones with names matching command line parameters.

Just did something similar and added it via the Tools menu to EA.
The JAVA program gets its input package guid as a parameter via main(arg0) and then processes it.
It works the same way from the command line. The only challenge is to get the input package GUID to be pasted as command line parameter which is a bit cumbersome. Called from EA it can be automatically set from the item selected. Make sure to check in your program whether the input GUID is really a package to avoid surprises.

It is very straightforward. The JAVA API is nothing but a wrapper for the COM API so it works the same way with C++, C# and any other wrapper available.

Oliver
Title: Re: Automate export of XMI
Post by: «Midnight» on October 15, 2008, 10:40:05 pm
Sorry about that all - and even more so to Culpers.

Frank and Oliver are completely correct of course. [Not to suggest that we would expect otherwise.   ;) ]

What I meant was that EA would not (yet) do this by itself. You can certainly do this via an external automation application.

The above said, I wonder if we could - either in future or with the currently-available technology - set up an add-in to capture the OpenFile event (or any other kind of application startup) and 'cut in' at that point. The idea would be to do this from 'within' EA rather than starting some other application. This might be turned on and off by registering or removing the add-in (somehow, perhaps via the current means) in the default configuration. Perhaps an additional option could be added, or set via an add-in menu, to trigger the intervention on startup.

David
Title: Re: Automate export of XMI
Post by: Frank Horn on October 16, 2008, 04:27:32 am
Quote
I wonder if we could - either in future or with the currently-available technology - set up an add-in to capture the OpenFile event (or any other kind of application startup) and 'cut in' at that point.

Using the EA_FileOpen broadcast event this should be no problem.

But having a command line application to export packages from a given EA project can be nice when you create code from xmi and want a batch for the build process. Alternatively you may want do run the complete build process from an EA AddIn.

As yet we are exporting manually and running the xsl transformations for code generation in a sort of half automated application, but as more and more definitions move from code to model we will have to decide whether we want a batch or an AddIn (or both).
Title: Re: Automate export of XMI
Post by: Oliver F. on October 16, 2008, 07:40:48 pm
Quote
Sorry about that all - and even more so to Culpers.

Frank and Oliver are completely correct of course. [Not to suggest that we would expect otherwise.   ;) ]

I have waited for long on that occasion- proving that David is wrong and slap him on the back for this  ;D
It took quite a while and dozens of excellent posts have past until I finally found one- strike :D

Oliver

P.S.: Just kidding ;)
Title: Re: Automate export of XMI
Post by: «Midnight» on October 17, 2008, 12:35:51 am
Touché!

The important thing here is that you've found something to fill the empty hours.   ;D
Title: Re: Automate export of XMI
Post by: Oliver F. on October 17, 2008, 12:49:04 am
Quote
Touché!

The important thing here is that you've found something to fill the empty hours.   ;D

Propably those hours of time shift between Canada and Europe- you guys wake up too late :)

Oliver
Title: Re: Automate export of XMI
Post by: «Midnight» on October 17, 2008, 12:53:46 am
Ahem!

Mister Excitement (that would be yours truly) does not sleep, he rests.

Mister Excitement does not not doze or daydream, he contemplates.

Mister Excitement is not late, he is delayed elsewhere.

A little respect here, please...   :-X
Title: Re: Automate export of XMI
Post by: Oliver F. on October 17, 2008, 07:04:48 pm
Quote

A little respect here, please...   :-X

============

No, you can' t have it

That quote and the sig make a good combination :)

Besides that I get the feeling of having been misunderstood, but maybe this is caused by the language barrier. Take my apologies uin that case.

Oliver
Title: Re: Automate export of XMI
Post by: «Midnight» on October 18, 2008, 02:03:04 am
No apology necessary. I took your original comment as intended. My reply was also meant in jest.

PS: And don't they (make a nice combination). I'd somehow managed not to notice that when I posted.   :-[