This is an automated email from the ASF dual-hosted git repository.
daim pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 5a900a2d81 OAK-11522 : removed usage of Guava's Iterables.filter
(#2115)
5a900a2d81 is described below
commit 5a900a2d81864b23756df0108a5406bbd541d2ba
Author: Rishabh Kumar <[email protected]>
AuthorDate: Wed Feb 26 14:54:31 2025 +0530
OAK-11522 : removed usage of Guava's Iterables.filter (#2115)
Co-authored-by: Rishabh Kumar <[email protected]>
---
.../authentication/external/impl/DynamicSyncContext.java | 3 ++-
.../external/impl/principal/SyncHandlerMappingTracker.java | 3 ++-
.../principalbased/impl/EffectivePolicyTest.java | 3 ++-
.../org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java | 4 ++--
.../org/apache/jackrabbit/oak/core/SecureNodeBuilder.java | 7 +++----
.../java/org/apache/jackrabbit/oak/core/SecureNodeState.java | 8 ++++----
.../jackrabbit/oak/plugins/identifier/IdentifierManager.java | 3 ++-
.../jackrabbit/oak/plugins/index/IndexInfoServiceImpl.java | 3 ++-
.../jackrabbit/oak/plugins/index/IndexPathServiceImpl.java | 3 +--
.../oak/plugins/index/reference/ReferenceIndex.java | 3 +--
.../oak/plugins/migration/AbstractDecoratedNodeState.java | 6 +++---
.../oak/plugins/nodetype/EffectiveNodeTypeImpl.java | 8 ++++----
.../apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java | 5 +++--
.../oak/plugins/nodetype/write/NodeTypeTemplateImpl.java | 4 ++--
.../apache/jackrabbit/oak/plugins/tree/impl/AbstractTree.java | 6 +++---
.../oak/security/authorization/accesscontrol/ACL.java | 5 +++--
.../apache/jackrabbit/oak/security/user/UserManagerImpl.java | 5 +++--
.../security/internal/SecurityProviderRegistrationTest.java | 2 +-
.../oak/security/user/CachedGroupPrincipalTest.java | 11 ++++++-----
.../jackrabbit/oak/composite/CompositeNodeStoreTest.java | 5 ++---
.../java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java | 5 +++--
.../oak/plugins/index/lucene/property/BucketSwitcher.java | 3 ++-
.../oak/spi/security/privilege/PrivilegeBitsProvider.java | 2 +-
.../security/principal/CompositePrincipalProviderTest.java | 4 ++--
.../oak/spi/security/principal/TestPrincipalProvider.java | 3 ++-
.../apache/jackrabbit/oak/composite/CompositeNodeStore.java | 5 ++---
.../org/apache/jackrabbit/oak/plugins/document/Branch.java | 3 +--
.../org/apache/jackrabbit/oak/plugins/document/Commit.java | 6 +++---
.../jackrabbit/oak/plugins/document/DocumentNodeState.java | 2 +-
.../jackrabbit/oak/plugins/document/DocumentNodeStore.java | 2 +-
.../oak/plugins/document/DocumentNodeStoreMBeanImpl.java | 7 +++----
.../jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java | 4 ++--
.../jackrabbit/oak/plugins/document/MissingBcSweeper2.java | 5 ++---
.../jackrabbit/oak/plugins/document/MissingLastRevSeeker.java | 3 ++-
.../apache/jackrabbit/oak/plugins/document/NodeDocument.java | 7 +++----
.../jackrabbit/oak/plugins/document/NodeDocumentSweeper.java | 5 ++---
.../jackrabbit/oak/plugins/document/PropertyHistory.java | 4 ++--
.../jackrabbit/oak/plugins/document/UnsavedModifications.java | 4 ++--
.../jackrabbit/oak/plugins/document/VersionGCSupport.java | 4 ++--
.../oak/plugins/document/mongo/MongoDocumentStore.java | 4 ++--
.../oak/plugins/document/mongo/MongoVersionGCSupport.java | 3 +--
.../oak/plugins/document/persistentCache/NodeCache.java | 4 ++--
.../oak/plugins/document/rdb/RDBVersionGCSupport.java | 6 ++----
.../document/secondary/DelegatingDocumentNodeState.java | 2 +-
.../document/MongoVersionGCSupportDefaultNoBranchTest.java | 4 ++--
.../oak/plugins/document/VersionGarbageCollectorIT.java | 5 ++---
.../jackrabbit/oak/plugins/memory/ModifiedNodeState.java | 11 +++++------
.../apache/jackrabbit/oak/spi/commit/BackgroundObserver.java | 5 ++---
.../apache/jackrabbit/oak/upgrade/SameNameSiblingsEditor.java | 4 ++--
49 files changed, 110 insertions(+), 113 deletions(-)
diff --git
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContext.java
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContext.java
index 36068ceab6..d1207cc78b 100644
---
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContext.java
+++
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DynamicSyncContext.java
@@ -20,6 +20,7 @@ import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import
org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup;
import
org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity;
import
org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityException;
@@ -234,7 +235,7 @@ public class DynamicSyncContext extends DefaultSyncContext {
*/
private void collectSyncEntries(@NotNull Iterable<ExternalIdentityRef>
declaredGroupRefs, long depth, @NotNull Map<ExternalIdentityRef, SyncEntry>
map) throws ExternalIdentityException, RepositoryException {
boolean shortcut = shortcut(depth);
- for (ExternalIdentityRef ref : Iterables.filter(declaredGroupRefs,
this::isSameIDP)) {
+ for (ExternalIdentityRef ref : IterableUtils.filter(declaredGroupRefs,
this::isSameIDP)) {
String principalName = null;
Authorizable a = null;
ExternalGroup externalGroup = null;
diff --git
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/SyncHandlerMappingTracker.java
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/SyncHandlerMappingTracker.java
index 664a6dff6d..75f19d7812 100644
---
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/SyncHandlerMappingTracker.java
+++
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/SyncHandlerMappingTracker.java
@@ -18,6 +18,7 @@ package
org.apache.jackrabbit.oak.spi.security.authentication.external.impl.prin
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import
org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler;
import
org.apache.jackrabbit.oak.spi.security.authentication.external.impl.SyncHandlerMapping;
import org.jetbrains.annotations.NotNull;
@@ -77,7 +78,7 @@ final class SyncHandlerMappingTracker extends ServiceTracker {
}
Iterable<String> getIdpNames(@NotNull final String syncHandlerName) {
- return Iterables.filter(Iterables.transform(referenceMap.values(),
mapping -> {
+ return IterableUtils.filter(Iterables.transform(referenceMap.values(),
mapping -> {
if (syncHandlerName.equals(mapping.syncHandlerName)) {
return mapping.idpName;
} else {
diff --git
a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/EffectivePolicyTest.java
b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/EffectivePolicyTest.java
index 277bf9c26f..62aa0e6827 100644
---
a/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/EffectivePolicyTest.java
+++
b/oak-authorization-principalbased/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/EffectivePolicyTest.java
@@ -22,6 +22,7 @@ import
org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
import
org.apache.jackrabbit.api.security.authorization.PrincipalAccessControlList;
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
@@ -138,7 +139,7 @@ public class EffectivePolicyTest extends
AbstractPrincipalBasedTest {
// filter expected entries: only entries that take effect at the
target path should be taken into consideration
ImmutablePrincipalPolicy byPrincipal = (ImmutablePrincipalPolicy)
acMgr.getEffectivePolicies(Set.of(effectivePolicy.getPrincipal()))[0];
- Set<JackrabbitAccessControlEntry> expected =
SetUtils.toSet(Iterables.filter(byPrincipal.getEntries(), entry -> {
+ Set<JackrabbitAccessControlEntry> expected =
SetUtils.toSet(IterableUtils.filter(byPrincipal.getEntries(), entry -> {
String effectivePath = ((PrincipalAccessControlList.Entry)
entry).getEffectivePath();
return effectivePath != null &&
Text.isDescendantOrEqual(effectivePath, path);
}));
diff --git
a/oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java
b/oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java
index d29f305363..b678b2a110 100644
---
a/oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java
+++
b/oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java
@@ -51,6 +51,7 @@ import org.apache.jackrabbit.core.data.DataRecord;
import org.apache.jackrabbit.core.data.DataStoreException;
import org.apache.jackrabbit.core.data.util.NamedThreadFactory;
import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
import org.apache.jackrabbit.oak.commons.collections.MapUtils;
import
org.apache.jackrabbit.oak.plugins.blob.datastore.directaccess.DataRecordDownloadOptions;
@@ -100,7 +101,6 @@ import
org.apache.jackrabbit.guava.common.cache.CacheBuilder;
import org.apache.jackrabbit.guava.common.collect.AbstractIterator;
import static
org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static java.lang.Thread.currentThread;
/**
@@ -1126,7 +1126,7 @@ public class S3Backend extends AbstractSharedBackend {
}
List<S3ObjectSummary> listing = ListUtils.toList(
- filter(prevObjectListing.getObjectSummaries(),
+
IterableUtils.filter(prevObjectListing.getObjectSummaries(),
input ->
!input.getKey().startsWith(META_KEY_PREFIX)));
// After filtering no elements
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeBuilder.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeBuilder.java
index 80378dc893..530064a7f9 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeBuilder.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeBuilder.java
@@ -37,7 +37,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static java.util.Collections.emptyList;
import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
import static org.apache.jackrabbit.oak.api.Type.NAME;
@@ -194,7 +193,7 @@ class SecureNodeBuilder implements NodeBuilder {
if (getTreePermission().canReadProperties() || isNew()) {
return builder.getPropertyCount();
} else {
- return IterableUtils.size(filter(
+ return IterableUtils.size(IterableUtils.filter(
builder.getProperties(),
new ReadablePropertyPredicate()::test));
}
@@ -206,7 +205,7 @@ class SecureNodeBuilder implements NodeBuilder {
if (getTreePermission().canReadProperties() || isNew()) {
return builder.getProperties();
} else {
- return filter(
+ return IterableUtils.filter(
builder.getProperties(),
new ReadablePropertyPredicate()::test);
}
@@ -285,7 +284,7 @@ class SecureNodeBuilder implements NodeBuilder {
@NotNull
@Override
public Iterable<String> getChildNodeNames() {
- return filter(
+ return IterableUtils.filter(
builder.getChildNodeNames(),
input -> input != null && getChildNode(input).exists());
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeState.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeState.java
index 7e6f7ff502..de259cddc3 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeState.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/core/SecureNodeState.java
@@ -17,6 +17,7 @@
package org.apache.jackrabbit.oak.core;
import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry;
import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
import
org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission;
@@ -28,7 +29,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import java.util.function.Function;
@@ -78,7 +78,7 @@ class SecureNodeState extends AbstractNodeState {
if (treePermission.canReadProperties()) {
propertyCount = state.getPropertyCount();
} else {
- propertyCount = count(filter(
+ propertyCount = count(IterableUtils.filter(
state.getProperties(),
new ReadablePropertyPredicate()::test));
}
@@ -91,7 +91,7 @@ class SecureNodeState extends AbstractNodeState {
if (treePermission.canReadProperties()) {
return state.getProperties();
} else {
- return filter(
+ return IterableUtils.filter(
state.getProperties(),
new ReadablePropertyPredicate()::test);
}
@@ -147,7 +147,7 @@ class SecureNodeState extends AbstractNodeState {
Iterable<ChildNodeEntry> readable = transform(
state.getChildNodeEntries(),
new WrapChildEntryFunction()::apply);
- return filter(readable, new IterableNodePredicate()::test);
+ return IterableUtils.filter(readable, new
IterableNodePredicate()::test);
} else {
return emptyList();
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
index 8a0ec05efc..4983323e08 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java
@@ -39,6 +39,7 @@ import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.QueryUtils;
import org.apache.jackrabbit.oak.commons.UUIDUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
import org.apache.jackrabbit.oak.plugins.memory.PropertyValues;
import org.apache.jackrabbit.oak.plugins.memory.StringPropertyState;
@@ -319,7 +320,7 @@ public class IdentifierManager {
Query.JCR_SQL2, bindings, NO_MAPPINGS);
Iterable<Tree> resultTrees = Iterables.transform(result.getRows(),
row -> row.getTree(null));
- return Iterables.filter(resultTrees, tree1 ->
!tree1.getPath().startsWith(VersionConstants.VERSION_STORE_PATH)
+ return IterableUtils.filter(resultTrees, tree1 ->
!tree1.getPath().startsWith(VersionConstants.VERSION_STORE_PATH)
);
} catch (ParseException e) {
log.error("query failed", e);
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexInfoServiceImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexInfoServiceImpl.java
index 9e53c91059..3b5349ab08 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexInfoServiceImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexInfoServiceImpl.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.jackrabbit.guava.common.collect.Iterables;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -68,7 +69,7 @@ public class IndexInfoServiceImpl implements IndexInfoService{
} else {
activeIndexes.addAll(allIndexes);
}
- return
Iterables.filter(Iterables.transform(indexPathService.getIndexPaths(),
indexPath -> {
+ return
IterableUtils.filter(Iterables.transform(indexPathService.getIndexPaths(),
indexPath -> {
try {
IndexInfo info = getInfo(indexPath);
if (info != null) {
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexPathServiceImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexPathServiceImpl.java
index 5cf3fcae87..991da39f3e 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexPathServiceImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexPathServiceImpl.java
@@ -44,7 +44,6 @@ import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static org.apache.jackrabbit.guava.common.collect.Iterators.transform;
import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
@@ -92,7 +91,7 @@ public class IndexPathServiceImpl implements IndexPathService
{
log.warn("{} is not found to be indexed as part of nodetype index.
Non root indexes would " +
"not be listed", INDEX_DEFINITIONS_NODE_TYPE);
NodeState oakIndex = nodeStore.getRoot().getChildNode("oak:index");
- return transform(filter(oakIndex.getChildNodeEntries(),
+ return
transform(IterableUtils.filter(oakIndex.getChildNodeEntries(),
cne ->
INDEX_DEFINITIONS_NODE_TYPE.equals(cne.getNodeState().getName(JCR_PRIMARYTYPE))),
cne -> PathUtils.concat("/oak:index", cne.getName()));
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
index b9122a2210..c3aba25e70 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.index.reference;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static java.lang.Double.POSITIVE_INFINITY;
import static javax.jcr.PropertyType.REFERENCE;
@@ -137,7 +136,7 @@ class ReferenceIndex implements QueryIndex {
Iterable<String> paths = IterableUtils.chainedIterable(iterables);
if (!"*".equals(name)) {
- paths = filter(paths, path -> name.equals(getName(path)));
+ paths = IterableUtils.filter(paths, path ->
name.equals(getName(path)));
}
paths = transform(paths, path -> getParentPath(path));
return newPathCursor(paths, filter.getQueryLimits());
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/AbstractDecoratedNodeState.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/AbstractDecoratedNodeState.java
index d4c94ad4e5..4b27056cea 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/AbstractDecoratedNodeState.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/AbstractDecoratedNodeState.java
@@ -99,7 +99,7 @@ public abstract class AbstractDecoratedNodeState extends
AbstractNodeState {
if (propertyState != null &&
OAK_CHILD_ORDER.equals(propertyState.getName())) {
final Collection<String> childNodeNames = new ArrayList<String>();
nodeState.getChildNodeNames().forEach(childNodeNames::add);
- final Iterable<String> values = Iterables.filter(
+ final Iterable<String> values = IterableUtils.filter(
propertyState.getValue(Type.NAMES), x ->
childNodeNames.contains(x));
return PropertyStates.createProperty(OAK_CHILD_ORDER, values,
Type.NAMES);
}
@@ -149,7 +149,7 @@ public abstract class AbstractDecoratedNodeState extends
AbstractNodeState {
}
return null;
});
- return Iterables.filter(transformed, x -> x != null);
+ return IterableUtils.filter(transformed, x -> x != null);
}
@Override
@@ -173,7 +173,7 @@ public abstract class AbstractDecoratedNodeState extends
AbstractNodeState {
final Iterable<PropertyState> propertyStates = Iterables.transform(
delegate.getProperties(),
propertyState -> decorate(propertyState));
- return Iterables.filter(IterableUtils.chainedIterable(propertyStates,
getNewPropertyStates()), Objects::nonNull);
+ return
IterableUtils.filter(IterableUtils.chainedIterable(propertyStates,
getNewPropertyStates()), Objects::nonNull);
}
/**
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
index c1074cd47e..21b3320b83 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java
@@ -175,25 +175,25 @@ class EffectiveNodeTypeImpl implements EffectiveNodeType {
@NotNull
@Override
public Iterable<NodeDefinition> getAutoCreateNodeDefinitions() {
- return Iterables.filter(getNodeDefinitions(), nodeDefinition ->
nodeDefinition.isAutoCreated());
+ return IterableUtils.filter(getNodeDefinitions(), nodeDefinition ->
nodeDefinition.isAutoCreated());
}
@NotNull
@Override
public Iterable<PropertyDefinition> getAutoCreatePropertyDefinitions() {
- return Iterables.filter(getPropertyDefinitions(), propertyDefinition
-> propertyDefinition.isAutoCreated());
+ return IterableUtils.filter(getPropertyDefinitions(),
propertyDefinition -> propertyDefinition.isAutoCreated());
}
@NotNull
@Override
public Iterable<NodeDefinition> getMandatoryNodeDefinitions() {
- return Iterables.filter(getNodeDefinitions(), nodeDefinition ->
nodeDefinition.isMandatory());
+ return IterableUtils.filter(getNodeDefinitions(), nodeDefinition ->
nodeDefinition.isMandatory());
}
@NotNull
@Override
public Iterable<PropertyDefinition> getMandatoryPropertyDefinitions() {
- return Iterables.filter(getPropertyDefinitions(), propertyDefinition
-> propertyDefinition.isMandatory());
+ return IterableUtils.filter(getPropertyDefinitions(),
propertyDefinition -> propertyDefinition.isMandatory());
}
/**
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
index ae92cb98b3..757dd77b23 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeImpl.java
@@ -73,6 +73,7 @@ import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.UUIDUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.conditions.Validate;
import org.apache.jackrabbit.oak.namepath.JcrNameParser;
import org.apache.jackrabbit.oak.namepath.JcrPathParser;
@@ -186,7 +187,7 @@ class NodeTypeImpl extends AbstractTypeDefinition
implements NodeType {
@Override @NotNull
public PropertyDefinition[] getDeclaredPropertyDefinitions() {
Map<Integer, PropertyDefinition> definitions = new TreeMap<>();
- for (Tree child : Iterables.filter(definition.getChildren(),
PrimaryTypePredicate.PROPERTY_DEF_PREDICATE::test)) {
+ for (Tree child : IterableUtils.filter(definition.getChildren(),
PrimaryTypePredicate.PROPERTY_DEF_PREDICATE::test)) {
definitions.put(getIndex(child), new PropertyDefinitionImpl(child,
this, mapper));
}
return definitions.values().toArray(NO_PROPERTY_DEFINITIONS);
@@ -200,7 +201,7 @@ class NodeTypeImpl extends AbstractTypeDefinition
implements NodeType {
@Override @NotNull
public NodeDefinition[] getDeclaredChildNodeDefinitions() {
Map<Integer, NodeDefinition> definitions = new TreeMap<>();
- for (Tree child : Iterables.filter(definition.getChildren(),
PrimaryTypePredicate.CHILDNODE_DEF_PREDICATE::test)) {
+ for (Tree child : IterableUtils.filter(definition.getChildren(),
PrimaryTypePredicate.CHILDNODE_DEF_PREDICATE::test)) {
definitions.put(getIndex(child), new NodeDefinitionImpl(child,
this, mapper));
}
return definitions.values().toArray(NO_NODE_DEFINITIONS);
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
index a885937433..ac61f95a04 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.nodetype.write;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.JcrConstants.JCR_CHILDNODEDEFINITION;
import static org.apache.jackrabbit.JcrConstants.JCR_HASORDERABLECHILDNODES;
import static org.apache.jackrabbit.JcrConstants.JCR_ISMIXIN;
@@ -49,6 +48,7 @@ import javax.jcr.nodetype.PropertyDefinitionTemplate;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.namepath.NameMapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -178,7 +178,7 @@ class NodeTypeTemplateImpl extends NamedTemplate implements
NodeTypeTemplate {
private static void writeItemDefinitions(@NotNull Tree nodeTypeTree,
@Nullable List<? extends ItemDefinitionTemplate> itemDefTemplates,
@NotNull String nodeName,
@NotNull String primaryTypeName) throws RepositoryException {
// first remove existing
- for (Tree t : filter(nodeTypeTree.getChildren(), new
SameNamePredicate(nodeName)::test)) {
+ for (Tree t : IterableUtils.filter(nodeTypeTree.getChildren(), new
SameNamePredicate(nodeName)::test)) {
t.remove();
}
// now write definitions
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/tree/impl/AbstractTree.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/tree/impl/AbstractTree.java
index 4f0d5bbee2..a8fe9e07eb 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/tree/impl/AbstractTree.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/tree/impl/AbstractTree.java
@@ -18,7 +18,6 @@
*/
package org.apache.jackrabbit.oak.plugins.tree.impl;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static org.apache.jackrabbit.oak.api.Tree.Status.MODIFIED;
import static org.apache.jackrabbit.oak.api.Tree.Status.NEW;
@@ -29,6 +28,7 @@ import static
org.apache.jackrabbit.oak.plugins.tree.TreeConstants.OAK_CHILD_ORD
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -275,7 +275,7 @@ public abstract class AbstractTree implements Tree {
@Override
@NotNull
public Iterable<? extends PropertyState> getProperties() {
- return filter(getNodeBuilder().getProperties(), propertyState ->
!isHidden(propertyState.getName()));
+ return IterableUtils.filter(getNodeBuilder().getProperties(),
propertyState -> !isHidden(propertyState.getName()));
}
@Override
@@ -314,6 +314,6 @@ public abstract class AbstractTree implements Tree {
AbstractTree child = createChild(name);
return child.exists() ? child : null;
});
- return filter(children, x -> x != null);
+ return IterableUtils.filter(children, Objects::nonNull);
}
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACL.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACL.java
index c7b9946421..0fab26a1e6 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACL.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACL.java
@@ -31,6 +31,7 @@ import javax.jcr.security.Privilege;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
import org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.ACE;
@@ -164,7 +165,7 @@ abstract class ACL extends AbstractAccessControlList {
private boolean internalAddEntry(@NotNull ACE entry) throws
RepositoryException {
final String principalName = entry.getPrincipal().getName();
final Set<Restriction> restrictions = entry.getRestrictions();
- List<ACE> subList = ListUtils.toList(Iterables.filter(entries, ace ->
+ List<ACE> subList = ListUtils.toList(IterableUtils.filter(entries, ace
->
principalName.equals(requireNonNull(ace).getPrincipal().getName()) &&
restrictions.equals(ace.getRestrictions())));
boolean addEntry = true;
@@ -211,7 +212,7 @@ abstract class ACL extends AbstractAccessControlList {
@NotNull
private Set<Restriction> validateRestrictions(@NotNull Map<String, Value>
restrictions, @NotNull Map<String, Value[]> mvRestrictions) throws
RepositoryException {
- Iterable<RestrictionDefinition> mandatoryDefs =
Iterables.filter(getRestrictionProvider().getSupportedRestrictions(getOakPath()),
RestrictionDefinition::isMandatory);
+ Iterable<RestrictionDefinition> mandatoryDefs =
IterableUtils.filter(getRestrictionProvider().getSupportedRestrictions(getOakPath()),
RestrictionDefinition::isMandatory);
for (RestrictionDefinition def : mandatoryDefs) {
String jcrName = getNamePathMapper().getJcrName(def.getName());
boolean mandatoryPresent;
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
index a5e2b736db..afec708fa4 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
@@ -28,6 +28,7 @@ import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
import org.apache.jackrabbit.oak.plugins.tree.TreeUtil;
@@ -560,11 +561,11 @@ public class UserManagerImpl implements UserManager {
*/
@NotNull
private Iterable<GroupAction> filterGroupActions() {
- return
Iterables.filter(actionProvider.getAuthorizableActions(securityProvider),
GroupAction.class);
+ return
IterableUtils.filter(actionProvider.getAuthorizableActions(securityProvider),
GroupAction.class);
}
@NotNull
private Iterable<UserAction> filterUserActions() {
- return
Iterables.filter(actionProvider.getAuthorizableActions(securityProvider),
UserAction.class);
+ return
IterableUtils.filter(actionProvider.getAuthorizableActions(securityProvider),
UserAction.class);
}
}
diff --git
a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
index 62d0909bef..c652c1a91a 100644
---
a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
+++
b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistrationTest.java
@@ -211,7 +211,7 @@ public class SecurityProviderRegistrationTest extends
AbstractSecurityTest {
SecurityProvider service = context.getService(SecurityProvider.class);
assertNotNull(service);
- assertEquals(6,
IterableUtils.size(Iterables.filter(service.getConfigurations(), x -> x !=
null)));
+ assertEquals(6,
IterableUtils.size(IterableUtils.filter(service.getConfigurations(), x -> x !=
null)));
}
diff --git
a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/CachedGroupPrincipalTest.java
b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/CachedGroupPrincipalTest.java
index 1d7d5bf397..88cd4362d8 100644
---
a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/CachedGroupPrincipalTest.java
+++
b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/CachedGroupPrincipalTest.java
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.AbstractSecurityTest;
import org.apache.jackrabbit.oak.api.ContentSession;
import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.jdkcompat.Java23Subject;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
@@ -78,7 +79,7 @@ public class CachedGroupPrincipalTest extends
AbstractSecurityTest {
// a) force the cache to be created
pp = new UserPrincipalProvider(systemRoot, getUserConfiguration(),
namePathMapper);
- Iterable<? extends Principal> principals =
Iterables.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
+ Iterable<? extends Principal> principals =
IterableUtils.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
for (Principal p : principals) {
String className = p.getClass().getName();
assertEquals("org.apache.jackrabbit.oak.security.user.UserPrincipalProvider$GroupPrincipalImpl",
className);
@@ -123,7 +124,7 @@ public class CachedGroupPrincipalTest extends
AbstractSecurityTest {
// b) retrieve principals again (this time from the cache)
// -> verify that they are a different implementation
- Iterable<? extends Principal> principalsAgain =
Iterables.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
+ Iterable<? extends Principal> principalsAgain =
IterableUtils.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
for (Principal p : principalsAgain) {
String className = p.getClass().getName();
assertEquals("org.apache.jackrabbit.oak.security.user.UserPrincipalProvider$CachedGroupPrincipal",
className);
@@ -152,7 +153,7 @@ public class CachedGroupPrincipalTest extends
AbstractSecurityTest {
// b) retrieve principals again (this time from the cache)
// principal for 'testGroup' is no longer backed by an user mgt
group
// verify that this doesn't lead to runtime exceptions
- Iterable<? extends Principal> principalsAgain =
Iterables.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
+ Iterable<? extends Principal> principalsAgain =
IterableUtils.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
for (Principal p : principalsAgain) {
String className = p.getClass().getName();
assertEquals("org.apache.jackrabbit.oak.security.user.UserPrincipalProvider$CachedGroupPrincipal",
className);
@@ -186,7 +187,7 @@ public class CachedGroupPrincipalTest extends
AbstractSecurityTest {
// b) retrieve principals again (this time from the cache)
// principal for 'testGroup' is no longer backed by an user mgt
group
// verify that this doesn't lead to runtime exceptions
- Iterable<? extends Principal> principalsAgain =
Iterables.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
+ Iterable<? extends Principal> principalsAgain =
IterableUtils.filter(pp.getPrincipals(userId), new GroupPredicate()::test);
for (Principal p : principalsAgain) {
String className = p.getClass().getName();
assertEquals("org.apache.jackrabbit.oak.security.user.UserPrincipalProvider$CachedGroupPrincipal",
className);
@@ -215,7 +216,7 @@ public class CachedGroupPrincipalTest extends
AbstractSecurityTest {
// b) retrieve principals again (this time from the cache)
// principal for 'testGroup' is no longer backed by an user mgt
group
// verify that this doesn't lead to runtime exceptions
- Iterable<? extends Principal> principalsAgain =
Iterables.filter(provider.getPrincipals(userId), new GroupPredicate()::test);
+ Iterable<? extends Principal> principalsAgain =
IterableUtils.filter(provider.getPrincipals(userId), new
GroupPredicate()::test);
for (Principal p : principalsAgain) {
String className = p.getClass().getName();
assertEquals("org.apache.jackrabbit.oak.security.user.UserPrincipalProvider$CachedGroupPrincipal",
className);
diff --git
a/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
b/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
index 827d5f03cd..7f4d045281 100644
---
a/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
+++
b/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.jackrabbit.oak.composite;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
import static
org.apache.jackrabbit.oak.plugins.index.IndexUtils.createIndexDefinition;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -651,13 +650,13 @@ public class CompositeNodeStoreTest {
deepMountBuilder.child("new").setProperty("store", "deepMounted",
Type.STRING);
deepMountedStore.merge(deepMountBuilder, EmptyHook.INSTANCE,
CommitInfo.EMPTY);
- List<ChildNodeEntry> children =
ListUtils.toList(filter(store.getRoot().getChildNodeEntries(),
+ List<ChildNodeEntry> children =
ListUtils.toList(IterableUtils.filter(store.getRoot().getChildNodeEntries(),
x -> Objects.equals(x == null ? null : x.getName(), "new")));
assertEquals(1, children.size());
assertEquals("global",
children.get(0).getNodeState().getString("store"));
NodeBuilder rootBuilder = store.getRoot().builder();
- List<String> childNames =
ListUtils.toList(filter(rootBuilder.getChildNodeNames(),
+ List<String> childNames =
ListUtils.toList(IterableUtils.filter(rootBuilder.getChildNodeNames(),
x -> Objects.equals(x, "new")));
assertEquals(1, childNames.size());
assertEquals("global",
rootBuilder.getChildNode("new").getString("store"));
diff --git
a/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
b/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
index 4ef445b44b..a29d10a2ae 100644
--- a/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
+++ b/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ImporterImpl.java
@@ -44,6 +44,7 @@ import org.apache.jackrabbit.oak.api.Root;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
import org.apache.jackrabbit.oak.jcr.security.AccessManager;
@@ -296,7 +297,7 @@ public class ImporterImpl implements Importer {
}
private Iterable<ProtectedPropertyImporter> getPropertyImporters() {
- return Iterables.filter(Iterables.transform(pItemImporters, importer
-> {
+ return IterableUtils.filter(Iterables.transform(pItemImporters,
importer -> {
if (importer instanceof ProtectedPropertyImporter) {
return (ProtectedPropertyImporter) importer;
} else {
@@ -306,7 +307,7 @@ public class ImporterImpl implements Importer {
}
private Iterable<ProtectedNodeImporter> getNodeImporters() {
- return Iterables.filter(Iterables.transform(pItemImporters, importer
-> {
+ return IterableUtils.filter(Iterables.transform(pItemImporters,
importer -> {
if (importer instanceof ProtectedNodeImporter) {
return (ProtectedNodeImporter) importer;
} else {
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcher.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcher.java
index ea11e914a3..ae85bff50a 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcher.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/BucketSwitcher.java
@@ -24,6 +24,7 @@ import java.util.Objects;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import static
org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_ASYNC_INDEXED_TO_TIME_AT_SWITCH;
@@ -97,7 +98,7 @@ class BucketSwitcher {
public Iterable<String> getOldBuckets() {
String head = builder.getString(PROP_HEAD_BUCKET);
String previous = builder.getString(PROP_PREVIOUS_BUCKET);
- return Iterables.filter(builder.getChildNodeNames(),
+ return IterableUtils.filter(builder.getChildNodeNames(),
name -> !Objects.equals(name, head) && !Objects.equals(name,
previous)
);
}
diff --git
a/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
b/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
index 6e6f5ab0c0..291e519109 100644
---
a/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
+++
b/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
@@ -164,7 +164,7 @@ public final class PrivilegeBitsProvider implements
PrivilegeConstants {
*/
@NotNull
public PrivilegeBits getBits(@NotNull Privilege[] privileges, @NotNull
final NameMapper nameMapper) {
- return
getBits(Iterables.filter(Iterables.transform(Arrays.asList(privileges),
+ return
getBits(IterableUtils.filter(Iterables.transform(Arrays.asList(privileges),
privilege ->
nameMapper.getOakNameOrNull(privilege.getName())), x -> x != null));
}
diff --git
a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
index 3062176188..4d36727060 100644
---
a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
+++
b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/CompositePrincipalProviderTest.java
@@ -137,7 +137,7 @@ public class CompositePrincipalProviderTest {
@Test
public void findPrincipalsByTypeGroup() {
- Iterable<? extends Principal> expected =
IterableUtils.chainedIterable(Set.of(EveryonePrincipal.getInstance()),
Iterables.filter(testPrincipals(),
+ Iterable<? extends Principal> expected =
IterableUtils.chainedIterable(Set.of(EveryonePrincipal.getInstance()),
IterableUtils.filter(testPrincipals(),
input -> input instanceof GroupPrincipal));
Iterator<? extends Principal> result =
cpp.findPrincipals(PrincipalManager.SEARCH_TYPE_GROUP);
@@ -146,7 +146,7 @@ public class CompositePrincipalProviderTest {
@Test
public void findPrincipalsByTypeNotGroup() {
- Iterable<? extends Principal> expected =
Iterables.filter(testPrincipals(), input -> !(input instanceof GroupPrincipal));
+ Iterable<? extends Principal> expected =
IterableUtils.filter(testPrincipals(), input -> !(input instanceof
GroupPrincipal));
Iterator<? extends Principal> result =
cpp.findPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
assertIterator(expected, result);
diff --git
a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/TestPrincipalProvider.java
b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/TestPrincipalProvider.java
index 9cdc01776a..d1e2e5d8db 100644
---
a/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/TestPrincipalProvider.java
+++
b/oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/principal/TestPrincipalProvider.java
@@ -32,6 +32,7 @@ import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
import org.apache.jackrabbit.api.security.principal.PrincipalManager;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -135,7 +136,7 @@ public final class TestPrincipalProvider implements
PrincipalProvider {
@NotNull
@Override
public Iterator<? extends Principal> findPrincipals(@Nullable String
nameHint, int searchType) {
- return Iterables.filter(all(), new SearchTypePredicate(nameHint,
searchType)::test).iterator();
+ return IterableUtils.filter(all(), new SearchTypePredicate(nameHint,
searchType)::test).iterator();
}
@NotNull
diff --git
a/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/CompositeNodeStore.java
b/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/CompositeNodeStore.java
index 4c0cbbed9b..557d3a51a3 100644
---
a/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/CompositeNodeStore.java
+++
b/oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/CompositeNodeStore.java
@@ -21,6 +21,7 @@ import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.StreamUtils;
import org.apache.jackrabbit.oak.composite.checks.NodeStoreChecks;
import org.apache.jackrabbit.oak.spi.commit.ChangeDispatcher;
@@ -57,8 +58,6 @@ import java.util.stream.Collectors;
import static
org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
-
import static java.lang.System.currentTimeMillis;
import static
org.apache.jackrabbit.oak.composite.ModifiedPathDiff.getModifiedPaths;
@@ -206,7 +205,7 @@ public class CompositeNodeStore implements NodeStore,
PrefetchNodeStore, Observa
public Iterable<String> checkpoints() {
final NodeStore globalNodeStore = ctx.getGlobalStore().getNodeStore();
- return filter(globalNodeStore.checkpoints(),
+ return IterableUtils.filter(globalNodeStore.checkpoints(),
checkpoint -> isCompositeCheckpoint(checkpoint));
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
index 1198a2ddf7..dbd226a000 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.plugins.document;
import static
org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import java.lang.ref.ReferenceQueue;
@@ -272,7 +271,7 @@ class Branch {
if (!commits.containsKey(r)) {
return Collections.emptyList();
}
- Iterable<Iterable<Path>> paths = transform(filter(commits.entrySet(),
+ Iterable<Iterable<Path>> paths =
transform(IterableUtils.filter(commits.entrySet(),
new Predicate<Map.Entry<Revision, BranchCommit>>() {
@Override
public boolean test(Map.Entry<Revision, BranchCommit> input) {
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
index af50297d88..398a8528d1 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
@@ -30,6 +30,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
import org.apache.jackrabbit.oak.commons.json.JsopStream;
import org.apache.jackrabbit.oak.commons.json.JsopWriter;
@@ -42,7 +43,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static java.util.Collections.singletonList;
import static org.apache.jackrabbit.oak.plugins.document.Collection.JOURNAL;
@@ -889,7 +889,7 @@ public class Commit {
}
private static boolean hasContentChanges(UpdateOp op) {
- return filter(transform(op.getChanges().keySet(),
- input -> input.getName()),
Utils.PROPERTY_OR_DELETED::test).iterator().hasNext();
+ return IterableUtils.filter(transform(op.getChanges().keySet(),
+ Key::getName),
Utils.PROPERTY_OR_DELETED::test).iterator().hasNext();
}
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
index d5efb8b011..ee0417f2b5 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
@@ -253,7 +253,7 @@ public class DocumentNodeState extends
AbstractDocumentNodeState implements Cach
//Filter out the meta properties related to bundling from
//generic listing of props
if (bundlingContext.isBundled()){
- return Iterables.filter(properties.values(),
BundlorUtils.NOT_BUNDLOR_PROPS::test);
+ return IterableUtils.filter(properties.values(),
BundlorUtils.NOT_BUNDLOR_PROPS::test);
}
return properties.values();
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
index c925f9bb03..8dd74d01ae 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
@@ -2231,7 +2231,7 @@ public final class DocumentNodeStore
public Iterable<String> checkpoints() {
checkOpen();
final long now = clock.getTime();
- return
Iterables.transform(Iterables.filter(checkpoints.getCheckpoints().entrySet(),
+ return
Iterables.transform(IterableUtils.filter(checkpoints.getCheckpoints().entrySet(),
cp -> cp.getValue().getExpiryTime() > now),
cp -> cp.getKey().toString());
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreMBeanImpl.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreMBeanImpl.java
index 85df9cce9f..821897bb69 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreMBeanImpl.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreMBeanImpl.java
@@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory;
import static
org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
/**
@@ -87,21 +86,21 @@ final class DocumentNodeStoreMBeanImpl extends
AnnotatedStandardMBean implements
@Override
public String[] getInactiveClusterNodes() {
- return IterableUtils.toArray(transform(filter(clusterNodes,
+ return
IterableUtils.toArray(transform(IterableUtils.filter(clusterNodes,
input -> !input.isActive()),
input -> input.getClusterId() + "=" + input.getCreated()),
String.class);
}
@Override
public String[] getActiveClusterNodes() {
- return IterableUtils.toArray(transform(filter(clusterNodes,
+ return
IterableUtils.toArray(transform(IterableUtils.filter(clusterNodes,
input -> input.isActive()),
input -> input.getClusterId() + "=" +
input.getLeaseEndTime()), String.class);
}
@Override
public String[] getLastKnownRevisions() {
- return
IterableUtils.toArray(transform(filter(nodeStore.getHeadRevision(),
+ return
IterableUtils.toArray(transform(IterableUtils.filter(nodeStore.getHeadRevision(),
input -> input.getClusterId() != getClusterId()),
input -> input.getClusterId() + "=" + input.toString()),
String.class);
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
index d1cc48a579..863a80d47f 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
@@ -18,7 +18,6 @@
*/
package org.apache.jackrabbit.oak.plugins.document;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static java.util.Collections.singletonList;
import static org.apache.jackrabbit.oak.plugins.document.util.Utils.asISO8601;
@@ -45,6 +44,7 @@ import java.util.stream.Collectors;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.commons.TimeDurationFormatter;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.MapUtils;
import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier;
import org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlor;
@@ -776,7 +776,7 @@ public class LastRevRecoveryAgent {
* @return the recovery candidate nodes.
*/
public Iterable<Integer> getRecoveryCandidateNodes() {
- return Iterables.transform(filter(missingLastRevUtil.getAllClusters(),
+ return
Iterables.transform(IterableUtils.filter(missingLastRevUtil.getAllClusters(),
input ->revisionContext.getClusterId() != input.getClusterId()
&&
input.isRecoveryNeeded(revisionContext.getClock().getTime())),
ClusterNodeInfoDocument::getClusterId);
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java
index 94d160445b..1922c7d733 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java
@@ -17,7 +17,6 @@
package org.apache.jackrabbit.oak.plugins.document;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static
org.apache.jackrabbit.oak.plugins.document.util.Utils.COMMITROOT_OR_REVISIONS;
@@ -135,7 +134,7 @@ final class MissingBcSweeper2 {
private Iterable<Map.Entry<Path, UpdateOp>> sweepOperations(
final Iterable<NodeDocument> docs) {
- return filter(transform(docs,
+ return IterableUtils.filter(transform(docs,
new Function<NodeDocument, Map.Entry<Path, UpdateOp>>() {
int yieldCnt = 0;
@@ -170,7 +169,7 @@ final class MissingBcSweeper2 {
// as that's what was left out by the original sweep1:
// - COMMITROOT : for new child (parent)
// - REVISIONS : for commit roots (root for branch commits)
- for (String property : filter(doc.keySet(),
COMMITROOT_OR_REVISIONS::test)) {
+ for (String property : IterableUtils.filter(doc.keySet(),
COMMITROOT_OR_REVISIONS::test)) {
Map<Revision, String> valueMap = doc.getLocalMap(property);
for (Map.Entry<Revision, String> entry : valueMap.entrySet()) {
Revision rev = entry.getKey();
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
index fc9b38326e..0e113fe896 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.plugins.document;
import java.util.stream.StreamSupport;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.apache.jackrabbit.oak.stats.Clock;
import org.jetbrains.annotations.NotNull;
@@ -82,7 +83,7 @@ public class MissingLastRevSeeker {
// Fetch all documents where lastmod >= startTime
Iterable<NodeDocument> nodes = getSelectedDocuments(store,
MODIFIED_IN_SECS, getModifiedInSecs(startTime));
- return Iterables.filter(nodes, input -> {
+ return IterableUtils.filter(nodes, input -> {
Long modified = (Long) input.get(MODIFIED_IN_SECS);
Long sdType = (Long) input.get(SD_TYPE);
return (modified != null && (modified >=
getModifiedInSecs(startTime)) && sdType == null);
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
index 447b82e44b..01d87b61ed 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.plugins.document;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toSet;
import static
org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.mergeSorted;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
@@ -1402,7 +1401,7 @@ public final class NodeDocument extends Document {
}
// didn't find entry -> scan through remaining head ranges
- return
filter(transform(getPreviousRanges().headMap(revision).entrySet(), input -> {
+ return
IterableUtils.filter(transform(getPreviousRanges().headMap(revision).entrySet(),
input -> {
if (input.getValue().includes(revision)) {
return getPreviousDoc(input.getKey(), input.getValue());
}
@@ -1646,7 +1645,7 @@ public final class NodeDocument extends Document {
if (propRevFound != null) {
propRevFound.set(true);
}
- changes.add(filter(localChanges.entrySet(), p::test));
+ changes.add(IterableUtils.filter(localChanges.entrySet(),
p::test));
}
for (Revision r : readRevision) {
@@ -1819,7 +1818,7 @@ public final class NodeDocument extends Document {
} else {
changes =
IterableUtils.chainedIterable(transform(List.copyOf(ranges),
rangeToChanges::apply));
}
- return filter(changes, input ->
!readRev.isRevisionNewer(input.getKey()));
+ return IterableUtils.filter(changes, input ->
!readRev.isRevisionNewer(input.getKey()));
}
/**
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java
index cf76ae8f78..2ff54f551c 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java
@@ -32,7 +32,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static
org.apache.jackrabbit.oak.plugins.document.NodeDocument.isDeletedEntry;
import static
org.apache.jackrabbit.oak.plugins.document.NodeDocument.removeCommitRoot;
@@ -163,7 +162,7 @@ final class NodeDocumentSweeper {
private Iterable<Map.Entry<Path, UpdateOp>> sweepOperations(
final Iterable<NodeDocument> docs) {
- return filter(transform(docs, doc -> new
SimpleImmutableEntry<>(doc.getPath(), sweepOne(doc))),
+ return IterableUtils.filter(transform(docs, doc -> new
SimpleImmutableEntry<>(doc.getPath(), sweepOne(doc))),
input -> input.getValue() != null);
}
@@ -174,7 +173,7 @@ final class NodeDocumentSweeper {
// - DELETED : for new node (this)
// - COMMITROOT : for new child (parent)
// - REVISIONS : for commit roots (root for branch commits)
- for (String property : filter(doc.keySet(),
SWEEP_ONE_PREDICATE::test)) {
+ for (String property : IterableUtils.filter(doc.keySet(),
SWEEP_ONE_PREDICATE::test)) {
Map<Revision, String> valueMap = doc.getLocalMap(property);
for (Map.Entry<Revision, String> entry : valueMap.entrySet()) {
Revision rev = entry.getKey();
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PropertyHistory.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PropertyHistory.java
index 967a1b3d6d..025fcef457 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PropertyHistory.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PropertyHistory.java
@@ -17,7 +17,6 @@
package org.apache.jackrabbit.oak.plugins.document;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static java.util.AbstractMap.SimpleImmutableEntry;
@@ -28,6 +27,7 @@ import java.util.TreeMap;
import org.apache.jackrabbit.guava.common.collect.AbstractIterator;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.guava.common.collect.PeekingIterator;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
@@ -55,7 +55,7 @@ class PropertyHistory implements Iterable<NodeDocument> {
@Override
public Iterator<NodeDocument> iterator() {
- return
ensureOrder(filter(transform(doc.getPreviousRanges().entrySet(), input -> {
+ return
ensureOrder(IterableUtils.filter(transform(doc.getPreviousRanges().entrySet(),
input -> {
Revision r = input.getKey();
int h = input.getValue().height;
String prevId = Utils.getPreviousIdFor(mainPath, r, h);
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
index b8a6f184aa..231383f28b 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
@@ -115,9 +115,9 @@ class UnsavedModifications {
if (map.isEmpty()) {
return Collections.emptyList();
} else {
- return Iterables.transform(Iterables.filter(map.entrySet(),
+ return Iterables.transform(IterableUtils.filter(map.entrySet(),
input ->start.compareRevisionTime(input.getValue()) < 1),
- input -> input.getKey());
+ Map.Entry::getKey);
}
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
index e6cbe73a7a..a66c26261d 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
@@ -24,7 +24,6 @@ import static java.util.Optional.empty;
import static java.util.Optional.of;
import static java.util.Optional.ofNullable;
import static java.util.stream.Stream.concat;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static java.util.stream.Collectors.toList;
import static org.apache.jackrabbit.oak.plugins.document.Document.ID;
import static
org.apache.jackrabbit.oak.plugins.document.NodeDocument.MIN_ID_VALUE;
@@ -43,6 +42,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType;
import
org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.VersionGCStats;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
@@ -184,7 +184,7 @@ public class VersionGCSupport {
protected Iterable<NodeDocument> identifyGarbage(final Set<SplitDocType>
gcTypes,
final RevisionVector
sweepRevs,
final long
oldestRevTimeStamp) {
- return filter(getAllDocuments(store),
+ return IterableUtils.filter(getAllDocuments(store),
doc -> gcTypes.contains(doc.getSplitDocType())
&& doc.hasAllRevisionLessThan(oldestRevTimeStamp)
&& !isDefaultNoBranchSplitNewerThan(doc, sweepRevs));
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
index 2e3bf96102..971deace28 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
@@ -61,6 +61,7 @@ import com.mongodb.client.model.CreateCollectionOptions;
import
org.apache.jackrabbit.guava.common.util.concurrent.UncheckedExecutionException;
import org.apache.jackrabbit.oak.cache.CacheStats;
import org.apache.jackrabbit.oak.cache.CacheValue;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
import org.apache.jackrabbit.oak.commons.collections.MapUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
@@ -120,7 +121,6 @@ import com.mongodb.client.result.UpdateResult;
import static java.util.Objects.isNull;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.stream.Collectors.toList;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static com.mongodb.client.model.Projections.include;
import static java.lang.Integer.MAX_VALUE;
import static java.util.Collections.emptyList;
@@ -526,7 +526,7 @@ public class MongoDocumentStore implements DocumentStore {
result.queryCount++;
int invalidated = nodesCache.invalidateOutdated(modStamps);
- for (String id : filter(ids, x ->
!modStamps.keySet().contains(x))) {
+ for (String id : IterableUtils.filter(ids, x ->
!modStamps.keySet().contains(x))) {
nodesCache.invalidate(id);
invalidated++;
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
index 6568238ba1..74c807e233 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
@@ -26,7 +26,6 @@ import static com.mongodb.client.model.Projections.include;
import static com.mongodb.client.model.Sorts.ascending;
import static java.util.Optional.empty;
import static java.util.Optional.ofNullable;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static com.mongodb.client.model.Filters.and;
import static com.mongodb.client.model.Filters.lt;
@@ -348,7 +347,7 @@ public class MongoVersionGCSupport extends VersionGCSupport
{
// of the query as part of OAK-8351 does), it nevertheless
// makes any future similar problem more visible than long running
// queries alone (15min is still long).
- Iterable<NodeDocument> iterable =
filter(transform(getNodeCollection().find(query)
+ Iterable<NodeDocument> iterable =
IterableUtils.filter(transform(getNodeCollection().find(query)
.maxTime(15, TimeUnit.MINUTES).hint(hint),
input -> store.convertFromDBObject(NODES, input)),
input -> !isDefaultNoBranchSplitNewerThan(input,
sweepRevs));
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/NodeCache.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/NodeCache.java
index 07d37ad102..d9a61b1c52 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/NodeCache.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/NodeCache.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.document.persistentCache;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static java.util.Collections.singleton;
import static org.apache.jackrabbit.guava.common.cache.RemovalCause.COLLECTED;
import static org.apache.jackrabbit.guava.common.cache.RemovalCause.EXPIRED;
@@ -36,6 +35,7 @@ import org.apache.jackrabbit.guava.common.cache.CacheStats;
import org.apache.jackrabbit.guava.common.cache.RemovalCause;
import org.apache.jackrabbit.guava.common.collect.ImmutableMap;
import org.apache.jackrabbit.oak.cache.CacheValue;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.DocumentStore;
import
org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache.GenerationCache;
@@ -250,7 +250,7 @@ class NodeCache<K extends CacheValue, V extends CacheValue>
Iterable<K> typedKeys = (Iterable<K>) keys;
memCacheMetadata.incrementAll(keys);
ImmutableMap<K, V> result = memCache.getAllPresent(keys);
- memCacheMetadata.removeAll(filter(typedKeys, x ->
!result.keySet().contains(x)));
+ memCacheMetadata.removeAll(IterableUtils.filter(typedKeys, x ->
!result.keySet().contains(x)));
return result;
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
index b0ab1efba8..d177c29cbb 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.document.rdb;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
-
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
@@ -105,7 +103,7 @@ public class RDBVersionGCSupport extends VersionGCSupport {
private Iterable<NodeDocument> identifyGarbageMode1(final
Set<SplitDocType> gcTypes, final RevisionVector sweepRevs,
final long oldestRevTimeStamp) {
- return filter(getSplitDocuments(), getGarbageCheckPredicate(gcTypes,
sweepRevs, oldestRevTimeStamp)::test);
+ return IterableUtils.filter(getSplitDocuments(),
getGarbageCheckPredicate(gcTypes, sweepRevs, oldestRevTimeStamp)::test);
}
private Predicate<NodeDocument> getGarbageCheckPredicate(final
Set<SplitDocType> gcTypes, final RevisionVector sweepRevs,
@@ -161,7 +159,7 @@ public class RDBVersionGCSupport extends VersionGCSupport {
final CountingPredicate<NodeDocument> cp1 = new
CountingPredicate<NodeDocument>(name1, pred);
final CountingPredicate<NodeDocument> cp2 = new
CountingPredicate<NodeDocument>(name2, pred);
- return
CloseableIterable.wrap(IterableUtils.chainedIterable(Iterables.filter(fit1,
cp1::test), Iterables.filter(fit2, cp2::test)),
+ return
CloseableIterable.wrap(IterableUtils.chainedIterable(IterableUtils.filter(fit1,
cp1::test), IterableUtils.filter(fit2, cp2::test)),
new Closeable() {
@Override
public void close() throws IOException {
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
index 3e72bcce08..443ecab4c1 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
@@ -155,7 +155,7 @@ public class DelegatingDocumentNodeState extends
AbstractDocumentNodeState {
@NotNull
@Override
public Iterable<? extends PropertyState> getProperties() {
- return Iterables.filter(delegate.getProperties(),
NOT_META_PROPS::test);
+ return IterableUtils.filter(delegate.getProperties(),
NOT_META_PROPS::test);
}
@Override
diff --git
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoVersionGCSupportDefaultNoBranchTest.java
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoVersionGCSupportDefaultNoBranchTest.java
index d37b0ba339..6d350b0f5d 100644
---
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoVersionGCSupportDefaultNoBranchTest.java
+++
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoVersionGCSupportDefaultNoBranchTest.java
@@ -283,8 +283,8 @@ public class MongoVersionGCSupportDefaultNoBranchTest {
Iterable<NodeDocument> garbage = gcSupport1.identifyGarbage(GC_TYPES,
sweepRevs, oldestRevTimeStamp);
assertNotNull(garbage);
assertEquals(totalSplits, IterableUtils.size(garbage));
- assertEquals(numSplit1, IterableUtils.size(Iterables.filter(garbage,
splitDocsWithClusterId(1)::test)));
- assertEquals(numSplit2, IterableUtils.size(Iterables.filter(garbage,
splitDocsWithClusterId(2)::test)));
+ assertEquals(numSplit1,
IterableUtils.size(IterableUtils.filter(garbage,
splitDocsWithClusterId(1)::test)));
+ assertEquals(numSplit2,
IterableUtils.size(IterableUtils.filter(garbage,
splitDocsWithClusterId(2)::test)));
Stats stats = deleteSplitDocuments(gcSupport1, sweepRevs,
oldestRevTimeStamp);
assertNotNull(stats);
diff --git
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
index f51cdaa51f..1165848ce0 100644
---
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
+++
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
@@ -53,7 +53,6 @@ import static
org.apache.commons.lang3.reflect.FieldUtils.readField;
import static org.apache.commons.lang3.reflect.FieldUtils.writeField;
import static org.apache.commons.lang3.reflect.FieldUtils.writeStaticField;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.apache.jackrabbit.oak.api.Type.NAME;
@@ -3540,7 +3539,7 @@ public class VersionGarbageCollectorIT {
VersionGCSupport gcSupport = new
VersionGCSupport(store1.getDocumentStore()) {
@Override
public Iterable<NodeDocument> getPossiblyDeletedDocs(long
fromModified, long toModified) {
- return filter(super.getPossiblyDeletedDocs(fromModified,
toModified),
+ return
IterableUtils.filter(super.getPossiblyDeletedDocs(fromModified, toModified),
input -> {
try {
docs.put(input);
@@ -3773,7 +3772,7 @@ public class VersionGarbageCollectorIT {
VersionGCSupport nonReportingGcSupport = new
VersionGCSupport(store1.getDocumentStore()) {
@Override
public Iterable<NodeDocument> getPossiblyDeletedDocs(final long
fromModified, long toModified) {
- return
filter(fixtureGCSupport.getPossiblyDeletedDocs(fromModified, toModified),
+ return
IterableUtils.filter(fixtureGCSupport.getPossiblyDeletedDocs(fromModified,
toModified),
input -> {
docCounter.incrementAndGet();
// don't report any doc to be GC'able
diff --git
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
index 17787df118..1a92362d71 100644
---
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
+++
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ModifiedNodeState.java
@@ -18,8 +18,6 @@ package org.apache.jackrabbit.oak.plugins.memory;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
-
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static
org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry.iterable;
@@ -27,6 +25,7 @@ import static
org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry.iter
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
@@ -164,8 +163,8 @@ public class ModifiedNodeState extends AbstractNodeState {
Predicate<PropertyState> predicate =
x -> !keys.contains(x == null ? null : x.getName());
return IterableUtils.chainedIterable(
- filter(base.getProperties(), predicate::test),
- filter(properties.values(), x -> x != null));
+ IterableUtils.filter(base.getProperties(),
predicate::test),
+ IterableUtils.filter(properties.values(),
Objects::nonNull));
}
}
@@ -214,7 +213,7 @@ public class ModifiedNodeState extends AbstractNodeState {
}
final Set<String> keys = nodes.keySet();
return IterableUtils.chainedIterable(
- filter(base.getChildNodeNames(), x -> !keys.contains(x)),
+ IterableUtils.filter(base.getChildNodeNames(), x ->
!keys.contains(x)),
MapUtils.filterValues(nodes, NodeState.EXISTS).keySet());
}
}
@@ -347,7 +346,7 @@ public class ModifiedNodeState extends AbstractNodeState {
Predicate<ChildNodeEntry> predicate =
x -> !keys.contains(x == null ? null : x.getName());
return IterableUtils.chainedIterable(
- filter(base.getChildNodeEntries(), predicate::test),
+ IterableUtils.filter(base.getChildNodeEntries(),
predicate::test),
iterable(MapUtils.filterValues(nodes,
NodeState.EXISTS).entrySet()));
}
}
diff --git
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
index b3feadc3de..7c4c6dce27 100644
---
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
+++
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java
@@ -19,7 +19,6 @@
package org.apache.jackrabbit.oak.spi.commit;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import java.io.Closeable;
import java.lang.Thread.UncaughtExceptionHandler;
@@ -235,13 +234,13 @@ public class BackgroundObserver implements Observer,
Closeable {
@Override
public int getLocalEventCount() {
- return IterableUtils.size(filter(queue,
+ return IterableUtils.size(IterableUtils.filter(queue,
input -> !input.info.isExternal()));
}
@Override
public int getExternalEventCount() {
- return IterableUtils.size(filter(queue,
+ return IterableUtils.size(IterableUtils.filter(queue,
input -> input.info.isExternal()));
}
};
diff --git
a/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/SameNameSiblingsEditor.java
b/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/SameNameSiblingsEditor.java
index 381903e670..da97f02ec4 100644
---
a/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/SameNameSiblingsEditor.java
+++
b/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/SameNameSiblingsEditor.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.upgrade;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
import static org.apache.jackrabbit.JcrConstants.JCR_SAMENAMESIBLINGS;
import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
@@ -34,6 +33,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
import org.apache.jackrabbit.oak.spi.commit.DefaultEditor;
@@ -160,7 +160,7 @@ public class SameNameSiblingsEditor extends DefaultEditor {
* @return a list of names of children accepting the predicate
*/
private static Iterable<String> filterChildren(NodeState parent, final
Predicate<NodeState> predicate) {
- return transform(filter(parent.getChildNodeEntries(),
+ return transform(IterableUtils.filter(parent.getChildNodeEntries(),
input -> predicate.test(input.getNodeState())),
input -> input.getName());
}