camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r928427 - in /camel/trunk: components/camel-blueprint/pom.xml components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java parent/pom.xml
Date Sun, 28 Mar 2010 15:07:50 GMT
Author: davsclaus
Date: Sun Mar 28 15:07:49 2010
New Revision: 928427

URL: http://svn.apache.org/viewvc?rev=928427&view=rev
Log:
CAMEL-2586: camel-blueprint uses camel-osgi for class resolver. Thanks to Johan Edstrom for
patch.

Modified:
    camel/trunk/components/camel-blueprint/pom.xml
    camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
    camel/trunk/parent/pom.xml

Modified: camel/trunk/components/camel-blueprint/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/pom.xml?rev=928427&r1=928426&r2=928427&view=diff
==============================================================================
--- camel/trunk/components/camel-blueprint/pom.xml (original)
+++ camel/trunk/components/camel-blueprint/pom.xml Sun Mar 28 15:07:49 2010
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-parent</artifactId>
-        <version>2.1-SNAPSHOT</version>
+        <version>2.3-SNAPSHOT</version>
     </parent>
 
     <artifactId>camel-blueprint</artifactId>
@@ -48,6 +48,15 @@
             <artifactId>camel-core</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-osgi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>aries-blueprint</artifactId>
             <version>1.0.0-incubating-SNAPSHOT</version>

Modified: camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java?rev=928427&r1=928426&r2=928427&view=diff
==============================================================================
--- camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
(original)
+++ camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
Sun Mar 28 15:07:49 2010
@@ -53,6 +53,13 @@ import org.apache.camel.model.RouteDefin
 import org.apache.camel.model.TransactedDefinition;
 import org.apache.camel.model.config.PropertiesDefinition;
 import org.apache.camel.model.dataformat.DataFormatsDefinition;
+import org.apache.camel.osgi.OsgiCamelContextHelper;
+import org.apache.camel.osgi.OsgiClassResolver;
+import org.apache.camel.osgi.OsgiComponentResolver;
+import org.apache.camel.osgi.OsgiFactoryFinderResolver;
+import org.apache.camel.osgi.OsgiLanguageResolver;
+import org.apache.camel.osgi.OsgiPackageScanClassResolver;
+import org.apache.camel.osgi.OsgiServiceRegistry;
 import org.apache.camel.processor.interceptor.Delayer;
 import org.apache.camel.processor.interceptor.HandleFault;
 import org.apache.camel.processor.interceptor.TraceFormatter;
@@ -72,6 +79,8 @@ import org.apache.camel.util.EndpointHel
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
 
 /**
  * A bean to create and initialize a {@link BlueprintCamelContext}
@@ -245,7 +254,9 @@ public class CamelContextFactoryBean ext
         EventNotifier eventNotifier = getBeanForType(EventNotifier.class);
         if (eventNotifier != null) {
             LOG.info("Using custom EventNotifier: " + eventNotifier);
-            getContext().getManagementStrategy().setEventNotifier(eventNotifier);
+            List notifiers = getContext().getManagementStrategy().getEventNotifiers();
+            notifiers.add(eventNotifier);
+            getContext().getManagementStrategy().setEventNotifiers(notifiers);
         }
 
         // add global interceptors
@@ -472,7 +483,7 @@ public class CamelContextFactoryBean ext
             getContext().addLifecycleStrategy(new DefaultManagementLifecycleStrategy(getContext()));
             // set additional configuration from camelJMXAgent
             getContext().getManagementStrategy().onlyManageProcessorWithCustomId(camelJMXAgent.getOnlyRegisterProcessorWithCustomId());
-            getContext().getManagementStrategy().setSatisticsLevel(camelJMXAgent.getStatisticsLevel());
+            getContext().getManagementStrategy().setStatisticsLevel(camelJMXAgent.getStatisticsLevel());
         }
     }
 
@@ -773,6 +784,21 @@ public class CamelContextFactoryBean ext
             ctx.setShouldStartContext(shouldStartContext);
         }
 
+        // Adding discovery to this from camel-osgi
+
+        BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
+
+        OsgiServiceRegistry registry = new OsgiServiceRegistry(bundleContext);
+        ctx.setRegistry(registry);
+
+        OsgiCamelContextHelper.updateRegistry(ctx, bundleContext);
+
+        ctx.setClassResolver(new OsgiClassResolver(bundleContext));
+        ctx.setFactoryFinderResolver(new OsgiFactoryFinderResolver());
+        ctx.setPackageScanClassResolver(new OsgiPackageScanClassResolver(bundleContext));
+        ctx.setComponentResolver(new OsgiComponentResolver());
+        ctx.setLanguageResolver(new OsgiLanguageResolver());
+
         return ctx;
     }
 

Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=928427&r1=928426&r2=928427&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Sun Mar 28 15:07:49 2010
@@ -51,7 +51,7 @@
     <derby-version>10.4.2.0</derby-version>
     <dozer-version>5.2.0</dozer-version>
     <easymock-version>2.5.2</easymock-version>
-    <felix-osgi-version>1.2.0</felix-osgi-version>
+    <felix-osgi-version>1.4.0</felix-osgi-version>
     <flatpack-version>3.1.1</flatpack-version>
     <ftpserver-version>1.0.3</ftpserver-version>
     <fuse-commons-management-version>1.0</fuse-commons-management-version>



Mime
View raw message