org.dspace.statistics
Class SolrLogger

java.lang.Object
  extended by org.dspace.statistics.SolrLogger

public class SolrLogger
extends Object

Static SolrLogger used to hold HttpSolrClient connection pool to issue usage logging events to Solr from DSpace libraries.

Author:
ben at atmire.com, kevinvandevelde at atmire.com, mdiggory at atmire.com

Nested Class Summary
static class SolrLogger.ResultProcessor
           
 
Field Summary
static String DATE_FORMAT_8601
           
static String DATE_FORMAT_DCDATE
           
 
Constructor Summary
SolrLogger()
           
 
Method Summary
static void deleteIP(String ip)
           
static void deleteRobotsByIP()
           
static void deleteRobotsByIsBotFlag()
           
static String getIgnoreSpiderIPs()
          Returns in a filterQuery string all the ip addresses that should be ignored
static Map getMetadataStorageInfo()
           
static boolean isUseProxies()
           
static void markRobotByUserAgent(String agent)
           
static void markRobotsByIP()
           
static void post(DSpaceObject dspaceObject, javax.servlet.http.HttpServletRequest request, EPerson currentUser)
           
static void query(String query, int max)
           
static ObjectCount[] queryFacetDate(String query, String filterQuery, int max, String dateType, String dateStart, String dateEnd, boolean showTotal)
          Query used to get values grouped by the date
static ObjectCount[] queryFacetField(String query, String filterQuery, String facetField, int max, boolean showTotal, List<String> facetQueries)
          Query used to get values grouped by the given facetfield
static Map<String,Integer> queryFacetQuery(String query, String filterQuery, List<String> facetQueries)
           
static Map<String,List<String>> queryField(String query, List oldFieldVals, String field)
           
static ObjectCount queryTotal(String query, String filterQuery)
           
static void removeIndex(String query)
           
static void storeParents(org.apache.solr.common.SolrInputDocument doc1, DSpaceObject dso)
          Method just used to log the parents Community log: owning comms Collection log: owning comms & their comms Item log: owning colls/comms Bitstream log: owning item/colls/comms
static void update(String query, String action, List<String> fieldNames, List<List<Object>> fieldValuesList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_FORMAT_8601

public static final String DATE_FORMAT_8601
See Also:
Constant Field Values

DATE_FORMAT_DCDATE

public static final String DATE_FORMAT_DCDATE
See Also:
Constant Field Values
Constructor Detail

SolrLogger

public SolrLogger()
Method Detail

post

public static void post(DSpaceObject dspaceObject,
                        javax.servlet.http.HttpServletRequest request,
                        EPerson currentUser)

getMetadataStorageInfo

public static Map getMetadataStorageInfo()

storeParents

public static void storeParents(org.apache.solr.common.SolrInputDocument doc1,
                                DSpaceObject dso)
                         throws SQLException
Method just used to log the parents Community log: owning comms Collection log: owning comms & their comms Item log: owning colls/comms Bitstream log: owning item/colls/comms

Parameters:
doc1 - the current solrinputdoc
dso - the current dspace object we want to log
Throws:
SQLException - ignore it

isUseProxies

public static boolean isUseProxies()

removeIndex

public static void removeIndex(String query)
                        throws IOException,
                               org.apache.solr.client.solrj.SolrServerException
Throws:
IOException
org.apache.solr.client.solrj.SolrServerException

queryField

public static Map<String,List<String>> queryField(String query,
                                                  List oldFieldVals,
                                                  String field)

markRobotsByIP

public static void markRobotsByIP()

markRobotByUserAgent

public static void markRobotByUserAgent(String agent)

deleteRobotsByIsBotFlag

public static void deleteRobotsByIsBotFlag()

deleteIP

public static void deleteIP(String ip)

deleteRobotsByIP

public static void deleteRobotsByIP()

update

public static void update(String query,
                          String action,
                          List<String> fieldNames,
                          List<List<Object>> fieldValuesList)
                   throws org.apache.solr.client.solrj.SolrServerException,
                          IOException
Throws:
org.apache.solr.client.solrj.SolrServerException
IOException

query

public static void query(String query,
                         int max)
                  throws org.apache.solr.client.solrj.SolrServerException
Throws:
org.apache.solr.client.solrj.SolrServerException

queryFacetField

public static ObjectCount[] queryFacetField(String query,
                                            String filterQuery,
                                            String facetField,
                                            int max,
                                            boolean showTotal,
                                            List<String> facetQueries)
                                     throws org.apache.solr.client.solrj.SolrServerException
Query used to get values grouped by the given facetfield

Parameters:
query - the query to be used
facetField - the facet field on which to group our values
max - the max number of values given back (in case of 10 the top 10 will be given)
showTotal - a boolean determening whether the total amount should be given back as the last element of the array
Returns:
an array containing our results
Throws:
org.apache.solr.client.solrj.SolrServerException - ...

queryFacetDate

public static ObjectCount[] queryFacetDate(String query,
                                           String filterQuery,
                                           int max,
                                           String dateType,
                                           String dateStart,
                                           String dateEnd,
                                           boolean showTotal)
                                    throws org.apache.solr.client.solrj.SolrServerException
Query used to get values grouped by the date

Parameters:
query - the query to be used
max - the max number of values given back (in case of 10 the top 10 will be given)
dateType - the type to be used (example: DAY, MONTH, YEAR)
dateStart - the start date Format:(-3, -2, ..) the date is calculated relatively on today
dateEnd - the end date stop Format (-2, +1, ..) the date is calculated relatively on today
showTotal - a boolean determening whether the total amount should be given back as the last element of the array
Returns:
and array containing our results
Throws:
org.apache.solr.client.solrj.SolrServerException - ...

queryFacetQuery

public static Map<String,Integer> queryFacetQuery(String query,
                                                  String filterQuery,
                                                  List<String> facetQueries)
                                           throws org.apache.solr.client.solrj.SolrServerException
Throws:
org.apache.solr.client.solrj.SolrServerException

queryTotal

public static ObjectCount queryTotal(String query,
                                     String filterQuery)
                              throws org.apache.solr.client.solrj.SolrServerException
Throws:
org.apache.solr.client.solrj.SolrServerException

getIgnoreSpiderIPs

public static String getIgnoreSpiderIPs()
Returns in a filterQuery string all the ip addresses that should be ignored

Returns:
a string query with ip addresses


Copyright © 2010 DuraSpace. All Rights Reserved.