Package org.dspace.checker
Class ResultsPruner
java.lang.Object
org.dspace.checker.ResultsPruner
Manages the deletion of results from the checksum history. It uses the
dspace.cfg file as the default configuration file for the deletion settings
and can use a different configuration file if it is passed in.
- Author:
- Jim Downing, Grace Carpenter, Nathan Sarr
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterested(ChecksumResultCode result, long duration) Add a result and the length of time before the history with this type of result is removed from the database.voidaddInterested(ChecksumResultCode result, String duration) Add a result and the length of time before it is removed from the checksum history table.longThe default amount of time before a result is removed.static ResultsPrunergetDefaultPruner(Context context) Factory method for the default results pruner configuration using dspace.cfgstatic ResultsPrunerFactory method for ResultsPrunersstatic ResultsPrunergetPruner(Context context, Properties props) Factory method for ResultsPruners (used to load ConfigurationManager properties.intprune()Prunes the results retaining results as configured by the interests registered with this object.voidsetDefaultDuration(long defaultDuration) The default duration before records are removed from the checksum history table.
-
Constructor Details
-
ResultsPruner
Default Constructor- Parameters:
context- Context
-
-
Method Details
-
getDefaultPruner
Factory method for the default results pruner configuration using dspace.cfg- Parameters:
context- Context- Returns:
- a ResultsPruner that represent the default retention policy
-
getPruner
public static ResultsPruner getPruner(Context context, String propsFile) throws FileNotFoundException Factory method for ResultsPruners- Parameters:
context- ContextpropsFile- to configure the results pruner.- Returns:
- the configured results pruner.
- Throws:
FileNotFoundException- if file doesn't exist it the configuration file cannot be found.
-
getPruner
public static ResultsPruner getPruner(Context context, Properties props) throws FileNotFoundException Factory method for ResultsPruners (used to load ConfigurationManager properties.- Parameters:
context- Contextprops- Properties- Returns:
- pruner
- Throws:
FileNotFoundException- if file doesn't exist
-
addInterested
Add a result and the length of time before the history with this type of result is removed from the database.- Parameters:
result- code in the database.duration- before bitstreams with the specified result type in the checksum history is removed.
-
addInterested
Add a result and the length of time before it is removed from the checksum history table.- Parameters:
result- code in the database.duration- before bitstreams with the specified result type in the checksum history is removed.- Throws:
ParseException- if the duration cannot be parsed into a long value.
-
getDefaultDuration
public long getDefaultDuration()The default amount of time before a result is removed.- Returns:
- the default duration.
-
prune
Prunes the results retaining results as configured by the interests registered with this object.- Returns:
- number of results removed.
- Throws:
SQLException- if database error
-
setDefaultDuration
public void setDefaultDuration(long defaultDuration) The default duration before records are removed from the checksum history table.- Parameters:
defaultDuration- used before records are removed from the checksum history.
-