aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-layer
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2009-02-04 01:09:17 +0000
committerMaria Odea B. Ching <oching@apache.org>2009-02-04 01:09:17 +0000
commitc0e1f8872e0243918984b81c6e449765f620505a (patch)
tree57a7b1cf4810b71a82400f0a8d7a7e62eb4d9bff /archiva-modules/archiva-base/archiva-repository-layer
parentcedc0486947736ea872c7804dc59a5ccd5084c58 (diff)
downloadarchiva-c0e1f8872e0243918984b81c6e449765f620505a.tar.gz
archiva-c0e1f8872e0243918984b81c6e449765f620505a.zip
[MRM-749]
merged -r 728552:740257 from archiva-nexus-indexer branch git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@740552 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-layer')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java52
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java6
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java6
3 files changed, 64 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
new file mode 100644
index 000000000..52a9ca18a
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
@@ -0,0 +1,52 @@
+package org.apache.archiva.repository.scanner.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Closure;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * TriggerScanCompletedClosure
+ */
+public class TriggerScanCompletedClosure
+ implements Closure
+{
+ private Logger log = LoggerFactory.getLogger( TriggerScanCompletedClosure.class );
+
+ private final ManagedRepositoryConfiguration repository;
+
+ public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository )
+ {
+ this.repository = repository;
+ }
+
+ public void execute( Object input )
+ {
+ if ( input instanceof RepositoryContentConsumer )
+ {
+ RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
+ consumer.completeScan();
+ log.info( "Consumer [" + consumer.getId() + "] completed for repository [" + repository.getId() + "]" );
+ }
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
index 83042e287..6f35e81f3 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+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;
@@ -256,6 +257,11 @@ public class RepositoryContentConsumers implements ApplicationContextAware
// Nothing known processed this file. It is invalid!
CollectionUtils.forAllDo( selectedInvalidConsumers, closure );
}
+
+ TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure(repository);
+
+ CollectionUtils.forAllDo(selectedKnownConsumers, scanCompletedClosure);
+ CollectionUtils.forAllDo(selectedKnownConsumers, scanCompletedClosure);
}
finally
{
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
index d0fd38ad1..e8d86d90c 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
@@ -23,6 +23,7 @@ import java.io.File;
import java.util.Date;
import java.util.List;
+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;
@@ -144,6 +145,11 @@ public class RepositoryScannerInstance
public void directoryWalkFinished()
{
+ TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure(repository);
+
+ CollectionUtils.forAllDo( knownConsumers, scanCompletedClosure );
+ CollectionUtils.forAllDo( invalidConsumers, scanCompletedClosure );
+
log.info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getLocation() );
stats.triggerFinished();
}