camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1342302 - in /camel/branches/camel-2.9.x: ./ components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/ components/camel-core-xml/src/main/java/org/apache/...
Date Thu, 24 May 2012 15:43:53 GMT
Author: davsclaus
Date: Thu May 24 15:43:52 2012
New Revision: 1342302

URL: http://svn.apache.org/viewvc?rev=1342302&view=rev
Log:
Blueprint namespace should lookup default blueprint camelcontext if not explict configured
in the namespace.

Added:
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContextLookupHelper.java
      - copied unchanged from r1342300, camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContextLookupHelper.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelConsumerTemplateFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelEndpointFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProducerTemplateFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRedeliveryPolicyFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelThreadPoolFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyManagersParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyStoreParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextClientParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextServerParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SecureRandomParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/TrustManagersParametersFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
    camel/branches/camel-2.9.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-18.xml

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1342300

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

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelConsumerTemplateFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelConsumerTemplateFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelConsumerTemplateFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelConsumerTemplateFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -50,4 +51,16 @@ public class CamelConsumerTemplateFactor
         return null;
     }
 
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }
\ No newline at end of file

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelEndpointFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelEndpointFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelEndpointFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelEndpointFactoryBean.java
Thu May 24 15:43:52 2012
@@ -17,6 +17,7 @@
 package org.apache.camel.blueprint;
 
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -50,4 +51,17 @@ public class CamelEndpointFactoryBean ex
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -116,6 +117,18 @@ public class CamelErrorHandlerFactoryBea
         return null;
     }
 
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
     protected <T> T lookup(String name, Class<T> type) {
         return type.cast(blueprintContainer.getComponentInstance(name));
     }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProducerTemplateFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProducerTemplateFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProducerTemplateFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProducerTemplateFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -50,4 +51,16 @@ public class CamelProducerTemplateFactor
         return null;
     }
 
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -68,6 +69,18 @@ public class CamelProxyFactoryBean exten
         return null;
     }
 
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
     public void afterPropertiesSet() throws Exception {
         if (endpoint == null) {
             getCamelContext();

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRedeliveryPolicyFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRedeliveryPolicyFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRedeliveryPolicyFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRedeliveryPolicyFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -48,4 +49,17 @@ public class CamelRedeliveryPolicyFactor
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelThreadPoolFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelThreadPoolFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelThreadPoolFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelThreadPoolFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -49,4 +50,16 @@ public class CamelThreadPoolFactoryBean 
         return null;
     }
 
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }
\ No newline at end of file

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyManagersParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyManagersParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyManagersParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyManagersParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,9 +16,11 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractKeyManagersParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -49,4 +51,17 @@ public class KeyManagersParametersFactor
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyStoreParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyStoreParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyStoreParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/KeyStoreParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,10 +16,12 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractKeyStoreParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -40,4 +42,17 @@ public class KeyStoreParametersFactoryBe
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextClientParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextClientParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextClientParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextClientParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,10 +16,12 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractSSLContextClientParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -40,4 +42,17 @@ public class SSLContextClientParametersF
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,11 +16,13 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractSSLContextParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -97,5 +99,16 @@ public class SSLContextParametersFactory
         }
         return null;
     }
-    
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextServerParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextServerParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextServerParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SSLContextServerParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,10 +16,12 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractSSLContextServerParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -40,4 +42,17 @@ public class SSLContextServerParametersF
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SecureRandomParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SecureRandomParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SecureRandomParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/SecureRandomParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,10 +16,12 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractSecureRandomParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -40,4 +42,17 @@ public class SecureRandomParametersFacto
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/TrustManagersParametersFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/TrustManagersParametersFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/TrustManagersParametersFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/util/blueprint/TrustManagersParametersFactoryBean.java
Thu May 24 15:43:52 2012
@@ -16,9 +16,11 @@
  */
 package org.apache.camel.util.blueprint;
 
+import java.util.Set;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.blueprint.BlueprintCamelContextLookupHelper;
 import org.apache.camel.core.xml.util.jsse.AbstractTrustManagersParametersFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -49,4 +51,17 @@ public class TrustManagersParametersFact
         }
         return null;
     }
+
+    @Override
+    protected CamelContext discoverDefaultCamelContext() {
+        if (blueprintContainer != null) {
+            Set<String> ids = BlueprintCamelContextLookupHelper.lookupBlueprintCamelContext(blueprintContainer);
+            if (ids.size() == 1) {
+                // there is only 1 id for a BlueprintCamelContext so fallback and use this
+                return getCamelContextWithId(ids.iterator().next());
+            }
+        }
+        return null;
+    }
+
 }

Modified: camel/branches/camel-2.9.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
Thu May 24 15:43:52 2012
@@ -37,6 +37,14 @@ public abstract class AbstractCamelFacto
 
     protected abstract CamelContext getCamelContextWithId(String camelContextId);
 
+    /**
+     * If no explicit camelContext or camelContextId has been set
+     * then try to discover a default {@link CamelContext} to use.
+     */
+    protected CamelContext discoverDefaultCamelContext() {
+        return null;
+    }
+
     public void afterPropertiesSet() throws Exception {
     }
 
@@ -47,6 +55,9 @@ public abstract class AbstractCamelFacto
         if (camelContext == null && camelContextId != null) {
             camelContext = getCamelContextWithId(camelContextId);
         }
+        if (camelContext == null) {
+            camelContext = discoverDefaultCamelContext();
+        }
         return camelContext;
     }
 

Modified: camel/branches/camel-2.9.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-18.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-18.xml?rev=1342302&r1=1342301&r2=1342302&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-18.xml
(original)
+++ camel/branches/camel-2.9.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-18.xml
Thu May 24 15:43:52 2012
@@ -23,7 +23,7 @@
       <argument ref="sslContextParameters"/>
     </bean>
     
-    <sslContextParameters xmlns="http://camel.apache.org/schema/blueprint" camelContextId="test"
+    <sslContextParameters xmlns="http://camel.apache.org/schema/blueprint"
       id="sslContextParameters"
       sessionTimeout="1"
       secureSocketProtocol="TLS">



Mime
View raw message