public class TaskResolver extends Object
<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.| Modifier and Type | Field and Description |
|---|---|
protected Properties |
catalog |
protected static String |
CATALOG |
protected String |
scriptDir |
| Constructor and Description |
|---|
TaskResolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDescriptor(String taskName,
String descriptor)
Adds a task descriptor property and flushes catalog to disk.
|
boolean |
installScript(String taskName,
String fileName)
Installs a task script.
|
protected void |
loadCatalog()
Loads catalog of descriptors for tasks if not already loaded
|
ResolvedTask |
resolveTask(String taskName)
Returns a task implementation for a given task name,
or
null if no implementation could be obtained. |
protected static final String CATALOG
protected final String scriptDir
protected Properties catalog
public boolean installScript(String taskName, String fileName)
addDescriptor.taskName - logical name of task to associate with scriptfileName - name of file containing task scriptpublic void addDescriptor(String taskName, String descriptor)
taskName - logical task namedescriptor - descriptor for taskpublic ResolvedTask resolveTask(String taskName)
null if no implementation could be obtained.taskName - logical task nameprotected void loadCatalog()
Copyright © 2017 DuraSpace. All rights reserved.