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
index 000000000..783b35885
--- /dev/null
+++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
@@ -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 Joakim Erdfelt
+ * @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();
+
+ /**
+ *
+ * Get the list of patterns for a specified filetype.
+ *
+ *
+ *
+ * You will always get a list. In this order.
+ *
+ * - The Configured List
+ * - The Default List
+ * - A single item list of
"**/*"
+ *
+ *
+ *
+ * @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
index 000000000..c3d58c686
--- /dev/null
+++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeSelectionPredicate.java
@@ -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 Joakim Erdfelt
+ * @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
index 000000000..cfe7046e0
--- /dev/null
+++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java
@@ -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 Joakim Erdfelt
+ * @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/util/LocalRepositoryPredicate.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/LocalRepositoryPredicate.java
similarity index 96%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/LocalRepositoryPredicate.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/LocalRepositoryPredicate.java
index 8284d72da..7cbad9560 100644
--- 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/functors/LocalRepositoryPredicate.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
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/functors/NetworkProxyComparator.java
similarity index 96%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxyComparator.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java
index 6acd20ff5..c4f996c23 100644
--- 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/functors/NetworkProxyComparator.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
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/functors/NetworkProxySelectionPredicate.java
similarity index 96%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/NetworkProxySelectionPredicate.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxySelectionPredicate.java
index c21630866..ea7832dd7 100644
--- 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/functors/NetworkProxySelectionPredicate.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
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/functors/ProxyConnectorSelectionPredicate.java
similarity index 97%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/ProxyConnectorSelectionPredicate.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java
index b1fc9fc3f..12b0964e8 100644
--- 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/functors/ProxyConnectorSelectionPredicate.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
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/functors/RemoteRepositoryPredicate.java
similarity index 96%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RemoteRepositoryPredicate.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RemoteRepositoryPredicate.java
index bb8db282b..9ae15b22e 100644
--- 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/functors/RemoteRepositoryPredicate.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
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/functors/RepositoryConfigurationComparator.java
similarity index 96%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryConfigurationComparator.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryConfigurationComparator.java
index 1077b0cc7..b69161f0c 100644
--- 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/functors/RepositoryConfigurationComparator.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
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/functors/RepositoryIdListClosure.java
similarity index 96%
rename from archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/util/RepositoryIdListClosure.java
rename to archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/RepositoryIdListClosure.java
index 97503d5b0..a739f8c0b 100644
--- 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/functors/RepositoryIdListClosure.java
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.configuration.util;
+package org.apache.maven.archiva.configuration.functors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
index 66b39a368..49efaad10 100644
--- a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
+++ b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
@@ -598,6 +598,7 @@
+
FileType
diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
index b893fcc79..0ce132e36 100644
--- a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
+++ b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
@@ -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
index 000000000..61c50a950
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/InvalidRepositoryContentConsumer.java
@@ -0,0 +1,32 @@
+package org.apache.maven.archiva.consumers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Consumer for Invalid Repository Content
+ *
+ * @author Joakim Erdfelt
+ * @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
index 000000000..f0ff0257e
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/KnownRepositoryContentConsumer.java
@@ -0,0 +1,32 @@
+package org.apache.maven.archiva.consumers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Consumer for Known Repository Content.
+ *
+ * @author Joakim Erdfelt
+ * @version $Id$
+ */
+public interface KnownRepositoryContentConsumer
+ extends RepositoryContentConsumer
+{
+
+}
diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
index f9af58288..c444952b1 100644
--- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
@@ -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 Joakim Erdfelt
* @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." );
- }
}
}
diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
index a4d7d175e..938a90942 100644
--- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
@@ -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 Joakim Erdfelt
* @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." );
- }
}
}
diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
index e117e6566..e0be8b031 100644
--- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
@@ -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 Joakim Erdfelt
* @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"
diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
index 8dc5e1cc2..692edd598 100644
--- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
@@ -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 Joakim Erdfelt
* @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";
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
index 2d011c2a4..a8d5a09f8 100644
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
@@ -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 Joakim Erdfelt
* @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." );
- }
}
}
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java
index 36ffb1cf2..b71e78f1f 100644
--- a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java
@@ -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 Joakim Erdfelt
* @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." );
- }
}
}
diff --git a/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
index 6194ff50c..2e0e6fb25 100644
--- a/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
+++ b/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
@@ -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 Joakim Erdfelt
* @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"
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ActiveManagedRepositories.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ActiveManagedRepositories.java
index 4e89e6a08..989f10046 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ActiveManagedRepositories.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ActiveManagedRepositories.java
@@ -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
index 000000000..ec03a3437
--- /dev/null
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtil.java
@@ -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 Joakim Erdfelt
+ * @version $Id$
+ *
+ * @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumerUtil"
+ */
+public class RepositoryContentConsumerUtil
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArchivaConfiguration archivaConfiguration;
+
+ /**
+ * @plexus.requirement role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
+ */
+ private List availableGoodConsumers;
+
+ /**
+ * @plexus.requirement role="org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer"
+ */
+ private List availableBadConsumers;
+
+ class SelectedKnownRepoConsumersPredicate
+ implements Predicate
+ {
+ public boolean evaluate( Object object )
+ {
+ boolean satisfies = false;
+
+ if ( object instanceof KnownRepositoryContentConsumer )
+ {
+ KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object;
+ Configuration config = archivaConfiguration.getConfiguration();
+
+ return config.getRepositoryScanning().getGoodConsumers().contains( known.getId() );
+ }
+
+ return satisfies;
+ }
+
+ }
+
+ class SelectedInvalidRepoConsumersPredicate
+ implements Predicate
+ {
+ public boolean evaluate( Object object )
+ {
+ boolean satisfies = false;
+
+ if ( object instanceof KnownRepositoryContentConsumer )
+ {
+ InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object;
+ Configuration config = archivaConfiguration.getConfiguration();
+
+ return config.getRepositoryScanning().getBadConsumers().contains( invalid.getId() );
+ }
+
+ return satisfies;
+ }
+ }
+
+ class RepoConsumerToMapClosure
+ implements Closure
+ {
+ private Map map = new HashMap();
+
+ public void execute( Object input )
+ {
+ if ( input instanceof RepositoryContentConsumer )
+ {
+ RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
+ map.put( consumer.getId(), consumer );
+ }
+ }
+
+ public Map getMap()
+ {
+ return map;
+ }
+ }
+
+ public Predicate getKnownSelectionPredicate()
+ {
+ return new SelectedKnownRepoConsumersPredicate();
+ }
+
+ public Predicate getInvalidSelectionPredicate()
+ {
+ return new SelectedInvalidRepoConsumersPredicate();
+ }
+
+ public Map 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;
+ }
+}
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java
index 8b42e873a..8ab2012f7 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java
@@ -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 Joakim Erdfelt
* @version $Id$
*/
-public class ScanConsumer extends AbstractMonitoredConsumer implements RepositoryContentConsumer
+public class ScanConsumer extends AbstractMonitoredConsumer implements KnownRepositoryContentConsumer
{
private int processCount = 0;
diff --git a/archiva-base/archiva-xml-tools/pom.xml b/archiva-base/archiva-xml-tools/pom.xml
index 5f3a92b91..2ea88f25f 100644
--- a/archiva-base/archiva-xml-tools/pom.xml
+++ b/archiva-base/archiva-xml-tools/pom.xml
@@ -33,6 +33,11 @@
org.apache.maven.archiva
archiva-common
+
+ commons-collections
+ commons-collections
+ 3.2
+
dom4j
dom4j
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
index 000000000..117422362
--- /dev/null
+++ b/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java
@@ -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 Joakim Erdfelt
+ * @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
diff --git a/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/DuplicateArtifactsConsumer.java b/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/DuplicateArtifactsConsumer.java
index ad6bb675f..e6715094e 100644
--- a/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/DuplicateArtifactsConsumer.java
+++ b/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/DuplicateArtifactsConsumer.java
@@ -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()
diff --git a/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java b/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
index 3a350f54f..06d632b29 100644
--- a/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
+++ b/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
@@ -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()
diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java
index 047e93296..3caadfc48 100644
--- a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java
+++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java
@@ -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 );
+ configuredGoodConsumers.addAll( CollectionUtils.select( repoScanningConfig.getGoodConsumers(),
+ repositoryContentConsumerUtil
+ .getKnownSelectionPredicate() ) );
- if ( consumer == null )
- {
- getLogger().warn(
- "Desired Consumer [" + desiredConsumerId
- + "] does not exist. Skipping in repository scan." );
- continue;
- }
-
- activeConsumers.add( consumer );
- }
-
- 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;
}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
index 8b416bc9c..de24dea1f 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
@@ -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;
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
index 5da2144b5..68365ebbd 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyAction.java
@@ -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;
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
index 05254eb49..57a4bf314 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
@@ -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
index 000000000..bb4b5c040
--- /dev/null
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/ConfigureRepositoryScanningAction.java
@@ -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 Joakim Erdfelt
+ * @version $Id$
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryScanningAction"
+ */
+public class ConfigureRepositoryScanningAction
+extends PlexusActionSupport
+implements SecureAction, Preparable
+{
+
+ public SecureActionBundle getSecureActionBundle()
+ throws SecureActionException
+ {
+ SecureActionBundle bundle = new SecureActionBundle();
+
+ bundle.setRequiresAuthentication( true );
+ bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
+
+ return bundle;
+ }
+
+ public void prepare()
+ throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
index fb7fa6d5e..c326b5355 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java
@@ -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 void setServletRequest( HttpServletRequest request )
+ public List getBadConsumers()
{
- // TODO Auto-generated method stub
-
+ return badConsumers;
}
+ public void setBadConsumers( List badConsumers )
+ {
+ 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;
+ }
}
diff --git a/archiva-web/archiva-webapp/src/main/resources/xwork.xml b/archiva-web/archiva-webapp/src/main/resources/xwork.xml
index a60c3c423..b919f31fa 100644
--- a/archiva-web/archiva-webapp/src/main/resources/xwork.xml
+++ b/archiva-web/archiva-webapp/src/main/resources/xwork.xml
@@ -336,6 +336,30 @@
/WEB-INF/jsp/admin/repositoryScanning.jsp
+
+ /WEB-INF/jsp/admin/addRepositoryScanning.jsp
+ repositoryScanning
+
+
+
+
+ /WEB-INF/jsp/admin/editRepositoryScanning.jsp
+ repositoryScanning
+
+
+
+
+ /WEB-INF/jsp/admin/editRepositoryScanning.jsp
+ repositoryScanning
+
+
+
+
+ /WEB-INF/jsp/admin/deleteRepositoryScanning.jsp
+ repositoryScanning
+
+
+
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
index 000000000..3814dc94e
--- /dev/null
+++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositoryScanning.jsp
@@ -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" %>
+
+
+
+ Administration - Repository Scanning
+
+
+
+
+
+Administration - Repository Scanning
+
+
+
+
+
+
+
+
Repository Scanning - File Types
+
+
+
+ <%-- No File Types. Eeek! --%>
+ There are no file types configured.
+
+
+ <%-- Display the filetypes. --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- Does this even make sense for file types? --%>
+
+
+
${filetype.key}
+
+
+
+
+
+ ${pattern}
+ |
+
+ " />
+ |
+
+
+
+
+
+
+
+
+
+
+
Repository Scanning - Consumers of Good Content
+
+
+
+ <%-- No Good Consumers. Eeek! --%>
+ There are no good consumers configured.
+
+
+ <%-- Display the consumers. --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${consumer} |
+
+ " />
+ |
+
+
+
+
+
+
+
+
+
Repository Scanning - Consumers of Bad Content
+
+
+
+ <%-- No Bad Consumers. Eeek! --%>
+ There are no bad consumers configured.
+
+
+ <%-- Display the consumers. --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${consumer} |
+
+ " />
+ |
+
+
+
+
+
+
+
+
+
+
+
+