org.dspace.checker
Class ResultsPruner

java.lang.Object
  extended by org.dspace.checker.ResultsPruner

public final class ResultsPruner
extends Object

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
ResultsPruner()
          Default Constructor
 
Method Summary
 void addInterested(String result, long duration)
          Add a result and the length of time before the history with this type of result is removed from the database.
 void addInterested(String result, String duration)
          Add a result and the length of time before it is removed from the checksum history table.
 long getDefaultDuration()
          The default amount of time before a result is removed.
static ResultsPruner getDefaultPruner()
          Factory method for the default results pruner configuration using dspace.cfg
static ResultsPruner getPruner(Properties props)
          Factory method for ResultsPruners (used to load ConfigurationManager properties.
static ResultsPruner getPruner(String propsFile)
          Factory method for ResultsPruners
 int prune()
          Prunes the results retaining results as configured by the interests registered with this object.
 void setDefaultDuration(long defaultDuration)
          The default duration before records are removed from the checksum history table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultsPruner

public ResultsPruner()
Default Constructor

Method Detail

getDefaultPruner

public static ResultsPruner getDefaultPruner()
Factory method for the default results pruner configuration using dspace.cfg

Returns:
a ResultsPruner that represent the default retention policy

getPruner

public static ResultsPruner getPruner(String propsFile)
                               throws FileNotFoundException
Factory method for ResultsPruners

Parameters:
propsFile - to configure the results pruner.
Returns:
the configured results pruner.
Throws:
FileNotFoundException - it the configuration file cannot be found.

getPruner

public static ResultsPruner getPruner(Properties props)
                               throws FileNotFoundException
Factory method for ResultsPruners (used to load ConfigurationManager properties.

Parameters:
props -
Returns:
Throws:
FileNotFoundException

addInterested

public void addInterested(String result,
                          long duration)
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

public void addInterested(String result,
                          String duration)
                   throws ParseException
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

public int prune()
Prunes the results retaining results as configured by the interests registered with this object.

Returns:
number of results removed.

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.


Copyright © 2010 DuraSpace. All Rights Reserved.