From: Jesse McConnell Date: Thu, 12 Apr 2007 22:00:28 +0000 (+0000) Subject: working on getting the cli working again X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=67fd82cfadac141e3f9cf4e9d2b9bcd3172447cd;p=archiva.git working on getting the cli working again git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@528251 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-jpox-database-refactor/archiva-cli/pom.xml b/archiva-jpox-database-refactor/archiva-cli/pom.xml index 384126d96..ded6638b0 100644 --- a/archiva-jpox-database-refactor/archiva-cli/pom.xml +++ b/archiva-jpox-database-refactor/archiva-cli/pom.xml @@ -39,17 +39,14 @@ org.apache.maven.archiva archiva-core-consumers - 1.0-SNAPSHOT org.apache.maven.archiva archiva-database-consumers - 1.0-SNAPSHOT org.apache.maven.archiva archiva-lucene-consumers - 1.0-SNAPSHOT org.codehaus.plexus @@ -74,6 +71,11 @@ commons-lang commons-lang + + org.codehaus.plexus.registry + plexus-registry-commons + 1.0-alpha-2 + @@ -88,6 +90,24 @@ + + org.codehaus.plexus + plexus-maven-plugin + + + merge + + merge-descriptors + + + + ${basedir}/src/main/resources/META-INF/plexus/components.xml + ${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml + + + + + diff --git a/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java index 903593443..ae4e87826 100644 --- a/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java +++ b/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java @@ -24,6 +24,7 @@ import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.common.utils.DateUtil; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.RepositoryContentConsumer; import org.apache.maven.archiva.converter.RepositoryConversionException; @@ -69,6 +70,8 @@ public class ArchivaCli public static final char CONSUMERS = 'u'; public static final char LIST_CONSUMERS = 'l'; + + public static final char DUMP_CONFIGURATION = 'd'; // ---------------------------------------------------------------------------- // Properties controlling Repository conversion @@ -80,6 +83,13 @@ public class ArchivaCli public static final String BLACKLISTED_PATTERNS = "blacklistPatterns"; + /** + * Configuration store. + * + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + public static void main( String[] args ) throws Exception { @@ -122,6 +132,9 @@ public class ArchivaCli Option listConsumersOption = createOption( LIST_CONSUMERS, "listconsumers", 0, "List available consumers." ); options.addOption( listConsumersOption ); + Option dumpConfig = createOption( DUMP_CONFIGURATION, "dumpconfig", 0, "Dump Current Configuration." ); + options.addOption( dumpConfig ); + return options; } @@ -140,6 +153,10 @@ public class ArchivaCli { dumpAvailableConsumers( plexus ); } + else if ( cli.hasOption( DUMP_CONFIGURATION ) ) + { + dumpConfiguration( plexus ); + } else { displayHelp(); @@ -279,4 +296,11 @@ public class ArchivaCli showFatalError( "Error converting repository.", e, true ); } } + + private void dumpConfiguration( PlexusContainer plexus ) throws ComponentLookupException + { + archivaConfiguration = (ArchivaConfiguration) plexus.lookup( ArchivaConfiguration.ROLE ); + + System.out.println( "File Type Count: " + archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().size() ); + } } diff --git a/archiva-jpox-database-refactor/archiva-cli/src/main/resources/META-INF/plexus/components.xml b/archiva-jpox-database-refactor/archiva-cli/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 000000000..6873d9f8f --- /dev/null +++ b/archiva-jpox-database-refactor/archiva-cli/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,52 @@ + + + + + + org.codehaus.plexus.registry.Registry + + org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry + + commons-configuration + + + + + + + + + + + +