You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by al...@apache.org on 2017/08/05 17:05:23 UTC

svn commit: r1804199 - in /aries/trunk/blueprint/plugin: blueprint-maven-plugin-annotation/ blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/ blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blue...

Author: alien11689
Date: Sat Aug  5 17:05:22 2017
New Revision: 1804199

URL: http://svn.apache.org/viewvc?rev=1804199&view=rev
Log:
[ARIES-1733] Inject array, set or list of beans by annotation

Added:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/CollectionInject.java
      - copied, changed from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/packageinfo
      - copied unchanged from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/packageinfo
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CollectionDependencyAnnotationHandler.java
      - copied, changed from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CustomDependencyAnnotationHandler.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/collection/
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/collection/CollectionInjectHandler.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/RefCollection.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler
      - copied, changed from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/BeanWithCollections.java
      - copied, changed from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/TestBean.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl1.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl2.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl3Annotated.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl4Annotated.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl1.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl2Annotated.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl3Annotated.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I3.java
Modified:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/Handlers.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Argument.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BlueprintRegistry.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml Sat Aug  5 17:05:22 2017
@@ -41,6 +41,7 @@
     <properties>
         <aries.osgi.export.pkg>
             org.apache.aries.blueprint.annotation.bean,
+            org.apache.aries.blueprint.annotation.collection,
             org.apache.aries.blueprint.annotation.config,
             org.apache.aries.blueprint.annotation.referencelistener
         </aries.osgi.export.pkg>

