diff options
author | Brett Porter <brett@apache.org> | 2008-11-28 15:15:57 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2008-11-28 15:15:57 +0000 |
commit | ebba6ca1d7022e5022b28a13b471d27c172199c8 (patch) | |
tree | 308f8ea9d9a86768d740d5a7a427b9f7ff0be0c8 /archiva-modules/archiva-database | |
parent | fbb49e338760ae54b51946c689e36eb0bfdb8220 (diff) | |
download | archiva-ebba6ca1d7022e5022b28a13b471d27c172199c8.tar.gz archiva-ebba6ca1d7022e5022b28a13b471d27c172199c8.zip |
[MRM-1025] consolidate more database uses into the database module
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@721514 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-database')
9 files changed, 146 insertions, 8 deletions
diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ArchivaArtifactConsumer.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ArchivaArtifactConsumer.java new file mode 100644 index 000000000..1dffed7ee --- /dev/null +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ArchivaArtifactConsumer.java @@ -0,0 +1,82 @@ +package org.apache.maven.archiva.database.updater; + +/* + * 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.maven.archiva.consumers.Consumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * ArchivaArtifactConsumer - consumer for ArchivaArtifact objects. + * + * @version $Id$ + */ +public interface ArchivaArtifactConsumer extends Consumer +{ + /** + * Get the list of included file patterns for this consumer. + * + * @return the list of ({@link String}) artifact types to process. + */ + public List<String> getIncludedTypes(); + + /** + * <p> + * Event that triggers at the beginning of a scan. + * </p> + * + * <p> + * NOTE: This would be a good place to initialize the consumer, to lock any resources, and to + * generally start tracking the scan as a whole. + * </p> + */ + public void beginScan(); + + /** + * <p> + * Event indicating an {@link ArchivaArtifact} is to be processed by this consumer. + * </p> + * + * <p> + * NOTE: The consumer does not need to process the artifact immediately, can can opt to queue and/or track + * the artifact to be processed in batch. Just be sure to complete the processing by the {@link #completeScan()} + * event. + * </p> + * + * @param file the file to process. + * @throws ConsumerException if there was a problem processing this file. + */ + public void processArchivaArtifact( ArchivaArtifact artifact ) throws ConsumerException; + + /** + * <p> + * Event that triggers on the completion of a scan. + * </p> + * + * <p> + * NOTE: If the consumer opted to batch up processing requests in the + * {@link #processArchivaArtifact(ArchivaArtifact)} event this would be the last opportunity to drain + * any processing queue's. + * </p> + */ + public void completeScan(); +} diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseCleanupConsumer.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseCleanupConsumer.java new file mode 100644 index 000000000..ac301b86a --- /dev/null +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseCleanupConsumer.java @@ -0,0 +1,31 @@ +package org.apache.maven.archiva.database.updater; + +/* + * 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. + */ + +/** + * DatabaseCleanupConsumer + * + * @version $Id$ + */ +public interface DatabaseCleanupConsumer + extends ArchivaArtifactConsumer +{ + +} diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java index c68c53df2..af5c647de 100644 --- a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java @@ -24,8 +24,6 @@ import org.apache.commons.collections.Predicate; import org.apache.commons.collections.functors.OrPredicate; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; -import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; -import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; import org.apache.maven.archiva.consumers.functors.PermanentConsumerPredicate; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseUnprocessedArtifactConsumer.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseUnprocessedArtifactConsumer.java new file mode 100644 index 000000000..a3cde7eaa --- /dev/null +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseUnprocessedArtifactConsumer.java @@ -0,0 +1,31 @@ +package org.apache.maven.archiva.database.updater; + +/* + * 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. + */ + +/** + * DatabaseUnprocessedArtifactConsumer + * + * @version $Id$ + */ +public interface DatabaseUnprocessedArtifactConsumer + extends ArchivaArtifactConsumer +{ + +} diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java index f4ccae856..41bd5bf52 100644 --- a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java @@ -27,7 +27,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.Predicate; import org.apache.commons.collections.functors.NotPredicate; -import org.apache.maven.archiva.consumers.ArchivaArtifactConsumer; import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint; diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ProcessArchivaArtifactClosure.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ProcessArchivaArtifactClosure.java index 5b46bf64f..eee178b8f 100644 --- a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ProcessArchivaArtifactClosure.java +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/ProcessArchivaArtifactClosure.java @@ -20,7 +20,6 @@ package org.apache.maven.archiva.database.updater; */ import org.apache.commons.collections.Closure; -import org.apache.maven.archiva.consumers.ArchivaArtifactConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.model.ArchivaArtifact; import org.slf4j.Logger; diff --git a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java index ab6678f5b..94bca9624 100644 --- a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java +++ b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java @@ -20,8 +20,8 @@ package org.apache.maven.archiva.database; */ import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; -import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.database.updater.DatabaseCleanupConsumer; +import org.apache.maven.archiva.database.updater.DatabaseUnprocessedArtifactConsumer; import org.apache.maven.archiva.database.updater.TestDatabaseCleanupConsumer; import org.apache.maven.archiva.database.updater.TestDatabaseUnprocessedConsumer; import org.apache.maven.archiva.model.ArtifactReference; diff --git a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseCleanupConsumer.java b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseCleanupConsumer.java index 6de10fc50..12cc9b6bd 100644 --- a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseCleanupConsumer.java +++ b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseCleanupConsumer.java @@ -21,7 +21,6 @@ package org.apache.maven.archiva.database.updater; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; -import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; import org.apache.maven.archiva.model.ArchivaArtifact; import java.util.List; diff --git a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseUnprocessedConsumer.java b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseUnprocessedConsumer.java index be9a9f19b..d059a4a65 100644 --- a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseUnprocessedConsumer.java +++ b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/updater/TestDatabaseUnprocessedConsumer.java @@ -24,7 +24,6 @@ import java.util.List; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; -import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; import org.apache.maven.archiva.model.ArchivaArtifact; import org.slf4j.Logger; import org.slf4j.LoggerFactory; |