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 3c4f4c4e47 OAK-11451 : removed usage of Guava Iterables.concat (#2049)
3c4f4c4e47 is described below
commit 3c4f4c4e478f125b680612f6c6b3a5b0d833a097
Author: Rishabh Kumar <[email protected]>
AuthorDate: Wed Feb 19 22:57:04 2025 +0530
OAK-11451 : removed usage of Guava Iterables.concat (#2049)
* OAK-11451 : removed usage of Guava Iterables.concat
* OAK-11451 : fixed test failure caused due to collecting element into list
via Stream
* OAK-11451 : fixed test failure because streams can't be used twice
* OAK-11451 : reverted code changes for Iterables.concat with
Iterable<Iterable<E>>
* OAK-11451 : reverted code changes for Iterables.concat with
Iterable<Iterable<E>> from oak-segment
* OAK-11451 : reverted unused imports
* OAK-11451 : removed usage of Guava Iterables.concat with oak-commons
IterableUtils
---------
Co-authored-by: Rishabh Kumar <[email protected]>
---
.../authentication/external/impl/ExternalLoginModule.java | 3 ++-
.../impl/principal/ExternalGroupPrincipalProvider.java | 2 +-
.../impl/PrincipalBasedAccessControlManager.java | 3 ++-
.../authorization/principalbased/PrinicipalBasedReadTest.java | 3 ++-
.../oak/plugins/index/nodetype/NodeTypeIndexLookup.java | 3 ++-
.../oak/plugins/index/property/PropertyIndexLookup.java | 2 +-
.../oak/plugins/index/property/PropertyIndexPlan.java | 4 ++--
.../jackrabbit/oak/plugins/index/reference/ReferenceIndex.java | 3 ++-
.../oak/plugins/migration/AbstractDecoratedNodeState.java | 4 +++-
.../oak/plugins/migration/version/VersionHistoryUtil.java | 4 ++--
.../jackrabbit/oak/plugins/nodetype/EffectiveNodeTypeImpl.java | 3 ++-
.../apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java | 3 +--
.../oak/security/authentication/token/TokenLoginModule.java | 3 ++-
.../oak/security/authentication/user/LoginModuleImpl.java | 3 ++-
.../oak/security/authorization/AuthorizationContext.java | 3 ++-
.../oak/security/internal/SecurityProviderRegistration.java | 3 ++-
.../oak/plugins/index/lucene/LuceneIndexNodeManager.java | 3 ++-
.../oak/plugins/index/lucene/LucenePropertyIndex.java | 3 ++-
.../oak/plugins/index/lucene/hybrid/LuceneDocumentHolder.java | 3 ++-
.../index/lucene/property/HybridPropertyIndexLookup.java | 3 ++-
.../index/lucene/property/UniquenessConstraintValidator.java | 3 ++-
.../oak/plugins/index/lucene/util/IndexDefinitionBuilder.java | 3 ++-
.../plugins/index/lucene/writer/MultiplexingIndexWriter.java | 10 +++++-----
.../oak/index/indexer/document/NodeStateEntryTraverser.java | 4 ++--
.../main/java/org/apache/jackrabbit/oak/run/cli/Options.java | 3 ++-
.../plugins/index/search/spi/editor/FulltextDocumentMaker.java | 3 ++-
.../plugins/index/search/spi/editor/FulltextIndexEditor.java | 3 ++-
.../oak/plugins/index/search/util/IndexDefinitionBuilder.java | 3 ++-
.../jackrabbit/oak/spi/security/CompositeConfiguration.java | 3 ++-
.../main/java/org/apache/jackrabbit/oak/segment/MapRecord.java | 6 +++---
.../org/apache/jackrabbit/oak/plugins/document/Branch.java | 5 +++--
.../apache/jackrabbit/oak/plugins/document/NodeDocument.java | 3 ++-
.../jackrabbit/oak/plugins/document/TieredDiffCache.java | 3 ++-
.../oak/plugins/document/cache/NodeDocumentCache.java | 5 +++--
.../oak/plugins/document/mongo/MongoVersionGCSupport.java | 4 ++--
.../oak/plugins/document/rdb/RDBVersionGCSupport.java | 3 ++-
.../jackrabbit/oak/plugins/memory/ModifiedNodeState.java | 9 +++++----
.../java/org/apache/jackrabbit/oak/spi/commit/MoveTracker.java | 4 +++-
38 files changed, 84 insertions(+), 54 deletions(-)
diff --git
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModule.java
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModule.java
index 723e4d1030..9239ebdac6 100644
---
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModule.java
+++
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModule.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.spi.security.authentication.external.impl;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.base.Stopwatch;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.user.UserManager;
@@ -457,7 +458,7 @@ public class ExternalLoginModule extends
AbstractLoginModule {
if (creds != null) {
attributes.putAll(credentialsSupport.getAttributes(creds));
}
- return new AuthInfoImpl(userId, attributes,
Iterables.concat(principals, subject.getPrincipals()));
+ return new AuthInfoImpl(userId, attributes,
IterableUtils.chainedIterable(principals, subject.getPrincipals()));
}
@NotNull
diff --git
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProvider.java
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProvider.java
index 89817f4009..c99e3e907d 100644
---
a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProvider.java
+++
b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalGroupPrincipalProvider.java
@@ -166,7 +166,7 @@ class ExternalGroupPrincipalProvider implements
PrincipalProvider, ExternalIdent
this.hasOnlyDynamicGroups = hasOnlyDynamicGroups;
autoMembershipPrincipals = new AutoMembershipPrincipals(userManager,
- Collections.singletonMap(idpName,
Iterables.toArray(Iterables.concat(syncConfig.user().getAutoMembership(),syncConfig.group().getAutoMembership()),
String.class)),
+ Collections.singletonMap(idpName,
Iterables.toArray(IterableUtils.chainedIterable(syncConfig.user().getAutoMembership(),syncConfig.group().getAutoMembership()),
String.class)),
Collections.singletonMap(idpName,
syncConfig.user().getAutoMembershipConfig()));
groupAutoMembershipPrincipals = (idpNamesWithDynamicGroups.isEmpty())
? null :
new AutoMembershipPrincipals(userManager,
diff --git
a/oak-authorization-principalbased/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManager.java
b/oak-authorization-principalbased/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManager.java
index 9d55463b5f..929a6ff81d 100644
---
a/oak-authorization-principalbased/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManager.java
+++
b/oak-authorization-principalbased/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAccessControlManager.java
@@ -16,6 +16,7 @@
*/
package
org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy;
@@ -233,7 +234,7 @@ class PrincipalBasedAccessControlManager extends
AbstractAccessControlManager im
Iterable<PrincipalAccessControlList> acls =
Iterables.transform(m.entrySet(), entry -> new
ImmutablePrincipalPolicy(entry.getKey(), filter.getOakPath(entry.getKey()),
entry.getValue(), mgrProvider.getRestrictionProvider(), getNamePathMapper()));
if (ReadPolicy.hasEffectiveReadPolicy(readPaths, oakPath)) {
- Iterable<AccessControlPolicy> iterable =
Iterables.concat(acls, Collections.singleton(ReadPolicy.INSTANCE));
+ Iterable<AccessControlPolicy> iterable =
IterableUtils.chainedIterable(acls, Collections.singleton(ReadPolicy.INSTANCE));
return Iterables.toArray(iterable, AccessControlPolicy.class);
} else {
return Iterables.toArray(acls,
PrincipalAccessControlList.class);
diff --git
a/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/authorization/principalbased/PrinicipalBasedReadTest.java
b/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/authorization/principalbased/PrinicipalBasedReadTest.java
index 8587b57954..8f0cdb44d4 100644
---
a/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/authorization/principalbased/PrinicipalBasedReadTest.java
+++
b/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/authorization/principalbased/PrinicipalBasedReadTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.benchmark.authorization.principalbased;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.api.JackrabbitSession;
@@ -159,7 +160,7 @@ public class PrinicipalBasedReadTest extends
ReadDeepTreeTest {
}
added = acl.addAccessControlEntry(principal, privileges);
} else {
- for (JackrabbitAccessControlPolicy policy :
Iterables.concat(Arrays.asList(acMgr.getApplicablePolicies(principal)),
+ for (JackrabbitAccessControlPolicy policy :
IterableUtils.chainedIterable(Arrays.asList(acMgr.getApplicablePolicies(principal)),
Arrays.asList(acMgr.getPolicies(principal)))) {
if (policy instanceof PrincipalAccessControlList) {
acl = (PrincipalAccessControlList) policy;
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java
index ad6f961578..c2b0f9efca 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.plugins.index.nodetype;
import static org.apache.jackrabbit.oak.plugins.memory.PropertyValues.newName;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexLookup;
import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider;
@@ -89,7 +90,7 @@ class NodeTypeIndexLookup implements JcrConstants {
*/
public Iterable<String> query(Filter filter) {
PropertyIndexLookup lookup = new PropertyIndexLookup(root,
mountInfoProvider);
- return Iterables.concat(
+ return IterableUtils.chainedIterable(
lookup.query(filter, JCR_PRIMARYTYPE,
newName(filter.getPrimaryTypes())),
lookup.query(filter, JCR_MIXINTYPES,
newName(filter.getMixinTypes())));
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java
index 389bf5e263..877d823f05 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java
@@ -126,7 +126,7 @@ public class PropertyIndexLookup {
iterables.add(s.query(filter, propertyName, indexMeta,
encode(value, pattern)));
}
- return Iterables.concat(iterables);
+ return
org.apache.jackrabbit.oak.commons.collections.IterableUtils.chainedIterable(iterables);
}
Set<IndexStoreStrategy> getStrategies(NodeState definition) {
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexPlan.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexPlan.java
index d03e25a44c..59fe645cd8 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexPlan.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexPlan.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Set;
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.commons.collections.StreamUtils;
import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
@@ -216,8 +217,7 @@ public class PropertyIndexPlan {
for (IndexStoreStrategy s : strategies) {
iterables.add(s.query(filter, name, definition, values));
}
- Cursor cursor = Cursors.newPathCursor(Iterables.concat(iterables),
- settings);
+ Cursor cursor =
Cursors.newPathCursor(IterableUtils.chainedIterable(iterables), settings);
if (depth > 1) {
cursor = Cursors.newAncestorCursor(cursor, depth - 1, settings);
}
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 a4810b12eb..b9122a2210 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
@@ -34,6 +34,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.index.property.Multiplexers;
import
org.apache.jackrabbit.oak.plugins.index.property.strategy.IndexStoreStrategy;
import org.apache.jackrabbit.oak.query.SQL2Parser;
@@ -133,7 +134,7 @@ class ReferenceIndex implements QueryIndex {
iterables.add(s.query(filter, index + "("
+ uuid + ")", indexRoot, Set.of(uuid)));
}
- Iterable<String> paths = Iterables.concat(iterables);
+ Iterable<String> paths = IterableUtils.chainedIterable(iterables);
if (!"*".equals(name)) {
paths = filter(paths, path -> name.equals(getName(path)));
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 a284301da4..abc3f2259a 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
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.migration;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
@@ -35,6 +36,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
import static
org.apache.jackrabbit.oak.plugins.tree.TreeConstants.OAK_CHILD_ORDER;
@@ -171,7 +173,7 @@ public abstract class AbstractDecoratedNodeState extends
AbstractNodeState {
final Iterable<PropertyState> propertyStates = Iterables.transform(
delegate.getProperties(),
propertyState -> decorate(propertyState));
- return Iterables.filter(Iterables.concat(propertyStates,
getNewPropertyStates()), x -> x != null);
+ return Iterables.filter(IterableUtils.chainedIterable(propertyStates,
getNewPropertyStates()), Objects::nonNull);
}
/**
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/version/VersionHistoryUtil.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/version/VersionHistoryUtil.java
index 4c16650e57..b2194284de 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/version/VersionHistoryUtil.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/migration/version/VersionHistoryUtil.java
@@ -16,7 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.migration.version;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.concat;
import static java.util.Collections.singleton;
import static org.apache.jackrabbit.JcrConstants.JCR_BASEVERSION;
import static org.apache.jackrabbit.JcrConstants.JCR_CREATED;
@@ -38,6 +37,7 @@ import java.util.Calendar;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
@@ -55,7 +55,7 @@ public class VersionHistoryUtil {
private static final Logger LOG =
LoggerFactory.getLogger(VersionHistoryUtil.class);
public static String getRelativeVersionHistoryPath(String versionableUuid)
{
- return String.join("/", concat(
+ return String.join("/", IterableUtils.chainedIterable(
singleton(""),
getRelativeVersionHistoryPathSegments(versionableUuid),
singleton(versionableUuid)));
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 a7ffed97b2..c1074cd47e 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
@@ -37,6 +37,7 @@ import javax.jcr.nodetype.PropertyDefinition;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.plugins.value.jcr.PartialValueFactory;
import org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType;
import org.jetbrains.annotations.NotNull;
@@ -204,7 +205,7 @@ class EffectiveNodeTypeImpl implements EffectiveNodeType {
@NotNull
@Override
public Iterable<NodeDefinition> getNamedNodeDefinitions(@NotNull final
String oakName) {
- return Iterables.concat(Iterables.transform(nodeTypes.values(),
+ return
IterableUtils.chainedIterable(Iterables.transform(nodeTypes.values(),
input -> input.getDeclaredNamedNodeDefinitions(oakName)));
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java
index 44f42457e3..434c778eb4 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java
@@ -31,7 +31,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.concat;
import static org.apache.jackrabbit.JcrConstants.JCR_DEFAULTPRIMARYTYPE;
import static org.apache.jackrabbit.JcrConstants.JCR_MANDATORY;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
@@ -243,7 +242,7 @@ class EffectiveType {
NodeState residual = type
.getChildNode(REP_RESIDUAL_CHILD_NODE_DEFINITIONS);
- for (ChildNodeEntry entry : concat(
+ for (ChildNodeEntry entry : IterableUtils.chainedIterable(
named.getChildNodeEntries(),
residual.getChildNodeEntries())) {
NodeState definition = entry.getNodeState();
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
index c159845a3d..f7d8434d32 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenLoginModule.java
@@ -31,6 +31,7 @@ import javax.security.auth.callback.Callback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import
org.apache.jackrabbit.api.security.authentication.token.TokenCredentials;
import org.apache.jackrabbit.oak.api.AuthInfo;
@@ -157,7 +158,7 @@ public final class TokenLoginModule extends
AbstractLoginModule {
public boolean commit() throws LoginException {
if (tokenCredentials != null && tokenInfo != null) {
principals = (principal != null) ? getPrincipals(principal) :
getPrincipals(tokenInfo.getUserId());
- authInfo = getAuthInfo(tokenInfo, Iterables.concat(principals,
subject.getPrincipals()));
+ authInfo = getAuthInfo(tokenInfo,
IterableUtils.chainedIterable(principals, subject.getPrincipals()));
updateSubject(subject, tokenCredentials, authInfo);
closeSystemSession();
return true;
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
index 43310e3672..ccd6740283 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.security.authentication.user;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.AuthInfo;
import org.apache.jackrabbit.oak.api.Root;
@@ -282,6 +283,6 @@ public final class LoginModuleImpl extends
AbstractLoginModule {
attributes.put(attrName, sc.getAttribute(attrName));
}
}
- return new AuthInfoImpl(userId, attributes,
Iterables.concat(principals, subject.getPrincipals()));
+ return new AuthInfoImpl(userId, attributes,
IterableUtils.chainedIterable(principals, subject.getPrincipals()));
}
}
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContext.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContext.java
index 59afaa488e..a85c83c189 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContext.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AuthorizationContext.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.security.authorization;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -30,7 +31,7 @@ final class AuthorizationContext implements Context,
AccessControlConstants, Per
private static final String[] NODE_NAMES = POLICY_NODE_NAMES.toArray(new
String[0]);
private static final String[] PROPERTY_NAMES =
ACE_PROPERTY_NAMES.toArray(new String[0]);
- private static final String[] NT_NAMES =
Iterables.toArray(Iterables.concat(AC_NODETYPE_NAMES,
PERMISSION_NODETYPE_NAMES), String.class);
+ private static final String[] NT_NAMES =
Iterables.toArray(IterableUtils.chainedIterable(AC_NODETYPE_NAMES,
PERMISSION_NODETYPE_NAMES), String.class);
private static final Context INSTANCE = new AuthorizationContext();
diff --git
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistration.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistration.java
index 00e91753e0..643a90e7bd 100644
---
a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistration.java
+++
b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/internal/SecurityProviderRegistration.java
@@ -20,6 +20,7 @@ import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.guava.common.io.Closer;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.osgi.OsgiWhiteboard;
import org.apache.jackrabbit.oak.plugins.tree.RootProvider;
import org.apache.jackrabbit.oak.plugins.tree.TreeProvider;
@@ -528,7 +529,7 @@ public class SecurityProviderRegistration {
closer = Closer.create();
Iterable<Iterable<Monitor<?>>> monitors =
Iterables.transform(securityProvider.getConfigurations(), sc ->
sc.getMonitors(statisticsProvider));
- for (Monitor monitor : Iterables.concat(monitors)) {
+ for (Monitor monitor : IterableUtils.chainedIterable(monitors)) {
Registration reg = whiteboard.register(monitor.getMonitorClass(),
monitor, monitor.getMonitorProperties());
closer.register(reg::unregister);
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexNodeManager.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexNodeManager.java
index 6597c380b0..16ba4d8aa1 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexNodeManager.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexNodeManager.java
@@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.PerfLogger;
@@ -251,7 +252,7 @@ public class LuceneIndexNodeManager {
IndexReader[] readerArr = new IndexReader[readers.size() +
nrtReaders.size()];
int i = 0;
- for (LuceneIndexReader r : Iterables.concat(readers, nrtReaders)){
+ for (LuceneIndexReader r : IterableUtils.chainedIterable(readers,
nrtReaders)){
readerArr[i++] = r.getReader();
}
return new MultiReader(readerArr, false);
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
index 63b5f99d3a..d2760530d8 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
@@ -37,6 +37,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.AbstractIterator;
import org.apache.jackrabbit.guava.common.collect.FluentIterable;
import org.apache.jackrabbit.guava.common.collect.Iterables;
@@ -1607,7 +1608,7 @@ public class LucenePropertyIndex extends FulltextIndex {
} else {
Validate.checkState(pr.evaluateSyncNodeTypeRestriction());
//Either of property or nodetype should not be null
Filter filter = plan.getFilter();
- paths = FluentIterable.from(Iterables.concat(
+ paths = FluentIterable.from(IterableUtils.chainedIterable(
lookup.query(filter, JCR_PRIMARYTYPE,
newName(filter.getPrimaryTypes())),
lookup.query(filter, JCR_MIXINTYPES,
newName(filter.getMixinTypes()))));
}
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/LuceneDocumentHolder.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/LuceneDocumentHolder.java
index ba48e4b690..fe3fa923e9 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/LuceneDocumentHolder.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/LuceneDocumentHolder.java
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.plugins.index.lucene.hybrid;
import java.util.Collection;
import java.util.Map;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.ListValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.apache.jackrabbit.guava.common.collect.Iterables;
@@ -98,7 +99,7 @@ public class LuceneDocumentHolder implements JournalProperty {
* may be directly forwarded to the queue or held in memory for later
processing
*/
Iterable<? extends LuceneDocInfo> getAllLuceneDocInfo(){
- return Iterables.concat(nrtIndexedList.values(),
syncIndexedList.values(),
+ return IterableUtils.chainedIterable(nrtIndexedList.values(),
syncIndexedList.values(),
asLuceneDocInfo(queuedNrtIndexedPath),
queuedSyncIndexedPath.values());
}
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookup.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookup.java
index b211da3b67..babd278252 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookup.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/HybridPropertyIndexLookup.java
@@ -22,6 +22,7 @@ package
org.apache.jackrabbit.oak.plugins.index.lucene.property;
import java.util.Collections;
import java.util.Set;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyValue;
import org.apache.jackrabbit.oak.api.Type;
@@ -121,7 +122,7 @@ public class HybridPropertyIndexLookup {
private Iterable<String> querySimple(Filter filter, String indexName,
NodeState propIndexNode,
Set<String> values) {
- return Iterables.concat(
+ return IterableUtils.chainedIterable(
queryBucket(filter, indexName, propIndexNode,
PROP_HEAD_BUCKET, values),
queryBucket(filter, indexName, propIndexNode,
PROP_PREVIOUS_BUCKET, values)
);
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniquenessConstraintValidator.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniquenessConstraintValidator.java
index eb74698683..46167ff68e 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniquenessConstraintValidator.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/property/UniquenessConstraintValidator.java
@@ -23,6 +23,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.HashMultimap;
import org.apache.jackrabbit.guava.common.collect.ImmutableSet;
import org.apache.jackrabbit.guava.common.collect.Iterables;
@@ -88,7 +89,7 @@ public class UniquenessConstraintValidator {
}
private Iterable<String> getIndexedPaths(String propertyRelativePath,
String value) {
- return Iterables.concat(
+ return IterableUtils.chainedIterable(
firstStore.getIndexedPaths(propertyRelativePath, value),
secondStore.getIndexedPaths(propertyRelativePath, value)
);
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
index 7658a11232..36d4ab7c96 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
@@ -29,6 +29,7 @@ import javax.jcr.Node;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -155,7 +156,7 @@ public final class IndexDefinitionBuilder {
if (tree.hasProperty(INDEX_TAGS)) {
currTags =
SetUtils.toSet(tree.getProperty(INDEX_TAGS).getValue(STRINGS));
}
- Set<String> tagVals = SetUtils.toSet(Iterables.concat(currTags,
asList(additionalTagVals)));
+ Set<String> tagVals =
SetUtils.toSet(IterableUtils.chainedIterable(currTags,
asList(additionalTagVals)));
boolean noAdditionalTags = currTags.containsAll(tagVals);
if (!noAdditionalTags) {
tree.removeProperty(INDEX_TAGS);
diff --git
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/writer/MultiplexingIndexWriter.java
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/writer/MultiplexingIndexWriter.java
index 3806188a69..7e1159faf7 100644
---
a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/writer/MultiplexingIndexWriter.java
+++
b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/writer/MultiplexingIndexWriter.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.StreamSupport;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexDefinition;
import
org.apache.jackrabbit.oak.plugins.index.lucene.directory.DirectoryFactory;
import org.apache.jackrabbit.oak.spi.mount.Mount;
@@ -31,7 +32,6 @@ import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.lucene.index.IndexableField;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.concat;
import static java.util.Collections.singleton;
class MultiplexingIndexWriter implements LuceneIndexWriter {
@@ -81,10 +81,10 @@ class MultiplexingIndexWriter implements LuceneIndexWriter {
// explicitly get writers for mounts which haven't got writers even at
close.
// This essentially ensures we respect DefaultIndexWriters#close's
intent to
// create empty index even if nothing has been written during re-index.
-
StreamSupport.stream(concat(singleton(mountInfoProvider.getDefaultMount()),
mountInfoProvider.getNonDefaultMounts())
- .spliterator(), false)
- .filter(m -> reindex && !m.isReadOnly()) // only needed when
re-indexing for read-write mounts.
- // reindex for ro-mount doesn't make sense in this case anyway.
+
StreamSupport.stream(IterableUtils.chainedIterable(singleton(mountInfoProvider.getDefaultMount()),
mountInfoProvider.getNonDefaultMounts())
+ .spliterator(), false)
+ .filter(m -> reindex && !m.isReadOnly()) // only needed when
re-indexing for read-write mounts.
+ // reindex for
ro-mount doesn't make sense in this case anyway.
.forEach(this::getWriter); // open default writers for mounts
that passed all our tests
boolean indexUpdated = false;
diff --git
a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
index 65bf0a678f..88a46bd4c0 100644
---
a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
+++
b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
@@ -19,6 +19,7 @@
package org.apache.jackrabbit.oak.index.indexer.document;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.FluentIterable;
import org.apache.jackrabbit.guava.common.io.Closer;
import org.apache.jackrabbit.oak.plugins.document.Collection;
@@ -40,7 +41,6 @@ import java.util.function.Consumer;
import static java.util.Collections.emptyList;
import static java.util.Collections.singleton;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.concat;
import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
public class NodeStateEntryTraverser implements Iterable<NodeStateEntry>,
Closeable {
@@ -124,7 +124,7 @@ public class NodeStateEntryTraverser implements
Iterable<NodeStateEntry>, Closea
}
return transform(
- concat(singleton(nodeState),
+ IterableUtils.chainedIterable(singleton(nodeState),
nodeState.getAllBundledNodesStates()),
dns -> {
NodeStateEntry.NodeStateEntryBuilder builder = new
NodeStateEntry.NodeStateEntryBuilder(dns, dns.getPath().toString());
diff --git
a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/run/cli/Options.java
b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/run/cli/Options.java
index 62b8b94dde..ef20190f9b 100644
---
a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/run/cli/Options.java
+++
b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/run/cli/Options.java
@@ -19,6 +19,7 @@
package org.apache.jackrabbit.oak.run.cli;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
@@ -70,7 +71,7 @@ public class Options {
* @return optionSet returned from OptionParser
*/
public OptionSet parseAndConfigure(OptionParser parser, String[] args,
boolean checkNonOptions) throws IOException {
- for (OptionsBeanFactory o : Iterables.concat(oakRunOptions,
beanFactories)){
+ for (OptionsBeanFactory o :
IterableUtils.chainedIterable(oakRunOptions, beanFactories)){
OptionsBean bean = o.newInstance(parser);
optionBeans.put(bean.getClass(), bean);
}
diff --git
a/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java
b/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java
index 0f5e0e1e72..af78beba4f 100644
---
a/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java
+++
b/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java
@@ -30,6 +30,7 @@ import java.util.regex.Pattern;
import javax.jcr.PropertyType;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -163,7 +164,7 @@ public abstract class FulltextDocumentMaker<D> implements
DocumentMaker<D> {
//regex for node name indexing
PropertyState nodenamePS =
new StringPropertyState(FieldNames.NODE_NAME, getName(path));
- for (PropertyState property : Iterables.concat(state.getProperties(),
Collections.singleton(nodenamePS))) {
+ for (PropertyState property :
IterableUtils.chainedIterable(state.getProperties(),
Collections.singleton(nodenamePS))) {
String pname = property.getName();
if (!isVisible(pname) && !FieldNames.NODE_NAME.equals(pname)) {
diff --git
a/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
b/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
index b6a0e55d73..5118423b13 100644
---
a/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
+++
b/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -287,7 +288,7 @@ public class FulltextIndexEditor<D> implements IndexEditor,
Aggregate.AggregateR
private MatcherState getMatcherState(String name, NodeState after) {
List<Aggregate.Matcher> matched = new ArrayList<>();
List<Aggregate.Matcher> inherited = new ArrayList<>();
- for (Aggregate.Matcher m : Iterables.concat(matcherState.inherited,
currentMatchers)) {
+ for (Aggregate.Matcher m :
IterableUtils.chainedIterable(matcherState.inherited, currentMatchers)) {
Aggregate.Matcher result = m.match(name, after);
if (result.getStatus() == Aggregate.Matcher.Status.MATCH_FOUND){
matched.add(result);
diff --git
a/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/util/IndexDefinitionBuilder.java
b/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/util/IndexDefinitionBuilder.java
index 47914275cf..203a22400c 100644
---
a/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/util/IndexDefinitionBuilder.java
+++
b/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/util/IndexDefinitionBuilder.java
@@ -18,6 +18,7 @@
*/
package org.apache.jackrabbit.oak.plugins.index.search.util;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
@@ -168,7 +169,7 @@ public class IndexDefinitionBuilder {
if (tree.hasProperty(INDEX_TAGS)) {
currTags =
SetUtils.toSet(tree.getProperty(INDEX_TAGS).getValue(STRINGS));
}
- Set<String> tagVals = SetUtils.toSet(Iterables.concat(currTags,
asList(additionalTagVals)));
+ Set<String> tagVals =
SetUtils.toSet(IterableUtils.chainedIterable(currTags,
asList(additionalTagVals)));
boolean noAdditionalTags = currTags.containsAll(tagVals);
if (!noAdditionalTags) {
tree.removeProperty(INDEX_TAGS);
diff --git
a/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
b/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
index 6c09270611..933c7be707 100644
---
a/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
+++
b/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
@@ -22,6 +22,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.collections.SetUtils;
import org.apache.jackrabbit.oak.plugins.tree.RootProvider;
import org.apache.jackrabbit.oak.plugins.tree.TreeLocation;
@@ -262,7 +263,7 @@ public abstract class CompositeConfiguration<T extends
SecurityConfiguration> im
@NotNull
@Override
public Iterable<Monitor<?>> getMonitors(@NotNull StatisticsProvider
statisticsProvider) {
- return Iterables.concat(
+ return IterableUtils.chainedIterable(
Iterables.transform(getConfigurations(), securityConfiguration
-> securityConfiguration.getMonitors(statisticsProvider)));
}
diff --git
a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/MapRecord.java
b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/MapRecord.java
index 13a03cd091..80006efc17 100644
---
a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/MapRecord.java
+++
b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/MapRecord.java
@@ -22,7 +22,6 @@ import static java.lang.Integer.bitCount;
import static java.lang.Integer.highestOneBit;
import static java.lang.Integer.numberOfTrailingZeros;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.concat;
import static org.apache.jackrabbit.oak.segment.MapEntry.newMapEntry;
import java.util.ArrayList;
@@ -33,6 +32,7 @@ import java.util.List;
import java.util.Objects;
import org.apache.jackrabbit.guava.common.collect.ComparisonChain;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
@@ -335,7 +335,7 @@ public class MapRecord extends Record {
}
});
}
- return concat(keys);
+ return IterableUtils.chainedIterable(keys);
}
RecordId[] ids = new RecordId[size];
@@ -385,7 +385,7 @@ public class MapRecord extends Record {
}
});
}
- return concat(entries);
+ return IterableUtils.chainedIterable(entries);
}
MapEntry[] entries = new MapEntry[size];
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 ed49a51f4c..1198a2ddf7 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
@@ -35,6 +35,7 @@ import java.util.function.Predicate;
import org.apache.jackrabbit.guava.common.collect.Iterables;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -279,7 +280,7 @@ class Branch {
&& input.getKey().compareRevisionTime(r) <= 0;
}
}::test), input -> input.getValue().getModifiedPaths());
- return Iterables.concat(paths);
+ return IterableUtils.chainedIterable(paths);
}
@Override
@@ -407,7 +408,7 @@ class Branch {
Iterable<Path> getModifiedPaths() {
Iterable<Iterable<Path>> paths = transform(previous.values(),
branchCommit -> branchCommit.getModifiedPaths());
- return Iterables.concat(paths);
+ return IterableUtils.chainedIterable(paths);
}
/**
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 bf66adb160..447b82e44b 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
@@ -59,6 +59,7 @@ import org.apache.jackrabbit.guava.common.collect.Ordering;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.collections.DequeUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
import org.apache.jackrabbit.oak.commons.json.JsopReader;
import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
@@ -1816,7 +1817,7 @@ public final class NodeDocument extends Document {
}
};
} else {
- changes = Iterables.concat(transform(List.copyOf(ranges),
rangeToChanges::apply));
+ changes =
IterableUtils.chainedIterable(transform(List.copyOf(ranges),
rangeToChanges::apply));
}
return filter(changes, input ->
!readRev.isRevisionNewer(input.getKey()));
}
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
index 1592397f8a..8dce4967b6 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.document;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.cache.Cache;
import org.apache.jackrabbit.guava.common.cache.CacheBuilder;
import org.apache.jackrabbit.guava.common.collect.Iterables;
@@ -95,7 +96,7 @@ class TieredDiffCache extends DiffCache {
@NotNull
@Override
public Iterable<CacheStats> getStats() {
- return Iterables.concat(localCache.getStats(), memoryCache.getStats());
+ return IterableUtils.chainedIterable(localCache.getStats(),
memoryCache.getStats());
}
@Override
diff --git
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java
index c7664a1373..93d1ef095c 100644
---
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java
+++
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java
@@ -33,6 +33,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.locks.Lock;
import java.util.function.Predicate;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.cache.Cache;
import org.apache.jackrabbit.oak.cache.CacheStats;
import org.apache.jackrabbit.oak.cache.CacheValue;
@@ -324,14 +325,14 @@ public class NodeDocumentCache implements Closeable {
* @return keys stored in cache
*/
public Iterable<CacheValue> keys() {
- return Iterables.concat(nodeDocumentsCache.asMap().keySet(),
prevDocumentsCache.asMap().keySet());
+ return
IterableUtils.chainedIterable(nodeDocumentsCache.asMap().keySet(),
prevDocumentsCache.asMap().keySet());
}
/**
* @return values stored in cache
*/
public Iterable<NodeDocument> values() {
- return Iterables.concat(nodeDocumentsCache.asMap().values(),
prevDocumentsCache.asMap().values());
+ return
IterableUtils.chainedIterable(nodeDocumentsCache.asMap().values(),
prevDocumentsCache.asMap().values());
}
public Iterable<CacheStats> getCacheStats() {
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 1d6e535d78..1bd5d177d3 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.concat;
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;
@@ -56,6 +55,7 @@ import java.util.regex.Pattern;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoCursor;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
import org.apache.jackrabbit.oak.plugins.document.Document;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
@@ -352,7 +352,7 @@ public class MongoVersionGCSupport extends VersionGCSupport
{
.maxTime(15, TimeUnit.MINUTES).hint(hint),
input -> store.convertFromDBObject(NODES, input)),
input -> !isDefaultNoBranchSplitNewerThan(input,
sweepRevs));
- allResults = concat(allResults, iterable);
+ allResults = IterableUtils.chainedIterable(allResults, iterable);
}
return allResults;
}
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 b3adab9788..1e545008bc 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
@@ -29,6 +29,7 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier;
import org.apache.jackrabbit.oak.plugins.document.Collection;
import org.apache.jackrabbit.oak.plugins.document.DocumentStoreException;
@@ -160,7 +161,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(Iterables.concat(Iterables.filter(fit1,
cp1::test), Iterables.filter(fit2, cp2::test)),
+ return
CloseableIterable.wrap(IterableUtils.chainedIterable(Iterables.filter(fit1,
cp1::test), Iterables.filter(fit2, cp2::test)),
new Closeable() {
@Override
public void close() throws IOException {
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 7e85eefb7a..3585ad6882 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,7 +18,6 @@ package org.apache.jackrabbit.oak.plugins.memory;
import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.collect.Iterables.concat;
import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
import static java.util.Collections.emptyList;
@@ -28,9 +27,11 @@ 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;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.commons.collections.MapUtils;
import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
@@ -163,7 +164,7 @@ public class ModifiedNodeState extends AbstractNodeState {
final Set<String> keys = properties.keySet();
Predicate<PropertyState> predicate =
x -> !keys.contains(x == null ? null : x.getName());
- return concat(
+ return IterableUtils.chainedIterable(
filter(base.getProperties(), predicate::test),
filter(properties.values(), x -> x != null));
}
@@ -213,7 +214,7 @@ public class ModifiedNodeState extends AbstractNodeState {
nodes = new HashMap<>(nodes);
}
final Set<String> keys = nodes.keySet();
- return concat(
+ return IterableUtils.chainedIterable(
filter(base.getChildNodeNames(), x -> !keys.contains(x)),
MapUtils.filterValues(nodes, NodeState.EXISTS).keySet());
}
@@ -346,7 +347,7 @@ public class ModifiedNodeState extends AbstractNodeState {
final Set<String> keys = nodes.keySet();
Predicate<ChildNodeEntry> predicate =
x -> !keys.contains(x == null ? null : x.getName());
- return concat(
+ return IterableUtils.chainedIterable(
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/MoveTracker.java
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/MoveTracker.java
index 5a4b47ebfa..3636adc260 100644
---
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/MoveTracker.java
+++
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/MoveTracker.java
@@ -20,6 +20,8 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
+import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.collect.Iterables;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.collections.ListUtils;
@@ -88,7 +90,7 @@ public class MoveTracker {
public boolean containsMove(@Nullable String path) {
if (path != null) {
- for (String p : Iterables.concat(parentSourcePaths,
parentDestPaths)) {
+ for (String p : IterableUtils.chainedIterable(parentSourcePaths,
parentDestPaths)) {
if (Text.isDescendantOrEqual(path, p)) {
return true;
}