Home > EMF, UML > Converting Enterprise Architect Model to EMF UML2 model

Converting Enterprise Architect Model to EMF UML2 model

February 11, 2010 Leave a comment Go to comments

Recently, I had a task of a converting a UML model in Enterprise Architect to a EMF UML2 model. Googling with the keywords took me straightaway to Ueli Brawand and his tool EA_UML2Exporter. It is a wonderful little tool that works with openArchitectureWare and gets the task done in no time. However, setting it up does consume some time. I thought of summarizing the steps I did, incase it helps others.

1. Downloading Enterprise Architect

  • If you don’t have Enterprise Architect, download a 30-day trial from here: http://www.sparxsystems.com/products/ea/trial.html.
    Please note that Enterprise Architect runs only on Microsoft Windows. If you are using other environments, please use a virtual Windows environment to install Enterprise Architect.

2. Downloading openArchitectureWare

3. Downloading EA_UML2Exporter

4. Setting up a new openArchitectureWare Project

  • Start the downloaded Eclipse distribution with oAW and create a new openArchitectureWare Project.
  • The EA_UML2Exporter libraries needs to be added to the project. Select Project Properties from context menu and add the EA_UML2Exporter JARs using Java Build Path -> Libraries ->  Add External JARs….
    Adding external Jars
  • The EA Java API library now needs to be added to the project in the same way. Browse to the Java API folder within Enterprise Architect Installation folder and add eaapi.jar to the project in the same way as above.
  • SSJavaCOM.dll within the Enterprise Architect Java API folder needs to be in the system path. Easiest would be to add this to the root of the newly created project.
  • Open MANIFEST.MF and add the following plugin dependencies:

org.eclipse.uml2

org.eclipse.uml2.uml

org.eclipse.uml2.uml.ecore.exporter

org.eclipse.uml2.uml.ecore.importer

org.eclipse.uml2.uml.resources

org.openarchitectureware.uml2.adapter

Plug-in Dependencies

  • Copy the to be converted Enterprise Architect EAP file to the src folder.
  • Create an empty file called model.uml within the src folder.
    This would be your converted UML2 model after the workflow is run.
  • Within this src folder create a workflow file (workflow.oaw) with the following content:

<?xml version=”1.0″ encoding=”UTF-8″?>

<workflow>

<property file=“workflow.properties”/>

<bean class=“oaw.uml2.Setup” standardUML2Setup=“true” />

<!– Metamodel-Definition –>

<bean id=“EmfMM” class=“oaw.type.emf.EmfMetaModel”>

<metaModelPackage value=“org.eclipse.emf.ecore.EcorePackage”/>

</bean>

<bean id=“UmlMM” class=“oaw.uml2.UML2MetaModel”/>

<component class=“oaw.uml2.toolsupport.ea.EA_Xmi2Exporter” >

<EapFile value=“${project_root}${ea_file}” />

<ModelFile value=“${model_file}” />

<PackageName value=“${model_pkg}” />

<Cleanup value=“true”/>

</component>

</workflow>

  • Within this src folder create a workflow properties file (workflow.properties) with the following content:

project_root =

# EA filename

ea_file =

#Output UML2 filename

model_file =

#Package within EA Model

model_pkg =

  • Fill in the missing values in the properties file.
    project_root: You could leave this empty
    ea_file: EAP file to be converted
    model_file: UML2 model to be created
    model_pkg: Package within EAP file to be converted (this could be the root package, if you want the whole file to be converted) 

    The properties file might look, for example, as below:

project_root =

# EA filename

ea_file = src/2006-10-04 RiF-Meta-Modell_v1.1_PUBLIC.EAP

#Output UML2 filename

model_file = src/model.uml

#Package within EA Model

model_pkg = RIF/ExchangeFile

  • If the project is setup correctly, it would look like this:
    oAW Project

