Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

import java.util.Iterator;

import org.apache.jackrabbit.guava.common.collect.Multimap;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.jackrabbit.oak.commons.collections.IteratorUtils;
import org.apache.jackrabbit.oak.plugins.document.spi.JournalProperty;

import static java.util.Objects.requireNonNull;

class IndexedPaths implements JournalProperty, Iterable<IndexedPathInfo> {
private final Multimap<String, String> indexedPaths;
private final MultiValuedMap<String, String> indexedPaths;

public IndexedPaths(Multimap<String, String> indexedPaths) {
public IndexedPaths(MultiValuedMap<String, String> indexedPaths) {
this.indexedPaths = requireNonNull(indexedPaths);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.util.Collection;
import java.util.Map;

import org.apache.jackrabbit.guava.common.collect.HashMultimap;
import org.apache.jackrabbit.guava.common.collect.Multimap;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
import org.apache.jackrabbit.oak.commons.json.JsopReader;
import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
Expand All @@ -36,8 +36,8 @@

class LuceneJournalPropertyBuilder implements JournalPropertyBuilder<LuceneDocumentHolder> {
private final static Logger log = LoggerFactory.getLogger(LuceneJournalPropertyBuilder.class);
//Use HashMultimap to ensure that indexPath is not duplicated per node path
private final Multimap<String, String> indexedNodes = HashMultimap.create();
//Use HashSetValuedHashMap to ensure that indexPath is not duplicated per node path
private final MultiValuedMap<String, String> indexedNodes = new HashSetValuedHashMap<>();
private boolean limitWarningLogged = false;
private final int maxSize;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.Map;
import java.util.Set;

import org.apache.jackrabbit.guava.common.collect.HashMultimap;
import org.apache.jackrabbit.guava.common.collect.Multimap;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
Expand All @@ -50,7 +50,7 @@
public class UniquenessConstraintValidator {
private final NodeState rootState;
private final String indexPath;
private final Multimap<String, String> uniqueKeys = HashMultimap.create();
private final MultiValuedMap<String, String> uniqueKeys = new HashSetValuedHashMap<>();
private final PropertyQuery firstStore;
private PropertyQuery secondStore = PropertyQuery.DEFAULT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
*/
package org.apache.jackrabbit.oak.plugins.index.lucene.hybrid;

import org.apache.jackrabbit.guava.common.collect.HashMultimap;

import org.apache.jackrabbit.guava.common.collect.Multimap;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
import org.apache.jackrabbit.guava.common.util.concurrent.MoreExecutors;
import org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker;
import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexDefinition;
Expand Down Expand Up @@ -88,7 +87,7 @@ public void emptyCommitContext() throws Exception {

@Test
public void nonExistingIndexDefn() throws Exception {
Multimap<String, String> indexedPaths = HashMultimap.create();
MultiValuedMap<String, String> indexedPaths = new HashSetValuedHashMap<>();
indexedPaths.put("/a", "/oak:index/foo");

commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
Expand All @@ -101,7 +100,7 @@ public void nonExistingIndexDefn() throws Exception {

@Test
public void nonExistingPath() throws Exception {
Multimap<String, String> indexedPaths = HashMultimap.create();
MultiValuedMap<String, String> indexedPaths = new HashSetValuedHashMap<>();
indexedPaths.put("/a", "/oak:index/foo");

commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
Expand All @@ -114,7 +113,7 @@ public void nonExistingPath() throws Exception {

@Test
public void nonApplicableRule() throws Exception {
Multimap<String, String> indexedPaths = HashMultimap.create();
MultiValuedMap<String, String> indexedPaths = new HashSetValuedHashMap<>();
indexedPaths.put("/a", "/oak:index/foo");

commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
Expand All @@ -132,7 +131,7 @@ public void nonApplicableRule() throws Exception {

@Test
public void ruleNotResultingInDoc() throws Exception {
Multimap<String, String> indexedPaths = HashMultimap.create();
MultiValuedMap<String, String> indexedPaths = new HashSetValuedHashMap<>();
indexedPaths.put("/a", "/oak:index/foo");

commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
Expand All @@ -154,7 +153,7 @@ public void docAddedToQueue() throws Exception {
}

private void assertIndexing(Observer observer){
Multimap<String, String> indexedPaths = HashMultimap.create();
MultiValuedMap<String, String> indexedPaths = new HashSetValuedHashMap<>();
indexedPaths.put("/a", "/oak:index/foo");

commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

package org.apache.jackrabbit.oak.plugins.index.lucene.hybrid;

import org.apache.jackrabbit.guava.common.collect.HashMultimap;
import org.apache.jackrabbit.guava.common.collect.Multimap;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.HashSetValuedHashMap;
import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.junit.Test;

Expand Down Expand Up @@ -84,7 +84,7 @@ public void addMulti() throws Exception{
builder.addProperty(h2);

IndexedPaths indexedPaths = (IndexedPaths) builder.build();
Multimap<String, String> map = createdIndexPathMap(indexedPaths);
MultiValuedMap<String, String> map = createdIndexPathMap(indexedPaths);
assertThat(map.keySet(), containsInAnyOrder("/oak:index/foo", "/oak:index/bar"));
assertThat(map.get("/oak:index/foo"), containsInAnyOrder("/a", "/b"));
}
Expand All @@ -105,7 +105,7 @@ public void addMultiJson() throws Exception{
builder2.addSerializedProperty(json);

IndexedPaths indexedPaths = (IndexedPaths) builder2.build();
Multimap<String, String> map = createdIndexPathMap(indexedPaths);
MultiValuedMap<String, String> map = createdIndexPathMap(indexedPaths);
assertThat(map.keySet(), containsInAnyOrder("/oak:index/foo", "/oak:index/bar"));
assertThat(map.get("/oak:index/foo"), containsInAnyOrder("/a", "/b"));
}
Expand All @@ -124,8 +124,8 @@ public void maxLimitReached() throws Exception{
assertEquals(maxSize, IterableUtils.size(indexedPaths));
}

private Multimap<String, String> createdIndexPathMap(Iterable<IndexedPathInfo> itr){
Multimap<String, String> map = HashMultimap.create();
private MultiValuedMap<String, String> createdIndexPathMap(Iterable<IndexedPathInfo> itr){
MultiValuedMap<String, String> map = new HashSetValuedHashMap<>();
for (IndexedPathInfo i : itr){
for (String indexPath : i.getIndexPaths()){
map.put(indexPath, i.getPath());
Expand Down
Loading