You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by wt...@apache.org on 2009/03/22 18:00:08 UTC

svn commit: r757216 - in /camel/trunk/camel-core/src/main/java/org/apache/camel: CamelContext.java MessageConverter.java impl/DefaultCamelContext.java

Author: wtam
Date: Sun Mar 22 17:00:07 2009
New Revision: 757216

URL: http://svn.apache.org/viewvc?rev=757216&view=rev
Log:
[CAMEL-1476]  Set property in the exchange to identify CXF component DataFormat mode (payload, message, or pojo)

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java   (with props)
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?rev=757216&r1=757215&r2=757216&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java Sun Mar 22 17:00:07 2009
@@ -258,6 +258,13 @@
     TypeConverterRegistry getTypeConverterRegistry();
 
     /**
+     * Returns the converter of message from one type to another
+     * 
+     * @return
+     */
+    MessageConverter getMessageConverter();
+    
+    /**
      * Returns the registry used to lookup components by name and type such as the Spring ApplicationContext,
      * JNDI or the OSGi Service Registry
      *

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java?rev=757216&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java Sun Mar 22 17:00:07 2009
@@ -0,0 +1,46 @@
+/**
+ * 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;
+
+/**
+ * This converter is capable of converting from one message 
+ * @version $Revision$
+ * @since 2.0
+ */
+public interface MessageConverter {
+    
+    /**
+     * Converts the IN message of a given Camel Exchange to the new type
+     * 
+     * @param <T> the new type
+     * @param type the new class type
+     * @param exchange the exchange that contains the source message
+     * @return
+     */
+    <T> T convertInMessageTo(Class<T> type, Exchange exchange);
+    
+    /**
+     * Converts the OUT message of a given Camel Exchange to the new type
+     * 
+     * @param <T>
+     * @param type
+     * @param exchange
+     * @return
+     */
+    <T> T convertOutMessageTo(Class<T> type, Exchange exchange);
+
+}

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=757216&r1=757215&r2=757216&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Sun Mar 22 17:00:07 2009
@@ -31,6 +31,7 @@
 import org.apache.camel.Component;
 import org.apache.camel.Endpoint;
 import org.apache.camel.IsSingleton;
+import org.apache.camel.MessageConverter;
 import org.apache.camel.NoFactoryAvailableException;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
@@ -608,6 +609,10 @@
     public void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry) {
         this.typeConverterRegistry = typeConverterRegistry;
     }
+    
+    public MessageConverter getMessageConverter() {
+        return null;
+    }
 
     public Injector getInjector() {
         if (injector == null) {



Re: svn commit: r757216 - in /camel/trunk/camel-core/src/main/java/org/apache/camel: CamelContext.java MessageConverter.java impl/DefaultCamelContext.java

Posted by William Tam <em...@gmail.com>.
Oops,  got the wrong stuff.  I'll first revert it and re-submit.

On Sun, Mar 22, 2009 at 1:00 PM,  <wt...@apache.org> wrote:
> Author: wtam
> Date: Sun Mar 22 17:00:07 2009
> New Revision: 757216
>
> URL: http://svn.apache.org/viewvc?rev=757216&view=rev
> Log:
> [CAMEL-1476]  Set property in the exchange to identify CXF component DataFormat mode (payload, message, or pojo)
>
> Added:
>    camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java   (with props)
> Modified:
>    camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
>    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
>
> Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
> URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?rev=757216&r1=757215&r2=757216&view=diff
> ==============================================================================
> --- camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java (original)
> +++ camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java Sun Mar 22 17:00:07 2009
> @@ -258,6 +258,13 @@
>     TypeConverterRegistry getTypeConverterRegistry();
>
>     /**
> +     * Returns the converter of message from one type to another
> +     *
> +     * @return
> +     */
> +    MessageConverter getMessageConverter();
> +
> +    /**
>      * Returns the registry used to lookup components by name and type such as the Spring ApplicationContext,
>      * JNDI or the OSGi Service Registry
>      *
>
> Added: camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java
> URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java?rev=757216&view=auto
> ==============================================================================
> --- camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java (added)
> +++ camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java Sun Mar 22 17:00:07 2009
> @@ -0,0 +1,46 @@
> +/**
> + * 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;
> +
> +/**
> + * This converter is capable of converting from one message
> + * @version $Revision$
> + * @since 2.0
> + */
> +public interface MessageConverter {
> +
> +    /**
> +     * Converts the IN message of a given Camel Exchange to the new type
> +     *
> +     * @param <T> the new type
> +     * @param type the new class type
> +     * @param exchange the exchange that contains the source message
> +     * @return
> +     */
> +    <T> T convertInMessageTo(Class<T> type, Exchange exchange);
> +
> +    /**
> +     * Converts the OUT message of a given Camel Exchange to the new type
> +     *
> +     * @param <T>
> +     * @param type
> +     * @param exchange
> +     * @return
> +     */
> +    <T> T convertOutMessageTo(Class<T> type, Exchange exchange);
> +
> +}
>
> Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/MessageConverter.java
> ------------------------------------------------------------------------------
>    svn:keywords = Rev Date
>
> Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
> URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=757216&r1=757215&r2=757216&view=diff
> ==============================================================================
> --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
> +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Sun Mar 22 17:00:07 2009
> @@ -31,6 +31,7 @@
>  import org.apache.camel.Component;
>  import org.apache.camel.Endpoint;
>  import org.apache.camel.IsSingleton;
> +import org.apache.camel.MessageConverter;
>  import org.apache.camel.NoFactoryAvailableException;
>  import org.apache.camel.Processor;
>  import org.apache.camel.ProducerTemplate;
> @@ -608,6 +609,10 @@
>     public void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry) {
>         this.typeConverterRegistry = typeConverterRegistry;
>     }
> +
> +    public MessageConverter getMessageConverter() {
> +        return null;
> +    }
>
>     public Injector getInjector() {
>         if (injector == null) {
>
>
>