Skip to content

Pervasive Scriptability

One of the strengths of Apiro is the extent to which things can be scripted.

This comes about in several ways:


Inline Extension Point Scriptability

All the extension points of Apiro are defined by a Java interface. The stock supplied extension points such as validators are implemented in java and ships in the core Apiro jar file. However, all extension points

an example of a Java java based inbuilt validator's configuration is:

Note a processor normally specifys a json schema validated input data structure

Every expension point can also be coded via an inline script, which looks like the above.


Script aware configuration

In addition to inline extension point scriptability outlined above, the configuration system is also script aware. Heres an example of a sxcript embedded directly into an extension point's configuration:

So in constructing the input configuration for an extension point, inline scripts can be embedded directly into a processor's configuration json, and these will be evaluated and substitued into the json object tree. This post processed final structure is what is validated for conformity to the processor's input object schema.

The format of these scriptable snippets looks like: GRV{ xxx }

and we call this a general script. the raw script 'xxx' is encased by the shown envelope. GRV indicates the engine to use to evaluate the script. GRV stands for GROOVY and is currently the only supported script language, though the door is open to supply more.


Script Surface Extensions

Finally, its important to point out that the API visible within the general script, while containing predefined Apiro objects, can also be extended by clients. This is akin to, say, adding potentially complex custom macro into a, Excel spreadsheet template.

To take an example - suppose a certian company does a lot of conditional processing every friday. It would therefore be very handy to add the facility to test whether it is indeed friday directly to the script interface. We call this a GeneralScript Surface Extension. In configuring a script surface extension, a new function may be added into the general script api called ITS_FRIDAY(), which would enable a general script to take the form

GRV{ if (ITS_FRIDAY) { ... } }

In this way - more knowledgeable developers in the company could maintain a library of potentially complex script surface extensions, which would made availabile for perhaps less technical business analysts or other subject matter experts to maintain the schema pipeline configurations on their own after some familiarity.

Again a good analogy goes back to Excel - most spreadsheet users are not capable of writing macros, but they are more than capable of embedding pre-supplied functions and macros into individual cell expressions.

Apiro Schema DataPoint configuration elements can be viewed in a very similar way.