|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.curate.AbstractCurationTask
public abstract class AbstractCurationTask
AbstractCurationTask encapsulates a few common patterns of task use, resources, and convenience methods.
| Field Summary | |
|---|---|
protected Curator |
curator
|
protected String |
taskId
|
| Constructor Summary | |
|---|---|
AbstractCurationTask()
|
|
| Method Summary | |
|---|---|
protected DSpaceObject |
dereference(Context ctx,
String id)
Returns a DSpaceObject for passed identifier, if it exists |
protected void |
distribute(DSpaceObject dso)
Distributes a task through a DSpace container - a convenience method for tasks declaring the @Distributive property. |
void |
init(Curator curator,
String taskId)
Initialize task - parameters inform the task of it's invoking curator. |
int |
perform(Context ctx,
String id)
Perform the curation task for passed id |
abstract int |
perform(DSpaceObject dso)
Perform the curation task upon passed DSO |
protected void |
performItem(Item item)
Performs task upon a single DSpace Item. |
protected void |
performObject(DSpaceObject dso)
Performs task upon a single DSpaceObject. |
protected void |
report(String message)
Sends message to the reporting stream |
protected void |
setResult(String result)
Assigns the result of the task performance |
protected boolean |
taskBooleanProperty(String name,
boolean defaultValue)
Returns task configuration boolean property value for passed name, else passed default value if no properties defined or no value for passed key. |
protected int |
taskIntProperty(String name,
int defaultValue)
Returns task configuration integer property value for passed name, else passed default value if no properties defined or no value for passed key. |
protected long |
taskLongProperty(String name,
long defaultValue)
Returns task configuration long property value for passed name, else passed default value if no properties defined or no value for passed key. |
protected String |
taskProperty(String name)
Returns task configuration property value for passed name, else null if no properties defined or no value for passed key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Curator curator
protected String taskId
| Constructor Detail |
|---|
public AbstractCurationTask()
| Method Detail |
|---|
public void init(Curator curator,
String taskId)
throws IOException
CurationTask
init in interface CurationTaskcurator - the Curator controlling this tasktaskId - identifier task should use in invoking services
IOException
public abstract int perform(DSpaceObject dso)
throws IOException
CurationTask
perform in interface CurationTaskdso - the DSpace object
IOException
protected void distribute(DSpaceObject dso)
throws IOException
@Distributive property.
This method invokes the 'performObject()' method on the current DSO, and then recursively invokes the 'performObject()' method on all DSOs contained within the current DSO. For example: if a Community is passed in, then 'performObject()' will be called on that Community object, as well as on all SubCommunities/Collections/Items contained in that Community.
Individual tasks MUST override either the performObject method or
the performItem method to ensure the task is run on either all
DSOs or just all Items, respectively.
dso - current DSpaceObject
IOException
protected void performObject(DSpaceObject dso)
throws SQLException,
IOException
distribute method to run a single task across multiple DSpaceObjects.
By default, this method just wraps a call to performItem
for each Item Object.
You should override this method if you want to use
distribute to run your task across multiple DSpace Objects.
Either this method or performItem should be overridden if
distribute method is used.
dso - the DSpaceObject
SQLException
IOException
protected void performItem(Item item)
throws SQLException,
IOException
distribute method to run a single task across multiple Items.
You should override this method if you want to use
distribute to run your task across multiple DSpace Items.
Either this method or performObject should be overridden if
distribute method is used.
item - the DSpace Item
SQLException
IOException
public int perform(Context ctx,
String id)
throws IOException
CurationTask
perform in interface CurationTaskctx - DSpace context objectid - persistent ID for DSpace object
IOException
protected DSpaceObject dereference(Context ctx,
String id)
throws IOException
ctx - DSpace contextid - canonical id of object
IOExceptionprotected void report(String message)
message - the message to streamprotected void setResult(String result)
result - the result stringprotected String taskProperty(String name)
null if no properties defined or no value for passed key.
name - the property name
protected int taskIntProperty(String name,
int defaultValue)
name - the property namedefaultValue - value
the default value
protected long taskLongProperty(String name,
long defaultValue)
name - the property namedefaultValue - value
the default value
protected boolean taskBooleanProperty(String name,
boolean defaultValue)
name - the property namedefaultValue - value
the default value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||