camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r785603 - in /camel/branches/camel-1.x: ./ components/camel-osgi/src/main/java/org/apache/camel/osgi/ components/camel-osgi/src/main/resources/META-INF/ components/camel-spring/src/main/java/org/apache/camel/spring/handler/
Date Wed, 17 Jun 2009 13:55:21 GMT
Author: davsclaus
Date: Wed Jun 17 13:55:20 2009
New Revision: 785603

URL: http://svn.apache.org/viewvc?rev=785603&view=rev
Log:
Merged revisions 785599 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r785599 | davsclaus | 2009-06-17 15:43:18 +0200 (Wed, 17 Jun 2009) | 1 line
  
  CAMEL-1725: improved logging for camel-osgi and if Camel detects uses OSGi or not.
........

Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiAnnotationTypeConverterLoader.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiComponentResolver.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
    camel/branches/camel-1.x/components/camel-osgi/src/main/resources/META-INF/spring.schemas
    camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 17 13:55:20 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
 923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
 923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/Activator.java
Wed Jun 17 13:55:20 2009
@@ -66,6 +66,10 @@
     }
     
     public void bundleChanged(BundleEvent event) {
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Bundle changed: " + event);
+        }
+
         try {
             Bundle bundle = event.getBundle();
             if (event.getType() == BundleEvent.RESOLVED) {
@@ -82,9 +86,8 @@
                 mayBeRemoveTypeConverterFor(bundle);
             }
         } catch (Throwable e) {
-            LOG.fatal("Exception handing bundle changed event", e);
+            LOG.fatal("Exception occured during bundleChanged for event: " + event, e);
         }
-        
     }
 
     protected synchronized void addComponentEntry(String entryPath, Bundle bundle, Map<String,
ComponentEntry> entries) {
@@ -163,10 +166,16 @@
     }
 
     public void start(BundleContext context) throws Exception {
-        bundle = context.getBundle();       
+        LOG.info("Camel activator starting");
+
+        bundle = context.getBundle();
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Using bundle: " + bundle);
+        }
         context.addBundleListener(this);
+
         if (LOG.isDebugEnabled()) {
-            LOG.debug("checking existing bundles");
+            LOG.debug("Checking existing bundles for Camel components, languages and type
converters");
         }
         for (Bundle bundle : context.getBundles()) {
             if (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.STARTING
@@ -175,15 +184,15 @@
                 mayBeAddTypeConverterFor(bundle);
             }
         }
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("actived");
-        }
-        
-    }    
+
+        LOG.info("Camel activator started");
+    }
 
     public void stop(BundleContext context) throws Exception {
+        LOG.info("Camel activator stopping");
+
         if (LOG.isDebugEnabled()) {
-            LOG.debug("removing the components of existing bundles");
+            LOG.debug("Removing Camel bundles");
         }
         for (Bundle bundle : context.getBundles()) {
             if (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.STARTING

@@ -192,9 +201,8 @@
                 mayBeRemoveTypeConverterFor(bundle);
             }
         }
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("stopped");
-        }
+
+        LOG.info("Camel activator stopped");
     }
     
     protected Set<String> getConverterPackages(URL resource) {
@@ -240,9 +248,13 @@
     }
     
     protected static synchronized String[] findTypeConverterPackageNames() {
+        LOG.trace("Finding TypeConverterPackageNames");
         Set<String> packages = new HashSet<String>();
         for (TypeConverterEntry entry : TYPE_CONVERTERS.values()) {
             for (String packageName : entry.converterPackages) {
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Found TypeConverterPackage: " + packageName);
+                }
                 packages.add(packageName);
             }
         }
