]> source.dussan.org Git - archiva.git/commitdiff
Updates to Database scanner, updater, task, consumers, and admin screens.
authorJoakim Erdfelt <joakime@apache.org>
Wed, 9 May 2007 22:03:49 +0000 (22:03 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Wed, 9 May 2007 22:03:49 +0000 (22:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@536680 13f79535-47bb-0310-9956-ffa450edef68

42 files changed:
archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
archiva-base/archiva-configuration/src/test/conf/repository-manager.xml
archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseCleanupConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/DatabaseUnprocessedArtifactConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArchiveTableOfContentsConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java
archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java [new file with mode: 0644]
archiva-base/archiva-repository-layer/pom.xml
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtil.java [deleted file]
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java [new file with mode: 0644]
archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java [new file with mode: 0644]
archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java [new file with mode: 0644]
archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml [new file with mode: 0644]
archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java
archiva-web/archiva-webapp/pom.xml
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java [deleted file]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
archiva-web/archiva-webapp/src/main/resources/xwork.xml
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp
archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css
archiva-web/archiva-webapp/src/main/webapp/css/site.css
pom.xml

index 49efaad10f45eb968853a24df2a6341b65ac2b36..b0c91c5e9aa05d761d1cbd3b12473a7b4ffe6056 100644 (file)
           </description>
         </field>
         <field>
-          <name>goodConsumers</name>
+          <name>knownContentConsumers</name>
           <version>1.0.0+</version>
           <required>true</required>
           <association>
             <multiplicity>*</multiplicity>
           </association>
           <description>
-            The list of consumers for good content.
+            The list of active consumers IDs for known content.
           </description>
         </field>
         <field>
-          <name>badConsumers</name>
+          <name>invalidContentConsumers</name>
           <version>1.0.0+</version>
           <required>true</required>
           <association>
             <multiplicity>*</multiplicity>
           </association>
           <description>
-            The list of consumer IDs for this file processor.
+            The list of active consumer IDs for invalid content.
           </description>
         </field>
       </fields>
-        <!-- 
-      <codeSegments>
-        <codeSegment>
-          <version>1.0.0+</version>
-          <code><![CDATA[
-    /**
-     * Get a specific file type by ID.
-     * 
-     * @param id the id of the filetype to get. (null or empty will result in null return)
-     * @return the {@link FileType} or null if the id is not found.
-     */
-    public FileType getFileTypeById( String id )
-    {
-        if ( id == null )
-        {
-            return null;
-        }
-
-        if ( id.trim().length() <= 0 )
-        {
-            return null;
-        }
-
-        java.util.List types = getFileTypes();
-        if ( types == null )
-        {
-            return null;
-        }
-        
-        java.util.Iterator it = types.iterator();
-        while ( it.hasNext() )
-        {
-            FileType filetype = (FileType) it.next();
-            if ( id.equals( filetype.getId() ) )
-            {
-                return filetype;
-            }
-        }
-
-        return null;
-    }          
-          ]]></code>
-        </codeSegment>
-      </codeSegments>
-       -->
     </class>
     <class>
       <name>FileType</name>
           </description>
         </field>
         <field>
-          <name>processedConsumers</name>
+          <name>cleanupConsumers</name>
           <version>1.0.0+</version>
           <required>true</required>
           <association>
             <multiplicity>*</multiplicity>
           </association>
           <description>
-            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.
           </description>
         </field>
       </fields>
index e5c3a7692359ab8c29fd4338b2f2c694b81378cb..2c70a37ef4f4232b143811b08506beaf75a80e9a 100644 (file)
         </patterns>
       </fileType>
     </fileTypes>
-    <goodConsumers>
-      <goodConsumer>update-db-artifact</goodConsumer>
-      <goodConsumer>create-missing-checksums</goodConsumer>
-      <goodConsumer>update-db-repository-metadata</goodConsumer>
-      <goodConsumer>validate-checksum</goodConsumer>
-      <goodConsumer>validate-signature</goodConsumer>
-      <goodConsumer>index-content</goodConsumer>
-      <goodConsumer>auto-remove</goodConsumer>
-      <goodConsumer>auto-rename</goodConsumer>
-    </goodConsumers>
-    <badConsumers>
-      <badConsumer>update-db-bad-content</badConsumer>
-    </badConsumers>
+    <knownContentConsumers>
+      <knownContentConsumer>update-db-artifact</knownContentConsumer>
+      <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+      <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+      <knownContentConsumer>validate-checksum</knownContentConsumer>
+      <knownContentConsumer>validate-signature</knownContentConsumer>
+      <knownContentConsumer>index-content</knownContentConsumer>
+      <knownContentConsumer>auto-remove</knownContentConsumer>
+      <knownContentConsumer>auto-rename</knownContentConsumer>
+    </knownContentConsumers>
+    <invalidContentConsumers>
+      <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+    </invalidContentConsumers>
   </repositoryScanning>
 
   <databaseScanning>
       <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
       <unprocessedConsumer>index-public-methods</unprocessedConsumer>
     </unprocessedConsumers>
-    <processedConsumers>
-      <processedConsumer>not-present-remove-db-artifact</processedConsumer>
-      <processedConsumer>not-present-remove-db-project</processedConsumer>
-      <processedConsumer>not-present-remove-indexed</processedConsumer>
-    </processedConsumers>
+    <cleanupConsumers>
+      <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+    </cleanupConsumers>
   </databaseScanning>
 
 </configuration>
index 07e9f969b15572f8dcc4e23dc245a28a35358ec5..f2ff08a0513e0e149bfecdda67fe511da211dd08 100644 (file)
         </patterns>
       </fileType>
     </fileTypes>
-    <goodConsumers>
-      <goodConsumer>update-db-artifact</goodConsumer>
-      <goodConsumer>create-missing-checksums</goodConsumer>
-      <goodConsumer>update-db-repository-metadata</goodConsumer>
-      <goodConsumer>validate-checksum</goodConsumer>
-      <goodConsumer>validate-signature</goodConsumer>
-      <goodConsumer>index-content</goodConsumer>
-      <goodConsumer>auto-remove</goodConsumer>
-      <goodConsumer>auto-rename</goodConsumer>
-    </goodConsumers>
-    <badConsumers>
-      <badConsumer>update-db-bad-content</badConsumer>
-    </badConsumers>
+    <knownContentConsumers>
+      <knownContentConsumer>update-db-artifact</knownContentConsumer>
+      <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+      <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+      <knownContentConsumer>validate-checksum</knownContentConsumer>
+      <knownContentConsumer>validate-signature</knownContentConsumer>
+      <knownContentConsumer>index-content</knownContentConsumer>
+      <knownContentConsumer>auto-remove</knownContentConsumer>
+      <knownContentConsumer>auto-rename</knownContentConsumer>
+    </knownContentConsumers>
+    <invalidContentConsumers>
+      <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+    </invalidContentConsumers>
   </repositoryScanning>
 
   <databaseScanning>
       <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
       <unprocessedConsumer>index-public-methods</unprocessedConsumer>
     </unprocessedConsumers>
-    <processedConsumers>
-      <processedConsumer>not-present-remove-db-artifact</processedConsumer>
-      <processedConsumer>not-present-remove-db-project</processedConsumer>
-      <processedConsumer>not-present-remove-indexed</processedConsumer>
-    </processedConsumers>
+    <cleanupConsumers>
+      <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+    </cleanupConsumers>
   </databaseScanning>
 
 </configuration>
index 180bc1f8f89b4af25d764d8c40e947571b44762e..81bbba1a42962e69d2f66066577cda2e161f2222 100644 (file)
@@ -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 (file)
index 0000000..ef5a787
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..fce7e5c
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..2b1dd00
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..0b49497
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..ceef3a3
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..8ac9366
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..de169fe
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..e44c3ed
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..1038cb3
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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;
+    }
+
+}
index b71e78f1fbb1181f1d5eada7ae7ec915b2a5d1c3..98da60d3725783884acbdd7125303861b17091e7 100644 (file)
@@ -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 (file)
index 0000000..23e3d5b
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..e3cee2e
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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;
+    }
+
+}
index 1a4ce33b2b69d100a53d6a763dc77b70c296b6ae..c4866880fc9b3baa03c5602aa0de5c70927d35c8 100644 (file)
       <version>1.0-alpha-2</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>1.2_Java1.3</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index 45dab28e08097c34d11e2890f9895ab5e1e27973..cf9b790aea4fa7d97eec071f0adbadeb6233cc21 100644 (file)