5. Running the openArchitectureWare workflow

  • Run the workflow by selecting the workflow file (workflow.oaw) and choosing Run As -> oAW Worlflow from context menu.
  • Enterprise Architect would now be started in the background.
  • If the conversion is successful you would get a console output similiar to below:

0    INFO  WorkflowRunner     – ————————————————————————————–

0    INFO  WorkflowRunner     – openArchitectureWare 4.3.1, Build 20090107-2000PRD

0    INFO  WorkflowRunner     – (c) 2005-2008 openarchitectureware.org and contributors

0    INFO  WorkflowRunner     – ————————————————————————————–

0    INFO  WorkflowRunner     – running workflow: workflow.oaw

0    INFO  WorkflowRunner     –

1281 INFO  CompositeComponent – EA_Xmi2Exporter

1281 INFO  EA_Xmi2ExportBase  – UML2Exporter for EA (1.7.0-SNAPSHOT)

1281 INFO  EA_Xmi2ExportBase  –   EAP-File   : src\2006-10-04 RiF-Meta-Modell_v1.1_PUBLIC.EAP

1281 INFO  EA_Xmi2ExportBase  –   Package    : RIF/ExchangeFile

1281 INFO  EA_Xmi2ExportBase  –   OutputFile : src\model.uml

70266 INFO  EA_Xmi2ExportBase  – Start XML2.0-output …

86891 INFO  EA_Xmi2ExportBase  – XML2.0-Export done.

86891 INFO  WorkflowRunner     – workflow completed in 85610ms!

  • model.uml file would now be the converted UML2 file.
