From: Joakim Erdfelt Date: Wed, 9 May 2007 22:03:49 +0000 (+0000) Subject: Updates to Database scanner, updater, task, consumers, and admin screens. X-Git-Tag: archiva-1.0-alpha-1~102 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=711bb6c0c6e885dfa33120e4222b0be11d80b36b;p=archiva.git Updates to Database scanner, updater, task, consumers, and admin screens. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@536680 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 49efaad10..b0c91c5e9 100644 --- a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -574,7 +574,7 @@ - goodConsumers + knownContentConsumers 1.0.0+ true @@ -582,11 +582,11 @@ * - The list of consumers for good content. + The list of active consumers IDs for known content. - badConsumers + invalidContentConsumers 1.0.0+ true @@ -594,55 +594,10 @@ * - The list of consumer IDs for this file processor. + The list of active consumer IDs for invalid content. - FileType @@ -693,7 +648,7 @@ - processedConsumers + cleanupConsumers 1.0.0+ true @@ -701,7 +656,9 @@ * - The list of consumers for previously processed ArchivaArtifact database objects. + The list of consumers for previously processed ArchivaArtifact database + objects that no longer exist on the filesystem, and might need to + undergo a cleanup. diff --git a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml b/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml index e5c3a7692..2c70a37ef 100644 --- a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml +++ b/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml @@ -135,19 +135,19 @@ - - update-db-artifact - create-missing-checksums - update-db-repository-metadata - validate-checksum - validate-signature - index-content - auto-remove - auto-rename - - - update-db-bad-content - + + update-db-artifact + create-missing-checksums + update-db-repository-metadata + validate-checksum + validate-signature + index-content + auto-remove + auto-rename + + + update-db-bad-content + @@ -160,11 +160,11 @@ update-db-bytecode-stats index-public-methods - - not-present-remove-db-artifact - not-present-remove-db-project - not-present-remove-indexed - + + not-present-remove-db-artifact + not-present-remove-db-project + not-present-remove-indexed + diff --git a/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml b/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml index 07e9f969b..f2ff08a05 100644 --- a/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml +++ b/archiva-base/archiva-configuration/src/test/conf/repository-manager.xml @@ -147,19 +147,19 @@ - - update-db-artifact - create-missing-checksums - update-db-repository-metadata - validate-checksum - validate-signature - index-content - auto-remove - auto-rename - - - update-db-bad-content - + + update-db-artifact + create-missing-checksums + update-db-repository-metadata + validate-checksum + validate-signature + index-content + auto-remove + auto-rename + + + update-db-bad-content + @@ -172,11 +172,11 @@ update-db-bytecode-stats index-public-methods - - not-present-remove-db-artifact - not-present-remove-db-project - not-present-remove-indexed - + + not-present-remove-db-artifact + not-present-remove-db-project + not-present-remove-indexed + diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java index 180bc1f8f..81bbba1a4 100644 --- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java +++ b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java @@ -60,8 +60,8 @@ public class ArchivaConfigurationTest extends PlexusTestCase RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning(); assertNotNull( "check repository scanning", repoScanning ); assertEquals( "check file types", 4, repoScanning.getFileTypes().size() ); - assertEquals( "check good consumers", 8, repoScanning.getGoodConsumers().size() ); - assertEquals( "check bad consumers", 1, repoScanning.getBadConsumers().size() ); + assertEquals( "check known consumers", 8, repoScanning.getKnownContentConsumers().size() ); + assertEquals( "check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size() ); List patterns = filetypes.getFileTypePatterns( "artifacts" ); assertNotNull( "check 'artifacts' file type", patterns ); @@ -70,7 +70,7 @@ public class ArchivaConfigurationTest extends PlexusTestCase DatabaseScanningConfiguration dbScanning = configuration.getDatabaseScanning(); assertNotNull( "check database scanning", dbScanning ); assertEquals( "check unprocessed consumers", 6, dbScanning.getUnprocessedConsumers().size() ); - assertEquals( "check processed consumers", 3, dbScanning.getProcessedConsumers().size() ); + assertEquals( "check cleanup consumers", 3, dbScanning.getCleanupConsumers().size() ); RepositoryConfiguration repository = (RepositoryConfiguration) configuration.getRepositories().iterator().next(); diff --git a/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseCleanupConsumer.java b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseCleanupConsumer.java new file mode 100644 index 000000000..ef5a787f9 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseCleanupConsumer.java @@ -0,0 +1,32 @@ +package org.apache.maven.archiva.consumers; + +/* + * 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 + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public interface DatabaseCleanupConsumer + extends ArchivaArtifactConsumer +{ + +} diff --git a/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseUnprocessedArtifactConsumer.java b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseUnprocessedArtifactConsumer.java new file mode 100644 index 000000000..fce7e5c04 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseUnprocessedArtifactConsumer.java @@ -0,0 +1,32 @@ +package org.apache.maven.archiva.consumers; + +/* + * 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 + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public interface DatabaseUnprocessedArtifactConsumer + extends ArchivaArtifactConsumer +{ + +} diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java new file mode 100644 index 000000000..2b1dd00e1 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.database; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * BytecodeStatsToDatabaseConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + * role-hint="update-db-bytecode-stats" + * instantiation-strategy="per-lookup" + */ +public class BytecodeStatsToDatabaseConsumer + extends AbstractMonitoredConsumer + implements DatabaseUnprocessedArtifactConsumer +{ + /** + * @plexus.configuration default-value="update-db-bytecode-stats" + */ + private String id; + + /** + * @plexus.configuration default-value="Update database with java bytecode stats." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java new file mode 100644 index 000000000..0b4949709 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.database; + +/* + * 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.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; + +/** + * DatabaseCleanupRemoveArtifactConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" + * role-hint="not-present-remove-db-artifact" + * instantiation-strategy="per-lookup" + */ +public class DatabaseCleanupRemoveArtifactConsumer + extends AbstractMonitoredConsumer + implements DatabaseCleanupConsumer +{ + /** + * @plexus.configuration default-value="not-present-remove-db-artifact" + */ + private String id; + + /** + * @plexus.configuration default-value="Remove artifact from database if not present on filesystem." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java new file mode 100644 index 000000000..ceef3a37e --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.database; + +/* + * 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.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; + +/** + * DatabaseCleanupRemoveProjectConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" + * role-hint="not-present-remove-db-project" + * instantiation-strategy="per-lookup" + */ +public class DatabaseCleanupRemoveProjectConsumer + extends AbstractMonitoredConsumer + implements DatabaseCleanupConsumer +{ + /** + * @plexus.configuration default-value="not-present-remove-db-project" + */ + private String id; + + /** + * @plexus.configuration default-value="Remove project from database if not present on filesystem." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java new file mode 100644 index 000000000..8ac936639 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.database; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * ProjectModelToDatabaseConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + * role-hint="update-db-project" + * instantiation-strategy="per-lookup" + */ +public class ProjectModelToDatabaseConsumer + extends AbstractMonitoredConsumer + implements DatabaseUnprocessedArtifactConsumer +{ + /** + * @plexus.configuration default-value="update-db-project" + */ + private String id; + + /** + * @plexus.configuration default-value="Update database with project model information." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java new file mode 100644 index 000000000..de169fe4b --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.database; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * VerifyMetadataAgainstDatabaseConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + * role-hint="validate-repository-metadata" + * instantiation-strategy="per-lookup" + */ +public class VerifyMetadataAgainstDatabaseConsumer + extends AbstractMonitoredConsumer + implements DatabaseUnprocessedArtifactConsumer +{ + /** + * @plexus.configuration default-value="validate-repository-metadata" + */ + private String id; + + /** + * @plexus.configuration default-value="Verify repository metadata files against database." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArchiveTableOfContentsConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArchiveTableOfContentsConsumer.java new file mode 100644 index 000000000..e44c3edec --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArchiveTableOfContentsConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.lucene; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * IndexArchiveTableOfContentsConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + * role-hint="index-archive-toc" + * instantiation-strategy="per-lookup" + */ +public class IndexArchiveTableOfContentsConsumer + extends AbstractMonitoredConsumer + implements DatabaseUnprocessedArtifactConsumer +{ + /** + * @plexus.configuration default-value="index-archive-toc" + */ + private String id; + + /** + * @plexus.configuration default-value="Index the archive table of contents for Full Text Search." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java new file mode 100644 index 000000000..1038cb372 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.lucene; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * IndexArtifactConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + * role-hint="index-artifact" + * instantiation-strategy="per-lookup" + */ +public class IndexArtifactConsumer + extends AbstractMonitoredConsumer + implements DatabaseUnprocessedArtifactConsumer +{ + /** + * @plexus.configuration default-value="index-artifact" + */ + private String id; + + /** + * @plexus.configuration default-value="Index the artifact details for Full Text Search." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java index b71e78f1f..98da60d37 100644 --- a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java @@ -79,7 +79,7 @@ public class IndexContentConsumer private FileTypes filetypes; /** - * @plexus.requirement + * @plexus.requirement role-hint="lucene" */ private RepositoryContentIndexFactory indexFactory; diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java new file mode 100644 index 000000000..23e3d5b17 --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.lucene; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; +import org.apache.maven.archiva.model.ArchivaArtifact; + +import java.util.List; + +/** + * IndexJavaPublicMethodsConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + * role-hint="index-public-methods" + * instantiation-strategy="per-lookup" + */ +public class IndexJavaPublicMethodsConsumer + extends AbstractMonitoredConsumer + implements DatabaseUnprocessedArtifactConsumer +{ + /** + * @plexus.configuration default-value="index-public-methods" + */ + private String id; + + /** + * @plexus.configuration default-value="Index the java public methods for Full Text Search." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java new file mode 100644 index 000000000..e3cee2e8a --- /dev/null +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java @@ -0,0 +1,93 @@ +package org.apache.maven.archiva.consumers.lucene; + +/* + * 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.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; + +/** + * LuceneCleanupRemoveIndexedConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" + * role-hint="not-present-remove-indexed" + * instantiation-strategy="per-lookup" + */ +public class LuceneCleanupRemoveIndexedConsumer + extends AbstractMonitoredConsumer + implements DatabaseCleanupConsumer +{ + /** + * @plexus.configuration default-value="not-present-remove-indexed" + */ + private String id; + + /** + * @plexus.configuration default-value="Remove indexed content if not present on filesystem." + */ + private String description; + + public void beginScan() + { + // TODO Auto-generated method stub + + } + + public void completeScan() + { + // TODO Auto-generated method stub + + } + + public List getIncludedTypes() + { + // TODO Auto-generated method stub + return null; + } + + public void processArchivaArtifact( ArchivaArtifact artifact ) + throws ConsumerException + { + // TODO Auto-generated method stub + + } + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isPermanent() + { + return false; + } + +} diff --git a/archiva-base/archiva-repository-layer/pom.xml b/archiva-base/archiva-repository-layer/pom.xml index 1a4ce33b2..c4866880f 100644 --- a/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-base/archiva-repository-layer/pom.xml @@ -88,6 +88,12 @@ 1.0-alpha-2 test + + easymock + easymock + 1.2_Java1.3 + test + diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java index 45dab28e0..cf9b790ae 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java @@ -51,7 +51,7 @@ public class DefaultRepositoryScanner /** * @plexus.requirement */ - private RepositoryContentConsumerUtil consumerUtil; + private RepositoryContentConsumers consumerUtil; public RepositoryContentStatistics scan( ArchivaRepository repository, long changesSince ) throws RepositoryException diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtil.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtil.java deleted file mode 100644 index 135db420d..000000000 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtil.java +++ /dev/null @@ -1,183 +0,0 @@ -package org.apache.maven.archiva.repository.scanner; - -/* - * 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.commons.collections.CollectionUtils; -import org.apache.commons.collections.Predicate; -import org.apache.commons.collections.functors.IfClosure; -import org.apache.maven.archiva.configuration.ArchivaConfiguration; -import org.apache.maven.archiva.configuration.Configuration; -import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; -import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; -import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.consumers.RepositoryContentConsumer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * RepositoryContentConsumerUtil - * - * @author Joakim Erdfelt - * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumerUtil" - */ -public class RepositoryContentConsumerUtil -{ - /** - * @plexus.requirement - */ - private ArchivaConfiguration archivaConfiguration; - - /** - * @plexus.requirement role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer" - */ - private List availableGoodConsumers; - - /** - * @plexus.requirement role="org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer" - */ - private List availableBadConsumers; - - class SelectedKnownRepoConsumersPredicate - implements Predicate - { - public boolean evaluate( Object object ) - { - boolean satisfies = false; - - if ( object instanceof KnownRepositoryContentConsumer ) - { - KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object; - Configuration config = archivaConfiguration.getConfiguration(); - - return config.getRepositoryScanning().getGoodConsumers().contains( known.getId() ); - } - - return satisfies; - } - - } - - class SelectedInvalidRepoConsumersPredicate - implements Predicate - { - public boolean evaluate( Object object ) - { - boolean satisfies = false; - - if ( object instanceof KnownRepositoryContentConsumer ) - { - InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object; - Configuration config = archivaConfiguration.getConfiguration(); - - return config.getRepositoryScanning().getBadConsumers().contains( invalid.getId() ); - } - - return satisfies; - } - } - - class RepoConsumerToMapClosure - implements Closure - { - private Map map = new HashMap(); - - public void execute( Object input ) - { - if ( input instanceof RepositoryContentConsumer ) - { - RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; - map.put( consumer.getId(), consumer ); - } - } - - public Map getMap() - { - return map; - } - } - - public Predicate getKnownSelectionPredicate() - { - return new SelectedKnownRepoConsumersPredicate(); - } - - public Predicate getInvalidSelectionPredicate() - { - return new SelectedInvalidRepoConsumersPredicate(); - } - - public Map getSelectedKnownConsumersMap() - { - RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); - - RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); - Closure ifclosure = IfClosure.getInstance( getKnownSelectionPredicate(), consumerMapClosure ); - CollectionUtils.forAllDo( scanning.getGoodConsumers(), ifclosure ); - - return consumerMapClosure.getMap(); - } - - public Map getSelectedInvalidConsumersMap() - { - RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); - - RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); - Closure ifclosure = IfClosure.getInstance( getInvalidSelectionPredicate(), consumerMapClosure ); - CollectionUtils.forAllDo( scanning.getGoodConsumers(), ifclosure ); - - return consumerMapClosure.getMap(); - } - - public List getSelectedKnownConsumers() - { - RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); - - List ret = new ArrayList(); - ret.addAll( CollectionUtils.select( scanning.getGoodConsumers(), getKnownSelectionPredicate() )); - - return ret; - } - - public List getSelectedInvalidConsumers() - { - RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); - - List ret = new ArrayList(); - ret.addAll( CollectionUtils.select( scanning.getBadConsumers(), getInvalidSelectionPredicate() )); - - return ret; - } - - public List getAvailableKnownConsumers() - { - return availableGoodConsumers; - } - - public List getAvailableInvalidConsumers() - { - return availableBadConsumers; - } -} diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java new file mode 100644 index 000000000..6e38b7ae2 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java @@ -0,0 +1,191 @@ +package org.apache.maven.archiva.repository.scanner; + +/* + * 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.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.apache.commons.collections.functors.IfClosure; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; +import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; +import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; +import org.apache.maven.archiva.consumers.RepositoryContentConsumer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * RepositoryContentConsumerUtil + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers" + */ +public class RepositoryContentConsumers +{ + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + + /** + * @plexus.requirement role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer" + */ + private List availableKnownConsumers; + + /** + * @plexus.requirement role="org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer" + */ + private List availableInvalidConsumers; + + class SelectedKnownRepoConsumersPredicate + implements Predicate + { + public boolean evaluate( Object object ) + { + boolean satisfies = false; + + if ( object instanceof KnownRepositoryContentConsumer ) + { + KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object; + Configuration config = archivaConfiguration.getConfiguration(); + + return config.getRepositoryScanning().getKnownContentConsumers().contains( known.getId() ); + } + + return satisfies; + } + + } + + class SelectedInvalidRepoConsumersPredicate + implements Predicate + { + public boolean evaluate( Object object ) + { + boolean satisfies = false; + + if ( object instanceof InvalidRepositoryContentConsumer ) + { + InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object; + Configuration config = archivaConfiguration.getConfiguration(); + + return config.getRepositoryScanning().getInvalidContentConsumers().contains( invalid.getId() ); + } + + return satisfies; + } + } + + class RepoConsumerToMapClosure + implements Closure + { + private Map map = new HashMap(); + + public void execute( Object input ) + { + if ( input instanceof RepositoryContentConsumer ) + { + RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; + map.put( consumer.getId(), consumer ); + } + } + + public Map getMap() + { + return map; + } + } + + public Predicate getKnownSelectionPredicate() + { + return new SelectedKnownRepoConsumersPredicate(); + } + + public Predicate getInvalidSelectionPredicate() + { + return new SelectedInvalidRepoConsumersPredicate(); + } + + public List getSelectedKnownConsumerIds() + { + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); + return scanning.getKnownContentConsumers(); + } + + public List getSelectedInvalidConsumerIds() + { + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); + return scanning.getInvalidContentConsumers(); + } + + public Map getSelectedKnownConsumersMap() + { + RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); + Closure ifclosure = IfClosure.getInstance( getKnownSelectionPredicate(), consumerMapClosure ); + CollectionUtils.forAllDo( availableKnownConsumers, ifclosure ); + + return consumerMapClosure.getMap(); + } + + public Map getSelectedInvalidConsumersMap() + { + RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); + Closure ifclosure = IfClosure.getInstance( getInvalidSelectionPredicate(), consumerMapClosure ); + CollectionUtils.forAllDo( availableInvalidConsumers, ifclosure ); + + return consumerMapClosure.getMap(); + } + + public List getSelectedKnownConsumers() + { + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); + + List ret = new ArrayList(); + ret.addAll( CollectionUtils.select( scanning.getKnownContentConsumers(), getKnownSelectionPredicate() )); + + return ret; + } + + public List getSelectedInvalidConsumers() + { + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); + + List ret = new ArrayList(); + ret.addAll( CollectionUtils.select( scanning.getInvalidContentConsumers(), getInvalidSelectionPredicate() )); + + return ret; + } + + public List getAvailableKnownConsumers() + { + return availableKnownConsumers; + } + + public List getAvailableInvalidConsumers() + { + return availableInvalidConsumers; + } +} diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java new file mode 100644 index 000000000..8076f8256 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java @@ -0,0 +1,103 @@ +package org.apache.maven.archiva.repository.scanner; + +/* + * 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.KnownRepositoryContentConsumer; +import org.apache.maven.archiva.consumers.RepositoryContentConsumer; +import org.codehaus.plexus.PlexusTestCase; + +import java.util.List; +import java.util.Map; + +/** + * RepositoryContentConsumerUtilTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class RepositoryContentConsumerUtilTest + extends PlexusTestCase +{ + private RepositoryContentConsumers lookupRepositoryConsumerUtil() + throws Exception + { + RepositoryContentConsumers consumerUtil = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class + .getName() ); + assertNotNull( "RepositoryContentConsumerUtil should not be null.", consumerUtil ); + return consumerUtil; + } + + public void testGetSelectedIds() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); + + List knownConsumers = consumerutil.getSelectedKnownConsumerIds(); + assertNotNull( "Known Consumer IDs should not be null", knownConsumers ); + assertEquals( "Known Consumer IDs.size", 9, knownConsumers.size() ); + + List invalidConsumers = consumerutil.getSelectedInvalidConsumerIds(); + assertNotNull( "Invalid Consumer IDs should not be null", invalidConsumers ); + assertEquals( "Invalid Consumer IDs.size", 1, invalidConsumers.size() ); + } + + public void testGetSelectedConsumersMaps() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); + + Map knownConsumerMap = consumerutil.getSelectedKnownConsumersMap(); + assertNotNull( "Known Consumer Map should not be null", knownConsumerMap ); + assertEquals( "Known Consumer Map.size", 1, knownConsumerMap.size() ); + + Object o = knownConsumerMap.get( "sample-known" ); + assertNotNull( "Known[sample-known] should not be null.", o ); + assertInstanceof( "Known[sample-known]", RepositoryContentConsumer.class, o ); + assertInstanceof( "Known[sample-known]", KnownRepositoryContentConsumer.class, o ); + + Map invalidConsumerMap = consumerutil.getSelectedInvalidConsumersMap(); + assertNotNull( "Invalid Consumer Map should not be null", invalidConsumerMap ); + assertEquals( "Invalid Consumer Map.size", 0, invalidConsumerMap.size() ); + } + + private void assertInstanceof( String msg, Class clazz, Object o ) + { + if ( clazz.isInstance( o ) == false ) + { + fail( msg + ": Object [" + o.getClass().getName() + "] should have been an instanceof [" + clazz.getName() + + "]" ); + } + } + + public void testGetAvailableLists() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); + + List knownConsumers = consumerutil.getAvailableKnownConsumers(); + assertNotNull( "known consumers should not be null.", knownConsumers ); + assertEquals( "known consumers", 1, knownConsumers.size() ); + assertInstanceof( "Available Known Consumers", RepositoryContentConsumer.class, knownConsumers.get( 0 ) ); + + List invalidConsumers = consumerutil.getAvailableInvalidConsumers(); + assertNotNull( "invalid consumers should not be null.", invalidConsumers ); + assertEquals( "invalid consumers", 0, invalidConsumers.size() ); + } +} diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java new file mode 100644 index 000000000..94e5894f6 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java @@ -0,0 +1,83 @@ +package org.apache.maven.archiva.repository.scanner; + +/* + * 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.AbstractMonitoredConsumer; +import org.apache.maven.archiva.consumers.ConsumerException; +import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; +import org.apache.maven.archiva.model.ArchivaRepository; + +import java.util.List; + +/** + * SampleKnownConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer" + * role-hint="sample-known" + */ +public class SampleKnownConsumer + extends AbstractMonitoredConsumer + implements KnownRepositoryContentConsumer +{ + public void beginScan( ArchivaRepository repository ) + throws ConsumerException + { + /* nothing to do */ + } + + public void completeScan() + { + /* nothing to do */ + } + + public List getExcludes() + { + return null; + } + + public List getIncludes() + { + return null; + } + + public void processFile( String path ) + throws ConsumerException + { + /* nothing to do */ + } + + public String getDescription() + { + return "Sample Known Consumer"; + } + + public String getId() + { + return "sample-known"; + } + + public boolean isPermanent() + { + return false; + } +} diff --git a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml new file mode 100644 index 000000000..98b210894 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml @@ -0,0 +1,53 @@ + + + + + + + org.apache.maven.archiva.configuration.ArchivaConfiguration + org.apache.maven.archiva.configuration.DefaultArchivaConfiguration + + + org.codehaus.plexus.registry.Registry + configured + + + + + org.codehaus.plexus.registry.Registry + configured + org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry + + + + + + + + + + org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer + sample-known + org.apache.maven.archiva.repository.scanner.SampleKnownConsumer + + + + diff --git a/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml b/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml new file mode 100644 index 000000000..5a23d4efa --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml @@ -0,0 +1,110 @@ + + + + + + + + + artifacts + + **/*.pom + **/*.jar + **/*.ear + **/*.war + **/*.car + **/*.sar + **/*.mar + **/*.rar + **/*.dtd + **/*.tld + **/*.tar.gz + **/*.tar.bz2 + **/*.zip + + + + indexable-content + + **/*.txt + **/*.TXT + **/*.block + **/*.config + **/*.pom + **/*.xml + **/*.xsd + **/*.dtd + **/*.tld + + + + auto-remove + + **/*.bak + **/*~ + **/*- + + + + ignored + + **/.htaccess + **/KEYS + **/*.rb + **/*.sh + **/.svn/** + **/.DAV/** + + + + + sample-known + update-db-artifact + create-missing-checksums + update-db-repository-metadata + validate-checksum + validate-signature + index-content + auto-remove + auto-rename + + + update-db-bad-content + + + + + 0 0 * * ? + + index-artifact + update-db-project + validate-repository-metadata + index-archive-toc + update-db-bytecode-stats + index-public-methods + + + not-present-remove-db-artifact + not-present-remove-db-project + not-present-remove-indexed + + + + diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java new file mode 100644 index 000000000..6c4f65ffb --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java @@ -0,0 +1,157 @@ +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.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +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.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * DatabaseConsumers + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component role="org.apache.maven.archiva.database.updater.DatabaseConsumers" + */ +public class DatabaseConsumers + implements Initializable +{ + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + + /** + * @plexus.requirement role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer" + */ + private List availableUnprocessedConsumers; + + /** + * @plexus.requirement role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer" + */ + private List availableCleanupConsumers; + + private SelectedCleanupConsumersPredicate selectedCleanupConsumers; + + private SelectedUnprocessedConsumersPredicate selectedUnprocessedConsumers; + + class SelectedUnprocessedConsumersPredicate + implements Predicate + { + public boolean evaluate( Object object ) + { + boolean satisfies = false; + + if ( object instanceof DatabaseUnprocessedArtifactConsumer ) + { + DatabaseUnprocessedArtifactConsumer consumer = (DatabaseUnprocessedArtifactConsumer) object; + DatabaseScanningConfiguration config = archivaConfiguration.getConfiguration().getDatabaseScanning(); + + return config.getUnprocessedConsumers().contains( consumer.getId() ); + } + + return satisfies; + } + } + + class SelectedCleanupConsumersPredicate + implements Predicate + { + public boolean evaluate( Object object ) + { + boolean satisfies = false; + + if ( object instanceof DatabaseCleanupConsumer ) + { + DatabaseCleanupConsumer consumer = (DatabaseCleanupConsumer) object; + DatabaseScanningConfiguration config = archivaConfiguration.getConfiguration().getDatabaseScanning(); + + return config.getUnprocessedConsumers().contains( consumer.getId() ); + } + + return satisfies; + } + } + + public void initialize() + throws InitializationException + { + selectedCleanupConsumers = new SelectedCleanupConsumersPredicate(); + selectedUnprocessedConsumers = new SelectedUnprocessedConsumersPredicate(); + } + + /** + * Get the {@link List} of {@link DatabaseUnprocessedArtifactConsumer} objects + * for those consumers selected due to the configuration. + * + * @return the list of selected {@link DatabaseUnprocessedArtifactConsumer} objects. + */ + public List getSelectedUnprocessedConsumers() + { + List ret = new ArrayList(); + ret.addAll( CollectionUtils.select( availableUnprocessedConsumers, selectedUnprocessedConsumers ) ); + return ret; + } + + /** + * Get the {@link List} of {@link DatabaseCleanupConsumer} objects for those + * consumers selected due to the configuration. + * + * @return the list of selected {@link DatabaseCleanupConsumer} objects. + */ + public List getSelectedCleanupConsumers() + { + List ret = new ArrayList(); + ret.addAll( CollectionUtils.select( availableCleanupConsumers, selectedCleanupConsumers ) ); + return ret; + } + + /** + * Get the complete {@link List} of {@link DatabaseUnprocessedArtifactConsumer} objects + * that are available in the system, regardless of configuration. + * + * @return the list of all available {@link DatabaseUnprocessedArtifactConsumer} objects. + */ + public List getAvailableUnprocessedConsumers() + { + return Collections.unmodifiableList( this.availableUnprocessedConsumers ); + } + + /** + * Get the complete {@link List} of {@link DatabaseCleanupConsumer} objects + * that are available in the system, regardless of configuration. + * + * @return the list of all available {@link DatabaseCleanupConsumer} objects. + */ + public List getAvailableCleanupConsumers() + { + return Collections.unmodifiableList( this.availableCleanupConsumers ); + } +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java index 98a5d5635..69172a33a 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java @@ -217,7 +217,7 @@ public class JdoDatabaseUpdater } this.activeUnprocessedConsumers.addAll( getActiveConsumerList( dbScanning.getUnprocessedConsumers() ) ); - this.activeProcessedConsumers.addAll( getActiveConsumerList( dbScanning.getProcessedConsumers() ) ); + this.activeProcessedConsumers.addAll( getActiveConsumerList( dbScanning.getCleanupConsumers() ) ); } private List getActiveConsumerList( List potentialConsumerList ) diff --git a/archiva-web/archiva-webapp/pom.xml b/archiva-web/archiva-webapp/pom.xml index 33fa06e22..582eac1c6 100644 --- a/archiva-web/archiva-webapp/pom.xml +++ b/archiva-web/archiva-webapp/pom.xml @@ -58,6 +58,18 @@ org.apache.maven.archiva archiva-security + + org.apache.maven.archiva + archiva-database-consumers + + + org.apache.maven.archiva + archiva-lucene-consumers + + + org.apache.maven.archiva + archiva-signature-consumers + org.apache.maven.archiva archiva-applet diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java new file mode 100644 index 000000000..f46f50ed6 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java @@ -0,0 +1,67 @@ +package org.apache.maven.archiva.web.action.admin.database; + +/* + * 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.consumers.ArchivaArtifactConsumer; + +import java.util.ArrayList; +import java.util.List; + +/** + * AddAdminDatabaseConsumerClosure + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AddAdminDatabaseConsumerClosure + implements Closure +{ + private List list = new ArrayList(); + + private List selectedIds; + + public AddAdminDatabaseConsumerClosure( List selectedIds ) + { + this.selectedIds = selectedIds; + } + + public void execute( Object input ) + { + if ( input instanceof ArchivaArtifactConsumer ) + { + ArchivaArtifactConsumer consumer = (ArchivaArtifactConsumer) input; + + boolean enabled = this.selectedIds.contains( consumer.getId() ); + + AdminDatabaseConsumer adminconsumer = new AdminDatabaseConsumer(); + adminconsumer.setEnabled( enabled ); + adminconsumer.setId( consumer.getId() ); + adminconsumer.setDescription( consumer.getDescription() ); + + list.add( adminconsumer ); + } + } + + public List getList() + { + return list; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java new file mode 100644 index 000000000..2c200f088 --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java @@ -0,0 +1,65 @@ +package org.apache.maven.archiva.web.action.admin.database; + +/* + * 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. + */ + +/** + * AdminDatabaseConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AdminDatabaseConsumer +{ + private boolean enabled = false; + + private String id; + + private String description; + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isEnabled() + { + return enabled; + } + + public void setDescription( String description ) + { + this.description = description; + } + + public void setEnabled( boolean enabled ) + { + this.enabled = enabled; + } + + public void setId( String id ) + { + this.id = id; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java new file mode 100644 index 000000000..48737090d --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java @@ -0,0 +1,67 @@ +package org.apache.maven.archiva.web.action.admin.database; + +/* + * 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 java.util.Comparator; + +/** + * AdminDatabaseConsumerComparator + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AdminDatabaseConsumerComparator + implements Comparator +{ + private static AdminDatabaseConsumerComparator INSTANCE = new AdminDatabaseConsumerComparator(); + + public static AdminDatabaseConsumerComparator getInstance() + { + return INSTANCE; + } + + public int compare( Object o1, Object o2 ) + { + if ( o1 == null && o2 == null ) + { + return 0; + } + + if ( o1 == null && o2 != null ) + { + return 1; + } + + if ( o1 != null && o2 == null ) + { + return -1; + } + + if ( ( o1 instanceof AdminDatabaseConsumer ) && ( o2 instanceof AdminDatabaseConsumer ) ) + { + String id1 = ( (AdminDatabaseConsumer) o1 ).getId(); + String id2 = ( (AdminDatabaseConsumer) o2 ).getId(); + return id1.compareToIgnoreCase( id2 ); + } + + return 0; + } + +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java index 87acd09f0..815eae3ed 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java @@ -19,17 +19,23 @@ package org.apache.maven.archiva.web.action.admin.database; * under the License. */ -import com.opensymphony.webwork.interceptor.ServletRequestAware; -import com.opensymphony.xwork.ModelDriven; import com.opensymphony.xwork.Preparable; -import com.opensymphony.xwork.Validateable; +import org.apache.commons.collections.CollectionUtils; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; +import org.apache.maven.archiva.database.updater.DatabaseConsumers; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.apache.maven.archiva.web.action.admin.scanning.AdminRepositoryConsumerComparator; +import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import javax.servlet.http.HttpServletRequest; +import java.util.Collections; +import java.util.List; /** * DatabaseAction @@ -40,34 +46,101 @@ import javax.servlet.http.HttpServletRequest; * @plexus.component role="com.opensymphony.xwork.Action" role-hint="databaseAction" */ public class DatabaseAction -extends PlexusActionSupport -implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware + extends PlexusActionSupport + implements Preparable, SecureAction { + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; - public Object getModel() - { - // TODO Auto-generated method stub - return null; - } + /** + * @plexus.requirement + */ + private DatabaseConsumers databaseConsumers; + + private String cron; + + /** + * List of {@link AdminDatabaseConsumer} objects for unprocessed artifacts. + */ + private List unprocessedConsumers; + + /** + * List of {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts. + */ + private List cleanupConsumers; public void prepare() throws Exception { - // TODO Auto-generated method stub + Configuration config = archivaConfiguration.getConfiguration(); + DatabaseScanningConfiguration dbscanning = config.getDatabaseScanning(); + + this.cron = dbscanning.getCronExpression(); + + AddAdminDatabaseConsumerClosure addAdminDbConsumer; + getLogger().info( "Total Available Unprocessed Consumers: " + databaseConsumers.getAvailableUnprocessedConsumers().size() ); + getLogger().info( "Total Available Cleanup Consumers: " + databaseConsumers.getAvailableCleanupConsumers().size() ); + + addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getUnprocessedConsumers() ); + CollectionUtils.forAllDo( databaseConsumers.getAvailableUnprocessedConsumers(), addAdminDbConsumer ); + this.unprocessedConsumers = addAdminDbConsumer.getList(); + Collections.sort( this.unprocessedConsumers, AdminRepositoryConsumerComparator.getInstance() ); + + addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getCleanupConsumers() ); + CollectionUtils.forAllDo( databaseConsumers.getAvailableCleanupConsumers(), addAdminDbConsumer ); + this.cleanupConsumers = addAdminDbConsumer.getList(); + Collections.sort( this.cleanupConsumers, AdminRepositoryConsumerComparator.getInstance() ); } + public String updateUnprocessedConsumers() + { + getLogger().info( "updateUnprocesedConsumers()" ); + return INPUT; + } + + public String updateCleanupConsumers() + { + getLogger().info( "updateCleanupConsumers()" ); + return INPUT; + } + + public String updateSchedule() + { + getLogger().info( "updateSchedule()" ); + return INPUT; + } + public SecureActionBundle getSecureActionBundle() throws SecureActionException { - // TODO Auto-generated method stub - return null; + SecureActionBundle bundle = new SecureActionBundle(); + + bundle.setRequiresAuthentication( true ); + bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); + + return bundle; } - public void setServletRequest( HttpServletRequest request ) + public String getCron() { - // TODO Auto-generated method stub - + return cron; } + public void setCron( String cron ) + { + this.cron = cron; + } + + public List getCleanupConsumers() + { + return cleanupConsumers; + } + + public List getUnprocessedConsumers() + { + return unprocessedConsumers; + } } diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java new file mode 100644 index 000000000..a30d2775d --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java @@ -0,0 +1,66 @@ +package org.apache.maven.archiva.web.action.admin.scanning; + +/* + * 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.consumers.RepositoryContentConsumer; + +import java.util.ArrayList; +import java.util.List; + +/** + * AddAdminRepoConsumerClosure + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AddAdminRepoConsumerClosure + implements Closure +{ + private List list = new ArrayList(); + + private List selectedIds; + + public AddAdminRepoConsumerClosure( List selectedIds ) + { + this.selectedIds = selectedIds; + } + + public void execute( Object input ) + { + if ( input instanceof RepositoryContentConsumer ) + { + RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; + + boolean enabled = this.selectedIds.contains( consumer.getId() ); + AdminRepositoryConsumer adminconsumer = new AdminRepositoryConsumer(); + adminconsumer.setEnabled( enabled ); + adminconsumer.setId( consumer.getId() ); + adminconsumer.setDescription( consumer.getDescription() ); + + list.add( adminconsumer ); + } + } + + public List getList() + { + return list; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java new file mode 100644 index 000000000..77eda152b --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java @@ -0,0 +1,63 @@ +package org.apache.maven.archiva.web.action.admin.scanning; + +/* + * 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. + */ + +/** + * AdminRepositoryConsumer + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AdminRepositoryConsumer +{ + private boolean enabled = false; + private String id; + private String description; + + public String getDescription() + { + return description; + } + + public String getId() + { + return id; + } + + public boolean isEnabled() + { + return enabled; + } + + public void setDescription( String description ) + { + this.description = description; + } + + public void setEnabled( boolean enabled ) + { + this.enabled = enabled; + } + + public void setId( String id ) + { + this.id = id; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java new file mode 100644 index 000000000..aa61cc60f --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java @@ -0,0 +1,66 @@ +package org.apache.maven.archiva.web.action.admin.scanning; + +/* + * 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 java.util.Comparator; + +/** + * AdminRepositoryConsumerComparator + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class AdminRepositoryConsumerComparator + implements Comparator +{ + private static AdminRepositoryConsumerComparator INSTANCE = new AdminRepositoryConsumerComparator(); + + public static AdminRepositoryConsumerComparator getInstance() + { + return INSTANCE; + } + + public int compare( Object o1, Object o2 ) + { + if ( o1 == null && o2 == null ) + { + return 0; + } + + if ( o1 == null && o2 != null ) + { + return 1; + } + + if ( o1 != null && o2 == null ) + { + return -1; + } + + if ( ( o1 instanceof AdminRepositoryConsumer ) && ( o2 instanceof AdminRepositoryConsumer ) ) + { + String id1 = ( (AdminRepositoryConsumer) o1 ).getId(); + String id2 = ( (AdminRepositoryConsumer) o2 ).getId(); + return id1.compareToIgnoreCase( id2 ); + } + + return 0; + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java deleted file mode 100644 index bb4b5c040..000000000 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.maven.archiva.web.action.admin.scanning; - -/* - * 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 com.opensymphony.xwork.Preparable; - -import org.apache.maven.archiva.security.ArchivaRoleConstants; -import org.codehaus.plexus.security.rbac.Resource; -import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; -import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; -import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; -import org.codehaus.plexus.xwork.action.PlexusActionSupport; - -/** - * ConfigureRepositoryScanningAction - * - * @author Joakim Erdfelt - * @version $Id$ - * - * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryScanningAction" - */ -public class ConfigureRepositoryScanningAction -extends PlexusActionSupport -implements SecureAction, Preparable -{ - - public SecureActionBundle getSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL ); - - return bundle; - } - - public void prepare() - throws Exception - { - // TODO Auto-generated method stub - - } - -} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java index b8035c7a5..701409cc8 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java @@ -23,10 +23,16 @@ import com.opensymphony.xwork.Preparable; import com.opensymphony.xwork.Validateable; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.FileType; +import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; +import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate; import org.apache.maven.archiva.configuration.functors.FiletypeToMapClosure; +import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers; import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.codehaus.plexus.registry.RegistryException; import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; @@ -55,58 +61,100 @@ public class RepositoryScanningAction */ private ArchivaConfiguration archivaConfiguration; + /** + * @plexus.requirement + */ + private RepositoryContentConsumers repoconsumerUtil; + private Map fileTypeMap; - + private List fileTypeIds; - private List goodConsumers = new ArrayList(); + /** + * List of {@link AdminRepositoryConsumer} objects for consumers of known content. + */ + private List knownContentConsumers = new ArrayList(); + + /** + * List of {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content. + */ + private List invalidContentConsumers = new ArrayList(); - private List badConsumers = new ArrayList(); - private String pattern; - + private String fileTypeId; - public void prepare() - throws Exception + public void addActionError( String anErrorMessage ) { - Configuration config = archivaConfiguration.getConfiguration(); - FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure(); - - CollectionUtils.forAllDo( config.getRepositoryScanning().getFileTypes(), filetypeToMapClosure ); - fileTypeMap = filetypeToMapClosure.getMap(); - - goodConsumers.clear(); - goodConsumers.addAll( config.getRepositoryScanning().getGoodConsumers() ); - - badConsumers.clear(); - badConsumers.addAll( config.getRepositoryScanning().getBadConsumers() ); - - fileTypeIds = new ArrayList(); - fileTypeIds.addAll( fileTypeMap.keySet() ); - Collections.sort( fileTypeIds ); + super.addActionError( anErrorMessage ); + getLogger().warn( "[ActionError] " + anErrorMessage ); } - public String removeFiletypePattern() + public void addActionMessage( String aMessage ) { - getLogger().info( "Remove File Type Pattern [" + getFileTypeId() + ":" + getPattern() + "]" ); - - // TODO: remove the filetype - // TODO: save configuration - - return INPUT; + super.addActionMessage( aMessage ); + getLogger().info( "[ActionMessage] " + aMessage ); } public String addFiletypePattern() { getLogger().info( "Add New File Type Pattern [" + getFileTypeId() + ":" + getPattern() + "]" ); - - // TODO: add the filetype. - // TODO: report error if filetype pattern already exists. - // TODO: report success (message) if added successfully. - // TODO: save configuration each time. - - return INPUT; + + if ( !isValidFiletypeCommand() ) + { + return INPUT; + } + + String id = getFileTypeId(); + String pattern = getPattern(); + + FileType filetype = findFileType( id ); + if ( filetype == null ) + { + addActionError( "Pattern not added, unable to find filetype " + id ); + return INPUT; + } + + if ( filetype.getPatterns().contains( pattern ) ) + { + addActionError( "Not adding pattern \"" + pattern + "\" to filetype " + id + " as it already exists." ); + return INPUT; + } + + filetype.addPattern( pattern ); + addActionMessage( "Added pattern \"" + pattern + "\" to filetype " + id ); + + return saveConfiguration(); + } + + public String getFileTypeId() + { + return fileTypeId; + } + + public List getFileTypeIds() + { + return fileTypeIds; + } + + public Map getFileTypeMap() + { + return fileTypeMap; + } + + public List getInvalidContentConsumers() + { + return invalidContentConsumers; + } + + public List getKnownContentConsumers() + { + return knownContentConsumers; + } + + public String getPattern() + { + return pattern; } public SecureActionBundle getSecureActionBundle() @@ -120,43 +168,112 @@ public class RepositoryScanningAction return bundle; } - public List getBadConsumers() + public void prepare() + throws Exception { - return badConsumers; + Configuration config = archivaConfiguration.getConfiguration(); + RepositoryScanningConfiguration reposcanning = config.getRepositoryScanning(); + + FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure(); + + CollectionUtils.forAllDo( reposcanning.getFileTypes(), filetypeToMapClosure ); + fileTypeMap = filetypeToMapClosure.getMap(); + + AddAdminRepoConsumerClosure addAdminRepoConsumer; + + addAdminRepoConsumer = new AddAdminRepoConsumerClosure( reposcanning.getKnownContentConsumers() ); + CollectionUtils.forAllDo( repoconsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer ); + knownContentConsumers.clear(); + knownContentConsumers.addAll( addAdminRepoConsumer.getList() ); + Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); + + addAdminRepoConsumer = new AddAdminRepoConsumerClosure( reposcanning.getInvalidContentConsumers() ); + CollectionUtils.forAllDo( repoconsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer ); + invalidContentConsumers.clear(); + invalidContentConsumers.addAll( addAdminRepoConsumer.getList() ); + Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); + + fileTypeIds = new ArrayList(); + fileTypeIds.addAll( fileTypeMap.keySet() ); + Collections.sort( fileTypeIds ); } - public Map getFileTypeMap() + public String removeFiletypePattern() { - return fileTypeMap; + getLogger().info( "Remove File Type Pattern [" + getFileTypeId() + ":" + getPattern() + "]" ); + + if ( !isValidFiletypeCommand() ) + { + return INPUT; + } + + FileType filetype = findFileType( getFileTypeId() ); + if ( filetype == null ) + { + addActionError( "Pattern not removed, unable to find filetype " + getFileTypeId() ); + return INPUT; + } + + filetype.removePattern( getPattern() ); + + return saveConfiguration(); } - public List getGoodConsumers() + public void setFileTypeId( String fileTypeId ) { - return goodConsumers; + this.fileTypeId = fileTypeId; } - public String getFileTypeId() + public void setPattern( String pattern ) { - return fileTypeId; + this.pattern = pattern; } - public void setFileTypeId( String fileTypeId ) + public String updateInvalidConsumers() { - this.fileTypeId = fileTypeId; + addActionMessage("Update Invalid Consumers"); + return INPUT; } - public String getPattern() + public String updateKnownConsumers() { - return pattern; + addActionMessage("Update Known Consumers"); + return INPUT; } - public void setPattern( String pattern ) + private FileType findFileType( String id ) { - this.pattern = pattern; + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); + return (FileType) CollectionUtils.find( scanning.getFileTypes(), new FiletypeSelectionPredicate( id ) ); } - public List getFileTypeIds() + private boolean isValidFiletypeCommand() { - return fileTypeIds; + if ( StringUtils.isBlank( getFileTypeId() ) ) + { + addActionError( "Unable to process blank filetype id." ); + } + + if ( StringUtils.isBlank( getPattern() ) ) + { + addActionError( "Unable to process blank pattern." ); + } + + return !hasActionErrors(); + } + + private String saveConfiguration() + { + try + { + archivaConfiguration.save( archivaConfiguration.getConfiguration() ); + addActionMessage( "Successfully saved configuration" ); + } + catch ( RegistryException e ) + { + addActionError( "Unable to save configuration: " + e.getMessage() ); + } + + return INPUT; } } diff --git a/archiva-web/archiva-webapp/src/main/resources/xwork.xml b/archiva-web/archiva-webapp/src/main/resources/xwork.xml index b919f31fa..b726ec3b9 100644 --- a/archiva-web/archiva-webapp/src/main/resources/xwork.xml +++ b/archiva-web/archiva-webapp/src/main/resources/xwork.xml @@ -336,30 +336,6 @@ /WEB-INF/jsp/admin/repositoryScanning.jsp - - /WEB-INF/jsp/admin/addRepositoryScanning.jsp - repositoryScanning - - - - - /WEB-INF/jsp/admin/editRepositoryScanning.jsp - repositoryScanning - - - - - /WEB-INF/jsp/admin/editRepositoryScanning.jsp - repositoryScanning - - - - - /WEB-INF/jsp/admin/deleteRepositoryScanning.jsp - repositoryScanning - - - @@ -368,7 +344,6 @@ - /WEB-INF/jsp/admin/configure.jsp diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp new file mode 100644 index 000000000..711817aed --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp @@ -0,0 +1,173 @@ +<%-- + ~ 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. + --%> + +<%@ taglib prefix="ww" uri="/webwork"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="pss" uri="/plexusSecuritySystem"%> +<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva"%> + + + +Administration - Database + + + + + +

Administration - Database

+ +
+ + + + + + + +
+ +

Database - Unprocessed Artifacts Scanning

+ + + + + + + +
+ +
+
+ +

Database - Unprocessed Artifacts Scanning

+ + + + <%-- No Consumers. Eeek! --%> + There are no consumers for unprocessed artifacts. + + + <%-- Display the consumers. --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Enabled?IDDescription
+ + + + enabled + + + ${consumer.id} + ${consumer.description}
+ +
+
+ +
+
+ +

Database - Artifact Cleanup Scanning

+ + + + <%-- No Consumers. Eeek! --%> + There are no consumers for artifact cleanup. + + + <%-- Display the consumers. --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Enabled?IDDescription
+ + + + enabled + + + ${consumer.id} + ${consumer.description}
+ +
+
+ +
+
+ + +
+ + diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp index 039ac84f2..7db51246d 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp @@ -144,65 +144,113 @@ -

Repository Scanning - Consumers of Good Content

+

Repository Scanning - Consumers of Known Content

- + <%-- No Good Consumers. Eeek! --%> - There are no good consumers configured. + There are no consumers of known content available. <%-- Display the consumers. --%> - - + +
+ + + + + + + - + - + - - + + + + + + +
 Enabled?IDDescription
${consumer}" /> + + + + enabled + + + ${consumer.id} + ${consumer.description}
+ +
+
-

Repository Scanning - Consumers of Bad Content

+

Repository Scanning - Consumers of Invalid Content

- - <%-- No Bad Consumers. Eeek! --%> - There are no bad consumers configured. + + <%-- No Consumers. Eeek! --%> + There are no consumers of invalid content available. <%-- Display the consumers. --%> - - + +
+ + + + + + + - + - + - - + + + + + + +
 Enabled?IDDescription
${consumer}" /> + + + + enabled + + + ${consumer.id} + ${consumer.description}
+ +
+
diff --git a/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css b/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css index 952c9b5a3..ca951f8d0 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css +++ b/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css @@ -63,12 +63,10 @@ div.clear hr { .xleft, #bannerLeft img { float: left; - text-shadow: #7CFC00; } .xright, #bannerRight img { float: right; - text-shadow: #7CFC00; } #banner { diff --git a/archiva-web/archiva-webapp/src/main/webapp/css/site.css b/archiva-web/archiva-webapp/src/main/webapp/css/site.css index 587dd7161..73c65f9db 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/css/site.css +++ b/archiva-web/archiva-webapp/src/main/webapp/css/site.css @@ -43,7 +43,6 @@ float: right; font-size: small; font-weight: bold; - xmargin: 0px auto; margin: 15px auto 0px auto; height: auto; width: 150px; @@ -148,7 +147,9 @@ } .actionMessage { + font-size: 1.0em; font-weight: bold; + color: blue; } .errorBullet { @@ -318,11 +319,27 @@ div.filetype table td.controls { width: 5%; } -div.filetype table td.odd { +div.filetype table td.odd, +div.admin table.consumers td.odd { background-color: #dddddd; } -div.filetype table td.event { +div.filetype table td.even, +div.admin table.consumers td.even { background-color: white; } +div.admin table.consumers { + margin-left: 15px; + border: 1px solid gray; +} + +div.admin table.consumers th { + font-size: 1.0em; + background-color: #cccccc; + text-align: left; +} + +div.admin table.consumers td strong { + font-size: 0.8em; +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2187e4dc0..49541c0a0 100644 --- a/pom.xml +++ b/pom.xml @@ -323,6 +323,11 @@ archiva-lucene-consumers ${archiva.version}
+ + org.apache.maven.archiva + archiva-signature-consumers + ${archiva.version} + org.apache.maven.archiva archiva-model