felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r945597 - /felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
Date Tue, 18 May 2010 11:37:58 GMT
Author: cziegeler
Date: Tue May 18 11:37:57 2010
New Revision: 945597

URL: http://svn.apache.org/viewvc?rev=945597&view=rev
Log:
FELIX-2333 : service.ranking property type should be Integer by default

Modified:
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java?rev=945597&r1=945596&r2=945597&view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
Tue May 18 11:37:57 2010
@@ -18,15 +18,9 @@
  */
 package org.apache.felix.scrplugin.helper;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.felix.scrplugin.Constants;
-import org.apache.felix.scrplugin.SCRDescriptorException;
-import org.apache.felix.scrplugin.SCRDescriptorGenerator;
+import java.util.*;
+
+import org.apache.felix.scrplugin.*;
 import org.apache.felix.scrplugin.om.Component;
 import org.apache.felix.scrplugin.om.Property;
 import org.apache.felix.scrplugin.om.metatype.AttributeDefinition;
@@ -70,7 +64,13 @@ public class PropertyHandler {
     throws SCRDescriptorException {
         final Property prop = new Property(tag);
         prop.setName(name);
-        prop.setType(tag.getNamedParameter(Constants.PROPERTY_TYPE));
+        // special handling for service.ranking - FELIX-2333
+        if (name.equals(org.osgi.framework.Constants.SERVICE_RANKING)) {
+            prop.setType(Constants.PROPERTY_TYPE_INTEGER);
+        }
+        if ( tag.getNamedParameter(Constants.PROPERTY_TYPE) != null ) {
+            prop.setType(tag.getNamedParameter(Constants.PROPERTY_TYPE));
+        }
         // let's first check for a value attribute
         final String value = tag.getNamedParameter(Constants.PROPERTY_VALUE);
         if ( value != null ) {
@@ -182,21 +182,20 @@ public class PropertyHandler {
 
         component.addProperty(prop);
     }
-    
+
     private boolean isPrivate(String name, JavaTag tag) {
         if (name.equals(org.osgi.framework.Constants.SERVICE_RANKING)) {
             return SCRDescriptorGenerator.getBoolean(tag,
                 Constants.PROPERTY_PRIVATE, true);
-        } else {
-            return SCRDescriptorGenerator.getBoolean(tag,
-                Constants.PROPERTY_PRIVATE, false)
-                || name.equals(org.osgi.framework.Constants.SERVICE_PID)
-                || name.equals(org.osgi.framework.Constants.SERVICE_DESCRIPTION)
-                || name.equals(org.osgi.framework.Constants.SERVICE_ID)
-                || name.equals(org.osgi.framework.Constants.SERVICE_VENDOR)
-                || name.equals(ConfigurationAdmin.SERVICE_BUNDLELOCATION)
-                || name.equals(ConfigurationAdmin.SERVICE_FACTORYPID);
         }
+        return SCRDescriptorGenerator.getBoolean(tag,
+            Constants.PROPERTY_PRIVATE, false)
+            || name.equals(org.osgi.framework.Constants.SERVICE_PID)
+            || name.equals(org.osgi.framework.Constants.SERVICE_DESCRIPTION)
+            || name.equals(org.osgi.framework.Constants.SERVICE_ID)
+            || name.equals(org.osgi.framework.Constants.SERVICE_VENDOR)
+            || name.equals(ConfigurationAdmin.SERVICE_BUNDLELOCATION)
+            || name.equals(ConfigurationAdmin.SERVICE_FACTORYPID);
     }
 
     /**



Mime
View raw message