mirror of https://github.com/apache/archiva.git
Refactoring RepoContentConsumer into Known vs Invalid to aide in config/scanning
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@536233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
97a3237048
commit
c671224fbb
|
@ -0,0 +1,161 @@
|
|||
package org.apache.maven.archiva.configuration;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.collections.Closure;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
|
||||
import org.apache.maven.archiva.xml.ElementTextListClosure;
|
||||
import org.apache.maven.archiva.xml.XMLException;
|
||||
import org.apache.maven.archiva.xml.XMLReader;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* FileTypes
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.configuration.FileTypes"
|
||||
*/
|
||||
public class FileTypes
|
||||
implements Initializable
|
||||
{
|
||||
public static final String ARTIFACTS = "artifacts";
|
||||
|
||||
public static final String AUTO_REMOVE = "auto-remove";
|
||||
|
||||
public static final String INDEXABLE_CONTENT = "indexable-content";
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
/**
|
||||
* Map of default values for the file types.
|
||||
*/
|
||||
private Map defaultTypeMap = new HashMap();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Get the list of patterns for a specified filetype.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* You will always get a list. In this order.
|
||||
* <ul>
|
||||
* <li>The Configured List</li>
|
||||
* <li>The Default List</li>
|
||||
* <li>A single item list of <code>"**<span>/</span>*"</code></li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @param id the id to lookup.
|
||||
* @return the list of patterns.
|
||||
*/
|
||||
public List getFileTypePatterns( String id )
|
||||
{
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
Predicate selectedFiletype = new FiletypeSelectionPredicate( id );
|
||||
FileType filetype = (FileType) CollectionUtils.find( config.getRepositoryScanning().getFileTypes(),
|
||||
selectedFiletype );
|
||||
|
||||
if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) )
|
||||
{
|
||||
return filetype.getPatterns();
|
||||
}
|
||||
|
||||
List defaultPatterns = (List) defaultTypeMap.get( id );
|
||||
|
||||
if ( CollectionUtils.isEmpty( defaultPatterns ) )
|
||||
{
|
||||
return Collections.singletonList( "**/*" );
|
||||
}
|
||||
|
||||
return defaultPatterns;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
throws InitializationException
|
||||
{
|
||||
defaultTypeMap.clear();
|
||||
|
||||
try
|
||||
{
|
||||
URL defaultArchivaXml = this.getClass().getResource( "" );
|
||||
|
||||
XMLReader reader = new XMLReader( "configuration", defaultArchivaXml );
|
||||
List resp = reader.getElementList( "//configuration/repositoryScanning/fileTypes/fileType" );
|
||||
|
||||
CollectionUtils.forAllDo( resp, new AddFileTypeToDefaultMap() );
|
||||
}
|
||||
catch ( XMLException e )
|
||||
{
|
||||
throw new InitializationException( "Unable to setup default filetype maps.", e );
|
||||
}
|
||||
}
|
||||
|
||||
class AddFileTypeToDefaultMap
|
||||
implements Closure
|
||||
{
|
||||
public void execute( Object input )
|
||||
{
|
||||
if ( !( input instanceof Element ) )
|
||||
{
|
||||
// Not an element. skip.
|
||||
return;
|
||||
}
|
||||
|
||||
Element elem = (Element) input;
|
||||
if ( !StringUtils.equals( "fileType", elem.getName() ) )
|
||||
{
|
||||
// Not a 'fileType' element. skip.
|
||||
return;
|
||||
}
|
||||
|
||||
String id = elem.elementText( "id" );
|
||||
Element patternsElem = elem.element( "patterns" );
|
||||
if ( patternsElem == null )
|
||||
{
|
||||
// No patterns. skip.
|
||||
return;
|
||||
}
|
||||
|
||||
List patternElemList = patternsElem.elements( "pattern" );
|
||||
|
||||
ElementTextListClosure elemTextList = new ElementTextListClosure();
|
||||
CollectionUtils.forAllDo( patternElemList, elemTextList );
|
||||
List patterns = elemTextList.getList();
|
||||
|
||||
defaultTypeMap.put( id, patterns );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.apache.maven.archiva.configuration.functors;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.collections.Predicate;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
|
||||
/**
|
||||
* FiletypeSelectionPredicate
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class FiletypeSelectionPredicate
|
||||
implements Predicate
|
||||
{
|
||||
private String filetypeId;
|
||||
|
||||
public FiletypeSelectionPredicate( String id )
|
||||
{
|
||||
this.filetypeId = id;
|
||||
}
|
||||
|
||||
public boolean evaluate( Object object )
|
||||
{
|
||||
boolean satisfies = false;
|
||||
|
||||
if ( object instanceof FileType )
|
||||
{
|
||||
FileType filetype = (FileType) object;
|
||||
return ( StringUtils.equals( filetypeId, filetype.getId() ) );
|
||||
}
|
||||
|
||||
return satisfies;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.apache.maven.archiva.configuration.functors;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.collections.Closure;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* FiletypeToMapClosure
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class FiletypeToMapClosure
|
||||
implements Closure
|
||||
{
|
||||
private Map map = new HashMap();
|
||||
|
||||
public void execute( Object input )
|
||||
{
|
||||
if ( input instanceof FileType )
|
||||
{
|
||||
FileType filetype = (FileType) input;
|
||||
map.put( filetype.getId(), filetype );
|
||||
}
|
||||
}
|
||||
|
||||
public Map getMap()
|
||||
{
|
||||
return map;
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -598,6 +598,7 @@
|
|||
</description>
|
||||
</field>
|
||||
</fields>
|
||||
<!--
|
||||
<codeSegments>
|
||||
<codeSegment>
|
||||
<version>1.0.0+</version>
|
||||
|
@ -641,6 +642,7 @@
|
|||
]]></code>
|
||||
</codeSegment>
|
||||
</codeSegments>
|
||||
-->
|
||||
</class>
|
||||
<class>
|
||||
<name>FileType</name>
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package org.apache.maven.archiva.consumers;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Consumer for Invalid Repository Content
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface InvalidRepositoryContentConsumer
|
||||
extends RepositoryContentConsumer
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.apache.maven.archiva.consumers;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Consumer for Known Repository Content.
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface KnownRepositoryContentConsumer
|
||||
extends RepositoryContentConsumer
|
||||
{
|
||||
|
||||
}
|
|
@ -20,10 +20,10 @@ package org.apache.maven.archiva.consumers.core;
|
|||
*/
|
||||
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.model.ArchivaRepository;
|
||||
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
|
||||
import org.codehaus.plexus.digest.ChecksumFile;
|
||||
|
@ -45,12 +45,12 @@ import java.util.Map;
|
|||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="create-missing-checksums"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer, RegistryListener, Initializable
|
||||
implements KnownRepositoryContentConsumer, RegistryListener, Initializable
|
||||
{
|
||||
/**
|
||||
* @plexus.configuration default-value="create-missing-checksums"
|
||||
|
@ -66,6 +66,11 @@ public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
|||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaConfiguration configuration;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private FileTypes filetypes;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role="org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout"
|
||||
|
@ -206,11 +211,7 @@ public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
|||
{
|
||||
includes.clear();
|
||||
|
||||
FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning().getFileTypeById( "artifacts" );
|
||||
if ( artifactTypes != null )
|
||||
{
|
||||
includes.addAll( artifactTypes.getPatterns() );
|
||||
}
|
||||
includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
|
||||
}
|
||||
|
||||
public void initialize() throws InitializationException
|
||||
|
@ -225,10 +226,5 @@ public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
|||
configuration.addChangeListener( this );
|
||||
|
||||
initIncludes();
|
||||
|
||||
if ( includes.isEmpty() )
|
||||
{
|
||||
throw new InitializationException( "Unable to use " + getId() + " due to empty includes list. Check the configuration sources." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ package org.apache.maven.archiva.consumers.core;
|
|||
*/
|
||||
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.model.ArchivaRepository;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||
|
@ -40,13 +40,13 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="auto-remove"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class AutoRemoveConsumer
|
||||
extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer, RegistryListener, Initializable
|
||||
implements KnownRepositoryContentConsumer, RegistryListener, Initializable
|
||||
{
|
||||
/**
|
||||
* @plexus.configuration default-value="auto-remove"
|
||||
|
@ -62,6 +62,11 @@ public class AutoRemoveConsumer
|
|||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaConfiguration configuration;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private FileTypes filetypes;
|
||||
|
||||
private File repositoryDir;
|
||||
|
||||
|
@ -137,13 +142,8 @@ public class AutoRemoveConsumer
|
|||
private void initIncludes()
|
||||
{
|
||||
includes.clear();
|
||||
|
||||
FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning()
|
||||
.getFileTypeById( "auto-remove" );
|
||||
if ( artifactTypes != null )
|
||||
{
|
||||
includes.addAll( artifactTypes.getPatterns() );
|
||||
}
|
||||
|
||||
includes.addAll( filetypes.getFileTypePatterns( FileTypes.AUTO_REMOVE ) );
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
|
@ -159,10 +159,5 @@ public class AutoRemoveConsumer
|
|||
configuration.addChangeListener( this );
|
||||
|
||||
initIncludes();
|
||||
|
||||
if ( includes.isEmpty() )
|
||||
{
|
||||
throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.archiva.consumers.core;
|
|||
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.model.ArchivaRepository;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
@ -39,13 +40,13 @@ import java.util.Map;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="auto-rename"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class AutoRenameConsumer
|
||||
extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer
|
||||
implements KnownRepositoryContentConsumer
|
||||
{
|
||||
/**
|
||||
* @plexus.configuration default-value="auto-rename"
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.archiva.consumers.core;
|
|||
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.model.ArchivaRepository;
|
||||
import org.codehaus.plexus.digest.ChecksumFile;
|
||||
|
@ -42,12 +43,12 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="validate-checksum"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class ValidateChecksumConsumer extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer, Initializable
|
||||
implements KnownRepositoryContentConsumer, Initializable
|
||||
{
|
||||
private static final String NOT_VALID_CHECKSUM = "checksum-not-valid";
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ package org.apache.maven.archiva.consumers.database;
|
|||
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||
|
@ -50,13 +50,13 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="update-db-artifact"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class ArtifactUpdateDatabaseConsumer
|
||||
extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer, RegistryListener, Initializable
|
||||
implements KnownRepositoryContentConsumer, RegistryListener, Initializable
|
||||
{
|
||||
private static final String TYPE_NOT_ARTIFACT = "file-not-artifact";
|
||||
|
||||
|
@ -83,6 +83,11 @@ public class ArtifactUpdateDatabaseConsumer
|
|||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaConfiguration configuration;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private FileTypes filetypes;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
|
@ -222,11 +227,7 @@ public class ArtifactUpdateDatabaseConsumer
|
|||
{
|
||||
includes.clear();
|
||||
|
||||
FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning().getFileTypeById( "artifacts" );
|
||||
if ( artifactTypes != null )
|
||||
{
|
||||
includes.addAll( artifactTypes.getPatterns() );
|
||||
}
|
||||
includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
|
@ -235,10 +236,5 @@ public class ArtifactUpdateDatabaseConsumer
|
|||
configuration.addChangeListener( this );
|
||||
|
||||
initIncludes();
|
||||
|
||||
if ( includes.isEmpty() )
|
||||
{
|
||||
throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@ package org.apache.maven.archiva.consumers.lucene;
|
|||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.FileType;
|
||||
import org.apache.maven.archiva.configuration.FileTypes;
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
|
||||
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
|
||||
import org.apache.maven.archiva.indexer.RepositoryIndexException;
|
||||
|
@ -46,13 +46,13 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="index-content"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class IndexContentConsumer
|
||||
extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer, RegistryListener, Initializable
|
||||
implements KnownRepositoryContentConsumer, RegistryListener, Initializable
|
||||
{
|
||||
private static final String READ_CONTENT = "read_content";
|
||||
|
||||
|
@ -72,6 +72,11 @@ public class IndexContentConsumer
|
|||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaConfiguration configuration;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private FileTypes filetypes;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
|
@ -167,12 +172,7 @@ public class IndexContentConsumer
|
|||
{
|
||||
includes.clear();
|
||||
|
||||
FileType artifactTypes = configuration.getConfiguration().getRepositoryScanning()
|
||||
.getFileTypeById( "indexable-content" );
|
||||
if ( artifactTypes != null )
|
||||
{
|
||||
includes.addAll( artifactTypes.getPatterns() );
|
||||
}
|
||||
includes.addAll( filetypes.getFileTypePatterns( FileTypes.INDEXABLE_CONTENT ));
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
|
@ -188,10 +188,5 @@ public class IndexContentConsumer
|
|||
configuration.addChangeListener( this );
|
||||
|
||||
initIncludes();
|
||||
|
||||
if ( includes.isEmpty() )
|
||||
{
|
||||
throw new InitializationException( "Unable to use " + getId() + " due to empty includes list." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.archiva.converter.legacy;
|
|||
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.model.ArchivaRepository;
|
||||
import org.apache.maven.archiva.model.ArtifactReference;
|
||||
|
@ -42,13 +43,13 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||
* @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
* role-hint="artifact-legacy-to-default-converter"
|
||||
* instantiation-strategy="per-lookup"
|
||||
*/
|
||||
public class LegacyConverterArtifactConsumer
|
||||
extends AbstractMonitoredConsumer
|
||||
implements RepositoryContentConsumer
|
||||
implements KnownRepositoryContentConsumer
|
||||
{
|
||||
/**
|
||||
* @plexus.requirement role-hint="legacy-to-default"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
package org.apache.maven.archiva.repository.scanner;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.collections.Closure;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
import org.apache.commons.collections.functors.IfClosure;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
||||
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
||||
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* RepositoryContentConsumerUtil
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumerUtil"
|
||||
*/
|
||||
public class RepositoryContentConsumerUtil
|
||||
{
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
|
||||
*/
|
||||
private List availableGoodConsumers;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role="org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer"
|
||||
*/
|
||||
private List availableBadConsumers;
|
||||
|
||||
class SelectedKnownRepoConsumersPredicate
|
||||
implements Predicate
|
||||
{
|
||||
public boolean evaluate( Object object )
|
||||
{
|
||||
boolean satisfies = false;
|
||||
|
||||
if ( object instanceof KnownRepositoryContentConsumer )
|
||||
{
|
||||
KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object;
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
|
||||
return config.getRepositoryScanning().getGoodConsumers().contains( known.getId() );
|
||||
}
|
||||
|
||||
return satisfies;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SelectedInvalidRepoConsumersPredicate
|
||||
implements Predicate
|
||||
{
|
||||
public boolean evaluate( Object object )
|
||||
{
|
||||
boolean satisfies = false;
|
||||
|
||||
if ( object instanceof KnownRepositoryContentConsumer )
|
||||
{
|
||||
InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object;
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
|
||||
return config.getRepositoryScanning().getBadConsumers().contains( invalid.getId() );
|
||||
}
|
||||
|
||||
return satisfies;
|
||||
}
|
||||
}
|
||||
|
||||
class RepoConsumerToMapClosure
|
||||
implements Closure
|
||||
{
|
||||
private Map map = new HashMap();
|
||||
|
||||
public void execute( Object input )
|
||||
{
|
||||
if ( input instanceof RepositoryContentConsumer )
|
||||
{
|
||||
RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
|
||||
map.put( consumer.getId(), consumer );
|
||||
}
|
||||
}
|
||||
|
||||
public Map getMap()
|
||||
{
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
public Predicate getKnownSelectionPredicate()
|
||||
{
|
||||
return new SelectedKnownRepoConsumersPredicate();
|
||||
}
|
||||
|
||||
public Predicate getInvalidSelectionPredicate()
|
||||
{
|
||||
return new SelectedInvalidRepoConsumersPredicate();
|
||||
}
|
||||
|
||||
public Map getSelectedKnownConsumers()
|
||||
{
|
||||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
|
||||
|
||||
RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure();
|
||||
Closure ifclosure = IfClosure.getInstance( getKnownSelectionPredicate(), consumerMapClosure );
|
||||
CollectionUtils.forAllDo( scanning.getGoodConsumers(), ifclosure );
|
||||
|
||||
return consumerMapClosure.getMap();
|
||||
}
|
||||
|
||||
public Map getSelectedInvalidConsumers()
|
||||
{
|
||||
RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
|
||||
|
||||
RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure();
|
||||
Closure ifclosure = IfClosure.getInstance( getInvalidSelectionPredicate(), consumerMapClosure );
|
||||
CollectionUtils.forAllDo( scanning.getGoodConsumers(), ifclosure );
|
||||
|
||||
return consumerMapClosure.getMap();
|
||||
}
|
||||
|
||||
public List getAvailableKnownConsumers()
|
||||
{
|
||||
return availableGoodConsumers;
|
||||
}
|
||||
|
||||
public List getAvailableInvalidConsumers()
|
||||
{
|
||||
return availableBadConsumers;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ package org.apache.maven.archiva.repository.scanner;
|
|||
|
||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||
import org.apache.maven.archiva.model.ArchivaRepository;
|
||||
|
||||
|
@ -34,7 +35,7 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ScanConsumer extends AbstractMonitoredConsumer implements RepositoryContentConsumer
|
||||
public class ScanConsumer extends AbstractMonitoredConsumer implements KnownRepositoryContentConsumer
|
||||
{
|
||||
private int processCount = 0;
|
||||
|
||||
|
|
|
@ -33,6 +33,11 @@
|
|||
<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>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package org.apache.maven.archiva.xml;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.collections.Closure;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Gather the text from a collection of {@link Element}'s into a {@link List}
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ElementTextListClosure
|
||||
implements Closure
|
||||
{
|
||||
private List list = new ArrayList();
|
||||
|
||||
public void execute( Object input )
|
||||
{
|
||||
if ( input instanceof Element )
|
||||
{
|
||||
Element elem = (Element) input;
|
||||
list.add( elem.getTextTrim() );
|
||||
}
|
||||
}
|
||||
|
||||
public List getList()
|
||||
{
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package org.apache.maven.archiva.web.action.admin.scanning;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import com.opensymphony.xwork.Preparable;
|
||||
|
||||
import org.apache.maven.archiva.security.ArchivaRoleConstants;
|
||||
import org.codehaus.plexus.security.rbac.Resource;
|
||||
import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
|
||||
import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
|
||||
import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
|
||||
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
||||
|
||||
/**
|
||||
* ConfigureRepositoryScanningAction
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="configureRepositoryScanningAction"
|
||||
*/
|
||||
public class ConfigureRepositoryScanningAction
|
||||
extends PlexusActionSupport
|
||||
implements SecureAction, Preparable
|
||||
{
|
||||
|
||||
public SecureActionBundle getSecureActionBundle()
|
||||
throws SecureActionException
|
||||
{
|
||||
SecureActionBundle bundle = new SecureActionBundle();
|
||||
|
||||
bundle.setRequiresAuthentication( true );
|
||||
bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
public void prepare()
|
||||
throws Exception
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -336,6 +336,30 @@
|
|||
<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">
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
<%--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="ww" uri="/webwork" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %>
|
||||
<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Administration - Repository Scanning</title>
|
||||
<ww:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Administration - Repository Scanning</h1>
|
||||
|
||||
<div id="contentArea">
|
||||
|
||||
<ww:actionerror />
|
||||
<ww:actionmessage />
|
||||
|
||||
<div class="admin">
|
||||
<h2>Repository Scanning - File Types</h2>
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${empty(fileTypeMap)}">
|
||||
<%-- No File Types. Eeek! --%>
|
||||
<strong>There are no file types configured.</strong>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<%-- Display the filetypes. --%>
|
||||
|
||||
<c:forEach items="${fileTypeMap}" var="filetype" varStatus="i">
|
||||
<c:choose>
|
||||
<c:when test='${(i.index)%2 eq 0}'>
|
||||
<c:set var="rowColor" value="dark" scope="page" />
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:set var="rowColor" value="lite" scope="page" />
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
<div class="filetype ${rowColor}">
|
||||
|
||||
<div class="controls">
|
||||
<%-- Does this even make sense for file types? --%>
|
||||
</div>
|
||||
|
||||
<h3 class="filetype">${filetype.key}</h3>
|
||||
|
||||
<table>
|
||||
<c:forEach items="${filetype.value.patterns}" var="pattern" varStatus="i">
|
||||
<tr>
|
||||
<td>
|
||||
<code>${pattern}</code>
|
||||
</td>
|
||||
<td>
|
||||
<img src="<c:url value="/images/icons/delete.gif" />" />
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</c:forEach>
|
||||
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
<h2>Repository Scanning - Consumers of Good Content</h2>
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${empty(goodConsumers)}">
|
||||
<%-- No Good Consumers. Eeek! --%>
|
||||
<strong>There are no good consumers configured.</strong>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<%-- Display the consumers. --%>
|
||||
|
||||
<table>
|
||||
<c:forEach items="${goodConsumers}" var="consumer" varStatus="i">
|
||||
<c:choose>
|
||||
<c:when test='${(i.index)%2 eq 0}'>
|
||||
<c:set var="rowColor" value="dark" scope="page" />
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:set var="rowColor" value="lite" scope="page" />
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
<tr>
|
||||
<td><code>${consumer}</code></td>
|
||||
<td>
|
||||
<img src="<c:url value="/images/icons/delete.gif" />" />
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
|
||||
<h2>Repository Scanning - Consumers of Bad Content</h2>
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${empty(badConsumers)}">
|
||||
<%-- No Bad Consumers. Eeek! --%>
|
||||
<strong>There are no bad consumers configured.</strong>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<%-- Display the consumers. --%>
|
||||
|
||||
<table>
|
||||
<c:forEach items="${badConsumers}" var="consumer" varStatus="i">
|
||||
<c:choose>
|
||||
<c:when test='${(i.index)%2 eq 0}'>
|
||||
<c:set var="rowColor" value="dark" scope="page" />
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:set var="rowColor" value="lite" scope="page" />
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
<tr>
|
||||
<td><code>${consumer}</code></td>
|
||||
<td>
|
||||
<img src="<c:url value="/images/icons/delete.gif" />" />
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue