org.dspace.curate
Class Curator

java.lang.Object
  extended by org.dspace.curate.Curator

public class Curator
extends Object

Curator orchestrates and manages the application of a one or more curation tasks to a DSpace object. It provides common services and runtime environment to the tasks.

Author:
richardrodgers

Nested Class Summary
static class Curator.Invoked
           
 
Field Summary
static int CURATE_ERROR
          task encountered a 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
 
Constructor Summary
Curator()
          No-arg constructor
 
Method Summary
 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, String id)
          Performs all configured tasks upon object identified by id.
 void curate(DSpaceObject dso)
          Performs all configured tasks upon DSpace object.
 String getResult(String taskName)
          Returns the result string for the latest performance of the named task.
 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(String reporter)
          Sets the reporting stream for this curator.
 void setResult(String taskName, String result)
          Assigns a result to the performance of the named task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURATE_NOTASK

public static final int CURATE_NOTASK
Curator unable to find requested task

See Also:
Constant Field Values

CURATE_UNSET

public static final int CURATE_UNSET
no assigned status code - typically because task not yet performed

See Also:
Constant Field Values

CURATE_ERROR

public static final int CURATE_ERROR
task encountered a error in processing

See Also:
Constant Field Values

CURATE_SUCCESS

public static final int CURATE_SUCCESS
task completed successfully

See Also:
Constant Field Values

CURATE_FAIL

public static final int CURATE_FAIL
task failed

See Also:
Constant Field Values

CURATE_SKIP

public static final int CURATE_SKIP
task was not applicable to passed object

See Also:
Constant Field Values
Constructor Detail

Curator

public Curator()
No-arg constructor

Method Detail

addTask

public Curator addTask(String taskName)
Add a task to the set to be performed. Caller should make no assumptions on execution ordering.

Parameters:
taskName - - logical name of task
Returns:
this curator - to support concatenating invocation style

hasTask

public boolean hasTask(String taskName)
Returns whether this curator has the specified task

Parameters:
taskName - - logical name of the task
Returns:
true if task has been configured, else false

removeTask

public Curator removeTask(String taskName)
Removes a task from the set to be performed.

Parameters:
taskName - - logical name of the task
Returns:
this curator - to support concatenating invocation style

setInvoked

public Curator setInvoked(Curator.Invoked mode)
Assigns invocation mode.

Parameters:
mode - one of INTERACTIVE, BATCH, ANY
Returns:

setReporter

public Curator setReporter(String reporter)
Sets the reporting stream for this curator.

Parameters:
reporter - name of reporting stream. The name '-' causes reporting to standard out.
Returns:
the Curator instance

curate

public void curate(Context c,
                   String id)
            throws IOException
Performs all configured tasks upon object identified by id. If the object can be resolved as a handle, the DSO will be the target object.

Parameters:
c - a Dpace context
id - an object identifier
Throws:
IOException

curate

public void curate(DSpaceObject dso)
            throws IOException
Performs all configured tasks upon DSpace object.

Parameters:
dso - the DSpace object
Throws:
IOException

queue

public void queue(Context c,
                  String id,
                  String queueId)
           throws IOException
Places a curation request for the object identified by id on a managed queue named by the queueId.

Parameters:
c - A DSpace context
id - an object Id
queueId - name of a queue. If queue does not exist, it will be created automatically.
Throws:
IOException

clear

public void clear()
Removes all configured tasks from the Curator.


report

public void report(String message)
Adds a message to the configured reporting stream.

Parameters:
message - the message to output to the reporting stream.

getStatus

public int getStatus(String taskName)
Returns the status code for the latest performance of the named task.

Parameters:
taskName - the task name
Returns:
the status code - one of CURATE_ values

getResult

public String getResult(String taskName)
Returns the result string for the latest performance of the named task.

Parameters:
taskName - the task name
Returns:
the result string, or null if task has not set it.

setResult

public void setResult(String taskName,
                      String result)
Assigns a result to the performance of the named task.

Parameters:
taskName - the task name
result - a string indicating results of performing task.

isContainer

public static boolean isContainer(DSpaceObject dso)
Returns whether a given DSO is a 'container' - collection or community

Parameters:
dso - a DSpace object
Returns:
true if a container, false otherwise


Copyright © 2011 DuraSpace. All Rights Reserved.