@@ -250,14 +262,17 @@
     }
         
     public static synchronized Class getComponent(String name) throws Exception {
+        LOG.trace("Finding Component: " + name);
         return getClassFromEntries(name, COMPONENTS);
     }
     
     public static synchronized Class getLanguage(String name) throws Exception {
+        LOG.trace("Finding Language: " + name);
         return getClassFromEntries(name, LANGUAGES);
     }
     
     public static synchronized Class getLanguageResolver(String name) throws Exception {
+        LOG.trace("Finding LanguageResolver: " + name);
         return getClassFromEntries(name, LANGUAGE_RESOLVERS);
     }
     
@@ -294,6 +309,5 @@
         }
         return entry.type;
     }
-    
 
 }

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
Wed Jun 17 13:55:20 2009
@@ -14,14 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.osgi;
 
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.converter.AnnotationTypeConverterLoader;
@@ -46,19 +41,30 @@
     }
 
     public void setBundleContext(BundleContext bundleContext) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Using BundleContext: " + bundleContext);
+        }
         this.bundleContext = bundleContext;
     }
     
     public DefaultCamelContext createContext() {
+        LOG.debug("Creating DefaultCamelContext");
+
         DefaultCamelContext context = new DefaultCamelContext();
         if (bundleContext != null) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("The bundle context is not be null, let's setup the Osgi resolvers");
+                LOG.debug("Using OSGI resolvers");
             }
+            LOG.debug("Using OsgiFactoryFinder");
             context.setFactoryFinderClass(OsgiFactoryFinder.class);
+            LOG.debug("Using OsgiComponentResolver");
             context.setComponentResolver(new OsgiComponentResolver());
+            LOG.debug("Using OsgiLanguageResolver");
             context.setLanguageResolver(new OsgiLanguageResolver());
             addOsgiAnnotationTypeConverterLoader(context, bundleContext);            
+        } else {
+            // TODO: should we not thrown an excpetion to not allow it to startup
+            LOG.warn("BundleContext not set, cannot run in OSGI container");
         }
         
         return context;
@@ -77,8 +83,10 @@
     }
     
     protected void addOsgiAnnotationTypeConverterLoader(DefaultCamelContext context, BundleContext
bundleContext) {
+        LOG.debug("Using OsgiAnnotationTypeConverterLoader");
         DefaultTypeConverter typeConverter = (DefaultTypeConverter) context.getTypeConverter();
         List<TypeConverterLoader> typeConverterLoaders = typeConverter.getTypeConverterLoaders();
+
         // Remove the AnnotationTypeConverterLoader
         TypeConverterLoader atLoader = null; 
         for (TypeConverterLoader loader : typeConverterLoaders) {
@@ -91,6 +99,6 @@
             typeConverterLoaders.remove(atLoader);
         }
         typeConverterLoaders.add(new OsgiAnnotationTypeConverterLoader(bundleContext));
-        LOG.debug("added the OsgiAnnotationTypeConverterLoader");
-    }    
+    }
+
 }

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
Wed Jun 17 13:55:20 2009
@@ -26,9 +26,7 @@
 import org.apache.camel.impl.converter.AnnotationTypeConverterLoader;
 import org.apache.camel.impl.converter.DefaultTypeConverter;
 import org.apache.camel.impl.converter.TypeConverterLoader;
-import org.apache.camel.spring.RouteBuilderFinder;
 import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.util.FactoryFinder;
 import org.apache.camel.util.ResolverUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -48,6 +46,9 @@
     }
 
     public void setBundleContext(BundleContext bundleContext) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Using BundleContext: " + bundleContext);
+        }
         this.bundleContext = bundleContext;
     }
     
@@ -55,12 +56,18 @@
         SpringCamelContext context = super.createContext();        
         if (bundleContext != null) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("The bundle context is not be null, let's setup the Osgi resolvers");
+                LOG.debug("Using OSGI resolvers");
             }
+            LOG.debug("Using OsgiFactoryFinder");
             context.setFactoryFinderClass(OsgiFactoryFinder.class);
+            LOG.debug("Using OsgiComponentResolver");
             context.setComponentResolver(new OsgiComponentResolver());