Advertisements
  1. Andreas Graf
    February 11, 2010 at 1:51 pm

    Great summary! Thanks, Nirmal!

  2. October 10, 2010 at 1:47 pm

    Very nice tutorial…

    But I keep getting Invalid byte 1 of 1-byte UTF-8 sequence …. Workflow interrupted because of configuration errors. Is there any way to see which value is coursing the problem?

    henrik :-)

    • October 10, 2010 at 8:20 pm

      Thanks for your comment Henry.
      I saw that the latest version of EA_UML2Exporter is 2.0. I haven’t checked it out yet. I am not sure if it is backward compatible with openArchitectureWare 4.3.1. Could you please try with EA_UML2Exporter 1.7.2 and openArchitectureWare 4.3.1?

  3. October 11, 2010 at 3:45 pm

    Hi Nirmal

    Thanks for the response!

    I change to ea_toolsupport-1.7.2-RC1.jar and ea_com_interface-1.7.2-RC1.jar so my build path is now: http://img219.imageshack.us/img219/4485/configt.jpg

    I also changed the output xmi from EA so it looks like this now:

    but I sill get the same error? any suggestions?

    henrik :-)

  4. October 11, 2010 at 3:49 pm

    sorry it skipped my xmi… but it now output in utf-8 if I export my model directly from EA!

    henrik :-)

    • October 11, 2010 at 3:55 pm

      Does it mean it works for you now? Sorry your last comment wasn’t clear to me.
      Otherwise it does look like an encoding problem to me. Does your XMI have encoding as <?xml version=”1.0″ encoding=”UTF-8″>

    • October 11, 2010 at 4:07 pm

      Could be also due to the fact that you have some characters in the document which is not UTF-8 (due to some documentation that you have entered through EA). Also try changing the encoding of XMI as <?xml version=”1.0″ encoding=”ISO-8859-1″>

  5. October 11, 2010 at 9:46 pm

    Thank you for helping out and sorry I wasn’t precise enough! But in the first response I had a xmi snippet which was removed when I submitted my response.. there for my second response…

    But I still have the same problem! If I generate xmi directly from EA via the eap included in the project I get this: http://pastebin.com/aAmtBD1x or http://pastebin.com/VpWKkFKG depending on which encoding I set in EA, but still I get the same error: http://pastebin.com/BwAJwt08

    henrik :-)

  6. October 11, 2010 at 10:49 pm

    Sorry I think I got it now.. for some odd reason my workflow.oaw file was setup to something else than UTF-8… after fixing this the generater seems to run as it should.. but now it cannot find my pakage in my eap? I tried different values for model_pkg in the property file but I can get it to work?

    8500 INFO WorkflowRunner – workflow completed in 6875ms!
    8500 ERROR WorkflowRunner – Package [travelPakage/travelPakage] not found in model!
    8500 ERROR WorkflowRunner – Error in visit(EA_Repository):java.lang.NullPointerException

    my EAP looks like this : http://img840.imageshack.us/img840/8803/14011920.jpg

    can you please explain what is the right value for model_pkg based on this model

    henrik :-)

    • October 11, 2010 at 11:51 pm

      Try Model/travelPakage or Model/travelPakage/travelPakage
      I hope you noticed that you have a “c” missing in travelPakage

  7. October 11, 2010 at 11:59 pm

    Many thanks Model/travelPakage did it… Thank you very much for all your help

    henrik :-)

    • October 12, 2010 at 12:01 am

      You are welcome.
      Great that it worked for your finally :)

  8. January 14, 2011 at 4:51 pm

    Thank you so much for this post!! This is exactly what I was looking for. I did need to change the workflow.oaw a bit because the jar names from oAW has changed. Below is my workflow.oaw:

    • January 14, 2011 at 4:52 pm

      The xml content was stripped by wordpress by but my changes are:

      bean id=”EmfMM” class=”org.openarchitectureware.type.emf.EmfMetaModel”
      component class=”net.cmp4oaw.uml2export.oaw.EA_Xmi2Exporter

  9. Alejandro Cisneros
    June 9, 2011 at 11:11 pm

    Excellent entry Nirmal, your tutorial was very helpful. I found some issues that managed to fix. I would add the following tips:

    1. When defining the contents of workflow.oaw do not cut and paste the pice of code in the blog entry. I did so and got several successive error messages. At the end, I had to type the XML code to avoid such errors. This was due to codification issues, I guess.

    2. Right-click on workflow.oaw and select Properties. In the section entitled “Text file encoding” make sure that the selected code is UTF-8.

    3. I had to delete the .eap file from the project and import it again everytime I made a change to such .eap file. Right-clicking and refreshing on the .eap file didn’t seem to work.

    Thank you very much again. Kindest regards.

  10. André Olivera
    September 10, 2011 at 10:32 pm

    Hi Nirmal! Excelent post..

    Finally a easy way to use ea uml2 exporter tool.

    Following your steps I could make it works. But I couldn’t export the stereotypes from my EA project. Searching in the project page, I knew that they fix a lot of bugs in the new releases (2.0 and 2.1).

    Do you know how to use these releases instead the 1.7 release?

    Thank you very much!

    • André Olivera
      September 13, 2011 at 6:39 pm

      Hi Nirmal,

      I could export my stereotypes, the problem was not in the releases.

      This forum help me to do the task:
      http://www.openarchitectureware.org/forum/print.php?id=12732

      I even didn’t know that I have first create the profile, export only the profile and after configure the workflow to export the model with the profile already exported.

      By the way, I have some difficulties to correct the paths of the jars and some classes, but with the time I got some familiarity with eclipse and OAW and could solve this issues.

      Regards,

      André.

  11. Rodrigo Rossi
    September 15, 2011 at 4:36 pm

    I need a converter to *. eap file *. uml anyone know one??

  12. February 24, 2014 at 1:26 am

    I wonder if all of this can still be made to export from the latest EA to the latest EMF. The http://uml2ea.blogspot.com.au blog seems to have been hijacked by spam and the oWA 4 distribution is not longer available on the redirect link. Yet the need to pull content from EA into EMF is still there!

  13. Christian Seip
    July 10, 2015 at 4:53 pm
  1. September 6, 2010 at 9:01 am
  2. June 27, 2012 at 1:35 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: