Scripts written in the Boo or Python languages can be invoked within Curiosity. Scripts can be used in order to further manipulate acquired data before archiving or "providing" it, or in order to write new Providers.
You have two options for defining a set of scripts.
A more "verbose" format:
<scripts>
<script>
<file>script1.boo</file>
<paramList>
<param>
<name>p1</name>
<value>v1</value>
</param>
<param>
...
</param>
</paramList>
</script>
<script>
...
</script>
</scripts>
And a more concise format, where parameters are expressed in a url-like way (you can use the utils\urlEncode.boo script in order to find out the url-encoding of a parameter name or value):
<scripts> script1.boo?p1 =v1&p2=v2 script2.boo</scripts>
When a script is invoked, a number of global variables are set from within Curiosity. Three variables are always set:
Manipulating acquired data
As a first option, scripts can be invoked in order to manipulate acquired data before the data is checked against the history (ScriptActions.POST_BROKERING).
<webSource name="sourceName"
urlSource="http://...">
<scripts>aScript.boo?p1=v1&p2=v2</scripts>
...
</webSource>
In this case two global variables are set:
As a second option, you can manipulate acquired data but on a "per-Provider" basis - that is, the modifications will be applied after the data has been checked against the Source history, and before it is passed to a specific Provider (ScriptActions.PRE_PROVIDING).
<provider>
<class>com.curiosity.providers.AProvider</class>
<scripts>aScript.boo?p1=v1&p2=v2</scripts>
...
</provider>
Please, note that if you are defining a Provider Template you must employ the concise format in order to define its scripts.
In this case, besides the data and source variables previously described, another variable is set:
Implement a Provider
You can also use scripts in order to implement a new Provider (ScriptActions.PROVIDE).
<provider>
<class>com.curiosity.providers.
InfoProviderScript</class>
<scripts>aScript.boo?p1=v1&p2=v2</scripts>
...
</provider>
In this case the scripts attached to the provider definition won't be used in order to manipulate the acquired data as previously explained, but are meant to execute themselves some providing action.
Please, note that in this case you can defined just one script within the scripts tag (remaining scripts will be ignored).
In this case, besised the data and source variables, the following ones are set:
Moreover, it is expected that the script will set the stream global variable of type System.IO.Stream - as also explained in the Implement Providers section.
If the provider is invoked in order to recover from a RecoveryPoint (ScriptActions.RECOVER), besides the previously defined recoveryPoints variable, the following one is set: