git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134775 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M1
@@ -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 ) |
@@ -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; | |||
@@ -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> |