Fix issue Felix-866
The 'interface attribute of the 'provides' element becomes 'specifications' The semantic doesn't change.

Fix issue Felix-867
The ServiceProperty annotation was able to target Method. However this is not possible. Service properties can only be attached to fields.

Fix issue Felix-868
The Component annontation did'nt support the factory methods. So, the 'factory_method' attribute was added to support the configuration of factory methods.



git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@729971 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml b/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml
index aed8968..c8b0a64 100644
--- a/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml
+++ b/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml
@@ -62,17 +62,17 @@
 		classname="org.apache.felix.ipojo.test.composite.component.FooBarProviderType1"

 		name="COMPO-FooBarProviderType-2" architecture="true">

 		<provides

-			interface="{org.apache.felix.ipojo.test.composite.service.FooService, org.apache.felix.ipojo.test.composite.service.BarService }" />

+			specifications="{org.apache.felix.ipojo.test.composite.service.FooService, org.apache.felix.ipojo.test.composite.service.BarService }" />

 	</component>

 	<component

 		classname="org.apache.felix.ipojo.test.composite.component.FooBarProviderType1"

 		name="COMPO-FooBarProviderType-3" architecture="true">

 		<provides

-			interface="{org.apache.felix.ipojo.test.composite.service.FooService}">

+			specifications="{org.apache.felix.ipojo.test.composite.service.FooService}">

 			<property name="baz" type="java.lang.String" value="foo" />

 		</provides>

 		<provides

-			interface="{org.apache.felix.ipojo.test.composite.service.BarService}">

+			specifications="{org.apache.felix.ipojo.test.composite.service.BarService}">

 			<property name="baz" type="java.lang.String" value="bar" />

 		</provides>

 	</component>

diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
index d0d44a0..22bca51 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
@@ -32,6 +32,13 @@
         assertEquals("Name value", "nofactory", name);

     }

     

+    public void testFactoryMethod() {

+        Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.FactoryMethod");

+        String method = meta.getAttribute("factory-method");

+        assertNotNull("Method exists ", method);

+        assertEquals("Method value", "create", method);

+    }

+    

     

 

 }

diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
index 2b14b69..2702235 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
@@ -34,7 +34,7 @@
         Element[] provs = meta.getElements("provides");

         assertNotNull("Provides exists ", provs);

         Element prov = provs[0];

-        String itfs = prov.getAttribute("interface");

+        String itfs = prov.getAttribute("specifications");

         List list = ParseUtils.parseArraysAsList(itfs);

         assertTrue("Provides CS ", list.contains(CheckService.class.getName()));

     }

@@ -44,7 +44,7 @@
         Element[] provs = meta.getElements("provides");

         assertNotNull("Provides exists ", provs);

         Element prov = provs[0];

-        String itfs = prov.getAttribute("interface");

+        String itfs = prov.getAttribute("specifications");

         List list = ParseUtils.parseArraysAsList(itfs);

         assertTrue("Provides CS ", list.contains(CheckService.class.getName()));

         assertTrue("Provides Foo ", list.contains(FooService.class.getName()));

@@ -69,19 +69,15 @@
         //Boo

         Element boo = getPropertyByName(props, "boo");

         assertEquals("Check boo field", "boo", boo.getAttribute("field"));

-        assertEquals("Check boo method", "setboo", boo.getAttribute("method"));

         //Baa

         Element baa = getPropertyByName(props, "baa");

         assertEquals("Check baa field", "m_baa", baa.getAttribute("field"));

         assertEquals("Check baa name", "baa", baa.getAttribute("name"));

-        assertEquals("Check baa method", "setbaa", baa.getAttribute("method"));

         

         //Bar

         Element baz = getPropertyByName(props, "baz");

         assertEquals("Check baz field", "m_baz", baz.getAttribute("field"));

-        assertEquals("Check baz method", "setBaz", baz.getAttribute("method"));

-        assertEquals("Check baz name", "baz", baz.getAttribute("name"));

-        

+        assertEquals("Check baz name", "baz", baz.getAttribute("name"));        

         

         

     }

diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
new file mode 100644
index 0000000..30c47c4
--- /dev/null
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.test.scenarios.component;

+

+import org.apache.felix.ipojo.annotations.Component;

+

+@Component(factory_method="create")

+public class FactoryMethod {

+    

+    public static FactoryMethod create() {

+        return new FactoryMethod();

+    }

+}

diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
index 3f77af2..a1de405 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
@@ -18,29 +18,14 @@
     @ServiceProperty(value = "4", mandatory=true)

     public int bar;

     

-    @ServiceProperty

-    public void setboo(int boo) {

-        

-    }

-    

-    @ServiceProperty(name="baz")

-    public void setBaz(int baz) {

-        

-    }

-    

     @ServiceProperty(name="baz")

     int m_baz;

     

     @ServiceProperty

     public int boo;

     

-    @ServiceProperty(name="baa")

+    @ServiceProperty(name="baa", value="5")

     public int m_baa;

-    

-    @ServiceProperty(value="5")

-    public void setbaa(int baa) {

-        

-    }

 

     public boolean foo() {

         return false;

diff --git a/ipojo/tests/core/service-providing/src/main/resources/metadata.xml b/ipojo/tests/core/service-providing/src/main/resources/metadata.xml
index 3c50333..8be6b53 100644
--- a/ipojo/tests/core/service-providing/src/main/resources/metadata.xml
+++ b/ipojo/tests/core/service-providing/src/main/resources/metadata.xml
@@ -14,7 +14,7 @@
 		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

 		name="PS-FooProviderType-itf" architecture="true">

 		<provides

-			interface="org.apache.felix.ipojo.test.scenarios.ps.service.FooService" />

+			specifications="org.apache.felix.ipojo.test.scenarios.ps.service.FooService" />

 	</component>

 	

 	<component

@@ -41,17 +41,17 @@
 		classname="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"

 		name="PS-FooBarProviderType-2" architecture="true">

 		<provides

-			interface="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService, org.apache.felix.ipojo.test.scenarios.ps.service.BarService }" />

+			specifications="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService, org.apache.felix.ipojo.test.scenarios.ps.service.BarService }" />

 	</component>

 	<component

 		classname="org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"

 		name="PS-FooBarProviderType-3" architecture="true">

 		<provides

-			interface="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService}">

+			specifications="{org.apache.felix.ipojo.test.scenarios.ps.service.FooService}">

 			<property name="baz" type="java.lang.String" value="foo" />

 		</provides>

 		<provides

-			interface="{org.apache.felix.ipojo.test.scenarios.ps.service.BarService}">

+			specifications="{org.apache.felix.ipojo.test.scenarios.ps.service.BarService}">

 			<property name="baz" type="java.lang.String" value="bar" />

 		</provides>

 	</component>

@@ -108,14 +108,14 @@
 		classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation1"

 		name="PS-PI1-1" architecture="true">

 		<provides

-			interface="org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface" />

+			specifications="org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface" />

 	</component>

 

 	<component

 		classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation1"

 		name="PS-PI1-2" architecture="true">

 		<provides

-			interface="{org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface, org.apache.felix.ipojo.test.scenarios.ps.service.ParentInterface2}" />

+			specifications="{org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface, org.apache.felix.ipojo.test.scenarios.ps.service.ParentInterface2}" />

 	</component>

 

 	<component

@@ -128,7 +128,7 @@
 		classname="org.apache.felix.ipojo.test.scenarios.component.inherited.ProcessImplementation2"

 		name="PS-PI2-1" architecture="true">

 		<provides

-			interface="org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface" />

+			specifications="org.apache.felix.ipojo.test.scenarios.ps.service.ParentParentInterface" />

 	</component>

 

 	<component

diff --git a/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml b/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml
index 5392092..b574eb7 100644
--- a/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml
+++ b/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml
@@ -9,7 +9,7 @@
 	<component classname="org.apache.felix.ipojo.test.donut.DonutProviderImpl"
 		name="donut-provider">
 		<!-- Expose the donut provider service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutProvider">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutProvider">
 			<property name="name" field="m_name" value="Unknown donut vendor"/>
 		</provides>
 		<!-- Donut publisher -->
@@ -21,7 +21,7 @@
 	<component classname="org.apache.felix.ipojo.test.donut.DonutProviderImpl"
 		name="synchronous-donut-provider">
 		<!-- Expose the donut provider service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutProvider">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutProvider">
 			<property name="name" field="m_name" value="Unknown donut vendor"/>
 		</provides>
 		<!-- Donut publisher -->
@@ -34,7 +34,7 @@
 		classname="org.apache.felix.ipojo.test.donut.DonutEventProviderImpl"
 		name="donut-event-provider">
 		<!-- Expose the donut provider service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutProvider">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutProvider">
 			<property name="name" field="m_name" value="Unknown donut vendor"/>
 		</provides>
 		<!-- Raw events publisher -->
@@ -47,7 +47,7 @@
 		classname="org.apache.felix.ipojo.test.donut.DonutEventProviderImpl"
 		name="synchronous-donut-event-provider">
 		<!-- Expose the donut provider service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutProvider">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutProvider">
 			<property name="name" field="m_name" value="Unknown donut vendor"/>
 		</provides>
 		<!-- Raw events publisher -->
@@ -60,7 +60,7 @@
 		classname="org.apache.felix.ipojo.test.donut.AsyncEventProviderImpl"
 		name="event-provider">
 		<!-- Expose the donut provider service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutProvider">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutProvider">
 			<property name="name" field="m_name" value="Unknown donut vendor"/>
 		</provides>
 		<!-- Direcly interacts with the Event Admin service -->
@@ -72,7 +72,7 @@
 		classname="org.apache.felix.ipojo.test.donut.SyncEventProviderImpl"
 		name="synchronous-event-provider">
 		<!-- Expose the donut provider service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutProvider">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutProvider">
 			<property name="name" field="m_name" value="Unknown donut vendor"/>
 		</provides>
 		<!-- Direcly interacts with the Event Admin service -->
@@ -83,7 +83,7 @@
 	<component classname="org.apache.felix.ipojo.test.donut.DonutConsumerImpl"
 		name="donut-consumer">
 		<!-- Expose the donut consumer service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutConsumer">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutConsumer">
 			<property name="name" field="m_name" value="Unknown donut consumer"/>
 			<property name="slow" field="m_isSlow" value="false"/>
 		</provides>
@@ -97,7 +97,7 @@
 	<component classname="org.apache.felix.ipojo.test.donut.DonutConsumerImpl"
 		name="donut-event-consumer">
 		<!-- Expose the donut consumer service -->
-		<provides interface="org.apache.felix.ipojo.test.donut.DonutConsumer">
+		<provides specifications="org.apache.felix.ipojo.test.donut.DonutConsumer">
 			<property name="name" field="m_name" value="Unknown donut consumer"/>
 			<property name="slow" field="m_isSlow" value="false"/>
 		</provides>
@@ -111,7 +111,7 @@
 		name="event-consumer">
 		<!-- Expose the donut consumer service -->
 		<provides
-			interface="{org.apache.felix.ipojo.test.donut.DonutConsumer,org.osgi.service.event.EventHandler}">
+			specifications="{org.apache.felix.ipojo.test.donut.DonutConsumer,org.osgi.service.event.EventHandler}">
 			<property name="name" field="m_name" value="Unknown event consumer"/>
 			<property name="slow" field="m_isSlow" value="false"/>
 			<property name="event.topics" type="String" value="food/donuts"/>
@@ -123,7 +123,7 @@
 		name="event-tracker">
 		<!-- Expose the donut consumer service -->
 		<provides
-			interface="{org.apache.felix.ipojo.test.donut.EventTracker,org.osgi.service.event.EventHandler}">
+			specifications="{org.apache.felix.ipojo.test.donut.EventTracker,org.osgi.service.event.EventHandler}">
 			<property name="name" field="m_name" value="Unknown event tracker"/>
 			<property name="event.topics" type="String" value="food/donuts"/>
 		</provides>