You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2010/12/08 23:13:30 UTC

svn commit: r1043725 - in /camel/trunk: components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/ components/camel-blueprint/src/main/resources/org/apache/camel/blu...

Author: gnodet
Date: Wed Dec  8 22:13:29 2010
New Revision: 1043725

URL: http://svn.apache.org/viewvc?rev=1043725&view=rev
Log:
[CAMEL-3414] Support for <routeContext> and <proxy> in blueprint

Added:
    camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
    camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRouteContextFactoryBean.java
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestProxySender.java
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-11.xml
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-12.xml
Modified:
    camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
    camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
    camel/trunk/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java

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=1043725&r1=1043724&r2=1043725&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 Wed Dec  8 22:13:29 2010
@@ -114,10 +114,9 @@ public class CamelContextFactoryBean ext
     @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class, required = false)
     private CamelJMXAgentDefinition camelJMXAgent;
     @XmlElements({
-//        @XmlElement(name = "beanPostProcessor", type = CamelBeanPostProcessor.class, required = false),
         @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false),
         @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class, required = false),
-        @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false),
+        @XmlElement(name = "proxy", type = CamelProxyFactoryBean.class, required = false),
         @XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false),
         @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)
     })
@@ -149,12 +148,6 @@ public class CamelContextFactoryBean ext
     @XmlTransient
     private BlueprintCamelContext context;
     @XmlTransient
-    private ClassLoader contextClassLoaderOnStart;
-//    @XmlTransient
-//    private ApplicationContext applicationContext;
-//    @XmlTransient
-//    private BeanPostProcessor beanPostProcessor;
-    @XmlTransient
     private BlueprintContainer blueprintContainer;
     @XmlTransient
     private BundleContext bundleContext;
@@ -479,10 +472,6 @@ public class CamelContextFactoryBean ext
         this.routes = routes;
     }
 
-    public ClassLoader getContextClassLoaderOnStart() {
-        return contextClassLoaderOnStart;
-    }
-    
     public boolean isImplicitId() {
         return implicitId;
     }

