Author Topic: Writing a tool that uses some of Archi's components  (Read 409 times)

mweber

  • Newbie
  • *
  • Posts: 2
Writing a tool that uses some of Archi's components
« on: July 02, 2019, 10:42:13 AM »
Hello,

I'm trying to integrate Archi within a workflow that combines requirements management and architecture. What I intend to do is that when requirements are added to the requirements management tool, those new requirements are programatically added to the Archi model (and then I'll let the humans link those requirements to the relevant archimate elements). In the future, I also would like to programatically export all diagrams as SVG.

I naively thought I could write a simple Java program that uses the jar files in Archi/plugins, but it's not that simple. At the moment I'm trying to write an OSGI bundle that runs in Equinox, but it seems that my plugin cannot access the classes of e.g., the com.archimatetool.editor package (which is declared as an osgi bundle as well). Or would it be possible to achieve what I want with an additional command line plugin?

When you guys started to write Archi as an Eclipse plugin, what kind of documentation/tutorial/example code did you have, to know where to start?


Jean-Baptiste Sarrodie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 647
  • Archi Evangelist and Contributor. Visionary.
    • About me...
Re: Writing a tool that uses some of Archi's components
« Reply #1 on: July 02, 2019, 10:53:18 AM »
Hi,

The best and simple way to do it is to run Archi headless using Command Line Interface, open your target model and run a jArchi script that will add your Requirements and save the model.

Regards,

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

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1500
  • Archi Guy
    • Archi
Re: Writing a tool that uses some of Archi's components
« Reply #2 on: July 02, 2019, 10:59:10 AM »
If you want to automate your workflow in a headless environment (no UI) then you need to use the ACLI (https://github.com/archimatetool/archi/wiki/Archi-Command-Line-Interface) plug-in and a jArchi script. If you create a jArchi script that updates a model given certain parameters, it can be set to run from the ACLI, with an external trigger.

> I also would like to programatically export all diagrams as SVG.

That's currently a UI-only feature and so not implemented in either the ACLI or jArchi. PNG format is supported in jArchi, and in ACLI's export to report plug-in. You'd have to create your own ACLI plug-in for that.

> I naively thought I could write a simple Java program that uses the jar files in Archi/plugins, but it's not that simple.

I wish it were simple. Eclipse development is...challenging. ;-)

> When you guys started to write Archi as an Eclipse plugin, what kind of documentation/tutorial/example code did you have, to know where to start?

The usual trial and error approach associated with Eclipse development - Google, articles, GitHub..  ;)
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1500
  • Archi Guy
    • Archi
Re: Writing a tool that uses some of Archi's components
« Reply #3 on: July 02, 2019, 11:08:17 AM »
Thinking further and putting myself in your shoes I would, to get started:

1. Not write code for a new ACLI plug-in.
2. Assume that the existing ACLI can be used to automate your requirements.
3. Write a POC jArchi script to update a given model.
4. Automate the jArchi script with the ACLI.

As with all things free there are time costs. ;-)
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

mweber

  • Newbie
  • *
  • Posts: 2
Re: Writing a tool that uses some of Archi's components
« Reply #4 on: July 02, 2019, 11:32:29 AM »
Thank you for your replies.

Despite what Phil wrote, I'd rather write a new ACLI plugin, rather than being constrained by the capabilities of jArchi (which, by your own admission, does not allow to save diagrams in SVG).

I'll see if I can manage to write a plugin that adds command line providers.

Phil Beauvoir

  • Archi Guy
  • Hero Member
  • *****
  • Posts: 1500
  • Archi Guy
    • Archi
Re: Writing a tool that uses some of Archi's components
« Reply #5 on: July 02, 2019, 11:40:57 AM »
> ...jArchi (which, by your own admission, does not allow to save diagrams in SVG).

SVG export is also not implemented via the ACLI, as the API is currently UI only. You'd have to adapt that code in your own plug-in.

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