Copied: aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/CollectionInject.java (from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/CollectionInject.java?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/CollectionInject.java&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java&r1=1804042&r2=1804199&rev=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/collection/CollectionInject.java Sat Aug  5 17:05:22 2017
@@ -16,8 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.blueprint.annotation.bean;
-
+package org.apache.aries.blueprint.annotation.collection;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -25,41 +24,14 @@ import java.lang.annotation.RetentionPol
 import java.lang.annotation.Target;
 
 /**
- * Annotating any class or method will create a bean.
+ * Annotating any field, setter or constructor parameter inject collection of beans.
  */
-@Target({ElementType.TYPE, ElementType.METHOD})
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface Bean {
-
-    /**
-     * @return id or auto generated name from class name when id is empty
-     */
-    String id() default "";
-
-    /**
-     * @return activation of bean: eager, lazy or defaut for whole blueprint file
-     */
-    Activation activation() default Activation.DEFAULT;
-
-    /**
-     * @return array of bean ids on which this bean depends
-     */
-    String[] dependsOn() default {};
-
-    /**
-     * @return bean scope
-     */
-    Scope scope() default Scope.SINGLETON;
-
-    /**
-     * @return init method name, if empty then bean has no init method.
-     * Warning: if bean has another annotation which selects another init-method then cannot determine which method will be selected.
-     */
-    String initMethod() default "";
+public @interface CollectionInject {
 
     /**
-     * @return destroy method name, if empty then bean has no destroy method
-     * * Warning: if bean has another annotation which selects another destroy-method then cannot determine which method will be selected.
+     * @return class of beans to inject
      */
-    String destroyMethod() default "";
+    Class<?> value();
 }

Copied: aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CollectionDependencyAnnotationHandler.java (from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CustomDependencyAnnotationHandler.java)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CollectionDependencyAnnotationHandler.java?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CollectionDependencyAnnotationHandler.java&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CustomDependencyAnnotationHandler.java&r1=1804042&r2=1804199&rev=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CustomDependencyAnnotationHandler.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-spi/src/main/java/org/apache/aries/blueprint/plugin/spi/CollectionDependencyAnnotationHandler.java Sat Aug  5 17:05:22 2017
@@ -22,23 +22,13 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 
 /**
- * Annotation A allows for enriching blueprint XML or add new bean to context when injecting bean, e. g. for generating in bean which could be injected
+ * Annotation A on constructor, setter or field adds inject collection (array, list, set) of beans into annotated element.
  */
-public interface CustomDependencyAnnotationHandler<A extends Annotation> extends AnnotationHandler<A> {
-    /**
-     * @param annotatedElement field or setter method
-     * @param name name of bean to inject (null if bean name is not provided)
-     * @param contextEnricher context enricher
-     * @return name of generated bean which should be injected or null
-     */
-    String handleDependencyAnnotation(AnnotatedElement annotatedElement, String name, ContextEnricher contextEnricher);
+public interface CollectionDependencyAnnotationHandler<A extends Annotation> extends AnnotationHandler<A> {
 
     /**
-     * @param clazz class of constructor parameter or setter parameter
      * @param annotation instance of annotation A
-     * @param name name of bean to inject (null if bean name is not provided)
-     * @param contextEnricher context enricher
-     * @return name of generated bean which should be injected or null
+     * @return class of beans to inject
      */
-    String handleDependencyAnnotation(Class<?> clazz, A annotation, String name, ContextEnricher contextEnricher);
+    Class<?> getBeanClass(Annotation annotation);
 }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml Sat Aug  5 17:05:22 2017
@@ -143,12 +143,12 @@
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>blueprint-maven-plugin-spi</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>blueprint-maven-plugin-spring-handlers</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.0</version>
         </dependency>
 
         <dependency>
@@ -190,7 +190,7 @@
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>blueprint-maven-plugin-annotation</artifactId>
-            <version>1.1.0</version>
+            <version>1.1.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/Handlers.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/Handlers.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/Handlers.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/Handlers.java Sat Aug  5 17:05:22 2017
@@ -20,6 +20,7 @@ package org.apache.aries.blueprint.plugi
 
 import org.apache.aries.blueprint.plugin.spi.BeanAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.BeanFinder;
+import org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.ContextInitializationHandler;
 import org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.FactoryMethodFinder;
@@ -48,6 +49,7 @@ public class Handlers {
     public static final List<Class<? extends Annotation>> FACTORY_METHOD_ANNOTATION_CLASSES = new ArrayList<>();
     public static final List<Class<? extends Annotation>> QUALIFING_ANNOTATION_CLASSES = new ArrayList<>();
     public static final List<ContextInitializationHandler> CONTEXT_INITIALIZATION_HANDLERS = new ArrayList<>();
+    public static final List<CollectionDependencyAnnotationHandler<? extends Annotation>> COLLECTION_DEPENDENCY_ANNOTATION_HANDLERS = new ArrayList<>();
 
     static {
         for (BeanFinder beanFinder : ServiceLoader.load(BeanFinder.class)) {
@@ -93,6 +95,10 @@ public class Handlers {
             QUALIFING_ANNOTATION_CLASSES.add((Class<? extends Annotation>) qualifingAnnotationFinder.getAnnotation());
         }
 
+        for (CollectionDependencyAnnotationHandler<? extends Annotation> collectionDependencyAnnotationHandler : ServiceLoader.load(CollectionDependencyAnnotationHandler.class)) {
+            COLLECTION_DEPENDENCY_ANNOTATION_HANDLERS.add(collectionDependencyAnnotationHandler);
+        }
+
         for (ContextInitializationHandler contextInitializationHandler : ServiceLoader.load(ContextInitializationHandler.class)) {
             CONTEXT_INITIALIZATION_HANDLERS.add(contextInitializationHandler);
         }

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/collection/CollectionInjectHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/collection/CollectionInjectHandler.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/collection/CollectionInjectHandler.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/handlers/collection/CollectionInjectHandler.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,36 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.handlers.collection;
+
+import org.apache.aries.blueprint.annotation.collection.CollectionInject;
+import org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler;
+
+import java.lang.annotation.Annotation;
+
+public class CollectionInjectHandler implements CollectionDependencyAnnotationHandler<CollectionInject> {
+    @Override
+    public Class<CollectionInject> getAnnotation() {
+        return CollectionInject.class;
+    }
+
+    @Override
+    public Class<?> getBeanClass(Annotation annotation) {
+        return ((CollectionInject) annotation).value();
+    }
+}

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java Sat Aug  5 17:05:22 2017
@@ -19,6 +19,8 @@
 package org.apache.aries.blueprint.plugin.model;
 
 import org.apache.aries.blueprint.plugin.handlers.Handlers;
+import org.apache.aries.blueprint.plugin.handlers.collection.CollectionInjectHandler;
+import org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
 import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
 import org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler;
@@ -38,6 +40,9 @@ class AnnotationHelper {
         for (ValueInjectionHandler<? extends Annotation> valueInjectionHandler : Handlers.VALUE_INJECTION_HANDLERS) {
             classes.add(valueInjectionHandler.getAnnotation());
         }
+        for (CollectionDependencyAnnotationHandler<? extends Annotation> collectionDependencyAnnotationHandler : Handlers.COLLECTION_DEPENDENCY_ANNOTATION_HANDLERS) {
+            classes.add(collectionDependencyAnnotationHandler.getAnnotation());
+        }
         return classes.toArray(new Class[classes.size()]);
     }
 

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Argument.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Argument.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Argument.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Argument.java Sat Aug  5 17:05:22 2017
@@ -19,12 +19,16 @@
 package org.apache.aries.blueprint.plugin.model;
 
 import org.apache.aries.blueprint.plugin.handlers.Handlers;
+import org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.XmlWriter;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 import static org.apache.aries.blueprint.plugin.model.AnnotationHelper.findName;
 import static org.apache.aries.blueprint.plugin.model.AnnotationHelper.findValue;
@@ -33,11 +37,18 @@ import static org.apache.aries.blueprint
 class Argument implements XmlWriter {
     private final String ref;
     private final String value;
+    private final RefCollection refCollection;
 
     Argument(BlueprintRegistry blueprintRegistry, Class<?> argumentClass, Annotation[] annotations) {
         this.value = findValue(annotations);
         if (value != null) {
             ref = null;
+            refCollection = null;
+            return;
+        }
+        this.refCollection = RefCollection.getRefCollection(blueprintRegistry, argumentClass, annotations);
+        if (refCollection != null) {
+            ref = null;
             return;
         }
         this.ref = findRef(blueprintRegistry, argumentClass, annotations);
@@ -79,11 +90,14 @@ class Argument implements XmlWriter {
 
     @Override
     public void write(XMLStreamWriter writer) throws XMLStreamException {
-        writer.writeEmptyElement("argument");
+        writer.writeStartElement("argument");
         if (ref != null) {
             writer.writeAttribute("ref", ref);
         } else if (value != null) {
             writer.writeAttribute("value", value);
+        }else if (refCollection != null) {
+            refCollection.write(writer);
         }
+        writer.writeEndElement();
     }
 }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java Sat Aug  5 17:05:22 2017
@@ -18,7 +18,9 @@
  */
 package org.apache.aries.blueprint.plugin.model;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -41,4 +43,14 @@ class BeanRefStore {
         }
         return null;
     }
+
+    List<BeanRef> getAllMatching(BeanTemplate template) {
+        List<BeanRef> refs = new ArrayList<>();
+        for (BeanRef bean : reg) {
+            if (bean.matches(template)) {
+                refs.add(bean);
+            }
+        }
+        return refs;
+    }
 }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java Sat Aug  5 17:05:22 2017
@@ -110,6 +110,10 @@ public class Blueprint implements Bluepr
         return beanRefStore.getMatching(template);
     }
 
+    public List<BeanRef> getAllMatching(BeanTemplate template) {
+        return beanRefStore.getAllMatching(template);
+    }
+
     Collection<Bean> getBeans() {
         return generatedBeans;
     }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BlueprintRegistry.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BlueprintRegistry.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BlueprintRegistry.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BlueprintRegistry.java Sat Aug  5 17:05:22 2017
@@ -20,6 +20,11 @@ package org.apache.aries.blueprint.plugi
 
 import org.apache.aries.blueprint.plugin.spi.ContextEnricher;
 
+import java.util.List;
+
 interface BlueprintRegistry extends ContextEnricher {
     BeanRef getMatching(BeanTemplate template);
+
+    List<BeanRef> getAllMatching(BeanTemplate template);
+
 }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java Sat Aug  5 17:05:22 2017
@@ -19,6 +19,7 @@
 package org.apache.aries.blueprint.plugin.model;
 
 import org.apache.aries.blueprint.plugin.handlers.Handlers;
+import org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
 import org.apache.aries.blueprint.plugin.spi.XmlWriter;
@@ -29,6 +30,9 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 import static org.apache.aries.blueprint.plugin.model.AnnotationHelper.findName;
 import static org.apache.aries.blueprint.plugin.model.NamingHelper.getBeanName;
@@ -38,31 +42,39 @@ class Property implements Comparable<Pro
     public final String ref;
     public final String value;
     final boolean isField;
+    private final RefCollection refCollection;
 
-    private Property(String name, String ref, String value, boolean isField) {
+    private Property(String name, String ref, String value, boolean isField, RefCollection refCollection) {
         this.name = name;
         this.ref = ref;
         this.value = value;
         this.isField = isField;
+        this.refCollection = refCollection;
     }
 
     static Property create(BlueprintRegistry blueprintRegistry, Field field) {
         if (needsInject(field)) {
             String value = AnnotationHelper.findValue(field.getAnnotations());
             if (value != null) {
-                return new Property(field.getName(), null, value, true);
+                return new Property(field.getName(), null, value, true, null);
             }
+
+            RefCollection refCollection = RefCollection.getRefCollection(blueprintRegistry, field);
+            if (refCollection != null) {
+                return new Property(field.getName(), null, null, true, refCollection);
+            }
+
             String ref = getForcedRefName(field);
             String refFromCustomeDependencyHandler = getRefFromCustomDependencyHandlers(blueprintRegistry, field, ref);
             if (refFromCustomeDependencyHandler != null) {
                 ref = refFromCustomeDependencyHandler;
             }
             if (ref != null) {
-                return new Property(field.getName(), ref, null, true);
+                return new Property(field.getName(), ref, null, true, null);
             }
             BeanRef matching = blueprintRegistry.getMatching(new BeanTemplate(field));
             ref = (matching == null) ? getDefaultRefName(field) : matching.id;
-            return new Property(field.getName(), ref, null, true);
+            return new Property(field.getName(), ref, null, true, null);
         } else {
             // Field is not a property
             return null;
@@ -90,10 +102,15 @@ class Property implements Comparable<Pro
 
         String value = AnnotationHelper.findValue(method.getAnnotations());
         if (value != null) {
-            return new Property(propertyName, null, value, false);
+            return new Property(propertyName, null, value, false, null);
         }
 
         if (needsInject(method)) {
+            RefCollection refCollection = RefCollection.getRefCollection(blueprintRegistry, method);
+            if (refCollection != null) {
+                return new Property(propertyName, null, null, true, refCollection);
+            }
+
             String ref = getForcedRefName(method);
             if (ref == null) {
                 ref = findName(method.getParameterAnnotations()[0]);
@@ -104,7 +121,7 @@ class Property implements Comparable<Pro
             }
 
             if (ref != null) {
-                return new Property(propertyName, ref, null, false);
+                return new Property(propertyName, ref, null, false, null);
             }
 
             for (CustomDependencyAnnotationHandler customDependencyAnnotationHandler : Handlers.CUSTOM_DEPENDENCY_ANNOTATION_HANDLERS) {
@@ -118,13 +135,13 @@ class Property implements Comparable<Pro
                 }
             }
             if (ref != null) {
-                return new Property(propertyName, ref, null, false);
+                return new Property(propertyName, ref, null, false, null);
             }
 
             BeanTemplate template = new BeanTemplate(method);
             BeanRef matching = blueprintRegistry.getMatching(template);
             ref = (matching == null) ? getBeanName(method.getParameterTypes()[0]) : matching.id;
-            return new Property(propertyName, ref, null, false);
+            return new Property(propertyName, ref, null, false, null);
         }
 
         return null;
@@ -188,12 +205,15 @@ class Property implements Comparable<Pro
 
     @Override
     public void write(XMLStreamWriter writer) throws XMLStreamException {
-        writer.writeEmptyElement("property");
+        writer.writeStartElement("property");
         writer.writeAttribute("name", name);
         if (ref != null) {
             writer.writeAttribute("ref", ref);
         } else if (value != null) {
             writer.writeAttribute("value", value);
+        } else if (refCollection != null) {
+            refCollection.write(writer);
         }
+        writer.writeEndElement();
     }
 }

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/RefCollection.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/RefCollection.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/RefCollection.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/RefCollection.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,80 @@
+package org.apache.aries.blueprint.plugin.model;
+
+import org.apache.aries.blueprint.plugin.handlers.Handlers;
+import org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler;
+import org.apache.aries.blueprint.plugin.spi.XmlWriter;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+class RefCollection implements XmlWriter {
+    private final String type;
+    private final List<String> refs;
+
+    private RefCollection(String type, List<String> refs) {
+        this.type = type;
+        this.refs = refs;
+    }
+
+    static RefCollection getRefCollection(BlueprintRegistry blueprintRegistry, Class<?> injectedType, Annotation[] annotations) {
+        List<String> refCollection = getMatchingRefs(blueprintRegistry, annotations);
+        if (refCollection == null) {
+            return null;
+        }
+        String collectionType = recognizeCollectionType(injectedType);
+        return new RefCollection(collectionType, refCollection);
+    }
+
+    static RefCollection getRefCollection(BlueprintRegistry blueprintRegistry, Field field) {
+        return getRefCollection(blueprintRegistry, field.getType(), field.getAnnotations());
+    }
+
+    static RefCollection getRefCollection(BlueprintRegistry blueprintRegistry, Method method) {
+        return getRefCollection(blueprintRegistry, method.getParameterTypes()[0], method.getAnnotations());
+    }
+
+    private static String recognizeCollectionType(Class<?> type) {
+        if (type.isAssignableFrom(List.class)) {
+            return "list";
+        }
+        if (type.isAssignableFrom(Set.class)) {
+            return "set";
+        }
+        if (type.isArray()) {
+            return "array";
+        }
+        throw new IllegalStateException("Expecting that class " + type.getName() + " will be Set, List or Array");
+    }
+
+    private static List<String> getMatchingRefs(BlueprintRegistry blueprintRegistry, Annotation[] annotations) {
+        for (CollectionDependencyAnnotationHandler<? extends Annotation> collectionDependencyAnnotationHandler : Handlers.COLLECTION_DEPENDENCY_ANNOTATION_HANDLERS) {
+            Annotation annotation = (Annotation) AnnotationHelper.findAnnotation(annotations, collectionDependencyAnnotationHandler.getAnnotation());
+            if (annotation != null) {
+                Class<?> classCollection = collectionDependencyAnnotationHandler.getBeanClass(annotation);
+                List<BeanRef> refs = blueprintRegistry.getAllMatching(new BeanTemplate(classCollection, annotations));
+                List<String> refList = new ArrayList<>();
+                for (BeanRef ref : refs) {
+                    refList.add(ref.id);
+                }
+                return refList;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void write(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeStartElement(type);
+        for (String componentId : refs) {
+            writer.writeEmptyElement("ref");
+            writer.writeAttribute("component-id", componentId);
+        }
+        writer.writeEndElement();
+    }
+}

Copied: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler (from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler&r1=1804042&r2=1804199&rev=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CustomDependencyAnnotationHandler (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.CollectionDependencyAnnotationHandler Sat Aug  5 17:05:22 2017
@@ -15,5 +15,5 @@
 # limitations under the License.
 #
 
-org.apache.aries.blueprint.plugin.handlers.pax.OsgiServiceHandler
-org.apache.aries.blueprint.plugin.handlers.config.ConfigPropertiesHandler
\ No newline at end of file
+org.apache.aries.blueprint.plugin.handlers.collection.CollectionInjectHandler
+

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java?rev=1804199&r1=1804198&r2=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java Sat Aug  5 17:05:22 2017
@@ -780,6 +780,138 @@ public class BlueprintFileWriterTest {
         assertXpathEquals(propertyPlaceholder, "default-properties/property[@name='test2']/@value", "v2");
     }
 
+    @Test
+    public void shouldInjectListViaField() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='listFieldInject']/list/ref)", "4");
+        assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[1]/@component-id", "i1Impl1");
+        assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[2]/@component-id", "i1Impl2");
+        assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[3]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[4]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectSetViaField() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='setFieldInject']/set/ref)", "4");
+        assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[1]/@component-id", "i1Impl1");
+        assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[2]/@component-id", "i1Impl2");
+        assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[3]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[4]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectArrayViaField() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='arrayFieldInject']/array/ref)", "3");
+        assertXpathEquals(bean, "property[@name='arrayFieldInject']/array/ref[1]/@component-id", "i2Impl1");
+        assertXpathEquals(bean, "property[@name='arrayFieldInject']/array/ref[2]/@component-id", "i2Impl2Annotated");
+        assertXpathEquals(bean, "property[@name='arrayFieldInject']/array/ref[3]/@component-id", "i2Impl3Annotated");
+    }
+
+    @Test
+    public void shouldInjectAnnotatedSetViaField() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='annotatedSetFieldInject']/set/ref)", "2");
+        assertXpathEquals(bean, "property[@name='annotatedSetFieldInject']/set/ref[1]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "property[@name='annotatedSetFieldInject']/set/ref[2]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectListViaSetter() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='listSetterInject']/list/ref)", "4");
+        assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[1]/@component-id", "i1Impl1");
+        assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[2]/@component-id", "i1Impl2");
+        assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[3]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[4]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectSetViaSetter() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='setSetterInject']/set/ref)", "3");
+        assertXpathEquals(bean, "property[@name='setSetterInject']/set/ref[1]/@component-id", "i2Impl1");
+        assertXpathEquals(bean, "property[@name='setSetterInject']/set/ref[2]/@component-id", "i2Impl2Annotated");
+        assertXpathEquals(bean, "property[@name='setSetterInject']/set/ref[3]/@component-id", "i2Impl3Annotated");
+    }
+
+    @Test
+    public void shouldInjectArrayViaSetter() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='arraySetterInject']/array/ref)", "4");
+        assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[1]/@component-id", "i1Impl1");
+        assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[2]/@component-id", "i1Impl2");
+        assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[3]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[4]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectAnnotatedArrayViaSetter() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(property[@name='annotatedArraySetterInject']/array/ref)", "2");
+        assertXpathEquals(bean, "property[@name='annotatedArraySetterInject']/array/ref[1]/@component-id", "i2Impl2Annotated");
+        assertXpathEquals(bean, "property[@name='annotatedArraySetterInject']/array/ref[2]/@component-id", "i2Impl3Annotated");
+    }
+
+    @Test
+    public void shouldInjectListViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[1]/list/ref)", "4");
+        assertXpathEquals(bean, "argument[1]/list/ref[1]/@component-id", "i1Impl1");
+        assertXpathEquals(bean, "argument[1]/list/ref[2]/@component-id", "i1Impl2");
+        assertXpathEquals(bean, "argument[1]/list/ref[3]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "argument[1]/list/ref[4]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectSetViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[2]/set/ref)", "4");
+        assertXpathEquals(bean, "argument[2]/set/ref[1]/@component-id", "i1Impl1");
+        assertXpathEquals(bean, "argument[2]/set/ref[2]/@component-id", "i1Impl2");
+        assertXpathEquals(bean, "argument[2]/set/ref[3]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "argument[2]/set/ref[4]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectArrayViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[3]/array/ref)", "3");
+        assertXpathEquals(bean, "argument[3]/array/ref[1]/@component-id", "i2Impl1");
+        assertXpathEquals(bean, "argument[3]/array/ref[2]/@component-id", "i2Impl2Annotated");
+        assertXpathEquals(bean, "argument[3]/array/ref[3]/@component-id", "i2Impl3Annotated");
+    }
+
+    @Test
+    public void shouldInjectAnnotatedListViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[4]/list/ref)", "2");
+        assertXpathEquals(bean, "argument[4]/list/ref[1]/@component-id", "i1Impl3Annotated");
+        assertXpathEquals(bean, "argument[4]/list/ref[2]/@component-id", "i1Impl4Annotated");
+    }
+
+    @Test
+    public void shouldInjectEmptyListViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[5]/list)", "1");
+        assertXpathEquals(bean, "count(argument[5]/list/ref)", "0");
+    }
+
+    @Test
+    public void shouldInjectEmptySetViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[6]/set)", "1");
+        assertXpathEquals(bean, "count(argument[6]/set/ref)", "0");
+    }
+
+    @Test
+    public void shouldInjectEmptyArrayViaConstructor() throws Exception {
+        Node bean = getBeanById("beanWithCollections");
+        assertXpathEquals(bean, "count(argument[7]/array)", "1");
+        assertXpathEquals(bean, "count(argument[7]/array/ref)", "0");
+    }
+
     private void assertXpathDoesNotExist(Node node, String xpathExpression) throws XPathExpressionException {
         assertXpathEquals(node, "count(" + xpathExpression + ")", "0");
     }