Added: camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java?rev=1043725&view=auto
==============================================================================
--- camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java (added)
+++ camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java Wed Dec  8 22:13:29 2010
@@ -0,0 +1,156 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.blueprint;
+
+import org.apache.aries.blueprint.ExtendedBlueprintContainer;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.FailedToCreateProducerException;
+import org.apache.camel.Producer;
+import org.apache.camel.component.bean.ProxyHelper;
+import org.apache.camel.core.xml.AbstractCamelFactoryBean;
+import org.apache.camel.util.ServiceHelper;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * A factory to create a Proxy to a a Camel Pojo Endpoint.
+ */
+@XmlRootElement(name = "proxy")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CamelProxyFactoryBean extends AbstractCamelFactoryBean<Object> {
+
+    @XmlAttribute
+    private String serviceUrl;
+    @XmlAttribute
+    private String serviceRef;
+    @XmlAttribute
+    private String serviceInterface;
+    @XmlTransient
+    private Endpoint endpoint;
+    @XmlTransient
+    private Object serviceProxy;
+    @XmlTransient
+    private Producer producer;
+    @XmlTransient
+    private ExtendedBlueprintContainer blueprintContainer;
+
+    public Object getObject() {
+        return serviceProxy;
+    }
+
+    public Class<Object> getObjectType() {
+        return Object.class;
+    }
+
+    protected CamelContext getCamelContextWithId(String camelContextId) {
+        if (blueprintContainer != null) {
+            return (CamelContext) blueprintContainer.getComponentInstance(camelContextId);
+        }
+        return null;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        if (endpoint == null) {
+            getCamelContext();
+            if (getServiceUrl() == null && getServiceRef() == null) {
+                throw new IllegalArgumentException("serviceUrl or serviceRef must be specified.");
+            }
+            if (getServiceInterface() == null) {
+                throw new IllegalArgumentException("serviceInterface must be specified.");
+            }
+
+            // lookup endpoint or we have the url for it
+            if (getServiceRef() != null) {
+                endpoint = getCamelContext().getRegistry().lookup(getServiceRef(), Endpoint.class);
+            } else {
+                endpoint = getCamelContext().getEndpoint(getServiceUrl());
+            }
+
+            if (endpoint == null) {
+                throw new IllegalArgumentException("Could not resolve endpoint: " + getServiceUrl());
+            }
+        }
+
+        try {
+            producer = endpoint.createProducer();
+            ServiceHelper.startService(producer);
+            Class clazz = blueprintContainer.loadClass(getServiceInterface());
+            serviceProxy = ProxyHelper.createProxy(endpoint, producer, clazz);
+        } catch (Exception e) {
+            throw new FailedToCreateProducerException(endpoint, e);
+        }
+
+    }
+
+    public void destroy() throws Exception {
+        ServiceHelper.stopService(producer);
+    }
+
+    public String getServiceUrl() {
+        return serviceUrl;
+    }
+
+    public void setServiceUrl(String serviceUrl) {
+        this.serviceUrl = serviceUrl;
+    }
+
+    public String getServiceRef() {
+        return serviceRef;
+    }
+
+    public void setServiceRef(String serviceRef) {
+        this.serviceRef = serviceRef;
+    }
+
+    public String getServiceInterface() {
+        return serviceInterface;
+    }
+
+    public void setServiceInterface(String serviceInterface) {
+        this.serviceInterface = serviceInterface;
+    }
+
+    public Endpoint getEndpoint() {
+        return endpoint;
+    }
+
+    public void setEndpoint(Endpoint endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    public Producer getProducer() {
+        return producer;
+    }
+
+    public void setProducer(Producer producer) {
+        this.producer = producer;
+    }
+
+    public ExtendedBlueprintContainer getBlueprintContainer() {
+        return blueprintContainer;
+    }
+
+    public void setBlueprintContainer(ExtendedBlueprintContainer blueprintContainer) {
+        this.blueprintContainer = blueprintContainer;
+    }
+
+}

Added: camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRouteContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRouteContextFactoryBean.java?rev=1043725&view=auto
==============================================================================
--- camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRouteContextFactoryBean.java (added)
+++ camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelRouteContextFactoryBean.java Wed Dec  8 22:13:29 2010
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.blueprint;
+
+import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.model.RouteDefinition;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement(name = "routeContext")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CamelRouteContextFactoryBean extends IdentifiedType {
+
+    @XmlElement(name = "route", required = true)
+    private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
+
+    public List<RouteDefinition> getRoutes() throws Exception {
+        return routes;
+    }
+
+}

Modified: camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java?rev=1043725&r1=1043724&r2=1043725&view=diff
==============================================================================
--- camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java (original)
+++ camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Wed Dec  8 22:13:29 2010
@@ -33,6 +33,7 @@ import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.blueprint.BlueprintCamelContext;
 import org.apache.camel.blueprint.CamelContextFactoryBean;
+import org.apache.camel.blueprint.CamelRouteContextFactoryBean;
 import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
 import org.apache.camel.core.xml.AbstractCamelFactoryBean;
 import org.apache.camel.impl.CamelPostProcessorHelper;
@@ -75,6 +76,7 @@ import java.util.concurrent.Callable;
 public class CamelNamespaceHandler implements NamespaceHandler {
 
     private static final String CAMEL_CONTEXT = "camelContext";
+    private static final String ROUTE_CONTEXT = "routeContext";
 
     private static final String SPRING_NS = "http://camel.apache.org/schema/spring";
     private static final String BLUEPRINT_NS = "http://camel.apache.org/schema/blueprint";
@@ -194,6 +196,39 @@ public class CamelNamespaceHandler imple
 
             return ctx;
         }
+        if (element.getNodeName().equals(ROUTE_CONTEXT)) {
+            // now lets parse the routes with JAXB
+            Binder<Node> binder;
+            try {
+                binder = getJaxbContext().createBinder();
+            } catch (JAXBException e) {
+                throw new ComponentDefinitionException("Failed to create the JAXB binder : " + e, e);
+            }
+            Object value = parseUsingJaxb(element, context, binder);
+            if (!(value instanceof CamelRouteContextFactoryBean)) {
+                throw new ComponentDefinitionException("Expected an instance of " + CamelRouteContextFactoryBean.class);
+            }
+
+            CamelRouteContextFactoryBean rcfb = (CamelRouteContextFactoryBean) value;
+            String id = rcfb.getId();
+
+            MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
+            factory.setId(".camelBlueprint.passThrough." + id);
+            factory.setObject(new PassThroughCallable<Object>(rcfb));
+
+            MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
+            factory2.setId(".camelBlueprint.factory." + id);
+            factory2.setFactoryComponent(factory);
+            factory2.setFactoryMethod("call");
+
+            MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
+            ctx.setId(id);
+            ctx.setRuntimeClass(List.class);
+            ctx.setFactoryComponent(factory2);
+            ctx.setFactoryMethod("getRoutes");
+
+            return ctx;
+        }
         return null;
     }
 
@@ -213,11 +248,11 @@ public class CamelNamespaceHandler imple
         fact.setCamelContextId(contextId);
 
         MutablePassThroughMetadata eff = context.createMetadata(MutablePassThroughMetadata.class);
