Author: fmeschbe
Date: Fri Sep 21 16:10:44 2007
New Revision: 578316

URL: http://svn.apache.org/viewvc?rev=578316&view=rev
Log:
FELIX-378 servicefactory attribute of @scr.service tag not handled correctly

Modified:
    
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
    
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java
    
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Service.java

Modified: 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java?rev=578316&r1=578315&r2=578316&view=diff
==============================================================================
--- 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
 (original)
+++ 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
 Fri Sep 21 16:10:44 2007
@@ -233,8 +233,7 @@
         final OCD ocd = this.doComponent(componentTag, component, metaData);
 
         boolean inherited = this.getBoolean(componentTag, 
Constants.COMPONENT_INHERIT, false);
-        boolean serviceFactory = 
this.doServices(description.getTagsByName(Constants.SERVICE, inherited), 
component, description);
-        component.setServiceFactory(serviceFactory);
+        this.doServices(description.getTagsByName(Constants.SERVICE, 
inherited), component, description);
 
         // properties
         final JavaTag[] properties = 
description.getTagsByName(Constants.PROPERTY, inherited);
@@ -372,11 +371,11 @@
      * @return
      * @throws MojoExecutionException
      */
-    protected boolean doServices(JavaTag[] services, Component component, 
JavaClassDescription description)
+    protected void doServices(JavaTag[] services, Component component, 
JavaClassDescription description)
     throws MojoExecutionException {
         // no services, hence certainly no service factory
         if (services == null || services.length == 0) {
-            return false;
+            return;
         }
 
         final Service service = new Service();
@@ -406,7 +405,7 @@
             serviceFactory |= this.getBoolean(services[i], 
Constants.SERVICE_FACTORY, false);
         }
 
-        return serviceFactory;
+        service.setServicefactory(serviceFactory);
     }
 
     /**

Modified: 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java?rev=578316&r1=578315&r2=578316&view=diff
==============================================================================
--- 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java
 (original)
+++ 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java
 Fri Sep 21 16:10:44 2007
@@ -62,8 +62,6 @@
     /** Is this an abstract description? */
     protected boolean isAbstract;
 
-    protected boolean serviceFactory;
-
     /**
      * Default constructor.
      */
@@ -171,14 +169,6 @@
         this.isAbstract = isAbstract;
     }
 
-    public boolean isServiceFactory() {
-        return this.serviceFactory;
-    }
-
-    public void setServiceFactory(boolean serviceFactory) {
-        this.serviceFactory = serviceFactory;
-    }
-
     /**
      * Validate the component description.
      * If errors occur a message is added to the issues list,
@@ -234,12 +224,14 @@
                     }
 
                     // verify service
+                    boolean isServiceFactory = false;
                     if (this.getService() != null) {
                         this.getService().validate(issues, warnings);
+                        isServiceFactory = 
Boolean.valueOf(this.getService().getServicefactory()).booleanValue();
                     }
 
                     // serviceFactory must not be true for immediate of 
component factory
-                    if (this.isServiceFactory() && this.isImmediate() != null 
&& this.isImmediate().booleanValue() && this.getFactory() != null) {
+                    if (isServiceFactory && this.isImmediate() != null && 
this.isImmediate().booleanValue() && this.getFactory() != null) {
                         issues.add(this.getMessage("Component must not be a 
ServiceFactory, if immediate and/or component factory: " + 
javaClass.getName()));
                     }
 

Modified: 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Service.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Service.java?rev=578316&r1=578315&r2=578316&view=diff
==============================================================================
--- 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Service.java 
(original)
+++ 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Service.java 
Fri Sep 21 16:10:44 2007
@@ -48,6 +48,10 @@
     public void setServicefactory(String servicefactory) {
         this.servicefactory = servicefactory;
     }
+    
+    public void setServicefactory(boolean servicefactory) {
+        this.servicefactory = String.valueOf(servicefactory);
+    }
 
     public List getInterfaces() {
         return this.interfaces;


Reply via email to