You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2012/02/05 01:03:05 UTC

svn commit: r1240647 - /aries/trunk/application/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java

Author: not
Date: Sun Feb  5 00:03:04 2012
New Revision: 1240647

URL: http://svn.apache.org/viewvc?rev=1240647&view=rev
Log:
ARIES-770 Committing patch from Richard Ellis. Changed from a StringBuffer to a StringBuilder at the same time.

Modified:
    aries/trunk/application/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java

Modified: aries/trunk/application/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java?rev=1240647&r1=1240646&r2=1240647&view=diff
==============================================================================
--- aries/trunk/application/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java (original)
+++ aries/trunk/application/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java Sun Feb  5 00:03:04 2012
@@ -82,15 +82,25 @@ public class BundleFrameworkConfiguratio
     /**
      * Set up CompositeServiceFilter-Import header for framework manifest
      */
-    StringBuffer serviceImportFilter = new StringBuffer("(" + Constants.OBJECTCLASS + "="
-        + EquinoxFrameworkConstants.TRANSACTION_REGISTRY_BUNDLE + ")");
+    StringBuilder serviceImportFilter = new StringBuilder();
+    String txRegsitryImport = "(" + Constants.OBJECTCLASS + "=" + EquinoxFrameworkConstants.TRANSACTION_REGISTRY_BUNDLE + ")";
 
+    Collection<Filter> deployedServiceImports = metadata.getDeployedServiceImport();
+    //if there are more services than the txRegistry import a OR group is required for the Filter
+    if (deployedServiceImports.size() > 0){
+      serviceImportFilter.append("(|");
+    }
+    
     for (Filter importFilter : metadata.getDeployedServiceImport()) {
-      if (serviceImportFilter.length() > 0) {
-        serviceImportFilter.append(",");
-      }
       serviceImportFilter.append(importFilter.toString());
     }
+    
+    serviceImportFilter.append(txRegsitryImport);
+    
+    //close the OR group if needed
+    if (deployedServiceImports.size() > 0){
+      serviceImportFilter.append(")");
+    }
 
     frameworkBundleManifest.put(EquinoxFrameworkConstants.COMPOSITE_SERVICE_FILTER_IMPORT,
         serviceImportFilter.toString());