Author: fmeschbe
Date: Tue Jun  3 01:23:26 2008
New Revision: 662692

URL: http://svn.apache.org/viewvc?rev=662692&view=rev
Log:
FELIX-593 Only set immediate attribute if explicitly declared (to not implement
complicated default value evaluation which is done anyways in the Declarative
Services implementation) and check that immediate is not true if the factory
attribute is set.

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

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=662692&r1=662691&r2=662692&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
 Tue Jun  3 01:23:26 2008
@@ -345,7 +345,13 @@
 
         component.setEnabled(Boolean.valueOf(getBoolean(tag, 
Constants.COMPONENT_ENABLED, true)));
         
component.setFactory(tag.getNamedParameter(Constants.COMPONENT_FACTORY));
-        component.setImmediate(Boolean.valueOf(getBoolean(tag, 
Constants.COMPONENT_IMMEDIATE, true)));
+        
+        // FELIX-593: immediate attribute does not default to true all the
+        // times hence we only set it if declared in the tag
+        if (tag.getNamedParameter(Constants.COMPONENT_IMMEDIATE) != null) {
+            component.setImmediate(Boolean.valueOf(getBoolean(tag,
+                Constants.COMPONENT_IMMEDIATE, true)));
+        }
 
         // whether metatype information is to generated for the component
         final String metaType = 
tag.getNamedParameter(Constants.COMPONENT_METATYPE);

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=662692&r1=662691&r2=662692&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
 Tue Jun  3 01:23:26 2008
@@ -249,6 +249,11 @@
                     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()));
                     }
+                    
+                    // immediate must not be true for component factory
+                    if (this.isImmediate() != null && 
this.isImmediate().booleanValue() && this.getFactory() != null) {
+                        issues.add(this.getMessage("Component must not be 
immediate if component factory: " + javaClass.getName()));
+                    }
 
                     // verify references
                     for (Iterator ri = this.getReferences().iterator(); 
ri.hasNext();) {


Reply via email to