Author: alien11689
Date: Fri Jan 13 14:27:54 2017
New Revision: 1778595

URL: http://svn.apache.org/viewvc?rev=1778595&view=rev
Log:
[ARIES-1661] Generate cm-properties and inject it via annotations in BMP

Added:
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperties.java
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/config/ConfigPropertiesHandler.java
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfigurationProperties.java
      - copied, changed from r1776017, 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean6.java
Modified:
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/Config.java
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperty.java
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/DefaultProperty.java
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/packageinfo
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml
    
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/GeneratorTest.java
    
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfig.java

Modified: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/Config.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/Config.java?rev=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/Config.java
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/Config.java
 Fri Jan 13 14:27:54 2017
@@ -1,3 +1,21 @@
+/**
+ * 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.annotation.config;
 
 import java.lang.annotation.ElementType;
@@ -13,8 +31,12 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Config {
     String pid();
-    String updatePolicy() default "reload"; 
+
+    String updatePolicy() default "reload";
+
     String placeholderPrefix() default "${";
+
     String placeholderSuffix() default "}";
+
     DefaultProperty[] defaults() default {};
 }

Added: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperties.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperties.java?rev=1778595&view=auto
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperties.java
 (added)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperties.java
 Fri Jan 13 14:27:54 2017
@@ -0,0 +1,32 @@
+/**
+ * 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.annotation.config;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ConfigProperties {
+    String pid();
+
+    boolean update() default false;
+}

Modified: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperty.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperty.java?rev=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperty.java
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/ConfigProperty.java
 Fri Jan 13 14:27:54 2017
@@ -1,3 +1,21 @@
+/**
+ * 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.annotation.config;
 
 import java.lang.annotation.ElementType;

Modified: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/DefaultProperty.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/DefaultProperty.java?rev=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/DefaultProperty.java
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/DefaultProperty.java
 Fri Jan 13 14:27:54 2017
@@ -1,6 +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.annotation.config;
 
 public @interface DefaultProperty {
     String key();
+
     String value();
 }

Modified: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/packageinfo
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/packageinfo?rev=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/packageinfo
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/config/packageinfo
 Fri Jan 13 14:27:54 2017
@@ -16,4 +16,4 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-version 1.0.0
+version 1.1.0

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=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/pom.xml Fri Jan 13 
14:27:54 2017
@@ -162,7 +162,7 @@
         <dependency>
                <groupId>org.apache.aries.blueprint</groupId>
                <artifactId>blueprint-maven-plugin-annotation</artifactId>
-               <version>1.0.0</version>
+               <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>

Added: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/config/ConfigPropertiesHandler.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/config/ConfigPropertiesHandler.java?rev=1778595&view=auto
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/config/ConfigPropertiesHandler.java
 (added)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/config/ConfigPropertiesHandler.java
 Fri Jan 13 14:27:54 2017
@@ -0,0 +1,70 @@
+package org.apache.aries.blueprint.plugin.config;
+
+import org.apache.aries.blueprint.annotation.config.ConfigProperties;
+import org.apache.aries.blueprint.plugin.spi.ContextEnricher;
+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.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Properties;
+
+public class ConfigPropertiesHandler implements 
CustomDependencyAnnotationHandler<ConfigProperties> {
+    @Override
+    public String handleDependencyAnnotation(AnnotatedElement 
annotatedElement, String name, ContextEnricher contextEnricher) {
+        ConfigProperties configProperties = 
annotatedElement.getAnnotation(ConfigProperties.class);
+        final String pid = configProperties.pid();
+        final boolean update = configProperties.update();
+        final String id = getId(name, pid, update);
+        enrichContext(contextEnricher, pid, update, id);
+        return id;
+    }
+
+    private void enrichContext(ContextEnricher contextEnricher, final String 
pid, final boolean update, final String id) {
+        contextEnricher.addBean(id, Properties.class);
+        contextEnricher.addBlueprintContentWriter("properties/" + id, new 
XmlWriter() {
+            @Override
+            public void write(XMLStreamWriter writer) throws 
XMLStreamException {
+                writer.writeEmptyElement("cm-properties");
+                
writer.writeDefaultNamespace("http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0";);
+                writer.writeAttribute("id", id);
+                writer.writeAttribute("persistent-id", pid);
+                writer.writeAttribute("update", String.valueOf(update));
+            }
+        });
+    }
+
+    @Override
+    public String handleDependencyAnnotation(Class<?> aClass, ConfigProperties 
configProperties, String name, ContextEnricher contextEnricher) {
+        final String pid = configProperties.pid();
+        final boolean update = configProperties.update();
+        final String id = getId(name, pid, update);
+        enrichContext(contextEnricher, pid, update, id);
+        return id;
+    }
+
+    private String getId(String name, String pid, boolean update) {
+        return name != null ? name : "properties-" + pid.replace('.', '-') + 
"-" + update;
+    }
+
+    @Override
+    public Class<ConfigProperties> getAnnotation() {
+        return ConfigProperties.class;
+    }
+
+    private Class<?> getClass(AnnotatedElement annotatedElement) {
+        if (annotatedElement instanceof Class<?>) {
+            return (Class<?>) annotatedElement;
+        }
+        if (annotatedElement instanceof Method) {
+            return ((Method) annotatedElement).getParameterTypes()[0];
+        }
+        if (annotatedElement instanceof Field) {
+            return ((Field) annotatedElement).getType();
+        }
+        throw new RuntimeException("Unknown annotated element");
+    }
+}

Modified: 
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.CustomDependencyAnnotationHandler?rev=1778595&r1=1778594&r2=1778595&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.CustomDependencyAnnotationHandler
 Fri Jan 13 14:27:54 2017
@@ -15,4 +15,5 @@
 # limitations under the License.
 #
 
-org.apache.aries.blueprint.plugin.pax.OsgiServiceHandler
\ No newline at end of file
+org.apache.aries.blueprint.plugin.pax.OsgiServiceHandler
+org.apache.aries.blueprint.plugin.config.ConfigPropertiesHandler
\ No newline at end of file

Modified: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java?rev=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java
 Fri Jan 13 14:27:54 2017
@@ -420,6 +420,79 @@ public class GeneratorTest {
         assertXpathEquals(example2, "@value", "v2");
     }
 
+    @Test
+    public void testProducesWithConfigProperty() throws Exception {
+        Node bean = getBeanById("producedWithConfigProperty");
+        assertXpathEquals(bean, "@class", 
"org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
+        assertXpathEquals(bean, "@factory-ref", "beanWithConfig");
+        assertXpathEquals(bean, "@factory-method", "createBean");
+        assertXpathEquals(bean, "@scope", "prototype");
+        assertXpathEquals(bean, "argument/@value", "1000");
+    }
+
+    @Test
+    public void testConfigPropertiesInjection() throws Exception {
+        Node bean = getBeanById("beanWithConfigurationProperties");
+        assertXpathEquals(bean, "@class", 
"org.apache.aries.blueprint.plugin.test.BeanWithConfigurationProperties");
+        assertXpathEquals(bean, "argument[1]/@ref", "testProps5");
+        assertXpathEquals(bean, "argument[2]/@ref", 
"properties-aries-test6-false");
+        assertXpathEquals(bean, "property[@name='prop1']/@ref", 
"properties-aries-test1-true");
+        assertXpathEquals(bean, "property[@name='prop2']/@ref", "testProps2");
+        assertXpathEquals(bean, "property[@name='prop3']/@ref", 
"properties-aries-test3-true");
+        assertXpathEquals(bean, "property[@name='prop4']/@ref", "testProps4");
+        assertXpathEquals(bean, "property[@name='prop7']/@ref", 
"properties-aries-test7-false");
+    }
+
+    @Test
+    public void testGenerateCmConfigProperties() throws Exception {
+        Node testProps5 = getCmPropertiesById("testProps5");
+        assertXpathEquals(testProps5, "@persistent-id", "aries.test5");
+        assertXpathEquals(testProps5, "@update", "true");
+
+        Node testProps6 = getCmPropertiesById("properties-aries-test6-false");
+        assertXpathEquals(testProps6, "@persistent-id", "aries.test6");
+        assertXpathEquals(testProps6, "@update", "false");
+
+        Node testProps1 = getCmPropertiesById("properties-aries-test1-true");
+        assertXpathEquals(testProps1, "@persistent-id", "aries.test1");
+        assertXpathEquals(testProps1, "@update", "true");
+
+        Node testProps2 = getCmPropertiesById("testProps2");
+        assertXpathEquals(testProps2, "@persistent-id", "aries.test2");
+        assertXpathEquals(testProps2, "@update", "false");
+
+        Node testProps3 = getCmPropertiesById("properties-aries-test3-true");
+        assertXpathEquals(testProps3, "@persistent-id", "aries.test3");
+        assertXpathEquals(testProps3, "@update", "true");
+
+        Node testProps4 = getCmPropertiesById("testProps4");
+        assertXpathEquals(testProps4, "@persistent-id", "aries.test4");
+        assertXpathEquals(testProps4, "@update", "false");
+
+        Node testProps7 = getCmPropertiesById("properties-aries-test7-false");
+        assertXpathEquals(testProps7, "@persistent-id", "aries.test7");
+        assertXpathEquals(testProps7, "@update", "false");
+    }
+
+    @Test
+    public void testProducesWithConfigProperties() throws Exception {
+        Node withProperties8 = getBeanById("withProperties8");
+        assertXpathEquals(withProperties8, "@class", 
"org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
+        assertXpathEquals(withProperties8, "argument/@ref", 
"properties-aries-test8-false");
+
+        Node testProps8 = getCmPropertiesById("properties-aries-test8-false");
+        assertXpathEquals(testProps8, "@persistent-id", "aries.test8");
+        assertXpathEquals(testProps8, "@update", "false");
+
+        Node withProperties9 = getBeanById("withProperties9");
+        assertXpathEquals(withProperties9, "@class", 
"org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
+        assertXpathEquals(withProperties9, "argument/@ref", "testProps9");
+
+        Node testProps9 = getCmPropertiesById("testProps9");
+        assertXpathEquals(testProps9, "@persistent-id", "aries.test9");
+        assertXpathEquals(testProps9, "@update", "true");
+    }
+
     private void assertXpathDoesNotExist(Node node, String xpathExpression) 
throws XPathExpressionException {
         assertXpathEquals(node, "count(" + xpathExpression + ")", "0");
     }
@@ -440,6 +513,10 @@ public class GeneratorTest {
         return (Node) xpath.evaluate("/blueprint/bean[@id='" + id + "']", 
document, XPathConstants.NODE);
     }
 
+    private static Node getCmPropertiesById(String id) throws 
XPathExpressionException {
+        return (Node) xpath.evaluate("/blueprint/cm-properties[@id='" + id + 
"']", document, XPathConstants.NODE);
+    }
+
     private static Node getServiceByRef(String id) throws 
XPathExpressionException {
         return (Node) xpath.evaluate("/blueprint/service[@ref='" + id + "']", 
document, XPathConstants.NODE);
     }

Modified: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfig.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfig.java?rev=1778595&r1=1778594&r2=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfig.java
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfig.java
 Fri Jan 13 14:27:54 2017
@@ -1,11 +1,16 @@
 package org.apache.aries.blueprint.plugin.test;
 
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
 import javax.inject.Singleton;
 
 import org.apache.aries.blueprint.annotation.config.Config;
+import org.apache.aries.blueprint.annotation.config.ConfigProperties;
 import org.apache.aries.blueprint.annotation.config.ConfigProperty;
 import org.apache.aries.blueprint.annotation.config.DefaultProperty;
 
+import java.util.Properties;
+
 @Config//
 ( //
     pid = "org.apache.aries.my", //
@@ -19,4 +24,10 @@ import org.apache.aries.blueprint.annota
 public class BeanWithConfig {
     @ConfigProperty("$[title]")
     String title;
+
+    @Produces
+    @Named("producedWithConfigProperty")
+    public MyProducedWithConstructor createBean(@ConfigProperty("1000") long 
test) {
+        return null;
+    }
 }

Copied: 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfigurationProperties.java
 (from r1776017, 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean6.java)
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfigurationProperties.java?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfigurationProperties.java&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean6.java&r1=1776017&r2=1778595&rev=1778595&view=diff
==============================================================================
--- 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean6.java
 (original)
+++ 
aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithConfigurationProperties.java
 Fri Jan 13 14:27:54 2017
@@ -18,19 +18,56 @@
  */
 package org.apache.aries.blueprint.plugin.test;
 
-import org.springframework.context.annotation.DependsOn;
+import org.apache.aries.blueprint.annotation.config.ConfigProperties;
+import org.ops4j.pax.cdi.api.OsgiService;
 
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
+import java.util.Properties;
 
 @Singleton
-@DependsOn
-public class MyBean6 {
+public class BeanWithConfigurationProperties {
 
-    @SuppressWarnings("unused")
-    private final ServiceA serviceA1;
+    @Inject
+    @ConfigProperties(pid = "aries.test1", update = true)
+    private Properties prop1;
 
-    public MyBean6(@Named("my2") ServiceA serviceA1) {
-        this.serviceA1 = serviceA1;
+    @Inject
+    @ConfigProperties(pid = "aries.test2")
+    @Named("testProps2")
+    private Properties prop2;
+
+    public BeanWithConfigurationProperties(
+            @ConfigProperties(pid = "aries.test5", update = true) 
@Named("testProps5") Properties prop5,
+            @ConfigProperties(pid = "aries.test6") Properties prop6) {
+    }
+
+    @ConfigProperties(pid = "aries.test3", update = true)
+    @Inject
+    public void setProp3(Properties prop3) {
+    }
+
+    @ConfigProperties(pid = "aries.test4")
+    @Named("testProps4")
+    @Inject
+    public void setProp4(Properties prop4) {
+    }
+
+    @Inject
+    public void setProp7(@ConfigProperties(pid = "aries.test7", update = 
false) Properties prop7) {
+    }
+
+    @Produces
+    @Named("withProperties8")
+    public MyProducedWithConstructor 
createBeanWithProperties8(@ConfigProperties(pid = "aries.test8") Properties 
prop8) {
+        return null;
+    }
+
+    @Produces
+    @Named("withProperties9")
+    public MyProducedWithConstructor 
createBeanWithProperties9(@ConfigProperties(pid = "aries.test9", update = true) 
@Named("testProps9") Properties prop9) {
+        return null;
     }
 }


Reply via email to