mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
[2025998] Usage event (statistics) plugin hook
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3402 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* AbstractUsageEvent.java
|
||||
*
|
||||
* Version: $Revision: 0 $
|
||||
*
|
||||
* Date: $Date: 2008/02/08 10:33:00 $
|
||||
*
|
||||
* Copyright (C) 2008, The DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
package org.dspace.app.statistics;
|
||||
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
/**
|
||||
* Base class to be extended by usage event handlers.
|
||||
*
|
||||
* @author Mark H. Wood
|
||||
* @version $Revision: 0 $
|
||||
*/
|
||||
public abstract class AbstractUsageEvent
|
||||
{
|
||||
/** Event is "object has been viewed or downloaded" */
|
||||
public static final int VIEW = 1;
|
||||
|
||||
/** Which session sent the query. */
|
||||
protected String sessionID;
|
||||
|
||||
/** Address from which the query was received */
|
||||
protected String sourceAddress;
|
||||
|
||||
/** The EPerson making the request, or null if not logged on */
|
||||
protected EPerson eperson;
|
||||
|
||||
/** What happened? Viewed, logged on, etc. */
|
||||
protected int eventType;
|
||||
|
||||
/**
|
||||
* Type of object which experienced the event. Bitstream, item, etc. See
|
||||
* {@link org.dspace.core.Constants Constants} for values.
|
||||
*/
|
||||
protected int objectType;
|
||||
|
||||
/** Identity of specific object which experienced the event */
|
||||
protected int objectID;
|
||||
|
||||
/**
|
||||
* Because the PluginManager can only call a plugin's niladic constructor,
|
||||
* the constructor returns an "empty" event. It must be populated using the
|
||||
* setter methods before "firing".
|
||||
*/
|
||||
public AbstractUsageEvent()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* opaque session identifier returned by the HTTP request
|
||||
*/
|
||||
public void setSessionID(String id)
|
||||
{
|
||||
sessionID = id;
|
||||
}
|
||||
|
||||
/** */
|
||||
public String getSessionID()
|
||||
{
|
||||
return sessionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param address
|
||||
* the address from which the HTTP request came
|
||||
*/
|
||||
public void setSource(String address)
|
||||
{
|
||||
sourceAddress = address;
|
||||
}
|
||||
|
||||
/** */
|
||||
public String getSource()
|
||||
{
|
||||
return sourceAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user
|
||||
* an object representing the logged-on user, if any. May be
|
||||
* null.
|
||||
*/
|
||||
public void setEperson(EPerson user)
|
||||
{
|
||||
eperson = user;
|
||||
}
|
||||
|
||||
/** */
|
||||
public EPerson getEperson()
|
||||
{
|
||||
return eperson;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type of event (view, logon, etc.)
|
||||
*/
|
||||
public void setEventType(int type)
|
||||
{
|
||||
eventType = type;
|
||||
}
|
||||
|
||||
/** */
|
||||
public int getEventType()
|
||||
{
|
||||
return eventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type of object experiencing the event (bitstream, etc.)
|
||||
*/
|
||||
public void setObjectType(int type)
|
||||
{
|
||||
objectType = type;
|
||||
}
|
||||
|
||||
/** */
|
||||
public int getObjectType()
|
||||
{
|
||||
return objectType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the identifier of the specific object experiencing the event
|
||||
*/
|
||||
public void setID(int id)
|
||||
{
|
||||
objectID = id;
|
||||
}
|
||||
|
||||
/** */
|
||||
public int getID()
|
||||
{
|
||||
return objectID;
|
||||
}
|
||||
|
||||
/** Called when the event is fully configured, to process the data. */
|
||||
abstract public void fire();
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* PassiveUsageEvent.java
|
||||
*
|
||||
* Version: $Revision: 0 $
|
||||
*
|
||||
* Date: $Date: 2008/02/08 10:33:00 $
|
||||
*
|
||||
* Copyright (C) 2008, the DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
package org.dspace.app.statistics;
|
||||
|
||||
/**
|
||||
* A null implementation of AbstractUsageEvent to absorb events harmlessly and
|
||||
* cheaply.
|
||||
*
|
||||
* @author Mark H. Wood
|
||||
* @version $Revision: 0 $
|
||||
*/
|
||||
public class PassiveUsageEvent extends AbstractUsageEvent
|
||||
{
|
||||
/**
|
||||
* Do nothing and return. Effectively, the event is discarded.
|
||||
*/
|
||||
public void fire()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* UsageEventTabFileLogger.java
|
||||
*
|
||||
* Version: $Revision: 0 $
|
||||
*
|
||||
* Date: $Date: 2008/02/08 10:33:00 $
|
||||
*
|
||||
* Copyright (C) 2008, the DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
package org.dspace.app.statistics;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
|
||||
/**
|
||||
* Serialize AbstractUsageEvent data to a file as Tab deliminated. Requires
|
||||
* configuration: in dspace.cfg specify the path to the file as the value of
|
||||
* {@code usageEvent.tabFileLogger.file}.
|
||||
*
|
||||
* @author Mark H. Wood
|
||||
* @author Mark Diggory
|
||||
* @version $Revision: 0 $
|
||||
*/
|
||||
public class UsageEventTabFileLogger extends AbstractUsageEvent
|
||||
{
|
||||
/** log4j category */
|
||||
private static Logger errorLog = Logger
|
||||
.getLogger(UsageEventTabFileLogger.class);
|
||||
|
||||
/** File on which to write event records */
|
||||
private static PrintWriter log = null;
|
||||
|
||||
public UsageEventTabFileLogger()
|
||||
{
|
||||
super();
|
||||
|
||||
if (null == log)
|
||||
{
|
||||
boolean appending;
|
||||
|
||||
String logPath = ConfigurationManager
|
||||
.getProperty("usageEvent.tabFileLogger.file");
|
||||
if (null == logPath)
|
||||
{
|
||||
errorLog
|
||||
.error("UsageEventTabFileLogger unconfigured, will not log events");
|
||||
return;
|
||||
}
|
||||
|
||||
String logDir = null;
|
||||
if (!new File(logPath).isAbsolute())
|
||||
logDir = ConfigurationManager.getProperty("log.dir");
|
||||
|
||||
File logFile = new File(logDir, logPath);
|
||||
appending = logFile.length() > 0;
|
||||
try
|
||||
{
|
||||
log = new PrintWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(logFile, true)));
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
errorLog
|
||||
.error(
|
||||
"UsageEventTabFileLogger cannot open file, will not log events",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!appending)
|
||||
{
|
||||
log.println("date event objectType objectId sessionId sourceAddress eperson");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to a file
|
||||
*/
|
||||
public void fire()
|
||||
{
|
||||
if (null == log)
|
||||
return;
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
"yyyyMMdd'T'HHmmssSSS");
|
||||
|
||||
String string = dateFormat.format(new Date());
|
||||
string += "\t" + new Integer(eventType);
|
||||
string += "\t" + new Integer(objectType);
|
||||
string += "\t" + new Integer(objectID);
|
||||
string += "\t" + sessionID;
|
||||
string += "\t" + sourceAddress;
|
||||
|
||||
String epersonName = (null == eperson ? "anonymous" : eperson.getEmail());
|
||||
string += "\t" + epersonName;
|
||||
|
||||
log.println(string);
|
||||
log.flush();
|
||||
}
|
||||
}
|
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* UsageEventXmlLogger.java
|
||||
*
|
||||
* Version: $Revision: 0 $
|
||||
*
|
||||
* Date: $Date: 2008/02/08 10:33:00 $
|
||||
*
|
||||
* Copyright (C) 2008, the DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
package org.dspace.app.statistics;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
|
||||
/**
|
||||
* Serialize AbstractUsageEvent data to a file as XML. Requires configuration:
|
||||
* in dspace.cfg specify the path to the file as the value of
|
||||
* {@code usageEvent.xmlLogger.file}.
|
||||
*
|
||||
* @author Mark H. Wood
|
||||
* @version $Revision: 0 $
|
||||
*/
|
||||
public class UsageEventXMLLogger extends AbstractUsageEvent
|
||||
{
|
||||
/** log4j category */
|
||||
private static Logger errorLog = Logger
|
||||
.getLogger(UsageEventXMLLogger.class);
|
||||
|
||||
/** File on which to write event records */
|
||||
private static PrintWriter log = null;
|
||||
|
||||
public UsageEventXMLLogger()
|
||||
{
|
||||
super();
|
||||
|
||||
if (null == log)
|
||||
{
|
||||
boolean appending;
|
||||
|
||||
String logPath = ConfigurationManager
|
||||
.getProperty("usageEvent.xmlLogger.file");
|
||||
if (null == logPath)
|
||||
{
|
||||
errorLog
|
||||
.error("UsageEventXMLLogger unconfigured, will not log events");
|
||||
return;
|
||||
}
|
||||
|
||||
String logDir = null;
|
||||
if (!new File(logPath).isAbsolute())
|
||||
logDir = ConfigurationManager.getProperty("log.dir");
|
||||
|
||||
File logFile = new File(logDir, logPath);
|
||||
appending = logFile.length() > 0;
|
||||
try
|
||||
{
|
||||
log = new PrintWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(logFile, true)));
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
errorLog
|
||||
.error(
|
||||
"UsageEventXMLLogger cannot open file, will not log events",
|
||||
e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!appending)
|
||||
{
|
||||
log.println("<?xml version='1.0' ?>");
|
||||
log.println("<usagelog>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to a file
|
||||
*/
|
||||
public void fire()
|
||||
{
|
||||
if (null == log)
|
||||
return;
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
"yyyyMMdd'T'HHmmssSSS");
|
||||
|
||||
log.print(" <event time='" + dateFormat.format(new Date()) + "'");
|
||||
log.print(" type='" + new Integer(eventType) + "'");
|
||||
log.print(" objectType='" + new Integer(objectType) + "'");
|
||||
log.print(" objectID='" + new Integer(objectID) + "'");
|
||||
log.print(">");
|
||||
|
||||
log.print("<session>" + sessionID + "</session>");
|
||||
|
||||
log.print("<source>" + sourceAddress + "</source>");
|
||||
|
||||
String epersonName = (null == eperson ? "" : eperson.getEmail());
|
||||
log.print("<eperson>" + epersonName + "</eperson>");
|
||||
|
||||
log.println("</event>");
|
||||
log.flush();
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>org.dspace.app.statistics package</title>
|
||||
<!--
|
||||
* Copyright (C) 2008, the DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
Defines usage event instrumentation points and provides implementations for
|
||||
testing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This package makes usage instrumentation (for statistics, or whatever else
|
||||
you may fancy) pluggable, while avoiding any unnecessary assumptions about how
|
||||
usage events may be transmitted, persisted, or processed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
At appropriate points in the processing of user actions, events may be
|
||||
assembled and "fired". What happens when an event is fired is configurable
|
||||
via the PluginManager. One must configure a plugin for the AbstractUsageEvent
|
||||
class, defined in this package, to select an event processing implementation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Three "stock" implementations are provided.
|
||||
</p>
|
||||
<dl>
|
||||
<dt>{@link org.dspace.app.statistics.PassiveUsageEvent PassiveUsageEvent}</dt>
|
||||
<dd>absorbs events without taking action, resulting in behavior identical
|
||||
to that of DSpace before this package was added. This is the default
|
||||
if no plugin is configured.</dd>
|
||||
<dt>{@link org.dspace.app.statistics.UsageEventTabFileLogger UsageEventTabFileLogger}</dt>
|
||||
<dd>writes event records to a file in Tab Separated Values format.</dd>
|
||||
<dt>{@link org.dspace.app.statistics.UsageEventXMLLogger UsageEventXMLLogger}</dt>
|
||||
<dd>writes event records to a file in an XML format. Suitable mainly for
|
||||
testing.</dd>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
@@ -54,7 +54,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.statistics.AbstractUsageEvent;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UsageEvent;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
@@ -203,6 +205,8 @@ public class BitstreamServlet extends DSpaceServlet
|
||||
|
||||
log.info(LogManager.getHeader(context, "view_bitstream",
|
||||
"bitstream_id=" + bitstream.getID()));
|
||||
new UsageEvent().fire(request, context, AbstractUsageEvent.VIEW,
|
||||
Constants.BITSTREAM, bitstream.getID());
|
||||
|
||||
// Modification date
|
||||
// Only use last-modified if this is an anonymous access
|
||||
|
@@ -49,7 +49,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.statistics.AbstractUsageEvent;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UsageEvent;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
@@ -237,6 +239,8 @@ public class HTMLServlet extends DSpaceServlet
|
||||
{
|
||||
log.info(LogManager.getHeader(context, "view_html", "handle="
|
||||
+ handle + ",bitstream_id=" + bitstream.getID()));
|
||||
new UsageEvent().fire(request, context, AbstractUsageEvent.VIEW,
|
||||
Constants.BITSTREAM, bitstream.getID());
|
||||
|
||||
// Set the response MIME type
|
||||
response.setContentType(bitstream.getFormat().getMIMEType());
|
||||
|
@@ -40,9 +40,11 @@
|
||||
package org.dspace.app.webui.servlet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.statistics.AbstractUsageEvent;
|
||||
import org.dspace.app.webui.util.Authenticate;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UIUtil;
|
||||
import org.dspace.app.webui.util.UsageEvent;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.AuthorizeManager;
|
||||
import org.dspace.content.*;
|
||||
@@ -157,6 +159,10 @@ public class HandleServlet extends DSpaceServlet
|
||||
{
|
||||
Item item = (Item) dso;
|
||||
|
||||
UsageEvent ue = new UsageEvent();
|
||||
ue.fire(request, context, AbstractUsageEvent.VIEW, Constants.ITEM,
|
||||
dso.getID());
|
||||
|
||||
// Only use last-modified if this is an anonymous access
|
||||
// - caching content that may be generated under authorisation
|
||||
// is a security problem
|
||||
@@ -190,6 +196,10 @@ public class HandleServlet extends DSpaceServlet
|
||||
{
|
||||
Collection c = (Collection) dso;
|
||||
|
||||
UsageEvent ue = new UsageEvent();
|
||||
ue.fire(request, context, AbstractUsageEvent.VIEW,
|
||||
Constants.COLLECTION, dso.getID());
|
||||
|
||||
// Store collection location in request
|
||||
request.setAttribute("dspace.collection", c);
|
||||
|
||||
@@ -225,6 +235,10 @@ public class HandleServlet extends DSpaceServlet
|
||||
{
|
||||
Community c = (Community) dso;
|
||||
|
||||
UsageEvent ue = new UsageEvent();
|
||||
ue.fire(request, context, AbstractUsageEvent.VIEW,
|
||||
Constants.COMMUNITY, dso.getID());
|
||||
|
||||
// Store collection location in request
|
||||
request.setAttribute("dspace.community", c);
|
||||
|
||||
|
@@ -48,7 +48,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.app.statistics.AbstractUsageEvent;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UsageEvent;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.core.Constants;
|
||||
@@ -113,6 +115,10 @@ public class RetrieveServlet extends DSpaceServlet
|
||||
log.info(LogManager.getHeader(context, "view_bitstream",
|
||||
"bitstream_id=" + bitstream.getID()));
|
||||
|
||||
UsageEvent ue = new UsageEvent();
|
||||
ue.fire(request, context, AbstractUsageEvent.VIEW,
|
||||
Constants.BITSTREAM, bitstream.getID());
|
||||
|
||||
// Pipe the bits
|
||||
InputStream is = bitstream.retrieve();
|
||||
|
||||
|
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* UsageEvent.java
|
||||
*
|
||||
* Version: $Revision: 0 $
|
||||
*
|
||||
* Date: $Date: 2008/02/08 10:33:00 $
|
||||
*
|
||||
* Copyright (C) 2008, The DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
package org.dspace.app.webui.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.app.statistics.AbstractUsageEvent;
|
||||
import org.dspace.app.statistics.PassiveUsageEvent;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.PluginConfigurationError;
|
||||
import org.dspace.core.PluginManager;
|
||||
|
||||
/**
|
||||
* Facade to hide the PluginManager guts from usage event producers.
|
||||
*
|
||||
* Some configured flavor of AbstractUsageEvent is created and wrapped.
|
||||
* This allows the caller to simply <code>new UsageEvent().fire(args);</code>
|
||||
* or the like without having to deal with configuration plumbing.
|
||||
* Suggested by Mark Diggory, dspace-devel@lists.sourceforge.net, 27-Mar-2008.
|
||||
*
|
||||
* @author mwood@IUPUI.Edu
|
||||
*/
|
||||
public class UsageEvent
|
||||
{
|
||||
/** The actual event, of whatever type is configured */
|
||||
AbstractUsageEvent ue;
|
||||
|
||||
/**
|
||||
* Wrap the creation of an internal AbstractUsageEvent for later use
|
||||
*/
|
||||
public UsageEvent()
|
||||
{
|
||||
try
|
||||
{
|
||||
ue = (AbstractUsageEvent) PluginManager
|
||||
.getSinglePlugin(AbstractUsageEvent.class);
|
||||
}
|
||||
catch (PluginConfigurationError pce)
|
||||
{
|
||||
ue = new PassiveUsageEvent();
|
||||
}
|
||||
}
|
||||
|
||||
/** @see org.dspace.app.statistics.AbstractUsageEvent#fire */
|
||||
public void fire()
|
||||
{
|
||||
ue.fire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience to fill and fire an event all in one call, for JSPUI
|
||||
*
|
||||
* @param request
|
||||
* the request passed by the servlet engine
|
||||
* @param context
|
||||
* the DSpace context for this request
|
||||
* @param eventType
|
||||
* the type of event (view, logon, etc.)
|
||||
* @param objectType
|
||||
* the type of object experiencing the event (bitstream, etc.)
|
||||
* @param objectID
|
||||
* the identifier of the specific object experiencing the event
|
||||
*/
|
||||
public void fire(HttpServletRequest request, Context context,
|
||||
int eventType, int objectType, int objectID)
|
||||
{
|
||||
ue.setSessionID(request.getSession(true).getId());
|
||||
ue.setSource(request.getRemoteAddr());
|
||||
ue.setEperson(context.getCurrentUser());
|
||||
ue.setEventType(eventType);
|
||||
ue.setObjectType(objectType);
|
||||
ue.setID(objectID);
|
||||
ue.fire();
|
||||
}
|
||||
}
|
@@ -44,6 +44,8 @@ import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.util.HashUtil;
|
||||
import org.apache.excalibur.source.SourceValidity;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -52,6 +54,7 @@ import org.dspace.app.xmlui.cocoon.DSpaceFeedGenerator;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.UsageEvent;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -71,6 +74,7 @@ import org.dspace.sort.SortException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@@ -250,6 +254,9 @@ public class CollectionViewer extends AbstractDSpaceTransformer implements Cache
|
||||
// Set up the major variables
|
||||
Collection collection = (Collection) dso;
|
||||
|
||||
new UsageEvent().fire((Request) ObjectModelHelper.getRequest(objectModel),
|
||||
context, UsageEvent.VIEW, Constants.COLLECTION, collection.getID());
|
||||
|
||||
// Build the collection viewer division.
|
||||
Division home = body.addDivision("collection-home", "primary repository collection");
|
||||
String name = collection.getMetadata("name");
|
||||
|
@@ -44,6 +44,8 @@ import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.util.HashUtil;
|
||||
import org.apache.excalibur.source.SourceValidity;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -52,6 +54,7 @@ import org.dspace.app.xmlui.cocoon.DSpaceFeedGenerator;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.UsageEvent;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -73,6 +76,7 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@@ -271,6 +275,10 @@ public class CommunityViewer extends AbstractDSpaceTransformer implements Cachea
|
||||
Community[] subCommunities = community.getSubcommunities();
|
||||
Collection[] collections = community.getCollections();
|
||||
|
||||
new UsageEvent().fire((Request) ObjectModelHelper
|
||||
.getRequest(objectModel), context, UsageEvent.VIEW,
|
||||
Constants.ITEM, community.getID());
|
||||
|
||||
// Build the community viewer division.
|
||||
Division home = body.addDivision("community-home", "primary repository community");
|
||||
String name = community.getMetadata("name");
|
||||
|
@@ -54,6 +54,7 @@ import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
import org.dspace.app.xmlui.utils.DSpaceValidity;
|
||||
import org.dspace.app.xmlui.utils.HandleUtil;
|
||||
import org.dspace.app.xmlui.utils.UIException;
|
||||
import org.dspace.app.xmlui.utils.UsageEvent;
|
||||
import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Body;
|
||||
@@ -66,6 +67,7 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.DCValue;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@@ -187,6 +189,9 @@ public class ItemViewer extends AbstractDSpaceTransformer implements CacheablePr
|
||||
return;
|
||||
Item item = (Item) dso;
|
||||
|
||||
new UsageEvent().fire((Request) ObjectModelHelper.getRequest(objectModel),
|
||||
context, UsageEvent.VIEW, Constants.ITEM, item.getID());
|
||||
|
||||
// Build the item viewer division.
|
||||
Division division = body.addDivision("item-view","primary");
|
||||
String title = getItemTitle(item);
|
||||
|
@@ -62,6 +62,7 @@ import org.apache.cocoon.environment.http.HttpEnvironment;
|
||||
import org.apache.cocoon.environment.http.HttpResponse;
|
||||
import org.apache.cocoon.reading.AbstractReader;
|
||||
import org.apache.cocoon.util.ByteRange;
|
||||
import org.dspace.app.xmlui.utils.UsageEvent;
|
||||
import org.dspace.app.xmlui.utils.AuthenticationUtil;
|
||||
import org.dspace.app.xmlui.utils.ContextUtil;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -316,6 +317,10 @@ public class BitstreamReader extends AbstractReader implements Recyclable
|
||||
}
|
||||
// Log that the bitstream has been viewed.
|
||||
log.info(LogManager.getHeader(context, "view_bitstream", "bitstream_id=" + bitstream.getID()));
|
||||
|
||||
// Fire a view event for this bitstream
|
||||
new UsageEvent().fire((Request) ObjectModelHelper.getRequest(objectModel),
|
||||
context, UsageEvent.VIEW, Constants.BITSTREAM, bitstream.getID());
|
||||
}
|
||||
catch (SQLException sqle)
|
||||
{
|
||||
|
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* UsageEvent.java
|
||||
*
|
||||
* Version: $Revision: 0 $
|
||||
*
|
||||
* Date: $Date: 2008/02/08 10:33:00 $
|
||||
*
|
||||
* Copyright (C) 2008, The DSpace Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the DSpace Foundation nor the names of their
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
package org.dspace.app.xmlui.utils;
|
||||
|
||||
import org.apache.cocoon.environment.Request;
|
||||
|
||||
import org.dspace.app.statistics.AbstractUsageEvent;
|
||||
import org.dspace.app.statistics.PassiveUsageEvent;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.PluginConfigurationError;
|
||||
import org.dspace.core.PluginManager;
|
||||
|
||||
/**
|
||||
* Facade to hide the PluginManager guts from usage event producers.
|
||||
*
|
||||
* Some configured flavor of AbstractUsageEvent is created and wrapped.
|
||||
* This allows the caller to simply <code>new UsageEvent().fire(args);</code>
|
||||
* or the like without having to deal with configuration plumbing.
|
||||
* Suggested by Mark Diggory, dspace-devel@lists.sourceforge.net, 27-Mar-2008.
|
||||
*
|
||||
* @author mwood@IUPUI.Edu
|
||||
*/
|
||||
public class UsageEvent extends AbstractUsageEvent
|
||||
{
|
||||
/** The actual event, of whatever type is configured */
|
||||
AbstractUsageEvent ue;
|
||||
|
||||
/**
|
||||
* Wrap the creation of an internal AbstractUsageEvent for later use
|
||||
*/
|
||||
public UsageEvent()
|
||||
{
|
||||
try
|
||||
{
|
||||
ue = (AbstractUsageEvent) PluginManager
|
||||
.getSinglePlugin(AbstractUsageEvent.class);
|
||||
}
|
||||
catch (PluginConfigurationError pce)
|
||||
{
|
||||
ue = new PassiveUsageEvent();
|
||||
}
|
||||
}
|
||||
|
||||
/** @see org.dspace.app.statistics.AbstractUsageEvent#fire() */
|
||||
public void fire()
|
||||
{
|
||||
ue.fire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience to fill and fire an event all in one call, for XMLUI
|
||||
*
|
||||
* @param request
|
||||
* the Request passed by Cocoon
|
||||
* @param context
|
||||
* the DSpace context for this request
|
||||
* @param eventType
|
||||
* the type of event (view, logon, etc.)
|
||||
* @param objectType
|
||||
* the type of object experiencing the event (bitstream, etc.)
|
||||
* @param objectID
|
||||
* the identifier of the specific object experiencing the event
|
||||
*/
|
||||
public void fire(Request request, Context context,
|
||||
int eventType, int objectType, int objectID)
|
||||
{
|
||||
ue.setSessionID(request.getSession(true).getId());
|
||||
ue.setSource(request.getRemoteAddr());
|
||||
ue.setEperson(context.getCurrentUser());
|
||||
ue.setEventType(eventType);
|
||||
ue.setObjectType(objectType);
|
||||
ue.setID(objectID);
|
||||
ue.fire();
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
(Mark Wood)
|
||||
- [2002866] Return 404, not 200, when page Not Found
|
||||
- [2025998] Usage event (statistics) plugin hook
|
||||
|
||||
(Stuart Lewis)
|
||||
- [2057231] Refactor LDAPServlet to use Stackable Authentication
|
||||
|
@@ -659,6 +659,11 @@ org.dspace.app.itemexport.max.size = 200
|
||||
# uncomment the following entry for only new items to be emailed
|
||||
# eperson.subscription.onlynew = true
|
||||
|
||||
### Usage event settings ###
|
||||
# The usage event handler to call. The default is the "passive" handler, which ignores events.
|
||||
# plugin.single.org.dspace.app.statistics.AbstractUsageEvent = \
|
||||
# org.dspace.app.statistics.PassiveUsageEvent
|
||||
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
#--------------JSPUI & XMLUI CONFIGURATIONS---------------------#
|
||||
|
@@ -2494,7 +2494,40 @@ ant index
|
||||
[dspace]/bin/dsrun org.dspace.browse.IndexBrowse -i
|
||||
</screen>
|
||||
</section>
|
||||
<section remap="h3">
|
||||
<title>
|
||||
<anchor id="docbook-configure.html-usage-instrumentation" xreflabel="Configuring Usage Instrumentation Plugins"></anchor>Configuring Usage Instrumentation Plugins</title>
|
||||
<para>A usage instrumentation plugin is configured as a
|
||||
<link linkend="docbook-business.html-plugin">singleton plugin</link>
|
||||
for the abstract class <code>org.dspace.app.statistics.AbstractUsageEvent</code>.
|
||||
</para>
|
||||
<section remap="h4">
|
||||
<title>
|
||||
<anchor id="docbook-configure.html-usage-insturmentation-passive" xreflabel="The Passive Plugin"></anchor>
|
||||
The Passive Plugin
|
||||
</title>
|
||||
<para>
|
||||
The Passive plugin is provided as the class <code>org.dspace.app.statistics.PassiveUsageEvent</code>. It absorbs events without effect. Use the Passive plugin when you have no use for usage event postings. This is the default if no plugin is configured.
|
||||
</para>
|
||||
</section>
|
||||
<section remap="h4">
|
||||
<title>
|
||||
<anchor id="docbook-configure.html-usage-instrumentation-tsv" xreflabel="The TSV File Logger Plugin"></anchor>
|
||||
The Tab File Logger Plugin
|
||||
</title>
|
||||
<para>
|
||||
The Tab File Logger plugin is provided as the class <code>org.dspace.app.statistics.UsageEventTabFileLogger</code>. It writes event records to a file in tab-separated column format. If left unconfigured, an error will be noted in the DSpace log and no file will be produced. To specify the file path, provide an absolute path as the value for <code>usageEvent.tabFileLogger.file</code> in <code>dspace.cfg</code>.
|
||||
</para>
|
||||
</section>
|
||||
<section remap="h4">
|
||||
<title>
|
||||
<anchor id="docbook-configure.html-usage-instrumentation-xml" xreflabel="The XML Logger Plugin"></anchor>
|
||||
The XML Logger Plugin
|
||||
</title>
|
||||
<para>
|
||||
The XML Logger plugin is provided as the class <code>org.dspace.app.statistics.UsageEventXMLLogger</code>. It writes event records to a file in a simple XML-like format. If left unconfigured, an error will be noted in the DSpace log and no file will be produced. To specify the file path, provide an absolute path as the value for <code>usageEvent.xmlLogger.file</code> in <code>dspace.cfg</code>.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
|
||||
|
@@ -697,6 +697,12 @@ Export"/>Import and Export</title>
|
||||
<title><anchor id="docbook-functional.html-checker" xreflabel="Checksum Checker"/>Checksum Checker</title>
|
||||
<para>The purpose of the checker is to verify that the content in a DSpace repository has not become corrupted or been tampered with. The functionality can be invoked on an ad-hoc basis from the command line, or configured via cron or similar. Options exist to support large repositories that cannot be entirely checked in one run of the tool. The tool is extensible to new reporting and checking priority approaches.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
<section remap="h2">
|
||||
<title>
|
||||
<anchor id="docbook-functional.html-usage"
|
||||
xreflabel="Usage Instrumentation"></anchor>Usage Instrumentation</title>
|
||||
<para>DSpace can report usage events, such as bitstream downloads, to a pluggable event processor. This can be used for developing customized usage statistics, for example. Sample event processor plugins writes event records to a file as tab-separated values or XML.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
|
||||
|
@@ -134,6 +134,11 @@
|
||||
<ulink url="functional.html#checker">Checksum Checker</ulink>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="functional.html#usage">Usage Instrumentation</ulink>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
|
Reference in New Issue
Block a user