From 765e78ef3b81ac77f1cb8c5d1adbe10d074afdb5 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Sat, 4 Nov 2006 04:05:09 +0000 Subject: [PATCH] o some files idea missed, 6.0 is buuuuggy git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@471110 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/maven/archiva/cli/Cli.java | 12 +++++++++++- .../org/apache/maven/archiva/cli/CliManager.java | 5 +++++ .../main/java/org/apache/maven/archiva/Archiva.java | 6 +++++- .../org/apache/maven/archiva/DefaultArchiva.java | 6 +++++- .../java/org/apache/maven/archiva/ArchivaTest.java | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/Cli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/Cli.java index 81f50c46a..57788c4b4 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/Cli.java +++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/Cli.java @@ -25,12 +25,15 @@ import org.codehaus.classworlds.ClassWorld; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.DefaultPlexusContainer; import org.codehaus.plexus.PlexusContainerException; +import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import java.io.IOException; import java.io.InputStream; import java.io.File; import java.util.Properties; +import java.util.List; +import java.util.Arrays; /** * @author jason van zyl @@ -160,9 +163,16 @@ public class Cli System.out.println( "Converting " + oldRepositoryPath + " to " + newRepositoryPath ); + List blacklistedPatterns = null; + + if ( cli.hasOption( CliManager.BLACKLISTED_PATTERNS ) ) + { + blacklistedPatterns = Arrays.asList( StringUtils.split( cli.getOptionValue( CliManager.BLACKLISTED_PATTERNS ), "," ) ); + } + try { - archiva.convertLegacyRepository( oldRepositoryPath, newRepositoryPath, true ); + archiva.convertLegacyRepository( oldRepositoryPath, newRepositoryPath, blacklistedPatterns, true ); } catch ( RepositoryConversionException e ) { diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/CliManager.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/CliManager.java index 06120de66..5b4d2b83f 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/CliManager.java +++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/CliManager.java @@ -23,6 +23,8 @@ public class CliManager public static final char NEW_REPOSITORY_PATH = 'n'; + public static final char BLACKLISTED_PATTERNS = 'b'; + // ---------------------------------------------------------------------------- // These are standard options that we would want to use for all our projects. // ---------------------------------------------------------------------------- @@ -53,6 +55,9 @@ public class CliManager options.addOption( OptionBuilder.withLongOpt( "new-repo" ).hasArg().withDescription( "Path to newly created Maven 2.x repository." ).create( NEW_REPOSITORY_PATH ) ); + + options.addOption( OptionBuilder.withLongOpt( "new-repo" ).hasArg().withDescription( + "Path to newly created Maven 2.x repository." ).create( BLACKLISTED_PATTERNS ) ); } public CommandLine parse( String[] args ) diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java b/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java index 460cad748..f36b8e706 100644 --- a/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java +++ b/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java @@ -20,6 +20,7 @@ import org.apache.maven.archiva.converter.RepositoryConversionException; import org.apache.maven.archiva.discoverer.DiscovererException; import java.io.File; +import java.util.List; /** * @author Jason van Zyl @@ -39,6 +40,9 @@ public interface Archiva * @param repositoryDirectory * @throws RepositoryConversionException */ - void convertLegacyRepository( File legacyRepositoryDirectory, File repositoryDirectory, boolean includeSnapshots ) + void convertLegacyRepository( File legacyRepositoryDirectory, + File repositoryDirectory, + List blacklistedPatterns, + boolean includeSnapshots ) throws RepositoryConversionException, DiscovererException; } diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java b/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java index 59fc60683..b50ed3936 100644 --- a/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java +++ b/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java @@ -21,6 +21,7 @@ import org.apache.maven.archiva.converter.RepositoryConversionException; import org.apache.maven.archiva.discoverer.DiscovererException; import java.io.File; +import java.util.List; /** * @author Jason van Zyl @@ -37,10 +38,13 @@ public class DefaultArchiva public void convertLegacyRepository( File legacyRepositoryDirectory, File repositoryDirectory, + List blacklistedPatterns, boolean includeSnapshots ) throws RepositoryConversionException, DiscovererException { - legacyRepositoryConverter.convertLegacyRepository( legacyRepositoryDirectory, repositoryDirectory, + legacyRepositoryConverter.convertLegacyRepository( legacyRepositoryDirectory, + repositoryDirectory, + blacklistedPatterns, includeSnapshots ); } } diff --git a/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java b/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java index 9e916dfdd..111bf9224 100644 --- a/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java +++ b/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java @@ -35,6 +35,6 @@ public class ArchivaTest Archiva rm = (Archiva) lookup( Archiva.ROLE ); - rm.convertLegacyRepository( legacyRepositoryDirectory, repositoryDirectory, true ); + rm.convertLegacyRepository( legacyRepositoryDirectory, repositoryDirectory, null, true ); } } -- 2.39.5