JArchi scripting startup - execute on starting Archi

Started by Manj75, October 24, 2019, 08:35:49 AM

Previous topic - Next topic


October 24, 2019, 08:35:49 AM Last Edit: October 24, 2019, 14:43:00 PM by Manj75

I just wanted to make a suggestion with regards to the JArchi scripting plugin, which I've been recently using and can see huge potential for extending the functionality of Archi.  I was wondering if anyone would find it useful for specified scripts to be run on startup of Archi tool.  I can think of a number of use cases where this would be beneficial, for example:

  • Open a specific view diagram of the default model on startup; e.g. a dashboard view could be created that displays the statistics or some reporting on the model and could consist of view transitions to other views, serving as the model homepage.

If this were to be made available then it would also be useful to support running scripts in the background in a separate thread if configured to do so.

A simplistic approach

As part of the JArchi scripting preferences supports a Start-up folder that the user can specify - or have a predefined 'startup' folder that gets created in the Script folder.

Copy into the 'startup' folder any *.ajs files to be run on startup of Archi.

As part of the Archi startup process it inspects the 'startup' folder for any files and proceeds to run each one found.  Encountered errors for any script will be handled as defined in that script, but will not prevent the running of subsequent scripts.

The running order could also be addressed through a run order list shown in the Preferences -> Scripting tab, that displays all the *.ajs files found in the startup folder, but can be moved up or down to change the run order.

What are your thought is this a useful feature and is it doable.

Kind Regards,

Phil Beauvoir

Well, it's an interesting idea. I see two issues:

1. How much user interest in such a feature? Does it have much value? Are there other ways to achieve the goal(s) (i.e. could the use case simply be a new feature)? What other use cases are there?
2. Implementation. Not as trivial as one might think due to concurrency and loading issues. It would probably require additional core generic support (Eclipse based "extension point") to run actions after Archi has started and loaded all models and finished its startup processes.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate


I'll expand on this, triggers for scripts.
One of the applications we've been working on is an Archi 'server', basically a web server with Archi installed, this has scheduled tasks to run on regular intervals that do the following.

  • Launch Archi CLI
  • Download latest Current State model from Repo
  • Execute following jArchi scripts
  • Update elements from external sources (e.g. CMDB)
  • Run HeatMap
  • Expire elements (different version of HeatMap
  • Run HTML report
  • Find "Last updated at:" within model.html and replace with "Last updated at: [current timestamp]"

Now, all this has jerry-rigged via scripts and external schedulers.  It would be a cleaner an simpler solution if Archi could just be running in the background with and run scripts with time based (or other) triggers. 

Phil Beauvoir

> It would be a cleaner an simpler solution if Archi could just be running in the background

That's not possible unless it's running as a UI app.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate


October 24, 2019, 14:37:10 PM #4 Last Edit: October 24, 2019, 14:40:20 PM by Manj75
Hi Alberto & Phil,

Your post and listed tasks is of interest as it is what I am looking to achieve, but I want it to be low maintenance, i.e. completed managed through JArchi scripting that can be invoked on startup of Archi in UI or CLI mode, the latter I had not yet asked, but presumed was possible.

How did you get automated CMDB integration?  Are you using ServiceNow and Herve's plugin - if so I understand that that plugin cannot be run using Archi CLI as yet.  I have got a pending feature request that Herve is looking into.

My high level goals are:

  • Automated scheduled import of ServiceNow Configuration Items using the plugin
  • Automatically heat map generation to show concepts usage by number of relationships and/or risk assessments
  • Keeping wiki/HTML report - ideally Markdown export to be build nightly/weekly
  • Integration with workflow tools such as Azure DevOps (VSTS) using REST API to sync with work items and process appropriate logic

I think what I have suggest would make for a great feature and starting point for running scripts like a preprocessor in an interactive mode, i.e. UI, for a structured Architecture Department.  For example I've create a 'New Project Requests' script when run will display a dialog to enter project details such as title and code - on clicking OK it produces a template project folder structure in the selected model.  It would be good to have this in the startup folder so it shows every time Archi is run.