]> source.dussan.org Git - archiva.git/commitdiff
Refactoring RepoContentConsumer into Known vs Invalid to aide in config/scanning
authorJoakim Erdfelt <joakime@apache.org>
Tue, 8 May 2007 16:05:18 +0000 (16:05 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Tue, 8 May 2007 16:05:18 +0000 (16:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@536233 13f79535-47bb-0310-9956-ffa450edef68

43 files changed:
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/LocalRepositoryPredicate.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RemoteRepositoryPredicate.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryIdListClosure.java [new file with mode: 0644]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/LocalRepositoryPredicate.java [deleted file]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java [deleted file]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java [deleted file]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/ProxyConnectorSelectionPredicate.java [deleted file]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RemoteRepositoryPredicate.java [deleted file]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryConfigurationComparator.java [deleted file]
archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryIdListClosure.java [deleted file]
archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
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/InvalidRepositoryContentConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/KnownRepositoryContentConsumer.java [new file with mode: 0644]
archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java
archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ActiveManagedRepositories.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtil.java [new file with mode: 0644]
archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java
archiva-base/archiva-xml-tools/pom.xml
archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java [new file with mode: 0644]
archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/DuplicateArtifactsConsumer.java
archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java [new file with mode: 0644]
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/repositoryScanning.jsp [new file with mode: 0644]

diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
new file mode 100644 (file)
index 0000000..783b358
--- /dev/null
@@ -0,0 +1,161 @@
+package org.apache.maven.archiva.configuration;
+
+/*
+ * 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.lang.StringUtils;
+import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
+import org.apache.maven.archiva.xml.ElementTextListClosure;
+import org.apache.maven.archiva.xml.XMLException;
+import org.apache.maven.archiva.xml.XMLReader;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.dom4j.Element;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * FileTypes 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role="org.apache.maven.archiva.configuration.FileTypes"
+ */
+public class FileTypes
+    implements Initializable
+{
+    public static final String ARTIFACTS = "artifacts";
+    
+    public static final String AUTO_REMOVE = "auto-remove";
+    
+    public static final String INDEXABLE_CONTENT = "indexable-content";
+    
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
+
+    /**
+     * Map of default values for the file types.
+     */
+    private Map defaultTypeMap = new HashMap();
+
+    /**
+     * <p>
+     * Get the list of patterns for a specified filetype.
+     * </p>
+     * 
+     * <p>
+     * You will always get a list.  In this order.
+     *   <ul>
+     *     <li>The Configured List</li>
+     *     <li>The Default List</li>
+     *     <li>A single item list of <code>"**<span>/</span>*"</code></li>
+     *   </ul>
+     * </p>
+     * 
+     * @param id the id to lookup.
+     * @return the list of patterns.
+     */
+    public List getFileTypePatterns( String id )
+    {
+        Configuration config = archivaConfiguration.getConfiguration();
+        Predicate selectedFiletype = new FiletypeSelectionPredicate( id );
+        FileType filetype = (FileType) CollectionUtils.find( config.getRepositoryScanning().getFileTypes(),
+                                                             selectedFiletype );
+
+        if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) )
+        {
+            return filetype.getPatterns();
+        }
+
+        List defaultPatterns = (List) defaultTypeMap.get( id );
+
+        if ( CollectionUtils.isEmpty( defaultPatterns ) )
+        {
+            return Collections.singletonList( "**/*" );
+        }
+
+        return defaultPatterns;
+    }
+
+    public void initialize()
+        throws InitializationException
+    {
+        defaultTypeMap.clear();
+
+        try
+        {
+            URL defaultArchivaXml = this.getClass().getResource( "" );
+
+            XMLReader reader = new XMLReader( "configuration", defaultArchivaXml );
+            List resp = reader.getElementList( "//configuration/repositoryScanning/fileTypes/fileType" );
+
+            CollectionUtils.forAllDo( resp, new AddFileTypeToDefaultMap() );
+        }
+        catch ( XMLException e )
+        {
+            throw new InitializationException( "Unable to setup default filetype maps.", e );
+        }
+    }
+
+    class AddFileTypeToDefaultMap
+        implements Closure
+    {
+        public void execute( Object input )
+        {
+            if ( !( input instanceof Element ) )
+            {
+                // Not an element. skip.
+                return;
+            }
+
+            Element elem = (Element) input;
+            if ( !StringUtils.equals( "fileType", elem.getName() ) )
+            {
+                // Not a 'fileType' element. skip.
+                return;
+            }
+
+            String id = elem.elementText( "id" );
+            Element patternsElem = elem.element( "patterns" );
+            if ( patternsElem == null )
+            {
+                // No patterns. skip.
+                return;
+            }
+
+            List patternElemList = patternsElem.elements( "pattern" );
+
+            ElementTextListClosure elemTextList = new ElementTextListClosure();
+            CollectionUtils.forAllDo( patternElemList, elemTextList );
+            List patterns = elemTextList.getList();
+
+            defaultTypeMap.put( id, patterns );
+        }
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java
new file mode 100644 (file)
index 0000000..c3d58c6
--- /dev/null
@@ -0,0 +1,55 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.FileType;
+
+/**
+ * FiletypeSelectionPredicate 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class FiletypeSelectionPredicate
+    implements Predicate
+{
+    private String filetypeId;
+
+    public FiletypeSelectionPredicate( String id )
+    {
+        this.filetypeId = id;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof FileType )
+        {
+            FileType filetype = (FileType) object;
+            return ( StringUtils.equals( filetypeId, filetype.getId() ) );
+        }
+
+        return satisfies;
+    }
+
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java
new file mode 100644 (file)
index 0000000..cfe7046
--- /dev/null
@@ -0,0 +1,52 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Closure;
+import org.apache.maven.archiva.configuration.FileType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * FiletypeToMapClosure 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class FiletypeToMapClosure
+    implements Closure
+{
+    private Map map = new HashMap();
+
+    public void execute( Object input )
+    {
+        if ( input instanceof FileType )
+        {
+            FileType filetype = (FileType) input;
+            map.put( filetype.getId(), filetype );
+        }
+    }
+
+    public Map getMap()
+    {
+        return map;
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/LocalRepositoryPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/LocalRepositoryPredicate.java
new file mode 100644 (file)
index 0000000..7cbad95
--- /dev/null
@@ -0,0 +1,55 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Predicate;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+
+/**
+ * Predicate for {@link RepositoryConfiguration} objects that are local (aka managed) 
+ * {@link RepositoryConfiguration#isManaged()} 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class LocalRepositoryPredicate
+    implements Predicate
+{
+    public static final Predicate INSTANCE = new LocalRepositoryPredicate();
+
+    public static Predicate getInstance()
+    {
+        return INSTANCE;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof RepositoryConfiguration )
+        {
+            RepositoryConfiguration repoconfig = (RepositoryConfiguration) object;
+            return repoconfig.isManaged();
+        }
+
+        return satisfies;
+    }
+
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java
new file mode 100644 (file)
index 0000000..c4f996c
--- /dev/null
@@ -0,0 +1,62 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+
+import java.util.Comparator;
+
+/**
+ * NetworkProxyComparator 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class NetworkProxyComparator
+    implements Comparator
+{
+
+    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 NetworkProxyConfiguration ) && ( o2 instanceof NetworkProxyConfiguration ) )
+        {
+            String id1 = ( (NetworkProxyConfiguration) o1 ).getId();
+            String id2 = ( (NetworkProxyConfiguration) o2 ).getId();
+            return id1.compareToIgnoreCase( id2 );
+        }
+
+        return 0;
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java
new file mode 100644 (file)
index 0000000..ea7832d
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
+
+/**
+ * NetworkProxySelectionPredicate 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class NetworkProxySelectionPredicate
+    implements Predicate
+{
+    private String proxyId;
+
+    public NetworkProxySelectionPredicate( String id )
+    {
+        this.proxyId = id;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof NetworkProxyConfiguration )
+        {
+            NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object;
+            return ( StringUtils.equals( proxyId, proxy.getId() ) );
+        }
+
+        return satisfies;
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java
new file mode 100644 (file)
index 0000000..12b0964
--- /dev/null
@@ -0,0 +1,59 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+
+/**
+ * ProxyConnectorPredicate 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProxyConnectorSelectionPredicate
+    implements Predicate
+{
+    private String sourceId;
+
+    private String targetId;
+
+    public ProxyConnectorSelectionPredicate( String sourceId, String targetId )
+    {
+        this.sourceId = sourceId;
+        this.targetId = targetId;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof ProxyConnectorConfiguration )
+        {
+            ProxyConnectorConfiguration connector = (ProxyConnectorConfiguration) object;
+            return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils
+                .equals( targetId, connector.getTargetRepoId() ) );
+        }
+
+        return satisfies;
+    }
+
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RemoteRepositoryPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RemoteRepositoryPredicate.java
new file mode 100644 (file)
index 0000000..9ae15b2
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Predicate;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+
+/**
+ * Predicate for {@link RepositoryConfiguration} objects that are remote 
+ * {@link RepositoryConfiguration#isRemote()} 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RemoteRepositoryPredicate
+    implements Predicate
+{
+    public static final Predicate INSTANCE = new RemoteRepositoryPredicate();
+
+    public static Predicate getInstance()
+    {
+        return INSTANCE;
+    }
+
+    public boolean evaluate( Object object )
+    {
+        boolean satisfies = false;
+
+        if ( object instanceof RepositoryConfiguration )
+        {
+            RepositoryConfiguration repoconfig = (RepositoryConfiguration) object;
+            return repoconfig.isRemote();
+        }
+
+        return satisfies;
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java
new file mode 100644 (file)
index 0000000..b69161f
--- /dev/null
@@ -0,0 +1,63 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+
+import java.util.Comparator;
+
+/**
+ * RepositoryConfigurationComparator 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryConfigurationComparator
+    implements Comparator
+{
+
+    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 RepositoryConfiguration ) && ( o2 instanceof RepositoryConfiguration ) )
+        {
+            String id1 = ( (RepositoryConfiguration) o1 ).getId();
+            String id2 = ( (RepositoryConfiguration) o2 ).getId();
+            return id1.compareToIgnoreCase( id2 );
+        }
+
+        return 0;
+    }
+
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryIdListClosure.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryIdListClosure.java
new file mode 100644 (file)
index 0000000..a739f8c
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.maven.archiva.configuration.functors;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.collections.Closure;
+import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+
+import java.util.List;
+
+/**
+ * RepositoryIdListClosure 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryIdListClosure
+    implements Closure
+{
+    private List list;
+
+    public RepositoryIdListClosure( List list )
+    {
+        this.list = list;
+    }
+
+    public void execute( Object input )
+    {
+        if ( input instanceof RepositoryConfiguration )
+        {
+            RepositoryConfiguration repoconfig = (RepositoryConfiguration) input;
+            list.add( repoconfig.getId() );
+        }
+    }
+
+    public List getList()
+    {
+        return list;
+    }
+}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/LocalRepositoryPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/LocalRepositoryPredicate.java
deleted file mode 100644 (file)
index 8284d72..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * 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.Predicate;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-
-/**
- * Predicate for {@link RepositoryConfiguration} objects that are local (aka managed) 
- * {@link RepositoryConfiguration#isManaged()} 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class LocalRepositoryPredicate
-    implements Predicate
-{
-    public static final Predicate INSTANCE = new LocalRepositoryPredicate();
-
-    public static Predicate getInstance()
-    {
-        return INSTANCE;
-    }
-
-    public boolean evaluate( Object object )
-    {
-        boolean satisfies = false;
-
-        if ( object instanceof RepositoryConfiguration )
-        {
-            RepositoryConfiguration repoconfig = (RepositoryConfiguration) object;
-            return repoconfig.isManaged();
-        }
-
-        return satisfies;
-    }
-
-}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java
deleted file mode 100644 (file)
index 6acd20f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * 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.configuration.NetworkProxyConfiguration;
-
-import java.util.Comparator;
-
-/**
- * NetworkProxyComparator 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class NetworkProxyComparator
-    implements Comparator
-{
-
-    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 NetworkProxyConfiguration ) && ( o2 instanceof NetworkProxyConfiguration ) )
-        {
-            String id1 = ( (NetworkProxyConfiguration) o1 ).getId();
-            String id2 = ( (NetworkProxyConfiguration) o2 ).getId();
-            return id1.compareToIgnoreCase( id2 );
-        }
-
-        return 0;
-    }
-}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java
deleted file mode 100644 (file)
index c216308..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * 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.Predicate;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
-
-/**
- * NetworkProxySelectionPredicate 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class NetworkProxySelectionPredicate
-    implements Predicate
-{
-    private String proxyId;
-
-    public NetworkProxySelectionPredicate( String id )
-    {
-        this.proxyId = id;
-    }
-
-    public boolean evaluate( Object object )
-    {
-        boolean satisfies = false;
-
-        if ( object instanceof NetworkProxyConfiguration )
-        {
-            NetworkProxyConfiguration proxy = (NetworkProxyConfiguration) object;
-            return ( StringUtils.equals( proxyId, proxy.getId() ) );
-        }
-
-        return satisfies;
-    }
-}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/ProxyConnectorSelectionPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/ProxyConnectorSelectionPredicate.java
deleted file mode 100644 (file)
index b1fc9fc..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * 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.Predicate;
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-
-/**
- * ProxyConnectorPredicate 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ProxyConnectorSelectionPredicate
-    implements Predicate
-{
-    private String sourceId;
-
-    private String targetId;
-
-    public ProxyConnectorSelectionPredicate( String sourceId, String targetId )
-    {
-        this.sourceId = sourceId;
-        this.targetId = targetId;
-    }
-
-    public boolean evaluate( Object object )
-    {
-        boolean satisfies = false;
-
-        if ( object instanceof ProxyConnectorConfiguration )
-        {
-            ProxyConnectorConfiguration connector = (ProxyConnectorConfiguration) object;
-            return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) && StringUtils
-                .equals( targetId, connector.getTargetRepoId() ) );
-        }
-
-        return satisfies;
-    }
-
-}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RemoteRepositoryPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RemoteRepositoryPredicate.java
deleted file mode 100644 (file)
index bb8db28..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * 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.Predicate;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-
-/**
- * Predicate for {@link RepositoryConfiguration} objects that are remote 
- * {@link RepositoryConfiguration#isRemote()} 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class RemoteRepositoryPredicate
-    implements Predicate
-{
-    public static final Predicate INSTANCE = new RemoteRepositoryPredicate();
-
-    public static Predicate getInstance()
-    {
-        return INSTANCE;
-    }
-
-    public boolean evaluate( Object object )
-    {
-        boolean satisfies = false;
-
-        if ( object instanceof RepositoryConfiguration )
-        {
-            RepositoryConfiguration repoconfig = (RepositoryConfiguration) object;
-            return repoconfig.isRemote();
-        }
-
-        return satisfies;
-    }
-}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryConfigurationComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryConfigurationComparator.java
deleted file mode 100644 (file)
index 1077b0c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * 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.configuration.RepositoryConfiguration;
-
-import java.util.Comparator;
-
-/**
- * RepositoryConfigurationComparator 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class RepositoryConfigurationComparator
-    implements Comparator
-{
-
-    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 RepositoryConfiguration ) && ( o2 instanceof RepositoryConfiguration ) )
-        {
-            String id1 = ( (RepositoryConfiguration) o1 ).getId();
-            String id2 = ( (RepositoryConfiguration) o2 ).getId();
-            return id1.compareToIgnoreCase( id2 );
-        }
-
-        return 0;
-    }
-
-}
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryIdListClosure.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryIdListClosure.java
deleted file mode 100644 (file)
index 97503d5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.maven.archiva.configuration.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-
-import java.util.List;
-
-/**
- * RepositoryIdListClosure 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class RepositoryIdListClosure
-    implements Closure
-{
-    private List list;
-
-    public RepositoryIdListClosure( List list )
-    {
-        this.list = list;
-    }
-
-    public void execute( Object input )
-    {
-        if ( input instanceof RepositoryConfiguration )
-        {
-            RepositoryConfiguration repoconfig = (RepositoryConfiguration) input;
-            list.add( repoconfig.getId() );
-        }
-    }
-
-    public List getList()
-    {
-        return list;
-    }
-}
index 66b39a36820b10b9b4b00661951ddfab873e994a..49efaad10f45eb968853a24df2a6341b65ac2b36 100644 (file)
           </description>
         </field>
       </fields>
+        <!-- 
       <codeSegments>
         <codeSegment>
           <version>1.0.0+</version>
           ]]></code>
         </codeSegment>
       </codeSegments>
+       -->
     </class>
     <class>
       <name>FileType</name>
index b893fcc791e2557229bbdb54969516bdb8cdb420..0ce132e362659b362fc401dc39a87b8c48fb0fc1 100644 (file)
@@ -23,6 +23,7 @@ import org.apache.commons.io.FileUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.File;
+import java.util.List;
 
 /**
  * Test the configuration store.
@@ -31,10 +32,14 @@ import java.io.File;
  */
 public class ArchivaConfigurationTest extends PlexusTestCase
 {
+    private FileTypes filetypes;
+    
     public void testDefaults() throws Exception
     {
         ArchivaConfiguration archivaConfiguration =
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-defaults" );
+        
+        filetypes = (FileTypes) lookup( FileTypes.class );
 
         Configuration configuration = archivaConfiguration.getConfiguration();
 
@@ -60,9 +65,9 @@ public class ArchivaConfigurationTest extends PlexusTestCase
         assertEquals( "check good consumers", 8, repoScanning.getGoodConsumers().size() );
         assertEquals( "check bad consumers", 1, repoScanning.getBadConsumers().size() );
 
-        FileType artifactTypes = repoScanning.getFileTypeById( "artifacts" );
-        assertNotNull( "check 'artifacts' file type", artifactTypes );
-        assertEquals( "check 'artifacts' patterns", 13, artifactTypes.getPatterns().size() );
+        List patterns = filetypes.getFileTypePatterns( "artifacts" );
+        assertNotNull( "check 'artifacts' file type", patterns );
+        assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
 
         DatabaseScanningConfiguration dbScanning = configuration.getDatabaseScanning();
         assertNotNull( "check database scanning", dbScanning );
diff --git a/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/InvalidRepositoryContentConsumer.java b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/InvalidRepositoryContentConsumer.java
new file mode 100644 (file)
index 0000000..61c50a9
--- /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.
+ */
+
+/**
+ * Consumer for Invalid Repository Content 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface InvalidRepositoryContentConsumer
+    extends RepositoryContentConsumer
+{
+
+}
diff --git a/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/KnownRepositoryContentConsumer.java b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/KnownRepositoryContentConsumer.java
new file mode 100644 (file)
index 0000000..f0ff025
--- /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.
+ */
+
+/**
+ * Consumer for Known Repository Content.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface KnownRepositoryContentConsumer
+    extends RepositoryContentConsumer
+{
+
+}
index f9af58288d28c1c88baa633d213a21223ae4625b..c444952b1b6f2b28aaf657309dbe49f329ad3b2b 100644 (file)
@@ -20,10 +20,10 @@ package org.apache.maven.archiva.consumers.core;
  */
 
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.FileType;
+import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.codehaus.plexus.digest.ChecksumFile;
@@ -45,12 +45,12 @@ import java.util.Map;
  *
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *                   role-hint="create-missing-checksums"
  *                   instantiation-strategy="per-lookup"
  */
 public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer, RegistryListener, Initializable
+    implements KnownRepositoryContentConsumer, RegistryListener, Initializable
 {
     /**
      * @plexus.configuration default-value="create-missing-checksums"
@@ -66,6 +66,11 @@ public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
      * @plexus.requirement
      */
     private ArchivaConfiguration configuration;
+    
+    /**
+     * @plexus.requirement
+     */
+    private FileTypes filetypes;
 
     /**
      * @plexus.requirement role="org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout"
@@ -206,11 +211,7 @@ public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
     {
         includes.clear();
         
-        FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning().getFileTypeById( "artifacts" );
-        if ( artifactTypes != null )
-        {
-            includes.addAll( artifactTypes.getPatterns() );
-        }
+        includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
     }
 
     public void initialize() throws InitializationException
@@ -225,10 +226,5 @@ public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
         configuration.addChangeListener( this );
 
         initIncludes();
-
-        if ( includes.isEmpty() )
-        {
-            throw new InitializationException( "Unable to use " + getId() + " due to empty includes list.  Check the configuration sources." );
-        }
     }
 }
index a4d7d175ee17378e83eb0f0b35e4bb7d95a0469b..938a909423bb888ccafc437f505b46d5d1dcf9f4 100644 (file)
@@ -20,10 +20,10 @@ package org.apache.maven.archiva.consumers.core;
  */
 
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.FileType;
+import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -40,13 +40,13 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *                   role-hint="auto-remove"
  *                   instantiation-strategy="per-lookup"
  */
 public class AutoRemoveConsumer
     extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer, RegistryListener, Initializable
+    implements KnownRepositoryContentConsumer, RegistryListener, Initializable
 {
     /**
      * @plexus.configuration default-value="auto-remove"
@@ -62,6 +62,11 @@ public class AutoRemoveConsumer
      * @plexus.requirement
      */
     private ArchivaConfiguration configuration;
+    
+    /**
+     * @plexus.requirement
+     */
+    private FileTypes filetypes;
 
     private File repositoryDir;
 
@@ -137,13 +142,8 @@ public class AutoRemoveConsumer
     private void initIncludes()
     {
         includes.clear();
-
-        FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning()
-            .getFileTypeById( "auto-remove" );
-        if ( artifactTypes != null )
-        {
-            includes.addAll( artifactTypes.getPatterns() );
-        }
+        
+        includes.addAll( filetypes.getFileTypePatterns( FileTypes.AUTO_REMOVE ) );
     }
 
     public void initialize()
@@ -159,10 +159,5 @@ public class AutoRemoveConsumer
         configuration.addChangeListener( this );
 
         initIncludes();
-
-        if ( includes.isEmpty() )
-        {
-            throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
-        }
     }
 }
index e117e6566fcb54313bc52201b53b2749e25371f2..e0be8b03128948fe03f38000226ecfe40e920153 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.consumers.core;
 
 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.consumers.RepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.codehaus.plexus.util.FileUtils;
@@ -39,13 +40,13 @@ import java.util.Map;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *                   role-hint="auto-rename"
  *                   instantiation-strategy="per-lookup"
  */
 public class AutoRenameConsumer
     extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer
+    implements KnownRepositoryContentConsumer
 {
     /**
      * @plexus.configuration default-value="auto-rename"
index 8dc5e1cc2220bdc69e5680b0076c1b1df902c475..692edd5986f1de1d0d4ae83f5edf909d68e98c2b 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.consumers.core;
 
 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.consumers.RepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.codehaus.plexus.digest.ChecksumFile;
@@ -42,12 +43,12 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *                   role-hint="validate-checksum"
  *                   instantiation-strategy="per-lookup"
  */
 public class ValidateChecksumConsumer extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer, Initializable
+    implements KnownRepositoryContentConsumer, Initializable
 {
     private static final String NOT_VALID_CHECKSUM = "checksum-not-valid";
 
index 2d011c2a48c2982578214cb48a216e478ed15a7c..a8d5a09f832bca092527aaf0e8f0137cd3422d7b 100644 (file)
@@ -21,10 +21,10 @@ package org.apache.maven.archiva.consumers.database;
 
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.FileType;
+import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
 import org.apache.maven.archiva.model.ArchivaArtifact;
@@ -50,13 +50,13 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *                   role-hint="update-db-artifact"
  *                   instantiation-strategy="per-lookup"
  */
 public class ArtifactUpdateDatabaseConsumer
     extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer, RegistryListener, Initializable
+    implements KnownRepositoryContentConsumer, RegistryListener, Initializable
 {
     private static final String TYPE_NOT_ARTIFACT = "file-not-artifact";
 
@@ -83,6 +83,11 @@ public class ArtifactUpdateDatabaseConsumer
      * @plexus.requirement
      */
     private ArchivaConfiguration configuration;
+    
+    /**
+     * @plexus.requirement
+     */
+    private FileTypes filetypes;
 
     /**
      * @plexus.requirement
@@ -222,11 +227,7 @@ public class ArtifactUpdateDatabaseConsumer
     {
         includes.clear();
 
-        FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning().getFileTypeById( "artifacts" );
-        if ( artifactTypes != null )
-        {
-            includes.addAll( artifactTypes.getPatterns() );
-        }
+        includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
     }
 
     public void initialize()
@@ -235,10 +236,5 @@ public class ArtifactUpdateDatabaseConsumer
         configuration.addChangeListener( this );
 
         initIncludes();
-
-        if ( includes.isEmpty() )
-        {
-            throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
-        }
     }
 }
index 36ffb1cf2d2b48b98c64e3d8164ab98339ecba48..b71e78f1fbb1181f1d5eada7ae7ec915b2a5d1c3 100644 (file)
@@ -21,10 +21,10 @@ package org.apache.maven.archiva.consumers.lucene;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.FileType;
+import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.indexer.RepositoryContentIndex;
 import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
 import org.apache.maven.archiva.indexer.RepositoryIndexException;
@@ -46,13 +46,13 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *                   role-hint="index-content"
  *                   instantiation-strategy="per-lookup"
  */
 public class IndexContentConsumer
     extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer, RegistryListener, Initializable
+    implements KnownRepositoryContentConsumer, RegistryListener, Initializable
 {
     private static final String READ_CONTENT = "read_content";
 
@@ -72,6 +72,11 @@ public class IndexContentConsumer
      * @plexus.requirement
      */
     private ArchivaConfiguration configuration;
+    
+    /**
+     * @plexus.requirement
+     */
+    private FileTypes filetypes;
 
     /**
      * @plexus.requirement
@@ -167,12 +172,7 @@ public class IndexContentConsumer
     {
         includes.clear();
 
-        FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning()
-            .getFileTypeById( "indexable-content" );
-        if ( artifactTypes != null )
-        {
-            includes.addAll( artifactTypes.getPatterns() );
-        }
+        includes.addAll( filetypes.getFileTypePatterns( FileTypes.INDEXABLE_CONTENT ));
     }
 
     public void initialize()
@@ -188,10 +188,5 @@ public class IndexContentConsumer
         configuration.addChangeListener( this );
 
         initIncludes();
-
-        if ( includes.isEmpty() )
-        {
-            throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
-        }
     }
 }
index 6194ff50cf9c0ebec98dc2c1ba09ac5c2a9be94c..2e0e6fb256ed74a727a277a9d6d7ec4b5b390b9d 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.converter.legacy;
 
 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.consumers.RepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.model.ArtifactReference;
@@ -42,13 +43,13 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  *     role-hint="artifact-legacy-to-default-converter"
  *     instantiation-strategy="per-lookup"
  */
 public class LegacyConverterArtifactConsumer
     extends AbstractMonitoredConsumer
-    implements RepositoryContentConsumer
+    implements KnownRepositoryContentConsumer
 {
     /**
      * @plexus.requirement role-hint="legacy-to-default"
index 4e89e6a08fa383c6a037fc52ee5bb64dbb78122a..989f10046cd13f0b467d98687bf086d79f209e67 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.util.LocalRepositoryPredicate;
+import org.apache.maven.archiva.configuration.functors.LocalRepositoryPredicate;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.registry.Registry;
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
new file mode 100644 (file)
index 0000000..ec03a34
--- /dev/null
@@ -0,0 +1,162 @@
+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.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 getSelectedKnownConsumers()
+    {
+        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 getSelectedInvalidConsumers()
+    {
+        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 getAvailableKnownConsumers()
+    {
+        return availableGoodConsumers;
+    }
+
+    public List getAvailableInvalidConsumers()
+    {
+        return availableBadConsumers;
+    }
+}
index 8b42e873ae11c9427f061b19669c3e6882c52317..8ab2012f71674d29666df787be6287153574fd38 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.repository.scanner;
 
 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.consumers.RepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 
@@ -34,7 +35,7 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  */
-public class ScanConsumer extends AbstractMonitoredConsumer implements RepositoryContentConsumer
+public class ScanConsumer extends AbstractMonitoredConsumer implements KnownRepositoryContentConsumer
 {
     private int processCount = 0;
 
index 5f3a92b911145f2787f1e2273157bd49f8ddccf6..2ea88f25f418bdac29b40818622e3a789777967b 100644 (file)
       <groupId>org.apache.maven.archiva</groupId>
       <artifactId>archiva-common</artifactId>
     </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.2</version>
+    </dependency>
     <dependency>
       <groupId>dom4j</groupId>
       <artifactId>dom4j</artifactId>
diff --git a/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java b/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java
new file mode 100644 (file)
index 0000000..1174223
--- /dev/null
@@ -0,0 +1,52 @@
+package org.apache.maven.archiva.xml;
+
+/*
+ * 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.dom4j.Element;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Gather the text from a collection of {@link Element}'s into a {@link List}
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ElementTextListClosure
+    implements Closure
+{
+    private List list = new ArrayList();
+
+    public void execute( Object input )
+    {
+        if ( input instanceof Element )
+        {
+            Element elem = (Element) input;
+            list.add( elem.getTextTrim() );
+        }
+    }
+
+    public List getList()
+    {
+        return list;
+    }
+}
\ No newline at end of file
index ad6bb675faf068f797bd809a14fe3764c90cd681..e6715094e8887fb703ce0e6788d21a1a7ff602b6 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.reporting.artifact;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.FileType;
+import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ArchivaArtifactConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
@@ -32,7 +32,6 @@ import org.apache.maven.archiva.database.ObjectNotFoundException;
 import org.apache.maven.archiva.database.constraints.ArtifactsBySha1ChecksumConstraint;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.reporting.artifact.DuplicateArtifactReport;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
 import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -73,6 +72,11 @@ public class DuplicateArtifactsConsumer
      */
     private ArchivaConfiguration configuration;
 
+    /**
+     * @plexus.requirement
+     */
+    private FileTypes filetypes;
+
     /**
      * @plexus.requirement role-hint="jdo"
      */
@@ -149,8 +153,8 @@ public class DuplicateArtifactsConsumer
             while ( it.hasNext() )
             {
                 ArchivaArtifact dupArtifact = (ArchivaArtifact) it.next();
-                
-                if( dupArtifact.equals( artifact ) )
+
+                if ( dupArtifact.equals( artifact ) )
                 {
                     // Skip reference to itself.
                     continue;
@@ -212,11 +216,7 @@ public class DuplicateArtifactsConsumer
     {
         includes.clear();
 
-        FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning().getFileTypeById( "artifacts" );
-        if ( artifactTypes != null )
-        {
-            includes.addAll( artifactTypes.getPatterns() );
-        }
+        includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
     }
 
     public void initialize()
index 3a350f54f6e273623c5fd10e2d0529ef5c7b25d5..06d632b290e8f9fefabc4da453589c6a4e2696e7 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.reporting.artifact;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.FileType;
+import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.configuration.RepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ArchivaArtifactConsumer;
@@ -84,6 +84,11 @@ public class LocationArtifactsConsumer
      * @plexus.requirement
      */
     private ArchivaConfiguration configuration;
+    
+    /**
+     * @plexus.requirement
+     */
+    private FileTypes filetypes;
 
     /**
      * @plexus.requirement role-hint="jdo"
@@ -331,11 +336,7 @@ public class LocationArtifactsConsumer
     {
         includes.clear();
 
-        FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning().getFileTypeById( "artifacts" );
-        if ( artifactTypes != null )
-        {
-            includes.addAll( artifactTypes.getPatterns() );
-        }
+        includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
     }
 
     private void initRepositoryMap()
index 047e93296cc68122f70ef74ca75f5d565577c453..3caadfc483c3b8e48bcfeaea4a57edad5dae3e02 100644 (file)
@@ -19,27 +19,26 @@ package org.apache.maven.archiva.scheduled.executors;
  * under the License.
  */
 
+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.RepositoryScanningConfiguration;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
 import org.apache.maven.archiva.database.RepositoryDAO;
 import org.apache.maven.archiva.database.updater.DatabaseUpdater;
 import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
 import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumerUtil;
 import org.apache.maven.archiva.repository.scanner.RepositoryScanner;
 import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
 import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
-
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 
-import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -62,6 +61,11 @@ public class ArchivaScheduledTaskExecutor
      */
     private ArchivaConfiguration archivaConfiguration;
 
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private ArchivaDAO dao;
+
     /**
      * @plexus.requirement role-hint="jdo"
      */
@@ -80,9 +84,10 @@ public class ArchivaScheduledTaskExecutor
 
     /**
      * The collection of available repository consumers.
-     * @plexus.requirement role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+     * 
+     * @plexus.requirement
      */
-    private Map availableRepositoryConsumers;
+    private RepositoryContentConsumerUtil repositoryContentConsumerUtil;
 
     public void executeTask( Task task )
         throws TaskExecutionException
@@ -140,16 +145,17 @@ public class ArchivaScheduledTaskExecutor
     {
         getLogger().info( "Executing task from queue with job name: " + task.getName() );
 
-        long time = System.currentTimeMillis();
-
         try
         {
             ArchivaRepository arepo = repositoryDAO.getRepository( task.getRepositoryId() );
 
             RepositoryScanner scanner = new RepositoryScanner();
 
-            scanner.scan( arepo, getActiveConsumerList(), true );
+            RepositoryContentStatistics stats = scanner.scan( arepo, getActiveConsumerList(), true );
 
+            dao.save( stats );
+
+            getLogger().info( "Finished repository task: " + stats.getDuration() + " ms." );
         }
         catch ( ArchivaDatabaseException e )
         {
@@ -159,10 +165,6 @@ public class ArchivaScheduledTaskExecutor
         {
             throw new TaskExecutionException( "Repository error when executing repository job.", e );
         }
-
-        time = System.currentTimeMillis() - time;
-
-        getLogger().info( "Finished repository task for " + time + "ms." );
     }
 
     private List getActiveConsumerList()
@@ -172,44 +174,16 @@ public class ArchivaScheduledTaskExecutor
         RepositoryScanningConfiguration repoScanningConfig = archivaConfiguration.getConfiguration()
             .getRepositoryScanning();
 
-        List configuredGoodConsumers = repoScanningConfig.getGoodConsumers();
-        List configuredBadConsumers = repoScanningConfig.getBadConsumers();
-        
-        getLogger().info( "Available Repository Consumers: " + availableRepositoryConsumers );
+        List configuredGoodConsumers = new ArrayList();
+        List configuredBadConsumers = new ArrayList();
 
-        for ( Iterator i = configuredGoodConsumers.iterator(); i.hasNext(); )
-        {
-            String desiredConsumerId = (String) i.next();
-            RepositoryContentConsumer consumer = (RepositoryContentConsumer) availableRepositoryConsumers
-                .get( desiredConsumerId );
-
-            if ( consumer == null )
-            {
-                getLogger().warn(
-                                  "Desired Consumer [" + desiredConsumerId
-                                      + "] does not exist.  Skipping in repository scan." );
-                continue;
-            }
-
-            activeConsumers.add( consumer );
-        }
+        configuredGoodConsumers.addAll( CollectionUtils.select( repoScanningConfig.getGoodConsumers(),
+                                                                repositoryContentConsumerUtil
+                                                                    .getKnownSelectionPredicate() ) );
 
-        for ( Iterator i = configuredBadConsumers.iterator(); i.hasNext(); )
-        {
-            String desiredConsumerId = (String) i.next();
-            RepositoryContentConsumer consumer = (RepositoryContentConsumer) availableRepositoryConsumers
-                .get( desiredConsumerId );
-
-            if ( consumer == null )
-            {
-                getLogger().warn(
-                                  "Desired Consumer [" + desiredConsumerId
-                                      + "] does not exist.  Skipping in repository scan." );
-                continue;
-            }
-
-            activeConsumers.add( consumer );
-        }
+        configuredBadConsumers.addAll( CollectionUtils.select( repoScanningConfig.getBadConsumers(),
+                                                               repositoryContentConsumerUtil
+                                                                   .getInvalidSelectionPredicate() ) );
 
         return activeConsumers;
     }
index 8b416bc9cae50ca370881524f58801183b879896..de24dea1fb7437078fea123b8767c25d287b25ec 100644 (file)
@@ -32,9 +32,9 @@ import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.InvalidConfigurationException;
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.configuration.util.ProxyConnectorSelectionPredicate;
-import org.apache.maven.archiva.configuration.util.RemoteRepositoryPredicate;
-import org.apache.maven.archiva.configuration.util.RepositoryIdListClosure;
+import org.apache.maven.archiva.configuration.functors.ProxyConnectorSelectionPredicate;
+import org.apache.maven.archiva.configuration.functors.RemoteRepositoryPredicate;
+import org.apache.maven.archiva.configuration.functors.RepositoryIdListClosure;
 import org.apache.maven.archiva.policies.DownloadPolicy;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
index 5da2144b5555aa2c3eaa4b0cd6090f9da3114c73..68365ebbd4a9762d5d5fe3a5241c461640464805 100644 (file)
@@ -28,7 +28,7 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.InvalidConfigurationException;
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
-import org.apache.maven.archiva.configuration.util.NetworkProxySelectionPredicate;
+import org.apache.maven.archiva.configuration.functors.NetworkProxySelectionPredicate;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
 import org.codehaus.plexus.registry.RegistryException;
 import org.codehaus.plexus.security.rbac.Resource;
index 05254eb49f6b6a660c62a7ff94082fa9aca2bbd3..57a4bf3142849a5e97e2521fbd84d56dbf58c1e9 100644 (file)
@@ -27,9 +27,9 @@ import org.apache.commons.collections.Transformer;
 import org.apache.commons.collections.list.TransformedList;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.util.LocalRepositoryPredicate;
-import org.apache.maven.archiva.configuration.util.RemoteRepositoryPredicate;
-import org.apache.maven.archiva.configuration.util.RepositoryConfigurationComparator;
+import org.apache.maven.archiva.configuration.functors.LocalRepositoryPredicate;
+import org.apache.maven.archiva.configuration.functors.RemoteRepositoryPredicate;
+import org.apache.maven.archiva.configuration.functors.RepositoryConfigurationComparator;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
 import org.apache.maven.archiva.web.util.ContextUtils;
 import org.codehaus.plexus.security.rbac.Resource;
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
new file mode 100644 (file)
index 0000000..bb4b5c0
--- /dev/null
@@ -0,0 +1,62 @@
+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 fb7fa6d5ef322a772e103abeca444f84bd289600..c326b5355493e559e51195268be86779da765a9e 100644 (file)
@@ -19,17 +19,23 @@ package org.apache.maven.archiva.web.action.admin.scanning;
  * 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.functors.FiletypeToMapClosure;
+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;
 
-import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * RepositoryScanningAction 
@@ -40,34 +46,74 @@ import javax.servlet.http.HttpServletRequest;
  * @plexus.component role="com.opensymphony.xwork.Action" role-hint="repositoryScanningAction"
  */
 public class RepositoryScanningAction
-extends PlexusActionSupport
-implements ModelDriven, Preparable, Validateable, SecureAction, ServletRequestAware
+    extends PlexusActionSupport
+    implements Preparable, Validateable, SecureAction
 {
+    /**
+     * @plexus.requirement
+     */
+    private ArchivaConfiguration archivaConfiguration;
 
-    public Object getModel()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
+    private Map fileTypeMap;
+
+    private List goodConsumers = new ArrayList();
+
+    private List badConsumers = new ArrayList();
 
     public void prepare()
         throws Exception
     {
-        // TODO Auto-generated method stub
-        
+        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() );
     }
 
     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 List getBadConsumers()
+    {
+        return badConsumers;
     }
 
-    public void setServletRequest( HttpServletRequest request )
+    public void setBadConsumers( List badConsumers )
     {
-        // TODO Auto-generated method stub
-        
+        this.badConsumers = badConsumers;
     }
 
+    public Map getFileTypeMap()
+    {
+        return fileTypeMap;
+    }
+
+    public void setFileTypeMap( Map fileTypeMap )
+    {
+        this.fileTypeMap = fileTypeMap;
+    }
+
+    public List getGoodConsumers()
+    {
+        return goodConsumers;
+    }
+
+    public void setGoodConsumers( List goodConsumers )
+    {
+        this.goodConsumers = goodConsumers;
+    }
 }
index a60c3c42333f7c8f2b6307fb978557907d5623ad..b919f31fae5e29c6c41e8d0b7fb892a33c16af05 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">
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp
new file mode 100644 (file)
index 0000000..3814dc9
--- /dev/null
@@ -0,0 +1,159 @@
+<%--
+  ~ 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="pss" uri="/plexusSecuritySystem" %>
+<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>
+
+<html>
+<head>
+  <title>Administration - Repository Scanning</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Administration - Repository Scanning</h1>
+
+<div id="contentArea">
+
+<ww:actionerror />
+<ww:actionmessage />
+
+<div class="admin">
+  <h2>Repository Scanning - File Types</h2>
+
+<c:choose>
+  <c:when test="${empty(fileTypeMap)}">
+    <%-- No File Types. Eeek! --%>
+    <strong>There are no file types configured.</strong>
+  </c:when>
+  <c:otherwise>
+    <%-- Display the filetypes. --%>
+    
+  <c:forEach items="${fileTypeMap}" var="filetype" varStatus="i">
+    <c:choose>
+      <c:when test='${(i.index)%2 eq 0}'>
+        <c:set var="rowColor" value="dark" scope="page" />
+      </c:when>
+      <c:otherwise>
+        <c:set var="rowColor" value="lite" scope="page" />
+      </c:otherwise>
+    </c:choose>
+
+    <div class="filetype ${rowColor}">
+
+      <div class="controls">
+        <%-- Does this even make sense for file types? --%>
+      </div>
+      
+      <h3 class="filetype">${filetype.key}</h3>
+
+      <table>
+      <c:forEach items="${filetype.value.patterns}" var="pattern" varStatus="i">
+        <tr>
+          <td>
+            <code>${pattern}</code>
+          </td>
+          <td>
+            <img src="<c:url value="/images/icons/delete.gif" />" />
+          </td>
+        </tr>
+      </c:forEach>
+      </table>
+    
+    </div>
+  </c:forEach>
+  
+  </c:otherwise>
+</c:choose>
+
+  <h2>Repository Scanning - Consumers of Good Content</h2>
+  
+<c:choose>
+  <c:when test="${empty(goodConsumers)}">
+    <%-- No Good Consumers. Eeek! --%>
+    <strong>There are no good consumers configured.</strong>
+  </c:when>
+  <c:otherwise>
+    <%-- Display the consumers. --%>
+    
+  <table>
+    <c:forEach items="${goodConsumers}" var="consumer" varStatus="i">
+      <c:choose>
+        <c:when test='${(i.index)%2 eq 0}'>
+          <c:set var="rowColor" value="dark" scope="page" />
+        </c:when>
+        <c:otherwise>
+          <c:set var="rowColor" value="lite" scope="page" />
+        </c:otherwise>
+      </c:choose>
+      
+      <tr>
+        <td><code>${consumer}</code></td>
+        <td>
+          <img src="<c:url value="/images/icons/delete.gif" />" />
+        </td>
+      </tr>
+    </c:forEach>
+  </table>
+  
+  </c:otherwise>
+</c:choose>
+  
+
+  <h2>Repository Scanning - Consumers of Bad Content</h2>
+  
+<c:choose>
+  <c:when test="${empty(badConsumers)}">
+    <%-- No Bad Consumers. Eeek! --%>
+    <strong>There are no bad consumers configured.</strong>
+  </c:when>
+  <c:otherwise>
+    <%-- Display the consumers. --%>
+    
+  <table>
+    <c:forEach items="${badConsumers}" var="consumer" varStatus="i">
+      <c:choose>
+        <c:when test='${(i.index)%2 eq 0}'>
+          <c:set var="rowColor" value="dark" scope="page" />
+        </c:when>
+        <c:otherwise>
+          <c:set var="rowColor" value="lite" scope="page" />
+        </c:otherwise>
+      </c:choose>
+      
+      <tr>
+        <td><code>${consumer}</code></td>
+        <td>
+          <img src="<c:url value="/images/icons/delete.gif" />" />
+        </td>
+      </tr>
+    </c:forEach>
+  </table>
+  
+  </c:otherwise>
+</c:choose>
+  
+
+</div>
+
+</body>
+</html>