Author Topic: Using the Archi data model outside of Eclipse  (Read 3169 times)

GeraldScott

  • Newbie
  • *
  • Posts: 3
Using the Archi data model outside of Eclipse
« on: October 30, 2014, 04:22:10 AM »
I have been experimenting with Archi in the context of sharing models in a community of Enterprise Architects. We would like to generate and render the models using SVG so we are looking for an elegant way of loading the serialized models from the '*.archimate' XML files into a servlet.

We hit a problem trying to use EMF outside of Eclipse. We were getting a PackageNotFoundException which we solved by following the advice in the EMF FAQ to initialize the package by accessing the eINSTANCE field, but the result is a complex model with a lot of processing overheads.

We then tried JAXB to generate the Java classes using xjc from the XSD that we exported from genmodel , but even though we suppressed the EMF related items, we were still getting "Failed to read schema document 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.xsd'" errors.

We have hacked a solution, using the MyImporter example as inspiration, and it works well, but we were hoping to find a more straightforward solution.

Has anyone else tried to do something similar? How did you do it? We are new to EMF and the Eclipse RCP so any advice would be very welcome.

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1514
  • Archi Guy
    • Archi
Re: Using the Archi data model outside of Eclipse
« Reply #1 on: October 30, 2014, 08:23:18 AM »
Hi Gerald,

your aim is have the models in SVG format, right? Did you try the "Export View As Image" option with SVG?

Phil
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

GeraldScott

  • Newbie
  • *
  • Posts: 3
Re: Using the Archi data model outside of Eclipse
« Reply #2 on: October 30, 2014, 17:36:58 PM »
Yes, that is the ultimate aim, and the export facility works beautifully, but we would like to manipulate the model on the server side to add other details to the model before generating the SVG.

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1514
  • Archi Guy
    • Archi
Re: Using the Archi data model outside of Eclipse
« Reply #3 on: October 30, 2014, 18:35:50 PM »
In order to render to SVG, this process happens:

1. Load the model into an EMF instance
2. Load the EMF instance into GEF Edit Parts which will instantiate Draw2D figures
3. Render to a GraphicalViewer
4. Take the top root Figure from the GraphicalViewer and re-render it to a GraphicsToGraphics2DAdaptor
5. Pass this through an Apache Batik SVGGraphics2D instance whicho converts to SVG format

It is possible to do this in a "headless" from within Eclipse, and this is how the JUnit tests do it, but I don't know how to get it all set up outside of Eclipse.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

GeraldScott

  • Newbie
  • *
  • Posts: 3
Re: Using the Archi data model outside of Eclipse
« Reply #4 on: October 31, 2014, 13:22:35 PM »
Thanks very much for the response. That has pointed in the right direction.