Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove all traces of metadataStorageInfo.

The field is never set in SolrLogger, so getMetadataStorageInfo always
returns null.  Attempts to dereference the Map supposedly returned
should thus always terminate abruptly.
  • Loading branch information...
commit 5ef301c00bc4cb4f3b4e006be6406296a00358ee 1 parent bd3d5ec
@mwoodiupui mwoodiupui authored
View
20 dspace-api/src/main/java/org/dspace/statistics/SolrLogger.java
@@ -7,7 +7,6 @@
*/
package org.dspace.statistics;
-import au.com.bytecode.opencsv.CSVParser;
import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.CSVWriter;
import com.maxmind.geoip.Location;
@@ -78,8 +77,6 @@
private static final LookupService locationService;
- private static Map<String, String> metadataStorageInfo;
-
private static final boolean useProxies;
private static List<String> statisticYearCores = new ArrayList<String>();
@@ -563,11 +560,6 @@ public static void postWorkflow(UsageWorkflowEvent usageWorkflowEvent) throws SQ
}
- public static Map<String, String> getMetadataStorageInfo()
- {
- return metadataStorageInfo;
- }
-
/**
* Method just used to log the parents.
* <ul>
@@ -676,18 +668,6 @@ public static void removeIndex(String query) throws IOException,
// We have at least one document good
SolrDocument document = response.getResults().get(0);
- for (Object storedField : metadataStorageInfo.keySet())
- {
- // For each of these fields that are stored we are to create a
- // list of the values it holds now
- java.util.Collection collection = document
- .getFieldValues((String) storedField);
- List<String> storedVals = new ArrayList<String>();
- storedVals.addAll(collection);
- // Now add it to our hashmap
- currentValsStored.put((String) storedField, storedVals);
- }
-
// System.out.println("HERE");
// Get the info we need
}
View
40 dspace-api/src/main/java/org/dspace/statistics/StatisticsLoggingConsumer.java
@@ -37,6 +37,7 @@
private Set<String> toRemoveQueries = null;
+ @Override
public void initialize() throws Exception
{
@@ -45,6 +46,7 @@ public void initialize() throws Exception
// TODO: checkout whether moving of collections, communities and bitstreams works
// TODO: use async threaded consumer as this might require some processing time
// TODO: we might be able to improve the performance: changing the collection will trigger 4 update commands
+ @Override
public void consume(Context ctx, Event event) throws Exception
{
if (toRemoveQueries == null)
@@ -78,45 +80,9 @@ else if (eventType == Event.MODIFY_METADATA
updateQuery, null, null);
// Get all the metadata
- Map<String, String> metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
List<String> storageFieldList = new ArrayList<String>();
List<List<Object>> storageValuesList = new ArrayList<List<Object>>();
- for (Map.Entry<String, String> entry : metadataStorageInfo.entrySet())
- {
- String[] metadataFieldInfo = entry.getValue().split("\\.");
-
- List<Object> values = new ArrayList<Object>();
- List<Object> valuesLow = new ArrayList<Object>();
- for (int i = 0; i < item.getMetadata(metadataFieldInfo[0],
- metadataFieldInfo[1], metadataFieldInfo[2], Item.ANY).length; i++)
- {
- values.add(item.getMetadata(metadataFieldInfo[0],
- metadataFieldInfo[1], metadataFieldInfo[2],
- Item.ANY)[i].value);
-
- valuesLow.add(item.getMetadata(metadataFieldInfo[0],
- metadataFieldInfo[1], metadataFieldInfo[2],
- Item.ANY)[i].value.toLowerCase());
- }
-
- List<String> indexedVals = indexedValues.get(entry.getKey());
-
- boolean update = true;
- if (values.size() == indexedVals.size() && values.containsAll(indexedVals))
- {
- update = false;
- }
-
- if (update)
- {
- storageFieldList.add(entry.getKey());
- storageFieldList.add(entry.getKey() + "_search");
- storageValuesList.add(values);
- storageValuesList.add(valuesLow);
- }
- }
-
SolrLogger.update(updateQuery, "replace", storageFieldList,
storageValuesList);
@@ -202,6 +168,7 @@ private void findComms(Community comm, List<Object> parentComms)
findComms(comm.getParentCommunity(), parentComms);
}
+ @Override
public void end(Context ctx) throws Exception
{
if (toRemoveQueries != null)
@@ -215,6 +182,7 @@ public void end(Context ctx) throws Exception
toRemoveQueries = null;
}
+ @Override
public void finish(Context ctx) throws Exception
{
}
View
23 dspace-api/src/main/java/org/dspace/statistics/util/StatisticsDataGenerator.java
@@ -16,13 +16,10 @@
import org.dspace.core.ConfigurationManager;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Bitstream;
-import org.dspace.content.DCValue;
-import org.dspace.content.Item;
import org.dspace.eperson.EPerson;
import org.dspace.statistics.SolrLogger;
import java.util.Date;
-import java.util.Map;
import java.text.SimpleDateFormat;
import com.maxmind.geoip.LookupService;
@@ -196,8 +193,6 @@ public static void main(String[] args) throws Exception {
solr.deleteByQuery("*:*");
solr.commit();
- Map<String, String> metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
-
String prevIp = null;
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
LookupService cl = new LookupService(dbfile,
@@ -366,24 +361,6 @@ public static void main(String[] args) throws Exception {
doc1.addField("dns", dns.toLowerCase());
}
- if (dso instanceof Item) {
- Item item = (Item) dso;
- // Store the metadata
- for (Map.Entry<String, String> entry : metadataStorageInfo.entrySet())
- {
- String dcField = entry.getValue();
-
- DCValue[] vals = item.getMetadata(dcField.split("\\.")[0],
- dcField.split("\\.")[1], dcField.split("\\.")[2],
- Item.ANY);
- for (DCValue val1 : vals) {
- String val = val1.value;
- doc1.addField(entry.getKey(), val);
- doc1.addField(entry.getKey() + "_search", val.toLowerCase());
- }
- }
- }
-
SolrLogger.storeParents(doc1, dso);
solr.add(doc1);
View
22 dspace-api/src/main/java/org/dspace/statistics/util/StatisticsImporter.java
@@ -48,9 +48,6 @@
/** GEOIP lookup service */
private static LookupService geoipLookup;
- /** Metadata storage information */
- private static Map<String, String> metadataStorageInfo;
-
/** Whether to skip the DNS reverse lookup or not */
private static boolean skipReverseDNS = false;
@@ -339,24 +336,6 @@ else if ("view_community".equals(action))
sid.addField("dns", dns.toLowerCase());
}
- if (dso instanceof Item) {
- Item item = (Item) dso;
- // Store the metadata
- for (String storedField : metadataStorageInfo.keySet()) {
- String dcField = metadataStorageInfo.get(storedField);
-
- DCValue[] vals = item.getMetadata(dcField.split("\\.")[0],
- dcField.split("\\.")[1], dcField.split("\\.")[2],
- Item.ANY);
- for (DCValue val1 : vals) {
- String val = val1.value;
- sid.addField(String.valueOf(storedField), val);
- sid.addField(String.valueOf(storedField + "_search"),
- val.toLowerCase());
- }
- }
- }
-
SolrLogger.storeParents(sid, dso);
solr.add(sid);
errors--;
@@ -471,7 +450,6 @@ public static void main(String[] args) throws Exception
}
solr = new HttpSolrServer(sserver);
- metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
try
{
Please sign in to comment.
Something went wrong with that request. Please try again.