aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-cli
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-11 21:31:07 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-11 21:31:07 +0000
commit27b5c1a52b04a14aa6433c7964a2146538fe060f (patch)
treee3e8b39f97dd51abbefe18fc56a3378d93f378ad /archiva-cli
parent0ad81d8bc63ccc141787df32875afeb241092650 (diff)
downloadarchiva-27b5c1a52b04a14aa6433c7964a2146538fe060f.tar.gz
archiva-27b5c1a52b04a14aa6433c7964a2146538fe060f.zip
fix cli module
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134775 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-cli')
-rw-r--r--archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java17
-rw-r--r--archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java25
-rw-r--r--archiva-cli/src/main/resources/META-INF/spring-context.xml33
3 files changed, 62 insertions, 13 deletions
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 52ed03113..a5e5adc06 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
@@ -47,6 +47,7 @@ import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -242,8 +243,20 @@ public class ArchivaCli
private Map<String, KnownRepositoryContentConsumer> getConsumers()
throws PlexusSisuBridgeException
{
- PlexusSisuBridge plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class );
- return plexusSisuBridge.lookupMap( KnownRepositoryContentConsumer.class );
+ Map<String, KnownRepositoryContentConsumer> beans =
+ applicationContext.getBeansOfType( KnownRepositoryContentConsumer.class );
+ // we use a naming conventions knownRepositoryContentConsumer#hint
+ // with plexus we used only hint so remove before#
+
+ Map<String, KnownRepositoryContentConsumer> smallNames =
+ new HashMap<String, KnownRepositoryContentConsumer>( beans.size() );
+
+ for ( Map.Entry<String, KnownRepositoryContentConsumer> entry : beans.entrySet() )
+ {
+ smallNames.put( StringUtils.substringAfterLast( entry.getKey(), "#" ), entry.getValue() );
+ }
+
+ return smallNames;
}
private void doConversion( String properties )
diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
index bfc5f6ebc..dc4ef7814 100644
--- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
+++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
@@ -19,33 +19,36 @@ package org.apache.maven.archiva.cli;
* under the License.
*/
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
import java.util.ArrayList;
import java.util.List;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-
/**
- * ArtifactCountConsumer
+ * ArtifactCountConsumer
*
* @version $Id$
- *
- * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- * role-hint="count-artifacts"
- * instantiation-strategy="per-lookup"
+ * plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
+ * role-hint="count-artifacts"
+ * instantiation-strategy="per-lookup"
*/
+@Service("knownRepositoryContentConsumer#count-artifacts")
+@Scope("prototype")
public class ArtifactCountConsumer
extends AbstractProgressConsumer
implements KnownRepositoryContentConsumer
{
/**
- * @plexus.configuration default-value="count-artifacts"
+ * plexus.configuration default-value="count-artifacts"
*/
- private String id;
+ private String id = "count-artifacts";
/**
- * @plexus.configuration default-value="Count Artifacts"
+ * plexus.configuration default-value="Count Artifacts"
*/
- private String description;
+ private String description = "Count Artifacts";
private List<String> includes;
diff --git a/archiva-cli/src/main/resources/META-INF/spring-context.xml b/archiva-cli/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 000000000..11fa0dda2
--- /dev/null
+++ b/archiva-cli/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.maven.archiva.cli"/>
+
+</beans> \ No newline at end of file