public class TaskResolver
extends java.lang.Object
Note that the requisite jars and other resources for these languages must be installed in the DSpace instance for them to be used here. Further work may involve remote URL-loadable code, etc.
Scripted tasks are managed in a directory configured with the
dspace/config/modules/curate.cfg property "script.dir".
A catalog of
scripted tasks named "task.catalog" is kept in this directory.
Each task has a 'descriptor' property with value syntax:
<engine>|<relFilePath>|<implClassCtor>
An example property:
linkchecker = ruby|rubytask.rb|LinkChecker.new
This descriptor means that a 'ruby' script engine will be created,
a script file named 'rubytask.rb' in the directory <script.dir>
will be
loaded and the resolver will expect an evaluation of 'LinkChecker.new'
will provide a correct implementation object.
Script files may embed their descriptors to facilitate deployment.
To accomplish this, a script must include the descriptor string with
syntax $td=<descriptor> somewhere on a comment line. For example:
# My descriptor $td=ruby|rubytask.rb|LinkChecker.new
For portability, the <relFilePath> component may be omitted in
this context.
Thus, $td=ruby||LinkChecker.new will be expanded to a descriptor
with the name of the embedding file.
| Constructor and Description |
|---|
TaskResolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDescriptor(java.lang.String taskName,
java.lang.String descriptor)
Adds a task descriptor property and flushes catalog to disk.
|
boolean |
installScript(java.lang.String taskName,
java.lang.String fileName)
Installs a task script.
|
ResolvedTask |
resolveTask(java.lang.String taskName)
Returns a task implementation for a given task name,
or
null if no implementation could be obtained. |
public boolean installScript(java.lang.String taskName,
java.lang.String fileName)
addDescriptor.taskName - logical name of task to associate with scriptfileName - name of file containing task scriptpublic void addDescriptor(java.lang.String taskName,
java.lang.String descriptor)
taskName - logical task namedescriptor - descriptor for taskpublic ResolvedTask resolveTask(java.lang.String taskName)
null if no implementation could be obtained.taskName - logical task nameCopyright © 2018 DuraSpace. All Rights Reserved.