archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r536680 [2/2] - in /maven/archiva/trunk: ./ archiva-base/archiva-configuration/src/main/mdo/ archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/test/conf/ arc...
Date Wed, 09 May 2007 22:03:52 GMT
Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml Wed May  9 15:03:49 2007
@@ -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>

Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java (added)
+++ maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java Wed May  9 15:03:49 2007
@@ -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 );
+    }
+}

Propchange: maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/DatabaseConsumers.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java (original)
+++ maven/archiva/trunk/archiva-database/src/main/java/org/apache/maven/archiva/database/updater/JdoDatabaseUpdater.java Wed May  9 15:03:49 2007
@@ -217,7 +217,7 @@
         }
 
         this.activeUnprocessedConsumers.addAll( getActiveConsumerList( dbScanning.getUnprocessedConsumers() ) );
-        this.activeProcessedConsumers.addAll( getActiveConsumerList( dbScanning.getProcessedConsumers() ) );
+        this.activeProcessedConsumers.addAll( getActiveConsumerList( dbScanning.getCleanupConsumers() ) );
     }
 
     private List getActiveConsumerList( List potentialConsumerList )

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml Wed May  9 15:03:49 2007
@@ -60,6 +60,18 @@
     </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>
       <!-- TODO: actually, just exclude from WAR plugin -->
       <scope>provided</scope>

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java Wed May  9 15:03:49 2007
@@ -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;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java Wed May  9 15:03:49 2007
@@ -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;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java Wed May  9 15:03:49 2007
@@ -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;
+    }
+
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java Wed May  9 15:03:49 2007
@@ -19,17 +19,23 @@
  * 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 @@
  * @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
 {
-
-    public Object getModel()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
+
+    /**
+     * @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;
+    }
 }

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java Wed May  9 15:03:49 2007
@@ -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;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java Wed May  9 15:03:49 2007
@@ -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;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java Wed May  9 15:03:49 2007
@@ -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;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java Wed May  9 15:03:49 2007
@@ -23,10 +23,16 @@
 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 @@
      */
     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 @@
         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;
     }
 }

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Wed May  9 15:03:49 2007
@@ -336,30 +336,6 @@
       <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">
@@ -367,7 +343,6 @@
     </action>
     
     <!-- .\ CONFIGURATION \.___________________________________________ -->
-    
     
     <action name="configure" class="configureAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/configure.jsp</result>

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp?view=auto&rev=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp Wed May  9 15:03:49 2007
@@ -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>

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/database.jsp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp Wed May  9 15:03:49 2007
@@ -144,65 +144,113 @@
   </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>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/maven-base.css Wed May  9 15:03:49 2007
@@ -63,12 +63,10 @@
 
 .xleft, #bannerLeft img {
     float: left;
-    text-shadow: #7CFC00;
 }
 
 .xright, #bannerRight img {
     float: right;
-    text-shadow: #7CFC00;
 }
 
 #banner {

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/css/site.css Wed May  9 15:03:49 2007
@@ -43,7 +43,6 @@
 	float: right;
 	font-size: small;
 	font-weight: bold;
-	xmargin: 0px auto;
 	margin: 15px auto 0px auto;
 	height: auto;
 	width: 150px;
@@ -148,7 +147,9 @@
 }
 
 .actionMessage {
+	font-size: 1.0em;
 	font-weight: bold;
+	color: blue;
 }
 
 .errorBullet {
@@ -318,11 +319,27 @@
 	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

Modified: maven/archiva/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/pom.xml?view=diff&rev=536680&r1=536679&r2=536680
==============================================================================
--- maven/archiva/trunk/pom.xml (original)
+++ maven/archiva/trunk/pom.xml Wed May  9 15:03:49 2007
@@ -325,6 +325,11 @@
          </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>
             <version>${archiva.version}</version>
          </dependency>



Mime
View raw message