FELIX-2300 : SCR Plugin should be able to produce a metatype property for service.ranking. Apply patch from Justin Edelson

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@937258 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
index 9eb2eec..69b42cc 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java
@@ -114,15 +114,7 @@
 
         // property is private if explicitly marked or a well known
         // service property such as service.pid
-        final boolean isPrivate = 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_RANKING)
-            || name.equals(org.osgi.framework.Constants.SERVICE_VENDOR)
-            || name.equals(ConfigurationAdmin.SERVICE_BUNDLELOCATION)
-            || name.equals(ConfigurationAdmin.SERVICE_FACTORYPID);
+        final boolean isPrivate = isPrivate(name, tag);
 
         // if this is an abstract component we store the extra info in the property
         if ( component.isAbstract() ) {
@@ -190,6 +182,22 @@
 
         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 the name of the property.