--- /dev/null
+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 );
+ }
+ }
+}
--- /dev/null
+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;
+ }
+
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+
+}
--- /dev/null
+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;
+ }
+}
+++ /dev/null
-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;
- }
-
-}
+++ /dev/null
-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;
- }
-}
+++ /dev/null
-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;
- }
-}
+++ /dev/null
-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;
- }
-
-}
+++ /dev/null
-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;
- }
-}
+++ /dev/null
-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;
- }
-
-}
+++ /dev/null
-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;
- }
-}
</description>
</field>
</fields>
+ <!--
<codeSegments>
<codeSegment>
<version>1.0.0+</version>
]]></code>
</codeSegment>
</codeSegments>
+ -->
</class>
<class>
<name>FileType</name>
import org.codehaus.plexus.PlexusTestCase;
import java.io.File;
+import java.util.List;
/**
* Test the configuration store.
*/
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();
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 );
--- /dev/null
+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
+{
+
+}
--- /dev/null
+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
+{
+
+}
*/
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;
*
* @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"
* @plexus.requirement
*/
private ArchivaConfiguration configuration;
+
+ /**
+ * @plexus.requirement
+ */
+ private FileTypes filetypes;
/**
* @plexus.requirement role="org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout"
{
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
configuration.addChangeListener( this );
initIncludes();
-
- if ( includes.isEmpty() )
- {
- throw new InitializationException( "Unable to use " + getId() + " due to empty includes list. Check the configuration sources." );
- }
}
}
*/
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;
* @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"
* @plexus.requirement
*/
private ArchivaConfiguration configuration;
+
+ /**
+ * @plexus.requirement
+ */
+ private FileTypes filetypes;
private File repositoryDir;
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()
configuration.addChangeListener( this );
initIncludes();
-
- if ( includes.isEmpty() )
- {
- throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
- }
}
}
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;
* @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"
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;
* @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";
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;
* @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";
* @plexus.requirement
*/
private ArchivaConfiguration configuration;
+
+ /**
+ * @plexus.requirement
+ */
+ private FileTypes filetypes;
/**
* @plexus.requirement
{
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()
configuration.addChangeListener( this );
initIncludes();
-
- if ( includes.isEmpty() )
- {
- throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
- }
}
}
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;
* @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";
* @plexus.requirement
*/
private ArchivaConfiguration configuration;
+
+ /**
+ * @plexus.requirement
+ */
+ private FileTypes filetypes;
/**
* @plexus.requirement
{
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()
configuration.addChangeListener( this );
initIncludes();
-
- if ( includes.isEmpty() )
- {
- throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
- }
}
}
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;
* @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"
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;
--- /dev/null
+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;
+ }
+}
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;
* @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;
<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>
--- /dev/null
+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
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;
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;
*/
private ArchivaConfiguration configuration;
+ /**
+ * @plexus.requirement
+ */
+ private FileTypes filetypes;
+
/**
* @plexus.requirement role-hint="jdo"
*/
while ( it.hasNext() )
{
ArchivaArtifact dupArtifact = (ArchivaArtifact) it.next();
-
- if( dupArtifact.equals( artifact ) )
+
+ if ( dupArtifact.equals( artifact ) )
{
// Skip reference to itself.
continue;
{
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()
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;
* @plexus.requirement
*/
private ArchivaConfiguration configuration;
+
+ /**
+ * @plexus.requirement
+ */
+ private FileTypes filetypes;
/**
* @plexus.requirement role-hint="jdo"
{
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()
* 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;
*/
private ArchivaConfiguration archivaConfiguration;
+ /**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ArchivaDAO dao;
+
/**
* @plexus.requirement role-hint="jdo"
*/
/**
* 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
{
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 )
{
{
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()
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;
}
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;
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;
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;
--- /dev/null
+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
+
+ }
+
+}
* 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
* @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;
+ }
}
<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">
--- /dev/null
+<%--
+ ~ 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>