diff options
author | Jesse McConnell <jmcconnell@apache.org> | 2007-04-12 22:00:28 +0000 |
---|---|---|
committer | Jesse McConnell <jmcconnell@apache.org> | 2007-04-12 22:00:28 +0000 |
commit | e970003cf5b624784bb2fbfebe259da3aa01574e (patch) | |
tree | faeea0fe2e7418440d32624c1cd923d11b322206 /archiva-cli | |
parent | 4a0241c5919acd3fb80076f42d6f77947bc2a5d5 (diff) | |
download | archiva-e970003cf5b624784bb2fbfebe259da3aa01574e.tar.gz archiva-e970003cf5b624784bb2fbfebe259da3aa01574e.zip |
working on getting the cli working again
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@528251 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-cli')
-rw-r--r-- | archiva-cli/pom.xml | 26 | ||||
-rw-r--r-- | archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java | 24 | ||||
-rw-r--r-- | archiva-cli/src/main/resources/META-INF/plexus/components.xml | 52 |
3 files changed, 99 insertions, 3 deletions
diff --git a/archiva-cli/pom.xml b/archiva-cli/pom.xml index 384126d96..ded6638b0 100644 --- a/archiva-cli/pom.xml +++ b/archiva-cli/pom.xml @@ -39,17 +39,14 @@ <dependency> <groupId>org.apache.maven.archiva</groupId> <artifactId>archiva-core-consumers</artifactId> - <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.maven.archiva</groupId> <artifactId>archiva-database-consumers</artifactId> - <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.maven.archiva</groupId> <artifactId>archiva-lucene-consumers</artifactId> - <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -74,6 +71,11 @@ <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> </dependency> + <dependency> + <groupId>org.codehaus.plexus.registry</groupId> + <artifactId>plexus-registry-commons</artifactId> + <version>1.0-alpha-2</version> + </dependency> </dependencies> <build> <plugins> @@ -88,6 +90,24 @@ </archive> </configuration> </plugin> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-maven-plugin</artifactId> + <executions> + <execution> + <id>merge</id> + <goals> + <goal>merge-descriptors</goal> + </goals> + <configuration> + <descriptors> + <descriptor>${basedir}/src/main/resources/META-INF/plexus/components.xml</descriptor> + <descriptor>${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </project> diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java index 903593443..ae4e87826 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java +++ b/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-cli/src/main/resources/META-INF/plexus/components.xml b/archiva-cli/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 000000000..6873d9f8f --- /dev/null +++ b/archiva-cli/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + ~ 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. + --> + +<components> + <component> + <role>org.codehaus.plexus.registry.Registry</role> + <implementation> + org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry + </implementation> + <role-hint>commons-configuration</role-hint> + <configuration> + <properties> + <system /> + <xml fileName="${user.home}/.m2/archiva.xml" + config-optional="true" + config-name="org.apache.maven.archiva.user" + config-at="org.apache.maven.archiva" /> + <xml fileName="${user.home}/.m2/shared.xml" + config-optional="true" + config-name="org.apache.maven.shared.app.user" + config-at="org.apache.maven.shared.app" + config-forceCreate="true" /> + <properties fileName="${user.home}/.m2/security.properties" + config-optional="true" + config-at="org.codehaus.plexus.security" /> + <properties fileName="${user.home}/.m2/archiva.properties" + config-optional="true" + config-at="org.codehaus.plexus.security" /> + <xml fileName="org/apache/maven/archiva/configuration/default-archiva.xml" + config-optional="true" + config-at="org.apache.maven.archiva"/> + </properties> + </configuration> + </component> +</components> |