[MGNLGROOVY-147] Provide general Command that can execute Groovy scripts Created: 22/Jun/16  Updated: 24/Mar/22

Status: Open
Project: Magnolia Groovy Module
Component/s: integration
Affects Version/s: 2.4.4
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christian Ringele Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

From a support ticket a needed functionality, which I think is not that exotic many others could benefit:
Executing a groovy script on scheduled regular bases.

The way to implement it with the tools given would be:

  • Have a scheduled Job executing a command
  • The command to execute is capable of running any groovy script in the goovy script workspace

What is missing:
A command, that can be configured able to execute any groovy script registered in the groovy script worksapce.



 Comments   
Comment by Richard Gange [ 28/Jul/16 ]

AFAIK you can register a command that uses a groovy class. That groovy class just needs to extend MgnlCommand.

What is missing:
A command, that can be configured able to execute any groovy script registered in the groovy script worksapce.

So this really isn't missing. The script itself is a magnolia command which extends MgnlCommand. Just like our example in the scripts workspace here /my/commands/GroovyMailCommand.

For these reasons I will close this as "not an issue"

Comment by Christian Ringele [ 03/Jan/17 ]

I don't get it:
The issue is that a comend is needed where you can point to a groovy script to be executed.
So you can for example use the scheduled to schedule this command, that then executes a groovy script.

AFAIK you can register a command that uses a groovy class. That groovy class just needs to extend MgnlCommand.

A groovy class is not a groovy script. Or is here the part I don't get...?

The goal:

  • one can write a groovy script
  • configure a command pointing to it
  • and use the command for example in the scheduler
    -> all done pure by configuration
    -> No IDE or Java coding needed

Think about light development...
One could write a groovy script, and have it ran periodically. All OTB.

groovy class just needs to extend MgnlCommand.

Is far of that.

Comment by Richard Gange [ 03/Jan/17 ]

Sure. This is fine.

The thing is we give a very nice example. See https://demo.magnolia-cms.com/.magnolia/admincentral#app:groovy:detail;/my/commands/GroovyMailCommand:edit. This does not require an IDE.

I mean, if you can write a script, is it that much harder to follow our example? I understand technically this would be "Java".

Let me ask this, is it possible to write this command in groovy? Then we could just provide it at our scripts page here https://wiki.magnolia-cms.com/display/WIKI/Groovy+Shell+Scripts.

Generated at Mon Feb 12 05:56:03 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.