+            LOG.debug("Using OsgiLanguageResolver");
             context.setLanguageResolver(new OsgiLanguageResolver());
             addOsgiAnnotationTypeConverterLoader(context, bundleContext);            
+        } else {
+            // TODO: should we not thrown an excpetion to not allow it to startup
+            LOG.warn("BundleContext not set, cannot run in OSGI container");
         }
         
         return context;
@@ -79,8 +86,11 @@
     }
     
     protected void addOsgiAnnotationTypeConverterLoader(SpringCamelContext context, BundleContext
bundleContext) {
+        LOG.debug("Using OsgiAnnotationTypeConverterLoader");
+
         DefaultTypeConverter typeConverter = (DefaultTypeConverter) context.getTypeConverter();
         List<TypeConverterLoader> typeConverterLoaders = typeConverter.getTypeConverterLoaders();
+
         // Remove the AnnotationTypeConverterLoader
         TypeConverterLoader atLoader = null; 
         for (TypeConverterLoader loader : typeConverterLoaders) {
@@ -93,7 +103,6 @@
             typeConverterLoaders.remove(atLoader);
         }        
         typeConverterLoaders.add(new OsgiAnnotationTypeConverterLoader(bundleContext));
-        LOG.debug("added the OsgiAnnotationTypeConverterLoader");
-    }    
+    }
     
 }

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
Wed Jun 17 13:55:20 2009
@@ -28,6 +28,8 @@
         super.init();
         registerParser("camelContext", new CamelContextBeanDefinitionParser(CamelContextFactoryBean.class));
     }
