aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-scanner
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2018-04-01 17:21:48 +0200
committerMartin Stockhammer <martin_s@apache.org>2018-04-01 17:21:48 +0200
commit98236b99cb4485f4c81abedf0a60b4d3d4c0d008 (patch)
tree59a206fb83dc2d0265801e2ad82bafa5078b67c6 /archiva-modules/archiva-base/archiva-repository-scanner
parentb3335cf6e50adeea3600e165585e146e1524ea3a (diff)
downloadarchiva-98236b99cb4485f4c81abedf0a60b4d3d4c0d008.tar.gz
archiva-98236b99cb4485f4c81abedf0a60b4d3d4c0d008.zip
Switching to apache commons collections4
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-scanner')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java23
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java21
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java2
7 files changed, 28 insertions, 26 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
index 7e080158d..8df894ee6 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
@@ -25,7 +25,7 @@ import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.consumers.RepositoryContentConsumer;
import org.apache.archiva.repository.ManagedRepository;
-import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
index c03c5d111..b561c112b 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -32,9 +32,10 @@ import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
-import org.apache.commons.collections.Closure;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.functors.IfClosure;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.IterableUtils;
+import org.apache.commons.collections4.functors.IfClosure;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -296,8 +297,8 @@ public class RepositoryContentConsumers
}
List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers();
- CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan );
- CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan );
+ IterableUtils.forEach( selectedKnownConsumers, triggerBeginScan );
+ IterableUtils.forEach( selectedInvalidConsumers, triggerBeginScan );
// yuck. In case you can't read this, it says
// "process the file if the consumer has it in the includes list, and not in the excludes list"
@@ -311,25 +312,25 @@ public class RepositoryContentConsumers
closure.setBasefile( baseFile );
closure.setExecuteOnEntireRepo( false );
- Closure processIfWanted = IfClosure.getInstance( predicate, closure );
+ Closure processIfWanted = IfClosure.ifClosure( predicate, closure );
- CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted );
+ IterableUtils.forEach( selectedKnownConsumers, processIfWanted );
if ( predicate.getWantedFileCount() <= 0 )
{
// Nothing known processed this file. It is invalid!
- CollectionUtils.forAllDo( selectedInvalidConsumers, closure );
+ IterableUtils.forEach( selectedInvalidConsumers, closure );
}
TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository, false );
- CollectionUtils.forAllDo( selectedKnownConsumers, scanCompletedClosure );
+ IterableUtils.forEach( selectedKnownConsumers, scanCompletedClosure );
}
finally
{
/* TODO: This is never called by the repository scanner instance, so not calling here either - but it probably should be?
- CollectionUtils.forAllDo( availableKnownConsumers, triggerCompleteScan );
- CollectionUtils.forAllDo( availableInvalidConsumers, triggerCompleteScan );
+ IterableUtils.forEach( availableKnownConsumers, triggerCompleteScan );
+ IterableUtils.forEach( availableInvalidConsumers, triggerCompleteScan );
*/
releaseSelectedKnownConsumers( selectedKnownConsumers );
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
index 1d9ebbeeb..7c915cabb 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
@@ -20,7 +20,7 @@ package org.apache.archiva.repository.scanner;
*/
import org.apache.archiva.repository.ManagedRepository;
-import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.CollectionUtils;
import javax.xml.bind.annotation.XmlRootElement;
import java.text.SimpleDateFormat;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
index 6d2616696..cbe66d75f 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
@@ -28,9 +28,10 @@ import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure;
-import org.apache.commons.collections.Closure;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.functors.IfClosure;
+import org.apache.commons.collections4.Closure;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.IterableUtils;
+import org.apache.commons.collections4.functors.IfClosure;
import org.apache.commons.lang.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -120,8 +121,8 @@ public class RepositoryScannerInstance
Closure triggerBeginScan =
new TriggerBeginScanClosure( repository, new Date( System.currentTimeMillis() ), true );
- CollectionUtils.forAllDo( knownConsumerList, triggerBeginScan );
- CollectionUtils.forAllDo( invalidConsumerList, triggerBeginScan );
+ IterableUtils.forEach( knownConsumerList, triggerBeginScan );
+ IterableUtils.forEach( invalidConsumerList, triggerBeginScan );
if ( SystemUtils.IS_OS_WINDOWS )
{
@@ -239,13 +240,13 @@ public class RepositoryScannerInstance
consumerProcessFile.setBasefile( basefile );
consumerWantsFile.setBasefile( basefile );
- Closure processIfWanted = IfClosure.getInstance( consumerWantsFile, consumerProcessFile );
- CollectionUtils.forAllDo( this.knownConsumers, processIfWanted );
+ Closure processIfWanted = IfClosure.ifClosure( consumerWantsFile, consumerProcessFile );
+ IterableUtils.forEach( this.knownConsumers, processIfWanted );
if ( consumerWantsFile.getWantedFileCount() <= 0 )
{
// Nothing known processed this file. It is invalid!
- CollectionUtils.forAllDo( this.invalidConsumers, consumerProcessFile );
+ IterableUtils.forEach( this.invalidConsumers, consumerProcessFile );
}
}
@@ -272,8 +273,8 @@ public class RepositoryScannerInstance
private void finishWalk() {
this.isRunning = false;
TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository, true );
- CollectionUtils.forAllDo( knownConsumers, scanCompletedClosure );
- CollectionUtils.forAllDo( invalidConsumers, scanCompletedClosure );
+ IterableUtils.forEach( knownConsumers, scanCompletedClosure );
+ IterableUtils.forEach( invalidConsumers, scanCompletedClosure );
stats.setConsumerTimings( consumerTimings );
stats.setConsumerCounts( consumerCounts );
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
index a6e5f7739..6cd9b21cf 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
@@ -21,7 +21,7 @@ package org.apache.archiva.repository.scanner.functors;
import org.apache.archiva.common.utils.BaseFile;
import org.apache.archiva.consumers.RepositoryContentConsumer;
-import org.apache.commons.collections.Closure;
+import org.apache.commons.collections4.Closure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
index b1e164bc6..8bd6d8e9a 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
@@ -22,7 +22,7 @@ package org.apache.archiva.repository.scanner.functors;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.RepositoryContentConsumer;
import org.apache.archiva.repository.ManagedRepository;
-import org.apache.commons.collections.Closure;
+import org.apache.commons.collections4.Closure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
index d14af6917..79909f8f9 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
@@ -21,7 +21,7 @@ package org.apache.archiva.repository.scanner.functors;
import org.apache.archiva.consumers.RepositoryContentConsumer;
import org.apache.archiva.repository.ManagedRepository;
-import org.apache.commons.collections.Closure;
+import org.apache.commons.collections4.Closure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;