org.dspace.app.statistics
Class ReportGenerator

java.lang.Object
  extended by org.dspace.app.statistics.ReportGenerator

public class ReportGenerator
extends Object

This class performs the action of coordinating a usage report being generated using the standard internal aggregation file format as a basis. All it's configuration information must come from that file. There is the opportunity for different output format options such as HTML. Use the -help flag for more information

Author:
Richard Jones

Constructor Summary
ReportGenerator()
           
 
Method Summary
static String getItemInfo(Context context, String handle)
          get the information for the item with the given handle
static void main(String[] argv)
          main method to be run from command line.
static Statistics prepareStats(Map aggregator, boolean sort, boolean translate)
          a standard stats block preparation method for use when an aggregator has to be put out in its entirity.
static void processReport(Context context, Report report, String myInput)
          using the pre-configuration information passed here, read in the aggregation data and output a file containing the report in the requested format
static void processReport(Context context, String myFormat, String myInput, String myOutput, String myMap)
          using the pre-configuration information passed here, read in the aggregation data and output a file containing the report in the requested format this method is retained for backwards compatibility, but delegates the actual wprk to a new method
static void readInput(String input)
          read the input file and populate all the class globals with the contents The values that come from this file form the basis of the analysis report
static void readMap(String map)
          read in the action map file which converts log file line actions into actions which are more understandable to humans
static void setParameters(String myInput)
          set the passed parameters up as global class variables.
static String translate(String text)
          look the given text up in the action map table and return a translated value if one exists.
static void usage()
          output the usage information to the terminal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportGenerator

public ReportGenerator()
Method Detail

main

public static void main(String[] argv)
                 throws Exception,
                        SQLException
main method to be run from command line. See usage information for details as to how to use the command line flags

Throws:
Exception
SQLException

processReport

public static void processReport(Context context,
                                 String myFormat,
                                 String myInput,
                                 String myOutput,
                                 String myMap)
                          throws Exception,
                                 SQLException
using the pre-configuration information passed here, read in the aggregation data and output a file containing the report in the requested format this method is retained for backwards compatibility, but delegates the actual wprk to a new method

Parameters:
context - the DSpace context in which this action is performed
myFormat - the desired output format (currently on HTML supported)
myInput - the aggregation file to be turned into a report
myOutput - the file into which to write the report
Throws:
Exception
SQLException

processReport

public static void processReport(Context context,
                                 Report report,
                                 String myInput)
                          throws Exception,
                                 SQLException
using the pre-configuration information passed here, read in the aggregation data and output a file containing the report in the requested format

Throws:
Exception
SQLException

prepareStats

public static Statistics prepareStats(Map aggregator,
                                      boolean sort,
                                      boolean translate)
a standard stats block preparation method for use when an aggregator has to be put out in its entirity. This method will not be able to deal with complex cases, although it will perform sorting by value and translations as per the map file if requested

Parameters:
aggregator - the aggregator that should be converted
sort - should the resulting stats be sorted by value
translate - translate the stat name using the map file
Returns:
a Statistics object containing all the relevant information

translate

public static String translate(String text)
look the given text up in the action map table and return a translated value if one exists. If no translation exists the original text is returned

Parameters:
text - the text to be translated
Returns:
a string containing either the translated text or the original text

readMap

public static void readMap(String map)
                    throws IOException
read in the action map file which converts log file line actions into actions which are more understandable to humans

Parameters:
map - the map file
Throws:
IOException

setParameters

public static void setParameters(String myInput)
set the passed parameters up as global class variables. This has to be done in a separate method because the API permits for running from the command line with args or calling the processReport method statically from elsewhere

Parameters:
myInput - regex for log file names

readInput

public static void readInput(String input)
                      throws IOException,
                             ParseException
read the input file and populate all the class globals with the contents The values that come from this file form the basis of the analysis report

Parameters:
input - the aggregator file
Throws:
IOException
ParseException

getItemInfo

public static String getItemInfo(Context context,
                                 String handle)
                          throws SQLException
get the information for the item with the given handle

Parameters:
context - the DSpace context we are operating under
handle - the handle of the item being looked up, in the form 1234/567 and so forth
Returns:
a string containing a reference (almost citation) to the article
Throws:
SQLException

usage

public static void usage()
output the usage information to the terminal



Copyright © 2010 DuraSpace. All Rights Reserved.