felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1689515 - in /felix/trunk/scr/src: main/java/org/apache/felix/scr/impl/config/ main/java/org/apache/felix/scr/impl/manager/ test/java/org/apache/felix/scr/integration/
Date Mon, 06 Jul 2015 22:26:19 GMT
Author: cziegeler
Date: Mon Jul  6 22:26:19 2015
New Revision: 1689515

URL: http://svn.apache.org/r1689515
Log:
FELIX-4951 : [DS][RFC-190] Correct pid handling - use scalar if single pid

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
    felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java?rev=1689515&r1=1689514&r2=1689515&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurableComponentHolder.java
Mon Jul  6 22:26:19 2015
@@ -469,7 +469,14 @@ public class ConfigurableComponentHolder
         }
         if (isDS13 && !pids.isEmpty())
         {
-            properties.put(Constants.SERVICE_PID, pids);
+        	if ( pids.size() == 1 )
+        	{
+        		properties.put(Constants.SERVICE_PID, pids.get(0));
+        	}
+        	else
+        	{
+        		properties.put(Constants.SERVICE_PID, pids);
+        	}
         }
         return properties;
     }

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java?rev=1689515&r1=1689514&r2=1689515&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java
Mon Jul  6 22:26:19 2015
@@ -443,16 +443,29 @@ public class SingleComponentManager<S> e
                 props.putAll(m_factoryProperties);
                 if (getComponentMetadata().getDSVersion().isDS13() && m_factoryProperties.containsKey(Constants.SERVICE_PID))
                 {
-                    List<String> servicePids = (List<String>) m_configurationProperties.get(Constants.SERVICE_PID);
-                    if (servicePids == null)
-                    {
-                        servicePids = new ArrayList<String>();
-                    }
+                	final List<String> servicePids = new ArrayList<String>();
+                	final Object configPropServicePids = m_configurationProperties.get(Constants.SERVICE_PID);
+                	if ( configPropServicePids instanceof List )
+                	{
+                		servicePids.addAll((List)configPropServicePids);
+                	}
+                	else 
+                	{
+                		servicePids.add(configPropServicePids.toString());
+                	}
                     if (m_factoryProperties.get(Constants.SERVICE_PID) instanceof String)
                     {
                         servicePids.add((String)m_factoryProperties.get(Constants.SERVICE_PID));
                     }
-                    props.put(Constants.SERVICE_PID, servicePids);
+                    
+                	if ( servicePids.size() == 1 )
+                	{
+                		props.put(Constants.SERVICE_PID, servicePids.get(0));
+                	}
+                	else
+                	{
+                		props.put(Constants.SERVICE_PID, servicePids);
+                	}
                 }
             }
 

Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java?rev=1689515&r1=1689514&r2=1689515&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
(original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
Mon Jul  6 22:26:19 2015
@@ -214,7 +214,7 @@ public class ComponentConfigurationTest
 	    }
 	    else 
 	    {
-	        pidWithout = Collections.singletonList(pid + ".description");
+	        pidWithout = pid + ".description";
 	        pidWith = Arrays.asList(new String[] {pid + ".description", pid});
 	    }
         deleteConfig( pid );



Mime
View raw message