Toke was asking for trouble yesterday. I would assume that he knew me better by now… With my last commit it is now actually possible to inline Javascript inside your configuration when using a ScriptFilter.
The following now actually works:
<xproperties>
<entry>
<key>filter.name</key>
<value class="string">InlineJavascriptTest</value>
</entry>
<entry>
<key>summa.filter.sequence.filterclass</key>
<value class="string">dk.statsbiblioteket.summa.common.filter.object.ScriptFilter</value>
</entry>
<entry>
<key>filter.script.inline</key>
<value class="string"><![CDATA[
payload.getRecord().setId('inlineJavascript');
]]></value>
</entry>
</xproperties>
I can not begin to enumerate all the dangers in doing this, but somehow the thrill of the possibilities got the better of me. If Javascript isn’t your thing you can specify the script language to anything supported by your Java runtime by defining the property filter.script.lang.
So – use this at your own peril!
UPDATE: You can find a list of available ScriptEngines for Java at scripting.dev.java.net.
Tags: javascript, scripting, Summa