org.dspace.browse
Class ItemCounter

java.lang.Object
  extended by org.dspace.browse.ItemCounter

public class ItemCounter
extends Object

This class provides a standard interface to all item counting operations for communities and collections. It can be run from the command line to prepare the cached data if desired, simply by running: java org.dspace.browse.ItemCounter It can also be invoked via its standard API. In the event that the data cache is not being used, this class will return direct real time counts of content.

Author:
Richard Jones

Constructor Summary
ItemCounter(Context context)
          Construct a new item counter which will use the give DSpace Context
 
Method Summary
 void buildItemCounts()
          This method does the grunt work of drilling through and iterating over all of the communities and collections in the system and obtaining and caching the item counts for each one.
 int getCount(DSpaceObject dso)
          Get the count of the items in the given container.
static void main(String[] args)
          method invoked by CLI which will result in the number of items in each community and collection being cached.
 void remove(DSpaceObject dso)
          Remove any cached data for the given container
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemCounter

public ItemCounter(Context context)
            throws ItemCountException
Construct a new item counter which will use the give DSpace Context

Parameters:
context -
Throws:
ItemCountException
Method Detail

main

public static void main(String[] args)
                 throws ItemCountException,
                        SQLException
method invoked by CLI which will result in the number of items in each community and collection being cached. These counts will not update themselves until this is run again.

Parameters:
args -
Throws:
ItemCountException
SQLException

buildItemCounts

public void buildItemCounts()
                     throws ItemCountException
This method does the grunt work of drilling through and iterating over all of the communities and collections in the system and obtaining and caching the item counts for each one.

Throws:
ItemCountException

getCount

public int getCount(DSpaceObject dso)
             throws ItemCountException
Get the count of the items in the given container. If the configuration value webui.strengths.cache is equal to 'true' this will return the cached value if it exists. If it is equal to 'false' it will count the number of items in the container in real time

Parameters:
dso -
Returns:
Throws:
ItemCountException
SQLException

remove

public void remove(DSpaceObject dso)
            throws ItemCountException
Remove any cached data for the given container

Parameters:
dso -
Throws:
ItemCountException


Copyright © 2010 DuraSpace. All Rights Reserved.