felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r729971 - in /felix/trunk/ipojo: annotations/src/main/java/org/apache/felix/ipojo/annotations/ core/src/main/java/org/apache/felix/ipojo/architecture/ core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ core/src/main/resourc...
Date Mon, 29 Dec 2008 18:59:41 GMT
Author: clement
Date: Mon Dec 29 10:59:40 2008
New Revision: 729971

URL: http://svn.apache.org/viewvc?rev=729971&view=rev
Log:
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.


Added:
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
  (with props)
Modified:
    felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
    felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
    felix/trunk/ipojo/core/src/main/resources/core.xsd
    felix/trunk/ipojo/core/src/main/resources/metadata.xml
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
    felix/trunk/ipojo/manipulator/src/main/resources/core.xsd
    felix/trunk/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
    felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml
    felix/trunk/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml

Modified: felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
(original)
+++ felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
Mon Dec 29 10:59:40 2008
@@ -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 "";
 }

Modified: felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
(original)
+++ felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
Mon Dec 29 10:59:40 2008
@@ -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 {
     
     /**

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
Mon Dec 29 10:59:40 2008
@@ -60,7 +60,7 @@
     private ComponentTypeDescription m_type;
 
     /**
-     * COntained instance list.
+     * Contained instance list.
      */
     private InstanceDescription[] m_containedInstances = new InstanceDescription[0];
 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
Mon Dec 29 10:59:40 2008
@@ -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;
     }
 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
Mon Dec 29 10:59:40 2008
@@ -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++) {

Modified: felix/trunk/ipojo/core/src/main/resources/core.xsd
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/resources/core.xsd?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/resources/core.xsd (original)
+++ felix/trunk/ipojo/core/src/main/resources/core.xsd Mon Dec 29 10:59:40 2008
@@ -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>

Modified: felix/trunk/ipojo/core/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/resources/metadata.xml?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/core/src/main/resources/metadata.xml Mon Dec 29 10:59:40 2008
@@ -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>

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
(original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
Mon Dec 29 10:59:40 2008
@@ -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", "");

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
(original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
Mon Dec 29 10:59:40 2008
@@ -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.
      */

Modified: felix/trunk/ipojo/manipulator/src/main/resources/core.xsd
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/resources/core.xsd?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/resources/core.xsd (original)
+++ felix/trunk/ipojo/manipulator/src/main/resources/core.xsd Mon Dec 29 10:59:40 2008
@@ -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>

Modified: felix/trunk/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/composite/composite-runtime/src/main/resources/metadata.xml Mon
Dec 29 10:59:40 2008
@@ -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>

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
Mon Dec 29 10:59:40 2008
@@ -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);
+    }
+    
     
 
 }

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
Mon Dec 29 10:59:40 2008
@@ -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"));        
         
         
     }

Added: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java?rev=729971&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
(added)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
Mon Dec 29 10:59:40 2008
@@ -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();
+    }
+}

Propchange: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ProvidesProperties.java
Mon Dec 29 10:59:40 2008
@@ -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;

Modified: felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/core/service-providing/src/main/resources/metadata.xml Mon Dec
29 10:59:40 2008
@@ -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

Modified: felix/trunk/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml?rev=729971&r1=729970&r2=729971&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/handler/eventadmin/src/main/resources/metadata.xml Mon Dec 29
10:59:40 2008
@@ -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>



Mime
View raw message