From: Brett Porter Date: Fri, 1 Sep 2006 01:47:48 +0000 (+0000) Subject: [MRM-144] various minor improvements to code X-Git-Tag: archiva-0.9-alpha-1~630 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=96ba48bf47f30f099a9b2bf83cd2f3686f5382ed;p=archiva.git [MRM-144] various minor improvements to code git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@439134 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-configuration/src/main/mdo/configuration.mdo index eabc96a60..87572e448 100644 --- a/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-configuration/src/main/mdo/configuration.mdo @@ -10,7 +10,6 @@ org.apache.maven.archiva.configuration - Configuration @@ -83,8 +82,11 @@ globalBlackListPatterns 1.0.0 - String Blacklisted patterns in the discovery process + + String + * + proxy @@ -287,8 +289,11 @@ blackListPatterns 1.0.0 - String Blacklisted patterns in the discovery process + + String + * + diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/IndexerTask.java b/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/IndexerTask.java index 4468b2b1d..52487d4f0 100644 --- a/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/IndexerTask.java +++ b/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/IndexerTask.java @@ -106,8 +106,15 @@ public class IndexerTask if ( repositoryConfiguration.isIndexed() ) { - // TODO! include global ones - String blacklistedPatterns = repositoryConfiguration.getBlackListPatterns(); + List blacklistedPatterns = new ArrayList(); + if ( repositoryConfiguration.getBlackListPatterns() != null ) + { + blacklistedPatterns.addAll( repositoryConfiguration.getBlackListPatterns() ); + } + if ( configuration.getGlobalBlackListPatterns() != null ) + { + blacklistedPatterns.addAll( configuration.getGlobalBlackListPatterns() ); + } boolean includeSnapshots = repositoryConfiguration.isIncludeSnapshots(); ArtifactRepository repository = repoFactory.createRepository( repositoryConfiguration ); diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractArtifactDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractArtifactDiscoverer.java index 5c184cd7c..9b3a8b98b 100644 --- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractArtifactDiscoverer.java +++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractArtifactDiscoverer.java @@ -46,13 +46,13 @@ public abstract class AbstractArtifactDiscoverer "**/*.MD5", "**/*.sha1", "**/*.SHA1", "**/*snapshot-version", "*/website/**", "*/licenses/**", "*/licences/**", "**/.htaccess", "**/*.html", "**/*.asc", "**/*.txt", "**/*.xml", "**/README*", "**/CHANGELOG*", "**/KEYS*"}; - private List scanForArtifactPaths( File repositoryBase, String blacklistedPatterns, long comparisonTimestamp ) + private List scanForArtifactPaths( File repositoryBase, List blacklistedPatterns, long comparisonTimestamp ) { return scanForArtifactPaths( repositoryBase, blacklistedPatterns, null, STANDARD_DISCOVERY_EXCLUDES, comparisonTimestamp ); } - public List discoverArtifacts( ArtifactRepository repository, String operation, String blacklistedPatterns, + public List discoverArtifacts( ArtifactRepository repository, String operation, List blacklistedPatterns, boolean includeSnapshots ) throws DiscovererException { diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractDiscoverer.java index 34abf41eb..dc90ef0c0 100644 --- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractDiscoverer.java +++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/AbstractDiscoverer.java @@ -22,7 +22,6 @@ import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; -import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.Xpp3DomWriter; @@ -89,7 +88,7 @@ public abstract class AbstractDiscoverer return kickedOutPaths.iterator(); } - protected List scanForArtifactPaths( File repositoryBase, String blacklistedPatterns, String[] includes, + protected List scanForArtifactPaths( File repositoryBase, List blacklistedPatterns, String[] includes, String[] excludes, long comparisonTimestamp ) { List allExcludes = new ArrayList(); @@ -98,10 +97,9 @@ public abstract class AbstractDiscoverer { allExcludes.addAll( Arrays.asList( excludes ) ); } - - if ( !StringUtils.isEmpty( blacklistedPatterns ) ) + if ( blacklistedPatterns != null ) { - allExcludes.addAll( Arrays.asList( blacklistedPatterns.split( "," ) ) ); + allExcludes.addAll( blacklistedPatterns ); } DirectoryScanner scanner = new DirectoryScanner(); diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/ArtifactDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/ArtifactDiscoverer.java index b818adb14..353a72f6e 100644 --- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/ArtifactDiscoverer.java +++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/ArtifactDiscoverer.java @@ -47,7 +47,7 @@ public interface ArtifactDiscoverer * @return the list of artifacts discovered * @throws DiscovererException if there was an unrecoverable problem discovering artifacts or recording progress */ - List discoverArtifacts( ArtifactRepository repository, String operation, String blacklistedPatterns, + List discoverArtifacts( ArtifactRepository repository, String operation, List blacklistedPatterns, boolean includeSnapshots ) throws DiscovererException; diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/DefaultMetadataDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/DefaultMetadataDiscoverer.java index 10ab005b5..7074774b9 100644 --- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/DefaultMetadataDiscoverer.java +++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/DefaultMetadataDiscoverer.java @@ -62,7 +62,7 @@ public class DefaultMetadataDiscoverer */ private static final String[] STANDARD_DISCOVERY_INCLUDES = {"**/maven-metadata.xml"}; - public List discoverMetadata( ArtifactRepository repository, String operation, String blacklistedPatterns ) + public List discoverMetadata( ArtifactRepository repository, String operation, List blacklistedPatterns ) throws DiscovererException { if ( !"file".equals( repository.getProtocol() ) ) diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/MetadataDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/MetadataDiscoverer.java index 1492c0742..04990808b 100644 --- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/MetadataDiscoverer.java +++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discovery/MetadataDiscoverer.java @@ -35,7 +35,8 @@ public interface MetadataDiscoverer * @param operation the operation being performed (used for timestamp comparison) * @param blacklistedPatterns Patterns that are to be excluded from the discovery process. * @return the list of artifacts found + * @throws DiscovererException if there is a problem during the discovery process */ - List discoverMetadata( ArtifactRepository repository, String operation, String blacklistedPatterns ) + List discoverMetadata( ArtifactRepository repository, String operation, List blacklistedPatterns ) throws DiscovererException; } diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/DefaultArtifactDiscovererTest.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/DefaultArtifactDiscovererTest.java index 355cbfbaf..9c68b02b8 100644 --- a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/DefaultArtifactDiscovererTest.java +++ b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/DefaultArtifactDiscovererTest.java @@ -37,6 +37,8 @@ import java.util.Map; public class DefaultArtifactDiscovererTest extends AbstractArtifactDiscovererTest { + private static final List JAVAX_BLACKLIST = Collections.singletonList( "javax/**" ); + protected String getLayout() { return "default"; @@ -105,7 +107,7 @@ public class DefaultArtifactDiscovererTest public void testBlacklistedExclude() throws DiscovererException { - List artifacts = discoverer.discoverArtifacts( repository, TEST_OPERATION, "javax/**", false ); + List artifacts = discoverer.discoverArtifacts( repository, TEST_OPERATION, JAVAX_BLACKLIST, false ); assertNotNull( "Check artifacts not null", artifacts ); boolean found = false; for ( Iterator i = discoverer.getExcludedPathsIterator(); i.hasNext() && !found; ) diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/LegacyArtifactDiscovererTest.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/LegacyArtifactDiscovererTest.java index e622372c0..d514da90a 100644 --- a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/LegacyArtifactDiscovererTest.java +++ b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discovery/LegacyArtifactDiscovererTest.java @@ -21,6 +21,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti import java.io.File; import java.net.MalformedURLException; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -28,11 +29,13 @@ import java.util.List; * Test the legacy artifact discoverer. * * @author Brett Porter - * @version $Id$ + * @version $Id:LegacyArtifactDiscovererTest.java 437105 2006-08-26 17:22:22 +1000 (Sat, 26 Aug 2006) brett $ */ public class LegacyArtifactDiscovererTest extends AbstractArtifactDiscovererTest { + private static final List JAVAX_SQL_BLACKLIST = Collections.singletonList( "javax.sql/**" ); + protected String getLayout() { return "legacy"; @@ -100,7 +103,7 @@ public class LegacyArtifactDiscovererTest public void testBlacklistedExclude() throws DiscovererException { - List artifacts = discoverer.discoverArtifacts( repository, TEST_OPERATION, "javax.sql/**", false ); + List artifacts = discoverer.discoverArtifacts( repository, TEST_OPERATION, JAVAX_SQL_BLACKLIST, false ); assertNotNull( "Check artifacts not null", artifacts ); boolean found = false; for ( Iterator i = discoverer.getExcludedPathsIterator(); i.hasNext() && !found; ) diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java index 5de9b9afc..346b42de6 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/DeleteProxiedRepositoryAction.java @@ -43,6 +43,6 @@ public class DeleteProxiedRepositoryAction protected void removeContents( AbstractRepositoryConfiguration existingRepository ) throws IOException { - // TODO! + // TODO! delete it } } diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxiedRepositories.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxiedRepositories.jsp index bf6334059..317ee80e0 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxiedRepositories.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxiedRepositories.jsp @@ -16,6 +16,7 @@ <%@ taglib prefix="ww" uri="/webwork" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> @@ -28,120 +29,86 @@

Administration

-

Proxied Repositories

+

Proxied Repositories

- - - There are no proxied repositories configured yet. - - -
-
- <%-- TODO replace with icons --%> - ">Edit - Repository | ">Delete - Repository -
-

${repository.name}

- - - - - - - - - - - - <%-- TODO: can probably just use layout appended to a key prefix in i18n to simplify this --%> - - - - - - - - - - - - - - - - - - - - - - - - - - -
Identifier - ${repository.id} -
URL${repository.url}
Type - - - Maven 2.x Repository - - - Maven 1.x Repository - - -
Snapshots - <%-- TODO! turn into a tag --%> - - - Disabled - - - Updated every request - - - Updated hourly - - - Updated daily - - - Updated every ${repository.snapshotsInterval} minutes - - -
Releases - <%-- TODO! turn into a tag --%> - - - Disabled - - - Updated every request - - - Updated hourly - - - Updated daily - - - Updated every ${repository.releasesInterval} minutes - - -
Proxied through - <%-- TODO: this is the hard way! would be nice if there was a ref in the model so it was directly linked --%> - ${repositoriesMap[repository.managedRepository].name} - (${repositoriesMap[repository.managedRepository].id}) -
Use HTTP Proxy
Cache Failures
Fail Whole Group
-
-
+ + + There are no proxied repositories configured yet. + + +
+
+ <%-- TODO replace with icons --%> + ">Edit + Repository | ">Delete + Repository +
+

${repository.name}

+ + + + + + + + + + + + <%-- TODO: can probably just use layout appended to a key prefix in i18n to simplify this --%> + + + + + + + + + + + + + + + + + + + + + + + + + + +
Identifier + ${repository.id} +
URL${repository.url}
Type + + + Maven 2.x Repository + + + Maven 1.x Repository + + +
Snapshots + +
Releases + +
Proxied through + <%-- TODO: this is the hard way! would be nice if there was a ref in the model so it was directly linked --%> + ${repositoriesMap[repository.managedRepository].name} + (${repositoriesMap[repository.managedRepository].id}) +
Use HTTP Proxy
Cache Failures
Fail Whole Group
+
+
-

- ">Add Repository -

+

+ ">Add Repository +

diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf index 51495fa49..a4d8318fc 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/quickSearchForm.jspf @@ -16,7 +16,7 @@ --%>