Author: ningjiang
Date: Wed Dec 10 22:37:24 2008
New Revision: 725596

URL: http://svn.apache.org/viewvc?rev=725596&view=rev
Log:
Merged revisions 725309,725314,725320 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r725309 | jstrachan | 2008-12-10 23:39:08 +0800 (Wed, 10 Dec 2008) | 1 line
  
  added initial JAXB change for CAMEL-1171
........
  r725314 | jstrachan | 2008-12-10 23:43:35 +0800 (Wed, 10 Dec 2008) | 1 line
  
  minor refactor to simplify the code a little for CAMEL-1171
........
  r725320 | jstrachan | 2008-12-11 00:12:41 +0800 (Thu, 11 Dec 2008) | 1 line
  
  fixed broken build due to previous fix for CAMEL-1171
........

Added:
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
      - copied, changed from r725320, 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOutType.java
      - copied, changed from r725320, 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOutType.java
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SendType.java
      - copied, changed from r725320, 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java
Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
    
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
    
activemq/camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Dec 10 22:37:24 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320

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

Copied: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
 (from r725320, 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java)
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java?p2=activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java&r1=725320&r2=725596&rev=725596&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOnlyType.java
 Wed Dec 10 22:37:24 2008
@@ -16,14 +16,13 @@
  */
 package org.apache.camel.model;
 
-import org.apache.camel.Endpoint;
-import org.apache.camel.ExchangePattern;
-
 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 org.apache.camel.Endpoint;
+import org.apache.camel.ExchangePattern;
+
 /**
  * Represents an XML <inOnly/> element
  *

Copied: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOutType.java
 (from r725320, 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOutType.java)
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOutType.java?p2=activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOutType.java&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOutType.java&r1=725320&r2=725596&rev=725596&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InOutType.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/InOutType.java
 Wed Dec 10 22:37:24 2008
@@ -16,14 +16,13 @@
  */
 package org.apache.camel.model;
 
-import org.apache.camel.Endpoint;
-import org.apache.camel.ExchangePattern;
-
 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 org.apache.camel.Endpoint;
+import org.apache.camel.ExchangePattern;
+
 /**
  * Represents an XML <inOut/> element
  *

Copied: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SendType.java
 (from r725320, 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java)
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SendType.java?p2=activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SendType.java&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java&r1=725320&r2=725596&rev=725596&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SendType.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SendType.java
 Wed Dec 10 22:37:24 2008
@@ -1,5 +1,4 @@
 /**
- *
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -17,6 +16,14 @@
  */
 package org.apache.camel.model;
 
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+
 import org.apache.camel.Endpoint;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
@@ -24,14 +31,6 @@
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.ObjectHelper;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlType;
-import java.util.Collections;
-import java.util.List;
-
 /**
  * Base class for sending to an endpoint with an optional [EMAIL PROTECTED] 
ExchangePattern}
  *

Modified: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java?rev=725596&r1=725595&r2=725596&view=diff
==============================================================================
--- 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ToType.java
 Wed Dec 10 22:37:24 2008
@@ -16,20 +16,13 @@
  */
 package org.apache.camel.model;
 
-import java.util.Collections;
-import java.util.List;
-
 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;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.processor.SendProcessor;
