incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r1022580 - in /incubator/aries/trunk/application: application-api/src/main/java/org/apache/aries/application/management/spi/framework/ application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/man...
Date Thu, 14 Oct 2010 15:32:42 GMT
Author: mnuttall
Date: Thu Oct 14 15:32:42 2010
New Revision: 1022580

URL: http://svn.apache.org/viewvc?rev=1022580&view=rev
Log:
ARIES-453: No Support for Service-Import in isolated frameworks. Patch by Chris Wilkinson.

Modified:
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java
    incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java
    incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
    incubator/aries/trunk/application/application-runtime-isolated/src/main/resources/OSGI-INF/blueprint/app-context-management.xml

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java?rev=1022580&r1=1022579&r2=1022580&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java
Thu Oct 14 15:32:42 2010
@@ -28,7 +28,9 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 
 public interface BundleFramework
-{
+{  
+  public static final String SHARED_BUNDLE_FRAMEWORK = "shared.bundle.framework";
+  
   /**
    * Initialises the framework
    * @throws BundleException

Modified: incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java?rev=1022580&r1=1022579&r2=1022580&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java
(original)
+++ incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java
Thu Oct 14 15:32:42 2010
@@ -35,6 +35,7 @@ import java.util.Set;
 import org.apache.aries.application.Content;
 import org.apache.aries.application.DeploymentContent;
 import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.InvalidAttributeException;
 import org.apache.aries.application.management.AriesApplication;
 import org.apache.aries.application.management.UpdateException;
 import org.apache.aries.application.management.spi.framework.BundleFramework;
@@ -48,6 +49,7 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -133,8 +135,6 @@ public class BundleFrameworkManagerImpl 
      * Set up framework config properties
      */
     Properties frameworkConfig = new Properties();
-    frameworkConfig.put("osgi.console", "0");
-
     String osgiFrameworkLocation = parentCtx.getProperty(FrameworkConstants.OSGI_FRAMEWORK);
     if (osgiFrameworkLocation != null) {
       frameworkConfig.put(FrameworkConstants.OSGI_FRAMEWORK, osgiFrameworkLocation);
@@ -151,6 +151,9 @@ public class BundleFrameworkManagerImpl 
     frameworkBundleManifest.put(Constants.BUNDLE_SYMBOLICNAME, deploymentMF.getApplicationSymbolicName());
     frameworkBundleManifest.put(Constants.BUNDLE_VERSION, deploymentMF.getApplicationVersion().toString());
 
+    /**
+     * Set up Import-Package header for framework manifest
+     */
     // Extract the import packages and remove anything we already have available in the current
framework
     Collection<Content> imports = 
       InstallUtils.calculateImports(
@@ -166,6 +169,31 @@ public class BundleFrameworkManagerImpl 
     }
     
     /**
+     * Set up CompositeServiceFilter-Import header for framework manifest
+     */
+    StringBuffer serviceImportFilter = 
+      new StringBuffer("(" + Constants.OBJECTCLASS + "=javax.transaction.TransactionSynchronizationRegistry)");
+    
+    try
+    {
+      for (Filter importFilter : app.getDeploymentMetadata().getDeployedServiceImport())
{
+        if (serviceImportFilter.length() > 0) {
+          serviceImportFilter.append(",");
+        }
+        serviceImportFilter.append(importFilter.toString());
+      }
+      
+      frameworkBundleManifest.put("CompositeServiceFilter-Import",
+          serviceImportFilter.toString());
+    }
+    catch (InvalidAttributeException e)
+    {
+      LOGGER.debug(LOG_EXCEPTION, e);
+      LOGGER.debug(LOG_EXIT,"isolatedInstall", e);
+      throw new BundleException("Failed to process Service Imports" , e);
+    }
+    
+    /**
      * Install and start the new isolated bundle framework
      */
     bundleFramework = 

Modified: incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java?rev=1022580&r1=1022579&r2=1022580&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
(original)
+++ incubator/aries/trunk/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
Thu Oct 14 15:32:42 2010
@@ -33,14 +33,12 @@ import org.apache.aries.application.mana
 
 import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
 import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
-import static org.apache.aries.application.utils.AppConstants.LOG_EXCEPTION;
 
 public class SharedBundleFramework
 {  
   private static final Logger LOGGER = LoggerFactory.getLogger(SharedBundleFramework.class);
   
   private static BundleFramework sharedFramework;
-  private static final String SHARED_BUNDLE_FRAMEWORK = "shared.bundle.framework";
 
   /**
    * This is not the right way to make blueprint usable by applications, but it is all
@@ -79,12 +77,12 @@ public class SharedBundleFramework
       }
       
       Properties compositeManifest = new Properties();
-      compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, SHARED_BUNDLE_FRAMEWORK);
+      compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, BundleFramework.SHARED_BUNDLE_FRAMEWORK);
 
       //Add blueprint so that it is available to applications.
       compositeManifest.put(Constants.IMPORT_PACKAGE, RUNTIME_PACKAGES);
 
-      sharedFramework = bundleFrameworkFactory.createBundleFramework(bc, SHARED_BUNDLE_FRAMEWORK,
+      sharedFramework = bundleFrameworkFactory.createBundleFramework(bc, BundleFramework.SHARED_BUNDLE_FRAMEWORK,
           frameworkConfig, compositeManifest);
 
       sharedFramework.init();

Modified: incubator/aries/trunk/application/application-runtime-isolated/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime-isolated/src/main/resources/OSGI-INF/blueprint/app-context-management.xml?rev=1022580&r1=1022579&r2=1022580&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime-isolated/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
(original)
+++ incubator/aries/trunk/application/application-runtime-isolated/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
Thu Oct 14 15:32:42 2010
@@ -19,7 +19,7 @@
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
   
-  <bean id="app-context-manager" class="org.apache.aries.application.runtime.isolated.impl.ApplicationContextManagerImpl"
scope="singleton" activation="lazy" destroy-method="close">
+  <bean id="app-context-manager" class="org.apache.aries.application.runtime.isolated.impl.ApplicationContextManagerImpl"
scope="singleton" activation="lazy">
     <property name="bundleFrameworkManager" ref="bundle-framework-manager"/>
     <property name="bundleRepositoryManager" ref="bundle-repository-manager"/>
   </bean>



Mime
View raw message