Copied: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/BeanWithCollections.java (from r1804042, aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/TestBean.java)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/BeanWithCollections.java?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/BeanWithCollections.java&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/TestBean.java&r1=1804042&r2=1804199&rev=1804199&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/TestBean.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/BeanWithCollections.java Sat Aug  5 17:05:22 2017
@@ -16,7 +16,56 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.blueprint.plugin.test.qualifiers;
+package org.apache.aries.blueprint.plugin.test.collection;
 
-public class TestBean {
+import org.apache.aries.blueprint.annotation.bean.Bean;
+import org.apache.aries.blueprint.annotation.collection.CollectionInject;
+import org.apache.aries.blueprint.plugin.AnnotatedService;
+
+import java.util.List;
+import java.util.Set;
+
+@Bean
+public class BeanWithCollections {
+
+    @CollectionInject(I1.class)
+    List<I1> listFieldInject;
+
+    @CollectionInject(I1.class)
+    Set<I1> setFieldInject;
+
+    @CollectionInject(I2.class)
+    I2[] arrayFieldInject;
+
+    @AnnotatedService
+    @CollectionInject(I1.class)
+    Set<I1> annotatedSetFieldInject;
+
+    @CollectionInject(I1.class)
+    public void setListSetterInject(List<I1> l) {
+    }
+
+    @CollectionInject(I2.class)
+    public void setSetSetterInject(Set<I1> l) {
+    }
+
+    @CollectionInject(I1.class)
+    public void setArraySetterInject(I1[] l) {
+    }
+
+    @AnnotatedService
+    @CollectionInject(I2.class)
+    public void setAnnotatedArraySetterInject(I2[] l) {
+    }
+
+    public BeanWithCollections(
+            @CollectionInject(I1.class) List<I1> listOfI1,
+            @CollectionInject(I1.class) Set<I1> setOfI1,
+            @CollectionInject(I2.class) I2[] arrayOfI2,
+            @CollectionInject(I1.class) @AnnotatedService List<I1> listOfAnnotatedI1,
+            @CollectionInject(I3.class) List<I3> listOfNotExistingI3,
+            @CollectionInject(I3.class) Set<I3> setOfNotExistingI3,
+            @CollectionInject(I3.class) I3[] arrayOfNotExistingI3
+    ) {
+    }
 }

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+public interface I1 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl1.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl1.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl1.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl1.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import javax.inject.Singleton;
+
+@Singleton
+public class I1Impl1 implements I1 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl2.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl2.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl2.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl2.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import javax.inject.Singleton;
+
+@Singleton
+public class I1Impl2 implements I1 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl3Annotated.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl3Annotated.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl3Annotated.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl3Annotated.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,28 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import org.apache.aries.blueprint.plugin.AnnotatedService;
+
+import javax.inject.Singleton;
+
+@Singleton
+@AnnotatedService
+public class I1Impl3Annotated implements I1 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl4Annotated.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl4Annotated.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl4Annotated.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl4Annotated.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,28 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import org.apache.aries.blueprint.plugin.AnnotatedService;
+
+import javax.inject.Singleton;
+
+@Singleton
+@AnnotatedService
+public class I1Impl4Annotated implements I1 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+public interface I2 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl1.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl1.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl1.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl1.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import javax.inject.Singleton;
+
+@Singleton
+public class I2Impl1 implements I2 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl2Annotated.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl2Annotated.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl2Annotated.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl2Annotated.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,28 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import org.apache.aries.blueprint.plugin.AnnotatedService;
+
+import javax.inject.Singleton;
+
+@Singleton
+@AnnotatedService
+public class I2Impl2Annotated implements I2 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl3Annotated.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl3Annotated.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl3Annotated.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl3Annotated.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,28 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+import org.apache.aries.blueprint.plugin.AnnotatedService;
+
+import javax.inject.Singleton;
+
+@Singleton
+@AnnotatedService
+public class I2Impl3Annotated implements I2 {
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I3.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I3.java?rev=1804199&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I3.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I3.java Sat Aug  5 17:05:22 2017
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+package org.apache.aries.blueprint.plugin.test.collection;
+
+public interface I3 {
+}