servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r564165 - in /incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel: ./ src/main/java/org/apache/camel/component/jbi/ src/main/java/org/apache/servicemix/ src/main/java/org/apache/servicemix/camel/ src/test/java/org/apache/...
Date Thu, 09 Aug 2007 10:47:08 GMT
Author: jstrachan
Date: Thu Aug  9 03:47:05 2007
New Revision: 564165

URL: http://svn.apache.org/viewvc?view=rev&rev=564165
Log:
Refactored the code to the servicemix package structure and to pass those damn checkstyle/pmd rules :)

Added:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/FromJbiProcessor.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiEndpoint.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiException.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/servicemix/
Removed:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/camel/component/jbi/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/camel/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/test/resources/org/apache/camel/component/jbi/
Modified:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/pom.xml

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/pom.xml?view=diff&rev=564165&r1=564164&r2=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/pom.xml (original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/pom.xml Thu Aug  9 03:47:05 2007
@@ -86,7 +86,7 @@
         <extensions>true</extensions>
         <configuration>
           <type>service-engine</type>
-          <component>org.apache.camel.component.jbi.CamelJbiComponent</component>
+          <component>org.apache.servicemix.camel.CamelJbiComponent</component>
         </configuration>
       </plugin>
 
@@ -99,8 +99,6 @@
             <include>**/*Test.*</include>
           </includes>
           <excludes>
-            <!-- TODO FIXME! -->
-            <exclude>**/JbiTest.*</exclude>
           </excludes>
         </configuration>
       </plugin>

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,272 @@
+/*
+ * 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.servicemix.camel;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.FailedToCreateProducerException;
+import org.apache.camel.Processor;
+import org.apache.servicemix.common.BaseServiceUnitManager;
+import org.apache.servicemix.common.DefaultComponent;
+import org.apache.servicemix.common.Deployer;
+import org.apache.servicemix.id.IdGenerator;
+import org.apache.servicemix.jbi.resolver.URIResolver;
+import org.apache.servicemix.jbi.util.IntrospectionSupport;
+import org.apache.servicemix.jbi.util.URISupport;
+
+/**
+ * Deploys the camel endpoints within JBI
+ * 
+ * @version $Revision: 426415 $
+ */
+public class CamelJbiComponent extends DefaultComponent implements Component<Exchange> {
+
+    protected CamelSpringDeployer deployer;
+
+    private JbiBinding binding;
+
+    private CamelContext camelContext;
+
+    private ScheduledExecutorService executorService;
+
+    private IdGenerator idGenerator;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.servicemix.common.BaseComponent#createServiceUnitManager()
+     */
+    @Override
+    public BaseServiceUnitManager createServiceUnitManager() {
+        Deployer[] deployers = new Deployer[] {new CamelSpringDeployer(this)};
+        return new BaseServiceUnitManager(this, deployers);
+    }
+
+    /**
+     * @return List of endpoints
+     * @see org.apache.servicemix.common.DefaultComponent#getConfiguredEndpoints()
+     */
+    @Override
+    protected List<CamelJbiEndpoint> getConfiguredEndpoints() {
+        return new ArrayList<CamelJbiEndpoint>();
+    }
+
+    /**
+     * @return Class[]
+     * @see org.apache.servicemix.common.DefaultComponent#getEndpointClasses()
+     */
+    @Override
+    protected Class[] getEndpointClasses() {
+        return new Class[] {CamelJbiEndpoint.class};
+    }
+
+    /**
+     * @return the binding
+     */
+    public JbiBinding getBinding() {
+        if (binding == null) {
+            binding = new JbiBinding();
+        }
+        return binding;
+    }
+
+    /**
+     * @param binding
+     *            the binding to set
+     */
+    public void setBinding(JbiBinding binding) {
+        this.binding = binding;
+    }
+
+    @Override
+    protected String[] getEPRProtocols() {
+        return new String[] {"camel"};
+    }
+
+    @Override
+    protected org.apache.servicemix.common.Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception {
+        CamelJbiEndpoint endpoint = createEndpoint(ep);
+        endpoint.activate();
+        return endpoint;
+    }
+
+    public CamelJbiEndpoint createEndpoint(ServiceEndpoint ep) throws URISyntaxException {
+        URI uri = new URI(ep.getEndpointName());
+        Map map = URISupport.parseQuery(uri.getQuery());
+        String camelUri = uri.getSchemeSpecificPart();
+        Endpoint camelEndpoint = getCamelContext().getEndpoint(camelUri);
+        Processor processor = createCamelProcessor(camelEndpoint);
+        CamelJbiEndpoint endpoint = new CamelJbiEndpoint(getServiceUnit(), camelEndpoint, getBinding(), processor);
+
+        IntrospectionSupport.setProperties(endpoint, map);
+
+        // TODO
+        // endpoint.setRole(MessageExchange.Role.PROVIDER);
+
+        return endpoint;
+    }
+
+    // Resolve Camel Endpoints
+    // -------------------------------------------------------------------------
+    public Endpoint<Exchange> createEndpoint(String uri) {
+        if (uri.startsWith("jbi:")) {
+            uri = uri.substring("jbi:".length());
+            return new JbiEndpoint(this, uri);
+        }
+        return null;
+    }
+
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    public ScheduledExecutorService getExecutorService() {
+        if (executorService == null) {
+            executorService = new ScheduledThreadPoolExecutor(5);
+        }
+        return executorService;
+    }
+
+    /**
+     * Activating a JBI endpoint created by a camel consumer.
+     * 
+     * @returns a JBI endpoint created for the given Camel endpoint
+     */
+    public CamelJbiEndpoint activateJbiEndpoint(Endpoint camelEndpoint, Processor processor) throws Exception {
+        CamelJbiEndpoint jbiEndpoint = createJbiEndpointFromCamel(camelEndpoint, processor);
+
+        // the following method will activate the new dynamic JBI endpoint
+        if (deployer != null) {
+            // lets add this to the current service unit being deployed
+            deployer.addService(jbiEndpoint);
+        } else {
+            addEndpoint(jbiEndpoint);
+        }
+        return jbiEndpoint;
+    }
+
+    public void deactivateJbiEndpoint(CamelJbiEndpoint jbiEndpoint) throws Exception {
+        // this will be done by the ServiceUnit
+        // jbiEndpoint.deactivate();
+    }
+
+    protected CamelJbiEndpoint createJbiEndpointFromCamel(Endpoint camelEndpoint, Processor processor) {
+        CamelJbiEndpoint jbiEndpoint;
+        String endpointUri = camelEndpoint.getEndpointUri();
+        if (camelEndpoint instanceof JbiEndpoint) {
+            QName service = null;
+            String endpoint = null;
+            if (endpointUri.startsWith("name:")) {
+                endpoint = endpointUri.substring("name:".length());
+                service = CamelJbiEndpoint.SERVICE_NAME;
+            } else if (endpointUri.startsWith("endpoint:")) {
+                String uri = endpointUri.substring("endpoint:".length());
+                // lets decode "serviceNamespace sep serviceName sep
+                // endpointName
+                String[] parts;
+                try {
+                    parts = URIResolver.split3(uri);
+                } catch (IllegalArgumentException e) {
+                    throw new IllegalArgumentException(
+                            "Expected syntax jbi:endpoint:[serviceNamespace][sep][serviceName][sep][endpointName] " 
+                            + "where sep = '/' or ':' depending on the serviceNamespace, but was given: "
+                                    + endpointUri + ". Cause: " + e, e);
+                }
+                service = new QName(parts[0], parts[1]);
+                endpoint = parts[2];
+            } else if (endpointUri.startsWith("service:")) {
+                String uri = endpointUri.substring("service:".length());
+                // lets decode "serviceNamespace sep serviceName
+                String[] parts;
+                try {
+                    parts = URIResolver.split2(uri);
+                } catch (IllegalArgumentException e) {
+                    throw new IllegalArgumentException(
+                            "Expected syntax jbi:endpoint:[serviceNamespace][sep][serviceName] " 
+                            + "where sep = '/' or ':' depending on the serviceNamespace, but was given: "
+                                    + endpointUri + ". Cause: " + e, e);
+                }
+                service = new QName(parts[0], parts[1]);
+                endpoint = createEndpointName();
+            } else {
+                throw new IllegalArgumentException(
+                        "Expected syntax jbi:endpoint:[serviceNamespace][sep][serviceName][sep][endpointName] " 
+                        + "or jbi:service:[serviceNamespace][sep][serviceName or jbi:name:[endpointName] but was given: "
+                                + endpointUri);
+            }
+            jbiEndpoint = new CamelJbiEndpoint(getServiceUnit(), service, endpoint, camelEndpoint, getBinding(), processor);
+        } else {
+            jbiEndpoint = new CamelJbiEndpoint(getServiceUnit(), camelEndpoint, getBinding(), processor);
+        }
+        return jbiEndpoint;
+    }
+
+    protected String createEndpointName() {
+        if (idGenerator == null) {
+            idGenerator = new IdGenerator("camel");
+        }
+        return idGenerator.generateSanitizedId();
+    }
+
+    /**
+     * Returns a JBI endpoint created for the given Camel endpoint
+     */
+    public CamelJbiEndpoint createJbiEndpointFromCamel(Endpoint camelEndpoint) {
+        Processor processor = createCamelProcessor(camelEndpoint);
+        return createJbiEndpointFromCamel(camelEndpoint, processor);
+    }
+
+    protected Processor createCamelProcessor(Endpoint camelEndpoint) {
+        Processor processor = null;
+        try {
+            processor = camelEndpoint.createProducer();
+        } catch (Exception e) {
+            throw new FailedToCreateProducerException(camelEndpoint, e);
+        }
+        return processor;
+    }
+
+    /**
+     * Should we expose the Camel JBI onto the NMR. <p/> We may wish to add some
+     * policy stuff etc.
+     * 
+     * @param endpoint
+     *            the camel endpoint
+     * @return true if the endpoint should be exposed in the NMR
+     */
+    public boolean isEndpointExposedOnNmr(Endpoint endpoint) {
+        // TODO we should only expose consuming endpoints
+        return !(endpoint instanceof JbiEndpoint);
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.common.endpoints.ProviderEndpoint;
+
+/**
+ * A JBI endpoint which when invoked will delegate to a Camel endpoint
+ * 
+ * @version $Revision: 426415 $
+ */
+public class CamelJbiEndpoint extends ProviderEndpoint {
+    public static final QName SERVICE_NAME = new QName("http://activemq.apache.org/camel/schema/jbi", "endpoint");
+
+    private static final transient Log LOG = LogFactory.getLog(CamelJbiEndpoint.class);
+
+    private Endpoint camelEndpoint;
+
+    private JbiBinding binding;
+
+    private Processor camelProcessor;
+
+    public CamelJbiEndpoint(ServiceUnit serviceUnit, QName service, String endpoint, Endpoint camelEndpoint, JbiBinding binding,
+            Processor camelProcessor) {
+        super(serviceUnit, service, endpoint);
+        this.camelProcessor = camelProcessor;
+        this.camelEndpoint = camelEndpoint;
+        this.binding = binding;
+    }
+
+    public CamelJbiEndpoint(ServiceUnit serviceUnit, Endpoint camelEndpoint, JbiBinding binding, Processor camelProcesso) {
+        this(serviceUnit, SERVICE_NAME, camelEndpoint.getEndpointUri(), camelEndpoint, binding, camelProcesso);
+    }
+
+    @Override
+    protected void processInOnly(MessageExchange exchange, NormalizedMessage in) throws Exception {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Received exchange: " + exchange);
+        }
+        JbiExchange camelExchange = new JbiExchange(camelEndpoint.getContext(), binding, exchange);
+        camelProcessor.process(camelExchange);
+    }
+
+    @Override
+    protected void processInOut(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws Exception {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Received exchange: " + exchange);
+        }
+        /*
+         * ToDo
+         */
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelJbiEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,121 @@
+/*
+ * 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.servicemix.camel;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.jbi.management.DeploymentException;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.common.xbean.AbstractXBeanDeployer;
+import org.apache.xbean.kernel.Kernel;
+import org.apache.xbean.server.spring.loader.PureSpringLoader;
+import org.apache.xbean.server.spring.loader.SpringLoader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+
+/**
+ * A deployer of the spring XML file
+ * 
+ * @version $Revision: 1.1 $
+ */
+public class CamelSpringDeployer extends AbstractXBeanDeployer {
+    private final CamelJbiComponent component;
+
+    private PureSpringLoader springLoader = new PureSpringLoader() {
+        @Override
+        protected AbstractXmlApplicationContext createXmlApplicationContext(String configLocation) {
+            return new FileSystemXmlApplicationContext(new String[] {configLocation}, false, createParentApplicationContext());
+        }
+    };
+
+    private List<CamelJbiEndpoint> activatedEndpoints = new ArrayList<CamelJbiEndpoint>();
+
+    public CamelSpringDeployer(CamelJbiComponent component) {
+        super(component);
+        this.component = component;
+    }
+
+    @Override
+    protected String getXBeanFile() {
+        return "camel-context";
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.servicemix.common.Deployer#deploy(java.lang.String,
+     *      java.lang.String)
+     */
+    @Override
+    public ServiceUnit deploy(String serviceUnitName, String serviceUnitRootPath) throws DeploymentException {
+        // lets register the deployer so that any endpoints activated are added
+        // to this SU
+        component.deployer = this;
+        return super.deploy(serviceUnitName, serviceUnitRootPath);
+    }
+
+    public void addService(CamelJbiEndpoint endpoint) {
+        activatedEndpoints.add(endpoint);
+    }
+
+    @Override
+    protected List getServices(Kernel kernel) {
+        try {
+            List<CamelJbiEndpoint> services = new ArrayList<CamelJbiEndpoint>(activatedEndpoints);
+            activatedEndpoints.clear();
+
+            ApplicationContext applicationContext = springLoader.getApplicationContext();
+            SpringCamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
+
+            // now lets iterate through all the endpoints
+            Collection<Endpoint> endpoints = camelContext.getSingletonEndpoints();
+            for (Endpoint endpoint : endpoints) {
+                if (component.isEndpointExposedOnNmr(endpoint)) {
+                    services.add(component.createJbiEndpointFromCamel(endpoint));
+                }
+            }
+            return services;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    protected SpringLoader createSpringLoader() {
+        return springLoader;
+    }
+
+    /**
+     * Returns the parent application context which can be used to auto-wire any
+     * JBI based components using the jbi prefix
+     */
+    protected ApplicationContext createParentApplicationContext() {
+        GenericApplicationContext answer = new GenericApplicationContext();
+        answer.getBeanFactory().registerSingleton("jbi", component);
+        answer.start();
+        answer.refresh();
+        return answer;
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/CamelSpringDeployer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/FromJbiProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/FromJbiProcessor.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/FromJbiProcessor.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/FromJbiProcessor.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Processor;
+import org.apache.servicemix.MessageExchangeListener;
+
+/**
+ * @version $Revision: 563665 $
+ */
+public class FromJbiProcessor implements MessageExchangeListener {
+    private CamelContext context;
+
+    private JbiBinding binding;
+
+    private Processor processor;
+
+    public FromJbiProcessor(CamelContext context, JbiBinding binding, Processor processor) {
+        this.context = context;
+        this.binding = binding;
+        this.processor = processor;
+    }
+
+    public void onMessageExchange(MessageExchange messageExchange) throws MessagingException {
+        try {
+            JbiExchange exchange = new JbiExchange(context, binding, messageExchange);
+            processor.process(exchange);
+        } catch (Exception e) {
+            throw new MessagingException(e);
+        }
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/FromJbiProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,82 @@
+/*
+ * 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.servicemix.camel;
+
+import java.io.StringReader;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.camel.Exchange;
+
+/**
+ * The binding of how Camel messages get mapped to JBI and back again
+ * 
+ * @version $Revision: 563665 $
+ */
+public class JbiBinding {
+    /**
+     * Extracts the body from the given normalized message
+     */
+    public Object extractBodyFromJbi(JbiExchange exchange, NormalizedMessage normalizedMessage) {
+        // TODO we may wish to turn this into a POJO such as a JAXB/DOM
+        return normalizedMessage.getContent();
+    }
+
+    public MessageExchange makeJbiMessageExchange(Exchange camelExchange, MessageExchangeFactory exchangeFactory) 
+        throws MessagingException {
+        
+        MessageExchange jbiExchange = createJbiMessageExchange(camelExchange, exchangeFactory);
+        NormalizedMessage normalizedMessage = jbiExchange.getMessage("in");
+        if (normalizedMessage == null) {
+            normalizedMessage = jbiExchange.createMessage();
+            jbiExchange.setMessage(normalizedMessage, "in");
+        }
+        normalizedMessage.setContent(getJbiInContent(camelExchange));
+        addJbiHeaders(jbiExchange, normalizedMessage, camelExchange);
+        return jbiExchange;
+    }
+
+    protected MessageExchange createJbiMessageExchange(Exchange camelExchange, MessageExchangeFactory exchangeFactory)
+        throws MessagingException {
+        
+        // TODO we should deal with other forms of MEP
+        return exchangeFactory.createInOnlyExchange();
+    }
+
+    protected Source getJbiInContent(Exchange camelExchange) {
+        // TODO this should be more smart
+        Object value = camelExchange.getIn().getBody();
+        if (value instanceof String) {
+            return new StreamSource(new StringReader(value.toString()));
+        }
+        return camelExchange.getIn().getBody(Source.class);
+    }
+
+    protected void addJbiHeaders(MessageExchange jbiExchange, NormalizedMessage normalizedMessage, Exchange camelExchange) {
+        Set<Map.Entry<String, Object>> entries = camelExchange.getIn().getHeaders().entrySet();
+        for (Map.Entry<String, Object> entry : entries) {
+            normalizedMessage.setProperty(entry.getKey(), entry.getValue());
+        }
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiEndpoint.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiEndpoint.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiEndpoint.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,82 @@
+/*
+ * 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.servicemix.camel;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultProducer;
+
+/**
+ * Represents an {@link org.apache.camel.Endpoint} for interacting with JBI
+ * 
+ * @version $Revision: 563665 $
+ */
+public class JbiEndpoint extends DefaultEndpoint<Exchange> {
+    private Processor toJbiProcessor;
+
+    private final CamelJbiComponent jbiComponent;
+
+    public JbiEndpoint(CamelJbiComponent jbiComponent, String uri) {
+        super(uri, jbiComponent);
+        this.jbiComponent = jbiComponent;
+        toJbiProcessor = new ToJbiProcessor(jbiComponent.getBinding(), jbiComponent.getComponentContext(), uri);
+    }
+
+    public Producer<Exchange> createProducer() throws Exception {
+        return new DefaultProducer<Exchange>(this) {
+            public void process(Exchange exchange) throws Exception {
+                toJbiProcessor.process(exchange);
+            }
+        };
+    }
+
+    public Consumer<Exchange> createConsumer(final Processor processor) throws Exception {
+        return new DefaultConsumer<Exchange>(this, processor) {
+            CamelJbiEndpoint jbiEndpoint;
+
+            @Override
+            protected void doStart() throws Exception {
+                super.doStart();
+                jbiEndpoint = jbiComponent.activateJbiEndpoint(JbiEndpoint.this, processor);
+            }
+
+            @Override
+            protected void doStop() throws Exception {
+                if (jbiEndpoint != null) {
+                    jbiComponent.deactivateJbiEndpoint(jbiEndpoint);
+                }
+                super.doStop();
+            }
+        };
+    }
+
+    public JbiExchange createExchange() {
+        return new JbiExchange(getContext(), getBinding());
+    }
+
+    public JbiBinding getBinding() {
+        return jbiComponent.getBinding();
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiException.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiException.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiException.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiException.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.servicemix.camel;
+
+import org.apache.camel.RuntimeCamelException;
+
+/**
+ * @version $Revision: 563665 $
+ */
+public class JbiException extends RuntimeCamelException {
+    public JbiException(Throwable cause) {
+        super(cause);
+    }
+
+    public JbiException(String message) {
+        super(message);
+    }
+
+    public JbiException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,133 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultExchange;
+
+/**
+ * An {@link org.apache.camel.Exchange} working with JBI which exposes the underlying JBI
+ * features such as the JBI {@link #getMessageExchange()},
+ * {@link #getInMessage()} and {@link #getOutMessage()}
+ * 
+ * @version $Revision: 563665 $
+ */
+public class JbiExchange extends DefaultExchange {
+    private final JbiBinding binding;
+
+    private MessageExchange messageExchange;
+
+    public JbiExchange(CamelContext context, JbiBinding binding) {
+        super(context);
+        this.binding = binding;
+    }
+
+    public JbiExchange(CamelContext context, JbiBinding binding, MessageExchange messageExchange) {
+        super(context);
+        this.binding = binding;
+        this.messageExchange = messageExchange;
+
+        // TODO we could maybe use the typesafe APIs of different derived APIs
+        // from JBI
+        setIn(new JbiMessage(messageExchange.getMessage("in")));
+        setOut(new JbiMessage(messageExchange.getMessage("out")));
+        setFault(new JbiMessage(messageExchange.getMessage("fault")));
+    }
+
+    @Override
+    public JbiMessage getIn() {
+        return (JbiMessage) super.getIn();
+    }
+
+    @Override
+    public JbiMessage getOut() {
+        return (JbiMessage) super.getOut();
+    }
+
+    @Override
+    public JbiMessage getOut(boolean lazyCreate) {
+        return (JbiMessage) super.getOut(lazyCreate);
+    }
+
+    @Override
+    public JbiMessage getFault() {
+        return (JbiMessage) super.getFault();
+    }
+
+    /**
+     * @return the Camel <-> JBI binding
+     */
+    public JbiBinding getBinding() {
+        return binding;
+    }
+
+    // Expose JBI features
+    // -------------------------------------------------------------------------
+
+    /**
+     * Returns the underlying JBI message exchange for an inbound exchange or
+     * null for outbound messages
+     * 
+     * @return the inbound message exchange
+     */
+    public MessageExchange getMessageExchange() {
+        return messageExchange;
+    }
+
+    /**
+     * Returns the underlying In {@link NormalizedMessage}
+     * 
+     * @return the In message
+     */
+    public NormalizedMessage getInMessage() {
+        return getIn().getNormalizedMessage();
+    }
+
+    /**
+     * Returns the underlying Out {@link NormalizedMessage}
+     * 
+     * @return the Out message
+     */
+    public NormalizedMessage getOutMessage() {
+        return getOut().getNormalizedMessage();
+    }
+
+    /**
+     * Returns the underlying Fault {@link NormalizedMessage}
+     * 
+     * @return the Fault message
+     */
+    public NormalizedMessage getFaultMessage() {
+        return getFault().getNormalizedMessage();
+    }
+
+    // Implementation methods
+    // -------------------------------------------------------------------------
+
+    @Override
+    protected JbiMessage createInMessage() {
+        return new JbiMessage();
+    }
+
+    @Override
+    protected JbiMessage createOutMessage() {
+        return new JbiMessage();
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.servicemix.camel;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.camel.impl.DefaultMessage;
+
+/**
+ * A JBI {@link org.apache.camel.Message} which provides access to the underlying JBI features
+ * such as {@link #getNormalizedMessage()}
+ * 
+ * @version $Revision: 563665 $
+ */
+public class JbiMessage extends DefaultMessage {
+    private NormalizedMessage normalizedMessage;
+
+    public JbiMessage() {
+    }
+
+    public JbiMessage(NormalizedMessage normalizedMessage) {
+        this.normalizedMessage = normalizedMessage;
+    }
+
+    @Override
+    public String toString() {
+        if (normalizedMessage != null) {
+            return "JbiMessage: " + normalizedMessage;
+        } else {
+            return "JbiMessage: " + getBody();
+        }
+    }
+
+    @Override
+    public JbiExchange getExchange() {
+        return (JbiExchange) super.getExchange();
+    }
+
+    /**
+     * Returns the underlying JBI message
+     * 
+     * @return the underlying JBI message
+     */
+    public NormalizedMessage getNormalizedMessage() {
+        return normalizedMessage;
+    }
+
+    public void setNormalizedMessage(NormalizedMessage normalizedMessage) {
+        this.normalizedMessage = normalizedMessage;
+    }
+
+    @Override
+    public Object getHeader(String name) {
+        Object answer = null;
+        if (normalizedMessage != null) {
+            answer = normalizedMessage.getProperty(name);
+        }
+        if (answer == null) {
+            answer = super.getHeader(name);
+        }
+        return answer;
+    }
+
+    @Override
+    public JbiMessage newInstance() {
+        return new JbiMessage();
+    }
+
+    @Override
+    protected Object createBody() {
+        if (normalizedMessage != null) {
+            return getExchange().getBinding().extractBodyFromJbi(getExchange(), normalizedMessage);
+        }
+        return null;
+    }
+
+    @Override
+    protected void populateInitialHeaders(Map<String, Object> map) {
+        if (normalizedMessage != null) {
+            Iterator iter = normalizedMessage.getPropertyNames().iterator();
+            while (iter.hasNext()) {
+                String name = iter.next().toString();
+                Object value = normalizedMessage.getProperty(name);
+                map.put(name, value);
+            }
+        }
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java?view=auto&rev=564165
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java Thu Aug  9 03:47:05 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.servicemix.camel;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.servicemix.jbi.resolver.URIResolver;
+
+/**
+ * A
+ * 
+ * @{link Processor} which takes a Camel {@link Exchange} and invokes it into
+ *        JBI using the straight JBI API
+ * @version $Revision: 563665 $
+ */
+public class ToJbiProcessor implements Processor {
+    private JbiBinding binding;
+
+    private ComponentContext componentContext;
+
+    private String destinationUri;
+
+    public ToJbiProcessor(JbiBinding binding, ComponentContext componentContext, String destinationUri) {
+        this.binding = binding;
+        this.componentContext = componentContext;
+        this.destinationUri = destinationUri;
+    }
+
+    public void process(Exchange exchange) {
+        try {
+            DeliveryChannel deliveryChannel = componentContext.getDeliveryChannel();
+            MessageExchangeFactory exchangeFactory = deliveryChannel.createExchangeFactory();
+            MessageExchange messageExchange = binding.makeJbiMessageExchange(exchange, exchangeFactory);
+
+            URIResolver.configureExchange(messageExchange, componentContext, destinationUri);
+            deliveryChannel.sendSync(messageExchange);
+        } catch (MessagingException e) {
+            throw new JbiException(e);
+        }
+    }
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message