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/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java b/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
index d6bc8ee..5c4210f 100644
--- a/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
+++ b/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
@@ -64,4 +64,12 @@
      * default no PID (i.e. the managed service will not be exposed).

      */

     String managedservice() default "";

+    

+    /**

+     * Set the factory-method, if the pojo has to be created

+     * from a static method. The specified method must be a static

+     * method and return a pojo object.

+     * By default, iPOJO uses the 'regular' constructor. 

+     */

+    String factory_method() default "";

 }

diff --git a/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java b/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
index ec17333..ceba75f 100644
--- a/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
+++ b/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
@@ -26,7 +26,7 @@
  * It can target both fields and methods.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-@Target({ ElementType.FIELD, ElementType.METHOD })

+@Target(ElementType.FIELD)

 public @interface ServiceProperty {

     

     /**

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
index 02df5e0..e7b0c59 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
@@ -60,7 +60,7 @@
     private ComponentTypeDescription m_type;
 
     /**
-     * COntained instance list.
+     * Contained instance list.
      */
     private InstanceDescription[] m_containedInstances = new InstanceDescription[0];
 
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
index 92d80d0..58f8091 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
@@ -62,23 +62,23 @@
     /**
      * Factory Policy : SINGLETON_FACTORY.
      */
-    public static final int SINGLETON_FACTORY = 0;
+    public static final int SINGLETON_STRATEGY = 0;
 
     /**
      * Factory policy : SERVICE_FACTORY.
      */
-    public static final int SERVICE_FACTORY = 1;
+    public static final int SERVICE_STRATEGY = 1;
     
     /**
      * Factory policy : STATIC_FACTORY.
      */
-    public static final int STATIC_FACTORY = 2;
+    public static final int STATIC_STRATEGY = 2;
     
     /**
      * Factory policy : INSTANCE.
      * Creates one service object per instance consuming the service.
      */
-    public static final int INSTANCE = 3;
+    public static final int INSTANCE_STRATEGY = 3;
 
     /**
      * At this time, it is only the java interface full name.
@@ -86,11 +86,6 @@
     private String[] m_serviceSpecification = new String[0];
 
     /**
-     * Factory policy.
-     */
-    private int m_factoryPolicy = SINGLETON_FACTORY;
-
-    /**
      * The service registration. is null when the service is not registered.
      * m_serviceRegistration : ServiceRegistration
      */
@@ -123,7 +118,6 @@
         m_handler = handler;
 
         m_serviceSpecification = specification;
-        m_factoryPolicy = factoryPolicy;
         
         // Add instance name & factory name
         try {
@@ -153,17 +147,17 @@
                 return;
             }
         } else {
-            switch (m_factoryPolicy) {
-                case SINGLETON_FACTORY:
+            switch (factoryPolicy) {
+                case SINGLETON_STRATEGY:
                     m_strategy = new SingletonStrategy();
                     break;
-                case SERVICE_FACTORY:
-                case STATIC_FACTORY:
+                case SERVICE_STRATEGY:
+                case STATIC_STRATEGY:
                     // In this case, we need to try to create a new pojo object,
                     // the factory method will handle the creation.
                     m_strategy = new FactoryStrategy();
                     break;
-                case INSTANCE:
+                case INSTANCE_STRATEGY:
                     m_strategy = new PerInstanceStrategy();
                     break;
                 // Other policies:
@@ -174,7 +168,7 @@
                     m_handler.error("["
                             + m_handler.getInstanceManager().getInstanceName()
                             + "] Unknown creation policy for " + specs + " : "
-                            + m_factoryPolicy);
+                            + factoryPolicy);
                     getInstanceManager().stop();
                     break;
             }
@@ -394,7 +388,7 @@
      * @return the list of provided service specifications (i.e. java
      * interface).
      */
-    public String[] getServiceSpecification() {
+    public String[] getServiceSpecifications() {
         return m_serviceSpecification;
     }
 
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
index 93d19bd..587701d 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
@@ -82,7 +82,7 @@
      * Get the array of provided service.
      * @return the list of the provided service.
      */
-    public ProvidedService[] getProvidedService() {
+    public ProvidedService[] getProvidedServices() {
         return m_providedServices;
     }
 
@@ -98,22 +98,24 @@
         // Create the dependency according to the component metadata
         Element[] providedServices = componentMetadata.getElements("Provides");
         for (int i = 0; i < providedServices.length; i++) {
-            String[] serviceSpecifications = ParseUtils.parseArrays(providedServices[i].getAttribute("interface")); // Set by the initialize component factory.
-            
+            String[] serviceSpecifications = ParseUtils.parseArrays(providedServices[i].getAttribute("specifications")); // Set by the initialize component factory.
+
             // Get the factory policy
-            int factory = ProvidedService.SINGLETON_FACTORY;
+            int factory = ProvidedService.SINGLETON_STRATEGY;
             Class custom = null;
             String strategy = providedServices[i].getAttribute("strategy");
             if (strategy == null) {
                 strategy = providedServices[i].getAttribute("factory");
             }
             if (strategy != null) {
-                if ("service".equalsIgnoreCase(strategy)) {
-                    factory = ProvidedService.SERVICE_FACTORY;
+                if ("singleton".equalsIgnoreCase(strategy)) {
+                    factory = ProvidedService.SINGLETON_STRATEGY;
+                } else if ("service".equalsIgnoreCase(strategy)) {
+                    factory = ProvidedService.SERVICE_STRATEGY;
                 } else if ("method".equalsIgnoreCase(strategy)) {
-                    factory = ProvidedService.STATIC_FACTORY;
+                    factory = ProvidedService.STATIC_STRATEGY;
                 } else if ("instance".equalsIgnoreCase(strategy)) {
-                    factory = ProvidedService.INSTANCE;
+                    factory = ProvidedService.INSTANCE_STRATEGY;
                 } else {
                     // Customized policy
                     try {
@@ -245,8 +247,8 @@
      * @throws ConfigurationException : the checked provided service is not correct.
      */
     private boolean checkProvidedService(ProvidedService svc) throws ConfigurationException {        
-        for (int i = 0; i < svc.getServiceSpecification().length; i++) {
-            String specName = svc.getServiceSpecification()[i];
+        for (int i = 0; i < svc.getServiceSpecifications().length; i++) {
+            String specName = svc.getServiceSpecifications()[i];
             
             // Check service level dependencies
             try {
@@ -265,18 +267,18 @@
                         isDependencyCorrect(dep, deps[j]);
                     }
                 } else {
-                    throw new ConfigurationException("Service Providing: The specification field of the service specification " + svc.getServiceSpecification()[i] + " needs to be a String");
+                    throw new ConfigurationException("Service Providing: The specification field of the service specification " + svc.getServiceSpecifications()[i] + " needs to be a String");
                 }
             } catch (NoSuchFieldException e) {
                 return true; // No specification field
             } catch (ClassNotFoundException e) {
-                throw new ConfigurationException("Service Providing: The service specification " + svc.getServiceSpecification()[i] + " cannot be load");
+                throw new ConfigurationException("Service Providing: The service specification " + svc.getServiceSpecifications()[i] + " cannot be load");
             } catch (IllegalArgumentException e) {
-                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " is not accessible : " + e.getMessage());
+                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecifications()[i] + " is not accessible : " + e.getMessage());
             } catch (IllegalAccessException e) {
-                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " is not accessible : " + e.getMessage());
+                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecifications()[i] + " is not accessible : " + e.getMessage());
             } catch (ParseException e) {
-                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " does not contain a valid String : " + e.getMessage());
+                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecifications()[i] + " does not contain a valid String : " + e.getMessage());
             }
         }
 
@@ -466,9 +468,9 @@
     public HandlerDescription getDescription() {
         ProvidedServiceHandlerDescription pshd = new ProvidedServiceHandlerDescription(this);
 
-        for (int j = 0; j < getProvidedService().length; j++) {
-            ProvidedService svc = getProvidedService()[j];
-            ProvidedServiceDescription psd = new ProvidedServiceDescription(svc.getServiceSpecification(), svc.getState(), svc.getServiceReference());
+        for (int j = 0; j < getProvidedServices().length; j++) {
+            ProvidedService svc = getProvidedServices()[j];
+            ProvidedServiceDescription psd = new ProvidedServiceDescription(svc.getServiceSpecifications(), svc.getState(), svc.getServiceReference());
 
             Properties props = new Properties();
             for (int k = 0; k < svc.getProperties().length; k++) {
@@ -489,8 +491,8 @@
      * @see org.apache.felix.ipojo.Handler#reconfigure(java.util.Dictionary)
      */
     public void reconfigure(Dictionary dict) {
-        for (int j = 0; j < getProvidedService().length; j++) {
-            ProvidedService svc = getProvidedService()[j];
+        for (int j = 0; j < getProvidedServices().length; j++) {
+            ProvidedService svc = getProvidedServices()[j];
             Property[] props = svc.getProperties();
             boolean update = false;
             for (int k = 0; k < props.length; k++) {
@@ -528,7 +530,14 @@
                 throw new ConfigurationException("An interface cannot be loaded : " + e.getMessage());
             }
             
-            String serviceSpecificationStr = provides[i].getAttribute("interface");
+            String serviceSpecificationStr = provides[i].getAttribute("specifications");
+            if (serviceSpecificationStr == null) {
+                serviceSpecificationStr = provides[i].getAttribute("interface");
+                if (serviceSpecificationStr != null) {
+                    warn("The 'interface' attribute is deprecated, use the 'specifications' attribute instead of 'interface'");
+                }
+            }
+
             if (serviceSpecificationStr != null) {
                 List itfs = ParseUtils.parseArraysAsList(serviceSpecificationStr);
                 for (int j = 0; j < itfs.size(); j++) {
@@ -559,7 +568,7 @@
             }
             
             specs.append('}');
-            provides[i].addAttribute(new Attribute("interface", specs.toString())); // Add interface attribute to avoid checking in the configure method
+            provides[i].addAttribute(new Attribute("specifications", specs.toString())); // Add interface attribute to avoid checking in the configure method
 
             Element[] props = provides[i].getElements("property");
             for (int j = 0; props != null && j < props.length; j++) {
diff --git a/ipojo/core/src/main/resources/core.xsd b/ipojo/core/src/main/resources/core.xsd
index 9bb7014..3099b8e 100644
--- a/ipojo/core/src/main/resources/core.xsd
+++ b/ipojo/core/src/main/resources/core.xsd
@@ -319,9 +319,13 @@
 					<xs:documentation>List of service specific properties.</xs:documentation>
 				</xs:annotation></xs:element>
 		</xs:sequence>
-		<xs:attribute name="interface" type="xs:string" use="optional">
+		<xs:attribute name="interface" type="xs:string" use="prohibited">
 			<xs:annotation>
-				<xs:documentation>The list of interfaces of the service to expose. By default, all interfaces implemented by the component implementation class are published.</xs:documentation>
+				<xs:documentation>Deprecated attribute, use 'specifications' instead of 'interface'</xs:documentation>
+			</xs:annotation></xs:attribute>
+		<xs:attribute name="specifications" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>The list of service specifications (i.e. interfaces) to expose. By default, all interfaces implemented by the component implementation class are published.</xs:documentation>
 			</xs:annotation></xs:attribute>
 		<xs:attribute name="factory" type="xs:string" use="prohibited">
 			<xs:annotation>
diff --git a/ipojo/core/src/main/resources/metadata.xml b/ipojo/core/src/main/resources/metadata.xml
index 6e49d69..2ba587c 100644
--- a/ipojo/core/src/main/resources/metadata.xml
+++ b/ipojo/core/src/main/resources/metadata.xml
@@ -40,7 +40,7 @@
 	<handler

 		classname="org.apache.felix.ipojo.handlers.architecture.ArchitectureHandler"

 		name="architecture" architecture="false">

-		<provides interface="org.apache.felix.ipojo.architecture.Architecture">

+		<provides specifications="org.apache.felix.ipojo.architecture.Architecture">

 			<property field="m_name" name="architecture.instance"/>

 		</provides>

 	</handler>

diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
index 49866d0..e28120e 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
@@ -264,7 +264,7 @@
              * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
              */
             public void visitEnd() {
-                m_prov.addAttribute(new Attribute("interface", m_itfs + "}"));
+                m_prov.addAttribute(new Attribute("specifications", m_itfs + "}"));
             }
             
         }
@@ -307,6 +307,11 @@
         private String m_managedservice;
         
         /**
+         * Factory-Method.
+         */
+        private String m_method;
+        
+        /**
          * Element properties.
          */
         private Element m_props;
@@ -342,6 +347,10 @@
                 m_managedservice = arg1.toString();
                 return;
             }
+            if (arg0.equals("factory_method")) {
+                m_method = arg1.toString();
+                return;
+            }
         }
 
         /**
@@ -365,6 +374,9 @@
             if (m_immediate != null) {
                 m_elem.addAttribute(new Attribute("immediate", m_immediate));
             }
+            if (m_method != null) {
+                m_elem.addAttribute(new Attribute("factory-method", m_method));
+            }
             if (m_propagation != null) {
                 if (m_props == null) {
                     m_props = new Element("properties", "");
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
index b139231..8bccc28 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
@@ -61,9 +61,6 @@
         if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Property;")) {
             return processProperty();
         }
-        if (arg0.equals("Lorg/apache/felix/ipojo/annotations/ServiceProperty;")) {
-            return processServiceProperty();
-        }
         if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Validate;")) {
             return processValidate();
         }
@@ -120,20 +117,6 @@
     }
 
     /**
-     * Process @serviceProperty annotation.
-     * @return the visitor parsing the visited annotation.
-     */
-    private AnnotationVisitor processServiceProperty() {
-        if (! m_collector.getIds().containsKey("provides")) {
-            System.err.println("The component does not provide services, skipping ServiceProperty for " + m_name);
-            return null;
-        } else {
-            Element provides = (Element) m_collector.getIds().get("provides");
-            return new PropertyAnnotationParser(provides, m_name);
-        }
-    }
-
-    /**
      * Process @property annotation.
      * @return the visitor parsing the visited annotation.
      */
diff --git a/ipojo/manipulator/src/main/resources/core.xsd b/ipojo/manipulator/src/main/resources/core.xsd
index d98fca3..4731b49 100644
--- a/ipojo/manipulator/src/main/resources/core.xsd
+++ b/ipojo/manipulator/src/main/resources/core.xsd
@@ -319,9 +319,13 @@
 					<xs:documentation>List of service specific properties.</xs:documentation>
 				</xs:annotation></xs:element>
 		</xs:sequence>
-		<xs:attribute name="interface" type="xs:string" use="optional">
+		<xs:attribute name="interface" type="xs:string" use="prohibited">
 			<xs:annotation>
-				<xs:documentation>The list of interfaces of the service to expose. By default, all interfaces implemented by the component implementation class are published.</xs:documentation>
+				<xs:documentation>Deprecated attribute, use 'specifications' instead of 'interface'</xs:documentation>
+			</xs:annotation></xs:attribute>
+		<xs:attribute name="specifications" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>The list of service specifications (i.e. interfaces) to expose. By default, all interfaces implemented by the component implementation class are published.</xs:documentation>
 			</xs:annotation></xs:attribute>
 		<xs:attribute name="factory" type="xs:string" use="prohibited">
 			<xs:annotation>
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>