Archi Forum

Archi Plug-ins => jArchi => Topic started by: Manj75 on October 24, 2019, 09:35:49 AM

Title: JArchi scripting startup - execute on starting Archi
Post by: Manj75 on October 24, 2019, 09:35:49 AM
Hi,

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:


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,
Manjit

Title: Re: JArchi scripting startup - execute on starting Archi
Post by: Phil Beauvoir on October 24, 2019, 11:03:46 AM
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.
Title: Re: JArchi scripting startup - execute on starting Archi
Post by: Alberto on October 24, 2019, 13:55:35 PM
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.

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. 
Title: Re: JArchi scripting startup - execute on starting Archi
Post by: Phil Beauvoir on October 24, 2019, 13:57:55 PM
> 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.
Title: Re: JArchi scripting startup - execute on starting Archi
Post by: Manj75 on October 24, 2019, 15:37:10 PM
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:


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.