@@ -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 (file)
index 135db42..0000000
+++ /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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @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 (file)
index 0000000..6e38b7a
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..8076f82
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..94e5894
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..98b2108
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+      <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.registry.Registry</role>
+          <role-hint>configured</role-hint>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.registry.Registry</role>
+      <role-hint>configured</role-hint>
+      <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
+      <configuration>
+        <properties>
+          <system/>
+          <xml fileName="${basedir}/src/test/resources/scanner-archiva.xml"
+               config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/>
+        </properties>
+      </configuration>
+    </component>
+
+    <component>
+      <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role>
+      <role-hint>sample-known</role-hint>
+      <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation>
+    </component>
+  </components>
+
+</component-set>
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 (file)
index 0000000..5a23d4e
--- /dev/null
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<configuration>
+
+  <repositoryScanning>
+    <fileTypes>
+      <fileType>
+        <id>artifacts</id>
+        <patterns>
+          <pattern>**/*.pom</pattern>
+          <pattern>**/*.jar</pattern>
+          <pattern>**/*.ear</pattern>
+          <pattern>**/*.war</pattern>
+          <pattern>**/*.car</pattern>
+          <pattern>**/*.sar</pattern>
+          <pattern>**/*.mar</pattern>
+          <pattern>**/*.rar</pattern>
+          <pattern>**/*.dtd</pattern>
+          <pattern>**/*.tld</pattern>
+          <pattern>**/*.tar.gz</pattern>
+          <pattern>**/*.tar.bz2</pattern>
+          <pattern>**/*.zip</pattern>
+        </patterns>
+      </fileType>
+      <fileType>
+        <id>indexable-content</id>
+        <patterns>
+          <pattern>**/*.txt</pattern>
+          <pattern>**/*.TXT</pattern>
+          <pattern>**/*.block</pattern>
+          <pattern>**/*.config</pattern>
+          <pattern>**/*.pom</pattern>
+          <pattern>**/*.xml</pattern>
+          <pattern>**/*.xsd</pattern>
+          <pattern>**/*.dtd</pattern>
+          <pattern>**/*.tld</pattern>
+        </patterns>
+      </fileType>
+      <fileType>
+        <id>auto-remove</id>
+        <patterns>
+          <pattern>**/*.bak</pattern>
+          <pattern>**/*~</pattern>
+          <pattern>**/*-</pattern>
+        </patterns>
+      </fileType>
+      <fileType>
+        <id>ignored</id>
+        <patterns>
+          <pattern>**/.htaccess</pattern>
+          <pattern>**/KEYS</pattern>
+          <pattern>**/*.rb</pattern>
+          <pattern>**/*.sh</pattern>
+          <pattern>**/.svn/**</pattern>
+          <pattern>**/.DAV/**</pattern>
+        </patterns>
+      </fileType>
+    </fileTypes>
+    <knownContentConsumers>
+      <knownContentConsumer>sample-known</knownContentConsumer>
+      <knownContentConsumer>update-db-artifact</knownContentConsumer>
+      <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+      <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+      <knownContentConsumer>validate-checksum</knownContentConsumer>
+      <knownContentConsumer>validate-signature</knownContentConsumer>
+      <knownContentConsumer>index-content</knownContentConsumer>
+      <knownContentConsumer>auto-remove</knownContentConsumer>
+      <knownContentConsumer>auto-rename</knownContentConsumer>
+    </knownContentConsumers>
+    <invalidContentConsumers>
+      <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+    </invalidContentConsumers>
+  </repositoryScanning>
+
+  <databaseScanning>
+    <cronExpression>0 0 * * ?</cronExpression>
+    <unprocessedConsumers>
+      <unprocessedConsumer>index-artifact</unprocessedConsumer>
+      <unprocessedConsumer>update-db-project</unprocessedConsumer>
+      <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+      <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+      <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+      <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+    </unprocessedConsumers>
+    <cleanupConsumers>
+      <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+    </cleanupConsumers>
+  </databaseScanning>
+
+</configuration>
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 (file)
index 0000000..6c4f65f
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 );
+    }
+}
index 98a5d56351475b2092490460edaa3086949748a5..69172a33a580eae68aaecaa0ae88d3b64ac61453 100644 (file)
@@ -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 )
index 33fa06e2299777d0e44f945cc3642f373bf6f6a1..582eac1c6afe3b682d2e4ca60faec16bc3ac2a42 100644 (file)
       <groupId>org.apache.maven.archiva</groupId>
       <artifactId>archiva-security</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-database-consumers</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-lucene-consumers</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-signature-consumers</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.archiva</groupId>
       <artifactId>archiva-applet</artifactId>
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 (file)
index 0000000..f46f50e
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..2c200f0
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..4873709
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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;
+    }
+
+}
index 87acd09f0649d1aaf6b5071384422c19d66f8bd1..815eae3ed2a008844ac758c7c1aba693ce049df1 100644 (file)
@@ -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 (file)
index 0000000..a30d277
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..77eda15
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..aa61cc6
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index bb4b5c0..0000000
+++ /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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @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
-        
-    }
-
-}
index b8035c7a5fa59c189cf78a2b20f5f1923a61dcf3..701409cc86f169db07fded7c24dabe10eebd0cd3 100644 (file)
@@ -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;
     }
 }
index b919f31fae5e29c6c41e8d0b7fb892a33c16af05..b726ec3b96ccbc75e94b78cdd0da2d95e167ad3a 100644 (file)
       <result name="input">/WEB-INF/jsp/admin/repositoryScanning.jsp</result>
     </action>
     
-    <action name="addRepositoryScanning" class="configureScanningAction" method="add">
-      <result name="input">/WEB-INF/jsp/admin/addRepositoryScanning.jsp</result>
-      <result name="success" type="redirect-action">repositoryScanning</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
-    </action>
-    
-    <action name="editRepositoryScanning" class="configureScanningAction" method="edit">
-      <result name="input">/WEB-INF/jsp/admin/editRepositoryScanning.jsp</result>
-      <result name="success" type="redirect-action">repositoryScanning</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
-    </action>
-    
-    <action name="saveRepositoryScanning" class="configureScanningAction" method="save">
-      <result name="input">/WEB-INF/jsp/admin/editRepositoryScanning.jsp</result>
-      <result name="success" type="redirect-action">repositoryScanning</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
-    </action>
-    
-    <action name="deleteRepositoryScanning" class="configureScanningAction" method="confirm">
-      <result name="input">/WEB-INF/jsp/admin/deleteRepositoryScanning.jsp</result>
-      <result name="success" type="redirect-action">repositoryScanning</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
-    </action>
-    
     <!-- .\ DATABASE \.________________________________________________ -->
     
     <action name="database" class="databaseAction" method="input">
     
     <!-- .\ CONFIGURATION \.___________________________________________ -->
     
-    
     <action name="configure" class="configureAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/configure.jsp</result>
       <interceptor-ref name="unconfiguredArchivaStack"/>
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 (file)
index 0000000..711817a
--- /dev/null
@@ -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"%>
+
+<html>
+<head>
+<title>Administration - Database</title>
+<ww:head />
+</head>
+
+<body>
+
+<h1>Administration - Database</h1>
+
+<div id="contentArea">
+
+<ww:actionerror /> 
+<ww:actionmessage /> 
+
+<c:url var="iconDeleteUrl" value="/images/icons/delete.gif" /> 
+<c:url var="iconCreateUrl" value="/images/icons/create.png" /> 
+   
+<div class="admin">
+
+<h2>Database - Unprocessed Artifacts Scanning</h2>
+
+  <ww:form method="post" action="database!updateSchedule" 
+             namespace="/admin" validate="false" theme="simple">
+    <table>
+      <ww:textfield name="cron" label="Cron" size="40" theme="xhtml" />
+      <tr>
+        <td colspan="2">
+          <ww:submit value="Update Cron" />
+        </td>
+      </tr>
+    </table>                 
+  </ww:form>
+
+<h2>Database - Unprocessed Artifacts Scanning</h2>
+
+<c:choose>
+  <c:when test="${empty(unprocessedConsumers)}">
+    <%-- No Consumers. Eeek! --%>
+    <strong>There are no consumers for unprocessed artifacts.</strong>
+  </c:when>
+  <c:otherwise>
+    <%-- Display the consumers. --%>
+
+    <ww:form method="post" action="database!updateUnprocessedConsumers" 
+             namespace="/admin" validate="false" theme="simple">
+    <table class="consumers">
+      <tr>
+        <th>&nbsp;</th>
+        <th>Enabled?</th>
+        <th>ID</th>
+        <th>Description</th>
+      </tr>
+      <c:forEach items="${unprocessedConsumers}" var="consumer" varStatus="i">
+        <c:choose>
+          <c:when test='${(i.index)%2 eq 0}'>
+            <c:set var="bgcolor" value="even" scope="page" />
+          </c:when>
+          <c:otherwise>
+            <c:set var="bgcolor" value="odd" scope="page" />
+          </c:otherwise>
+        </c:choose>
+
+        <tr>
+          <td class="${bgcolor}">
+            <ww:checkbox name="enabledUnprocessedConsumer[]" theme="simple" value="${consumer.enabled}" />
+          </td>
+          <td class="${bgcolor}">
+            <c:if test="${consumer.enabled}">
+              <strong>enabled</strong>
+            </c:if>
+          </td>
+          <td class="${bgcolor}">
+            <code>${consumer.id}</code>
+          </td>
+          <td class="${bgcolor}">${consumer.description}</td>
+        </tr>
+      </c:forEach>
+      <tr>
+        <td colspan="4">
+          <ww:submit value="Update Consumers" />
+        </td>
+      </tr>
+    </table>
+    </ww:form>
+
+  </c:otherwise>
+</c:choose>
+
+<h2>Database - Artifact Cleanup Scanning</h2>
+
+<c:choose>
+  <c:when test="${empty(cleanupConsumers)}">
+    <%-- No Consumers. Eeek! --%>
+    <strong>There are no consumers for artifact cleanup.</strong>
+  </c:when>
+  <c:otherwise>
+    <%-- Display the consumers. --%>
+
+    <ww:form method="post" action="database!updateCleanupConsumers" 
+             namespace="/admin" validate="false" theme="simple">
+    <table class="consumers">
+      <tr>
+        <th>&nbsp;</th>
+        <th>Enabled?</th>
+        <th>ID</th>
+        <th>Description</th>
+      </tr>
+      <c:forEach items="${cleanupConsumers}" var="consumer" varStatus="i">
+        <c:choose>
+          <c:when test='${(i.index)%2 eq 0}'>
+            <c:set var="bgcolor" value="even" scope="page" />
+          </c:when>
+          <c:otherwise>
+            <c:set var="bgcolor" value="odd" scope="page" />
+          </c:otherwise>
+        </c:choose>
+
+        <tr>
+          <td class="${bgcolor}">
+            <ww:checkbox name="enabledCleanupConsumer[]" theme="simple" value="${consumer.enabled}" />
+          </td>
+          <td class="${bgcolor}">
+            <c:if test="${consumer.enabled}">
+              <strong>enabled</strong>
+            </c:if>
+          </td>
+          <td class="${bgcolor}">
+            <code>${consumer.id}</code>
+          </td>
+          <td class="${bgcolor}">${consumer.description}</td>
+        </tr>
+      </c:forEach>
+      <tr>
+        <td colspan="4">
+          <ww:submit value="Update Consumers" />
+        </td>
+      </tr>
+    </table>
+    </ww:form>
+
+  </c:otherwise>
+</c:choose>
+
+
+</div>
+</body>
+</html>
index 039ac84f24acde8cde8cff426ffa02effdc435b2..7db51246d5668b2275c130edc5bc267e2fa4572e 100644 (file)
   </c:otherwise>
 </c:choose>
 
-<h2>Repository Scanning - Consumers of Good Content</h2>
+<h2>Repository Scanning - Consumers of Known Content</h2>
 
 <c:choose>
-  <c:when test="${empty(goodConsumers)}">
+  <c:when test="${empty(knownContentConsumers)}">
     <%-- No Good Consumers. Eeek! --%>
-    <strong>There are no good consumers configured.</strong>
+    <strong>There are no consumers of known content available.</strong>
   </c:when>
   <c:otherwise>
     <%-- Display the consumers. --%>
 
-    <table>
-      <c:forEach items="${goodConsumers}" var="consumer" varStatus="i">
+    <ww:form method="post" action="repositoryScanning!updateKnownConsumers" 
+             namespace="/admin" validate="false" theme="simple">
+    <table class="consumers">
+      <tr>
+        <th>&nbsp;</th>
+        <th>Enabled?</th>
+        <th>ID</th>
+        <th>Description</th>
+      </tr>
+      <c:forEach items="${knownContentConsumers}" var="consumer" varStatus="i">
         <c:choose>
           <c:when test='${(i.index)%2 eq 0}'>
-            <c:set var="rowColor" value="dark" scope="page" />
+            <c:set var="bgcolor" value="even" scope="page" />
           </c:when>
           <c:otherwise>
-            <c:set var="rowColor" value="lite" scope="page" />
+            <c:set var="bgcolor" value="odd" scope="page" />
           </c:otherwise>
         </c:choose>
 
         <tr>
-          <td><code>${consumer}</code></td>
-          <td><img src="<c:url value="/images/icons/delete.gif" />" /></td>
+          <td class="${bgcolor}">
+            <ww:checkbox name="enabledKnownConsumer[]" theme="simple" value="${consumer.enabled}" />
+          </td>
+          <td class="${bgcolor}">
+            <c:if test="${consumer.enabled}">
+              <strong>enabled</strong>
+            </c:if>
+          </td>
+          <td class="${bgcolor}">
+            <code>${consumer.id}</code>
+          </td>
+          <td class="${bgcolor}">${consumer.description}</td>
         </tr>
       </c:forEach>
+      <tr>
+        <td colspan="4">
+          <ww:submit value="Update Consumers" />
+        </td>
+      </tr>
     </table>
+    </ww:form>
 
   </c:otherwise>
 </c:choose>
 
 
-<h2>Repository Scanning - Consumers of Bad Content</h2>
+<h2>Repository Scanning - Consumers of Invalid Content</h2>
 
 <c:choose>
-  <c:when test="${empty(badConsumers)}">
-    <%-- No Bad Consumers. Eeek! --%>
-    <strong>There are no bad consumers configured.</strong>
+  <c:when test="${empty(invalidContentConsumers)}">
+    <%-- No Consumers. Eeek! --%>
+    <strong>There are no consumers of invalid content available.</strong>
   </c:when>
   <c:otherwise>
     <%-- Display the consumers. --%>
 
-    <table>
-      <c:forEach items="${badConsumers}" var="consumer" varStatus="i">
+    <ww:form method="post" action="repositoryScanning!updateInvalidConsumers" 
+             namespace="/admin" validate="false" theme="simple">
+    <table class="consumers">
+      <tr>
+        <th>&nbsp;</th>
+        <th>Enabled?</th>
+        <th>ID</th>
+        <th>Description</th>
+      </tr>
+      <c:forEach items="${invalidContentConsumers}" var="consumer" varStatus="i">
         <c:choose>
           <c:when test='${(i.index)%2 eq 0}'>
-            <c:set var="rowColor" value="dark" scope="page" />
+            <c:set var="bgcolor" value="even" scope="page" />
           </c:when>
           <c:otherwise>
-            <c:set var="rowColor" value="lite" scope="page" />
+            <c:set var="bgcolor" value="odd" scope="page" />
           </c:otherwise>
         </c:choose>
 
         <tr>
-          <td><code>${consumer}</code></td>
-          <td><img src="<c:url value="/images/icons/delete.gif" />" /></td>
+          <td class="${bgcolor}">
+            <ww:checkbox name="enabledUnknownConsumer[]" theme="simple" value="${consumer.enabled}" />
+          </td>
+          <td class="${bgcolor}">
+            <c:if test="${consumer.enabled}">
+              <strong>enabled</strong>
+            </c:if>
+          </td>
+          <td class="${bgcolor}">
+            <code>${consumer.id}</code>
+          </td>
+          <td class="${bgcolor}">${consumer.description}</td>
         </tr>
       </c:forEach>
+      <tr>
+        <td colspan="4">
+          <ww:submit value="Update Consumers" />
+        </td>
+      </tr>
     </table>
+    </ww:form>
 
   </c:otherwise>
 </c:choose></div>
index 952c9b5a31505bcc1a07e21f78013b94517903d4..ca951f8d0cda6e5dab415aa3396361b29e2a5097 100644 (file)
@@ -63,12 +63,10 @@ div.clear hr {
 
 .xleft, #bannerLeft img {
     float: left;
-    text-shadow: #7CFC00;
 }
 
 .xright, #bannerRight img {
     float: right;
-    text-shadow: #7CFC00;
 }
 
 #banner {
index 587dd7161b229870c5f451112bd96f36b8c3b492..73c65f9db69c83fdcda1531637ee61a02cd958fd 100644 (file)
@@ -43,7 +43,6 @@
        float: right;
        font-size: small;
        font-weight: bold;
-       xmargin: 0px auto;
        margin: 15px auto 0px auto;
        height: auto;
        width: 150px;
 }
 
 .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 2187e4dc091a6b803a5b82fa9c1ed65b367dd3e1..49541c0a033658ff31481e49d011c1ce74193d15 100644 (file)
--- a/pom.xml
+++ b/pom.xml
             <artifactId>archiva-lucene-consumers</artifactId>
             <version>${archiva.version}</version>
          </dependency>
+         <dependency>
+            <groupId>org.apache.maven.archiva</groupId>
+            <artifactId>archiva-signature-consumers</artifactId>
+            <version>${archiva.version}</version>
+         </dependency>
          <dependency>
             <groupId>org.apache.maven.archiva</groupId>
             <artifactId>archiva-model</artifactId>