public class Curator extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Curator.Invoked |
protected class |
Curator.TaskRunner |
static class |
Curator.TxScope |
| Modifier and Type | Field and Description |
|---|---|
protected CommunityService |
communityService |
static int |
CURATE_ERROR
task encountered an error in processing
|
static int |
CURATE_FAIL
task failed
|
static int |
CURATE_NOTASK
Curator unable to find requested task
|
static int |
CURATE_SKIP
task was not applicable to passed object
|
static int |
CURATE_SUCCESS
task completed successfully
|
static int |
CURATE_UNSET
no assigned status code - typically because task not yet performed
|
protected static ThreadLocal<Context> |
curationCtx |
protected HandleService |
handleService |
protected Curator.Invoked |
iMode |
protected ItemService |
itemService |
protected List<String> |
perfList |
protected Appendable |
reporter |
protected TaskResolver |
resolver |
protected Map<String,String> |
runParameters |
protected TaskQueue |
taskQ |
protected Map<String,Curator.TaskRunner> |
trMap |
protected Curator.TxScope |
txScope |
| Constructor and Description |
|---|
Curator()
No-arg constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(String name,
String value)
Set a parameter visible to all tasks in this Curator instance.
|
void |
addParameters(Map<String,String> parameters)
Set many parameters visible to all tasks in this Curator instance.
|
Curator |
addTask(String taskName)
Add a task to the set to be performed.
|
void |
clear()
Removes all configured tasks from the Curator.
|
void |
curate(Context c,
DSpaceObject dso)
Performs all configured tasks upon DSpace object
(Community, Collection or Item).
|
void |
curate(Context c,
String id)
Performs all configured tasks upon object identified by id.
|
void |
curate(DSpaceObject dso)
Performs all configured tasks upon DSpace object
(Community, Collection or Item).
|
static Context |
curationContext()
Returns the context object used in the current curation thread.
|
protected boolean |
doCollection(Curator.TaskRunner tr,
Collection coll)
Run task for Collection along with all Items in that collection.
|
protected boolean |
doCommunity(Curator.TaskRunner tr,
Community comm)
Run task for Community along with all sub-communities and collections.
|
protected boolean |
doSite(Curator.TaskRunner tr,
Site site)
Run task for entire Site (including all Communities, Collections and Items)
|
String |
getResult(String taskName)
Returns the result string for the latest performance of the named task.
|
String |
getRunParameter(String name)
Look up a run parameter.
|
int |
getStatus(String taskName)
Returns the status code for the latest performance of the named task.
|
boolean |
hasTask(String taskName)
Returns whether this curator has the specified task
|
static boolean |
isContainer(DSpaceObject dso)
Returns whether a given DSO is a 'container' - collection or community
|
void |
queue(Context c,
String id,
String queueId)
Places a curation request for the object identified by id on a
managed queue named by the queueId.
|
Curator |
removeTask(String taskName)
Removes a task from the set to be performed.
|
void |
report(String message)
Adds a message to the configured reporting stream.
|
Curator |
setInvoked(Curator.Invoked mode)
Assigns invocation mode.
|
Curator |
setReporter(Appendable reporter)
Sets the reporting stream for this curator.
|
void |
setResult(String taskName,
String result)
Assigns a result to the performance of the named task.
|
Curator |
setTransactionScope(Curator.TxScope scope)
Defines the transactional scope of curator executions.
|
protected void |
visit(DSpaceObject dso)
Record a 'visit' to a DSpace object and enforce any policies set
on this curator.
|
public static final int CURATE_NOTASK
public static final int CURATE_UNSET
public static final int CURATE_ERROR
public static final int CURATE_SUCCESS
public static final int CURATE_FAIL
public static final int CURATE_SKIP
protected static final ThreadLocal<Context> curationCtx
protected Map<String,Curator.TaskRunner> trMap
protected TaskQueue taskQ
protected Appendable reporter
protected Curator.Invoked iMode
protected TaskResolver resolver
protected Curator.TxScope txScope
protected CommunityService communityService
protected ItemService itemService
protected HandleService handleService
public void addParameter(String name, String value)
name - the parameter's name.value - the parameter's value.public void addParameters(Map<String,String> parameters)
parameters - parameter name/value pairs.public String getRunParameter(String name)
name - the name of the desired parameter.public Curator addTask(String taskName)
taskName - - logical name of taskpublic boolean hasTask(String taskName)
taskName - - logical name of the taskpublic Curator removeTask(String taskName)
taskName - - logical name of the taskpublic Curator setInvoked(Curator.Invoked mode)
mode - one of INTERACTIVE, BATCH, ANYpublic Curator setReporter(Appendable reporter)
reporter - name of reporting stream. The name '-'
causes reporting to standard out.public Curator setTransactionScope(Curator.TxScope scope)
scope - transactional scopepublic void curate(Context c, String id) throws IOException
Note: this method has the side-effect of setting this instance's Context reference. The setting is retained on return.
c - a DSpace contextid - an object identifierIOException - if IO errorpublic void curate(DSpaceObject dso) throws IOException
Note: Site-wide tasks will default to running as
an Anonymous User unless you call the Site-wide task
via the curate(Context,String) or
curate(Context, DSpaceObject) method with an
authenticated Context object.
dso - the DSpace objectIOException - if IO errorpublic void curate(Context c, DSpaceObject dso) throws IOException
Note: this method has the side-effect of setting this instance's Context reference. The setting is retained on return.
c - session context in which curation takes place.dso - the single object to be curated.IOException - passed through.public void queue(Context c, String id, String queueId) throws IOException
c - A DSpace contextid - an object IdqueueId - name of a queue. If queue does not exist, it will
be created automatically.IOException - if IO errorpublic void clear()
public void report(String message)
message - the message to output to the reporting stream.public int getStatus(String taskName)
taskName - the task namepublic String getResult(String taskName)
taskName - the task namenull if task has not set it.public void setResult(String taskName, String result)
taskName - the task nameresult - a string indicating results of performing task.public static Context curationContext() throws SQLException
If the context is null or not set, then this just returns a brand new Context object representing an Anonymous User.
SQLException - An exception that provides information on a database access error or other errors.public static boolean isContainer(DSpaceObject dso)
dso - a DSpace objectprotected boolean doSite(Curator.TaskRunner tr, Site site) throws IOException
tr - TaskRunnersite - DSpace Site objectIOException - if IO errorprotected boolean doCommunity(Curator.TaskRunner tr, Community comm) throws IOException
tr - TaskRunnercomm - CommunityIOException - if IO errorprotected boolean doCollection(Curator.TaskRunner tr, Collection coll) throws IOException
tr - TaskRunnercoll - CollectionIOException - if IO errorprotected void visit(DSpaceObject dso) throws IOException
dso - the DSpace objectIOException - A general class of exceptions produced by failed or interrupted I/O operations.Copyright © 2019 DuraSpace. All rights reserved.