Quite often it is desireable to adjust (or automatically generate) some values in a content instance, send emails or perform functionality that the original developer of a software component didn't have in mind when he wrote it. Changing the component is one way - but this neither endorses reusability of the component nor the modification of the required actions.
[fleXive] is built with the intention to allow various kinds of scripting. Scripts can be either executed
manually (on demand) or when a certain event occurs. The scope of events are defined in
FxScriptScope
for
types, assignments, binary processing,
user accounts
or
tree
actions.
The scripting language of choice is Groovy, but if JavaSE 6 or higher is used any language supported by the Java Scripting API can be used.
Scripts that are not executed manually or on demand are supplied with context dependent variables in so
called
bindings
. A script that is called before a content instance is saved will for example
require a reference to the content instance in its bindings.
Please see the
API documentation of
FxScriptEvent
for further information.
[fleXive] allows the definition of scripts which are executed once during the initial setup of a division
(database) called
run-once
scripts, or for every time the application server is started called
startup
scripts.
These scripts are located in the
resources/scripts/runonce
and
resources/scripts/startup
directories for applications extending [fleXive] and in
src/framework/resources/fxresources/scripts/runonce
and
src/framework/resources/fxresources/scripts/startup
for the framework itself.