]> source.dussan.org Git - archiva.git/commitdiff
working on getting the cli working again
authorJesse McConnell <jmcconnell@apache.org>
Thu, 12 Apr 2007 22:00:28 +0000 (22:00 +0000)
committerJesse McConnell <jmcconnell@apache.org>
Thu, 12 Apr 2007 22:00:28 +0000 (22:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@528251 13f79535-47bb-0310-9956-ffa450edef68

archiva-jpox-database-refactor/archiva-cli/pom.xml
archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
archiva-jpox-database-refactor/archiva-cli/src/main/resources/META-INF/plexus/components.xml [new file with mode: 0644]

index 384126d9620cc17adfc6f666e64f9e6311fd8a99..ded6638b05e6febfd820f8499ebbbaa867ee5418 100644 (file)
     <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>
       <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>
           </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>
index 903593443f425aebb554c4b64d03b655cabc07ba..ae4e878269cb86af570bdaa5d00a464fd680002f 100644 (file)
@@ -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 (file)
index 0000000..6873d9f
--- /dev/null
@@ -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>