+
+    // TODO: This does not look correct with the code below, why are the so few jaxb packages?
     
     protected Set<Class> getJaxbPackages() {
         Set<Class> classes = new HashSet<Class>();

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiAnnotationTypeConverterLoader.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiAnnotationTypeConverterLoader.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiAnnotationTypeConverterLoader.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiAnnotationTypeConverterLoader.java
Wed Jun 17 13:55:20 2009
@@ -17,12 +17,9 @@
 package org.apache.camel.osgi;
 
 import org.apache.camel.impl.converter.AnnotationTypeConverterLoader;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.osgi.framework.BundleContext;
 
 public class OsgiAnnotationTypeConverterLoader extends AnnotationTypeConverterLoader {
-    private static final transient Log LOG = LogFactory.getLog(OsgiAnnotationTypeConverterLoader.class);
     
     public OsgiAnnotationTypeConverterLoader(BundleContext context) {
         super(new OsgiResolverUtil(context));

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiComponentResolver.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiComponentResolver.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiComponentResolver.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiComponentResolver.java
Wed Jun 17 13:55:20 2009
@@ -16,23 +16,11 @@
  */
 package org.apache.camel.osgi;
 
-import java.io.BufferedInputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.spi.ComponentResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.SynchronousBundleListener;
-import org.springframework.osgi.util.BundleDelegatingClassLoader;
 
 public class OsgiComponentResolver implements ComponentResolver {
     

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
Wed Jun 17 13:55:20 2009
@@ -82,7 +82,7 @@
     public BundleEntry getResource(String name) {
         URL url = null;
         BundleEntry entry = null;
-        BundleContext bundleContext =  Activator.getBundle().getBundleContext();
+        BundleContext bundleContext = Activator.getBundle().getBundleContext();
         for (Bundle bundle : bundleContext.getBundles()) {            
             url = bundle.getEntry(getPath() + name);
             if (url != null) {

Modified: camel/branches/camel-1.x/components/camel-osgi/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-osgi/src/main/resources/META-INF/spring.schemas?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-osgi/src/main/resources/META-INF/spring.schemas
(original)
+++ camel/branches/camel-1.x/components/camel-osgi/src/main/resources/META-INF/spring.schemas
Wed Jun 17 13:55:20 2009
@@ -21,4 +21,5 @@
 http\://activemq.apache.org/camel/schema/osgi/camel-osgi-1.4.0.xsd=camel-osgi.xsd
 http\://activemq.apache.org/camel/schema/osgi/camel-osgi-1.5.0.xsd=camel-osgi.xsd
 http\://activemq.apache.org/camel/schema/osgi/camel-osgi-1.6.0.xsd=camel-osgi.xsd
+http\://activemq.apache.org/camel/schema/osgi/camel-osgi-1.6.1.xsd=camel-osgi.xsd
 http\://activemq.apache.org/camel/schema/osgi/camel-osgi-${pom.version}.xsd=camel-osgi.xsd

Modified: camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java?rev=785603&r1=785602&r2=785603&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
(original)
+++ camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
Wed Jun 17 13:55:20 2009
@@ -31,15 +31,6 @@
 
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.builder.xml.Namespaces;
-import org.apache.camel.model.config.PropertiesType;
-import org.apache.camel.model.dataformat.ArtixDSDataFormat;
-import org.apache.camel.model.dataformat.JaxbDataFormat;
-import org.apache.camel.model.dataformat.SerializationDataFormat;
-import org.apache.camel.model.dataformat.XMLBeansDataFormat;
-import org.apache.camel.model.loadbalancer.RandomLoadBalanceStrategy;
-import org.apache.camel.model.loadbalancer.RoundRobinLoadBalanceStrategy;
-import org.apache.camel.model.loadbalancer.StickyLoadBalanceStrategy;
-import org.apache.camel.model.loadbalancer.TopicLoadBalanceStrategy;
 import org.apache.camel.spi.NamespaceAware;
 import org.apache.camel.spring.CamelBeanPostProcessor;
 import org.apache.camel.spring.CamelContextFactoryBean;
@@ -50,6 +41,8 @@
 import org.apache.camel.spring.remoting.CamelServiceExporter;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.view.ModelFileGenerator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -58,13 +51,12 @@
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 import org.springframework.beans.factory.xml.ParserContext;
 
-
-
 /**
  * Camel namespace for the spring XML configuration file.
  */
 public class CamelNamespaceHandler extends NamespaceHandlerSupport {
 
+    private static final transient Log LOG = LogFactory.getLog(CamelNamespaceHandler.class);
     protected BeanDefinitionParser endpointParser = new BeanDefinitionParser(EndpointFactoryBean.class);
     protected BeanDefinitionParser beanPostProcessorParser = new BeanDefinitionParser(CamelBeanPostProcessor.class);
     protected Set<String> parserElementNames = new HashSet<String>();
@@ -72,12 +64,10 @@
     private JAXBContext jaxbContext;
     private Map<String, BeanDefinitionParser> parserMap = new HashMap<String, BeanDefinitionParser>();
 
-
     public ModelFileGenerator createModelFileGenerator() throws JAXBException {
         return new ModelFileGenerator(getJaxbContext());
     }
 
-
     public void init() {
         // remoting
         addBeanDefinitionParser("proxy", CamelProxyFactoryBean.class);
@@ -90,10 +80,23 @@
         // TODO switch to use the above mechanism?
         registerParser("endpoint", endpointParser);
 
+        boolean osgi = false;
         Class cl = CamelContextFactoryBean.class;
         try {
             cl = Class.forName("org.apache.camel.osgi.CamelContextFactoryBean");
+            osgi = true;
         } catch (Throwable t) {
+            LOG.trace("Cannot find class so assuming not running in OSGI container: " + t.getMessage());
+        }
+
+        if (osgi) {
+            LOG.info("camel-osgi.jar detected in classpath");
+        } else {
+            LOG.info("camel-osgi.jar not detected in classpath");
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Using " + cl.getCanonicalName() + " as CamelContextBeanDefinitionParser");
         }
         registerParser("camelContext", new CamelContextBeanDefinitionParser(cl));
     }



Mime
View raw message