Book a Demo

Author Topic: Import XMI model with Code  (Read 3973 times)

dballard

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Import XMI model with Code
« on: October 22, 2007, 01:02:22 pm »
Hi All,

It's possible that this may have been covered before.  I am new to EA and the forum.

I have written a tool to convert Visual Foxpro class libraries, forms, and VFP/xBase PRG files into XMI model files and want to import method code.

I am using the following snippet in my tool to write out the method code to the model file:

<UML:Method.body>
 <UML:ProcedureExpression>
   <UML:Expression.language>VFP</UML:Expression.language>
   <UML:Expression.body>Some Code Here</UML:Expression.body>
 </UML:ProcedureExpression>
</UML:Method.body>

The question is where can I find this code with EA after importing?  Do I need to configure my project to read additional aspects of the XMI model that I imported?

Any help will be much appreciated!!

Thank you.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Import XMI model with Code
« Reply #1 on: October 23, 2007, 02:03:01 am »
First, well done with the VFP import!

Several times I've meant to do just that, but each time I chickened out before getting going.

Meanwhile, you should find the code in the Initial Code box. This is on the lower part of the Behavior tab of the operations dialog.

In order to figure out if you are missing any XMI structure, try this experiment. Just create a class with an operation; use any built-in language that you're comfortable with. Export the class - or rather its package, you know the drill - to XMI. Now just examine the structure to make sure you've got all the necessary tags set up.

You might want to go through a few extra steps to make sure you handle data types gracefully, particularly if you reverse engineer a procedure, since VFP is not strongly typed (yes, I know it is when handling COM interop etc., but the general case still needs to be considered). Just make sure that you cause EA to explicitly define all the data types the way you want, rather than having EA use its current default handling. Somewhere down the line you'll be happy you took the time to do this.

HTH, David
No, you can't have it!

dballard

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Import XMI model with Code
« Reply #2 on: October 23, 2007, 04:50:18 am »
Thanks for the info.  I do define the VFP data types using data types more closely related to VB.  This will make it easier in the future to be able to use the model in .NET or other languages.

Thanks.

dballard

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Import XMI model with Code
« Reply #3 on: October 23, 2007, 07:02:25 am »
Let me add a few things I have noticed in hopes you can shed some light.

EA doesn't seem to display UML:Method from the XMI, yet it will display UML:Operation.  However, if I code an UML:Operation, the source code I try to import is not visible as the initial code.

When I import the same XMI file with UML:Method into ArgoUML, it shows the Methods properly and also shows the code imported as Body, which is proper.

My hierarchy to get to the method basically is UML:Class, then UML:Classifier.feature, then UML:Method.

Does EA require that methods be coded as operations in order to show in the project?  Am I missing something here?

Thanks,
Dave Ballard

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Import XMI model with Code
« Reply #4 on: October 23, 2007, 09:12:14 am »
Dave,

The short answer is that I really don't know. However, I should know, since I built an XMI converter for EA back in the olden days (when EA 4.1 was the 'new' version).

Try my suggestion - take a look at the actual constructs in the XMI files you are using. Also, take a look at the specific DTD or Schema files, since EA may be using them when it imports 'foreign' XMI files.

And I repeat my earlier suggestion: use EA to whip up a simple model of the results you think you want, then examine the results of an XMI export. Try duplicating the format you see there and see if it round trips successfully. If so, hand-edit the content a bit, examine the results, and adjust your VFP importer accordingly.

David
No, you can't have it!

dballard

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Import XMI model with Code
« Reply #5 on: October 23, 2007, 09:22:44 am »
I did a small package and class and exported to XMI.  I then found that EA does really use operation for method.  EA also uses tags to get the code instead of Method.Body.

I have mod'd my tool to do the import for EA specific method and code.  I will add some more interface stuff to the tool so I can switch from standard UML to EA specific when needed.

Thanks for the help.

Dave Ballard