Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Runnable FileSystem Resource is just like a file system resource, with the addition that, when configured as input to a reloadable service, it will call code that the you supply prior to checking whether the service needs to be refreshed.  This gives you the ability to be involved prior to a service being updated.

...

The injected class "runnable" (which has to implement java.lang.Runnable) is expected to update the file if required.  It could 

  • Connect to a database to refresh the file

  • Reach across the network (using a protocol other than HTTP) to refresh the resource

  • By a script - the ScriptedRunnable is described below.

ScriptedRunnable

This class, when injected into a RunnableFileSystemResource, allows a script to be run as part of a ReloadableService refresh.   There are only two properties which can be set: "script" an EvaluableScript to be run and "customObject".

Example
Code Block
languagexmltitleExample
<bean id="Script" class="net.shibboleth.utilities.java.support.scripting.EvaluableScript" c:_0="
    var i = 22;
    var j = 7;
    var pi = i/j;"/>
    
<bean id="Runnable" class="net.shibboleth.utilities.java.support.scripting.ScriptedRunnable" p:script-ref="Script" init-method="initialize"/>
    
<bean id="Resource" class="net.shibboleth.ext.spring.resource.RunnableFileSystemResource" c:path="file" c:runnable-ref="Runnable"/>