-import org.apache.camel.spi.RouteContext;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.ExchangePattern;
 
 /**
  * Represents an XML <to/> element
@@ -38,13 +31,10 @@
  */
 @XmlRootElement(name = "to")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class ToType extends ProcessorType<ProcessorType> {
-    @XmlAttribute
-    private String uri;
-    @XmlAttribute
-    private String ref;
+public class ToType extends SendType<ToType> {
+    //@XmlAttribute(required = false)
     @XmlTransient
-    private Endpoint endpoint;
+    private ExchangePattern pattern;
 
     public ToType() {
     }
@@ -68,73 +58,15 @@
     }
 
     @Override
-    public String getLabel() {
-        return FromType.description(getUri(), getRef(), getEndpoint());
-    }
-
-    @Override
-    public Processor createProcessor(RouteContext routeContext) throws 
Exception {
-        Endpoint endpoint = resolveEndpoint(routeContext);
-        return new SendProcessor(endpoint);
-    }
-
-    public Endpoint resolveEndpoint(RouteContext context) {
-        if (endpoint == null) {
-            endpoint = context.resolveEndpoint(getUri(), getRef());
-        }
-        return endpoint;
-    }
-
-    // Properties
-    // -----------------------------------------------------------------------
-    public String getUri() {
-        return uri;
-    }
-
-    /**
-     * Sets the URI of the endpoint to use
-     *
-     * @param uri the endpoint URI to use
-     */
-    public void setUri(String uri) {
-        this.uri = uri;
-    }
-
-    public String getRef() {
-        return ref;
+    public ExchangePattern getPattern() {
+        return pattern;
     }
 
     /**
-     * Sets the name of the endpoint within the registry (such as the Spring
-     * ApplicationContext or JNDI) to use
-     *
-     * @param ref the reference name to use
+     * Sets the optional [EMAIL PROTECTED] ExchangePattern} used to invoke 
this endpoint
      */
-    public void setRef(String ref) {
-        this.ref = ref;
+    public void setPattern(ExchangePattern pattern) {
+        this.pattern = pattern;
     }
 
-    public Endpoint getEndpoint() {
-        return endpoint;
-    }
-
-    public void setEndpoint(Endpoint endpoint) {
-        this.endpoint = endpoint;
-    }
-
-    public List<ProcessorType<?>> getOutputs() {
-        return Collections.EMPTY_LIST;
-    }
-
-    /**
-     * Returns the endpoint URI or the name of the reference to it
-     */
-    public Object getUriOrRef() {
-        if (ObjectHelper.isNullOrBlank(uri)) {
-            return uri;
-        } else if (endpoint != null) {
-            return endpoint.getEndpointUri();
-        }
-        return ref;
-    }
 }

Modified: 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java?rev=725596&r1=725595&r2=725596&view=diff
==============================================================================
--- 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
 Wed Dec 10 22:37:24 2008
@@ -20,6 +20,7 @@
 import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
 import org.apache.camel.Producer;
 import org.apache.camel.Service;
 import org.apache.camel.impl.ServiceSupport;
@@ -37,6 +38,7 @@
     private Endpoint destination;
     private Producer producer;
     private AsyncProcessor processor;
+    private ExchangePattern pattern;
 
     public SendProcessor(Endpoint destination) {
         if (destination == null) {
@@ -45,9 +47,14 @@
         this.destination = destination;
     }
 
+    public SendProcessor(Endpoint destination, ExchangePattern pattern) {
+        this(destination);
+        this.pattern = pattern;
+    }
+
     @Override
     public String toString() {
-        return "sendTo(" + destination + ")";
+        return "sendTo(" + destination + (pattern != null ? " " + pattern : 
"") + ")";
     }
 
     public void process(Exchange exchange) throws Exception {
@@ -58,6 +65,7 @@
                 throw new IllegalStateException("No producer, this processor 
has not been started!");
             }
         } else {
+            configureExchange(exchange);
             producer.process(exchange);
         }
     }
@@ -72,10 +80,11 @@
             callback.done(true);
             return true;
         } else {
+            configureExchange(exchange);
             return processor.process(exchange, callback);
         }
     }
-    
+
     public Endpoint getDestination() {
         return destination;
     }
@@ -97,4 +106,9 @@
         }
     }
 
+    protected void configureExchange(Exchange exchange) {
+        if (pattern != null) {
+            exchange.setPattern(pattern);
+        }
+    }
 }

Modified: 
activemq/camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
URL: 
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index?rev=725596&r1=725595&r2=725596&view=diff
==============================================================================
--- 
activemq/camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
 (original)
+++ 
activemq/camel/branches/camel-1.x/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
 Wed Dec 10 22:37:24 2008
@@ -28,6 +28,8 @@
 FinallyType
 FromType
 IdempotentConsumerType
+InOnlyType
+InOutType
 InterceptType
 InterceptorRef
 InterceptorType


Reply via email to