-        eff.setId(".camelBlueprint.bean.factory." + id);
+        eff.setId(".camelBlueprint.bean.passthrough." + id);
         eff.setObject(new PassThroughCallable<Object>(fact));
 
         MutableBeanMetadata ef = context.createMetadata(MutableBeanMetadata.class);
-        ef.setId(".camelBlueprint.bean.factory." + contextId);
+        ef.setId(".camelBlueprint.bean.factory." + id);
         ef.setFactoryComponent(eff);
         ef.setFactoryMethod("call");
         ef.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));

Modified: camel/trunk/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index?rev=1043725&r1=1043724&r2=1043725&view=diff
==============================================================================
--- camel/trunk/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index (original)
+++ camel/trunk/components/camel-blueprint/src/main/resources/org/apache/camel/blueprint/jaxb.index Wed Dec  8 22:13:29 2010
@@ -19,3 +19,5 @@ CamelContextFactoryBean
 CamelEndpointFactoryBean
 CamelProducerTemplateFactoryBean
 CamelThreadPoolFactoryBean
+CamelRouteContextFactoryBean
+CamelProxyFactoryBean
\ No newline at end of file

Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java?rev=1043725&r1=1043724&r2=1043725&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java Wed Dec  8 22:13:29 2010
@@ -163,6 +163,25 @@ public class OSGiBlueprintTestSupport ex
         assertNotNull(mth.invoke(producer));
     }
 
+    @Test
+    public void testRouteContext() throws Exception {
+        getInstalledBundle("CamelBlueprintTestBundle11").start();
+        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle11)", 5000);
+        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle11)", 5000);
+        assertEquals(3, ctx.getRoutes().size());
+    }
+
+    @Test
+    public void testProxy() throws Exception {
+        getInstalledBundle("CamelBlueprintTestBundle12").start();
+        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle12)", 5000);
+        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle12)", 5000);
+        Object proxy = ctn.getComponentInstance("myProxySender");
+        assertNotNull(proxy);
+        assertEquals(1, proxy.getClass().getInterfaces().length);
+        assertEquals(TestProxySender.class.getName(), proxy.getClass().getInterfaces()[0].getName());
+    }
+
     @Before
     public void setUp() throws Exception {
     }
@@ -239,6 +258,19 @@ public class OSGiBlueprintTestSupport ex
                         .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
                         .build()).noStart(),
 
+                bundle(newBundle()
+                        .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-11.xml"))
+                        .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle11")
+                        .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+                        .build()).noStart(),
+
+                bundle(newBundle()
+                        .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-12.xml"))
+                        .add(TestProxySender.class)
+                        .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle12")
+                        .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+                        .build()).noStart(),
+
                 // install the spring dm profile
                 profile("spring.dm").version("1.2.0"),
                 // this is how you set the default log level when using pax logging (logProfile)

Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestProxySender.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestProxySender.java?rev=1043725&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestProxySender.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestProxySender.java Wed Dec  8 22:13:29 2010
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.osgi.blueprint;
+
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Pattern;
+
+/**
+ * @version $Revision$
+ */
+public interface TestProxySender {
+
+    String hello(String name);
+
+    @Pattern(value = ExchangePattern.InOnly)
+    void greeting(String message);
+
+}

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-11.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-11.xml?rev=1043725&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-11.xml (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-11.xml Wed Dec  8 22:13:29 2010
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <routeContext id="myCoolRoutes" xmlns="http://camel.apache.org/schema/blueprint">
+        <!-- we can have a route -->
+        <route id="cool">
+            <from uri="direct:start"/>
+            <to uri="mock:result"/>
+        </route>
+        <!-- and another route, you can have as many your like -->
+        <route id="bar">
+            <from uri="direct:bar"/>
+            <to uri="mock:bar"/>
+        </route>
+    </routeContext>
+
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+        <!-- refer to a given route to be used -->
+        <routeContextRef ref="myCoolRoutes"/>
+
+        <!-- we can of course still use routes inside camelContext -->
+        <route id="inside">
+            <from uri="direct:inside"/>
+            <to uri="mock:inside"/>
+        </route>
+    </camelContext>
+
+</blueprint>

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-12.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-12.xml?rev=1043725&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-12.xml (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-12.xml Wed Dec  8 22:13:29 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+        <!-- create a proxy that will route to the direct:start endpoint when invoked -->
+        <proxy id="myProxySender"
+               serviceInterface="org.apache.camel.itest.osgi.blueprint.TestProxySender"
+               serviceUrl="direct:start"/>
+
+        <!-- this is the route that our proxy will routed when invoked
+             and the output from this route is returned as reply on the proxy -->
+        <route>
+            <from uri="direct:start"/>
+            <transform>
+                <simple>Bye ${body}</simple>
+            </transform>
+        </route>
+
+    </camelContext>
+
+</blueprint>