concept for future magnolia (possibly 3.5) (MAGNOLIA-587)

[MAGNOLIA-635] Using rhino (javascript) for configuration, scripting, shell Created: 13/Feb/06  Updated: 03/Dec/13  Resolved: 03/Dec/13

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Sub-task Priority: Major
Reporter: Philipp Bärfuss Assignee: Unassigned
Resolution: Outdated Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
is duplicated by MGNLGROOVY-3 Provide a Groovy-aware ClassFactory i... Closed
Template:
Date of First Response:

 Description   

Since some days I'm thinking about using rhino (javascript) to make magnolia customizable.

Now I like to get some feedback form the audience before I think farther.

Primar thoughts:

  • our main developers are weboriented and know javascript
  • If something is configured in a scripting language it is very felxible
  • It reduces the abstract step to a configuration file like xml
  • You can adapt functions (like the activation) without downloading the sources

Configuration
-------------
The startup script is written in javascript and if you need to instantiate an other cache-handler for example you just do
it by changing this startup file.

Let's call this IoC by scripting

Changing Execution
------------------
Methods like activation could be extracted to a script like activate.js which one could adapt without subclassing.

Shell


We could include Rhinos shell this would it make easy to analyze data:

  • dump data
  • change data
  • queries


 Comments   
Comment by Andreas Brenk [ 13/Feb/06 ]

Using the Bean Scripting Framework (http://jakarta.apache.org/bsf/) would allow pluggable script engines. I've just used it for a small proof of concept some time ago, but perhaps you could take a quick look if it convices you. It shouldn't be too hard to integrate and would allow developers to use e.g. Groovy instead of Javascript.

"Bean Scripting Framework (BSF) is a set of Java classes which provides scripting language support within Java applications, and access to Java objects and methods from scripting languages. (...) In addition, BSF permits any Java application to be implemented in part (or dynamically extended) by a language that is embedded within it. This is achieved by providing an API that permits calling scripting language engines from within Java, as well as an object registry that exposes Java objects to these scripting language engines."

Comment by Magnolia International [ 20/Jan/10 ]

This kinda duplicate the current efforts on the Groovy Module. The current Groovy Module (still in dev) relies directly on the Groovy APIs instead of something like javax.script, which allows us to expose Groovy script/classes as java.lang.Class. AFAIK, javax.script does not expose such functionality. It might be interesting to see if other scripting languages on the jvm offer this, but I don't know of any.

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