diff options
author | Olivier Lamy <olamy@apache.org> | 2011-06-11 21:31:07 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-06-11 21:31:07 +0000 |
commit | 27b5c1a52b04a14aa6433c7964a2146538fe060f (patch) | |
tree | e3e8b39f97dd51abbefe18fc56a3378d93f378ad /archiva-cli/src/main/java/org | |
parent | 0ad81d8bc63ccc141787df32875afeb241092650 (diff) | |
download | archiva-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/src/main/java/org')
-rw-r--r-- | archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java | 17 | ||||
-rw-r--r-- | archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java | 25 |
2 files changed, 29 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; |