camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r684667 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/impl/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ components/camel-http/src/main/java/org/apache...
Date Mon, 11 Aug 2008 08:32:13 GMT
Author: davsclaus
Date: Mon Aug 11 01:32:12 2008
New Revision: 684667

URL: http://svn.apache.org/viewvc?rev=684667&view=rev
Log:
CAMEL-806: Introduced isLenientProperties() on Endpoint to allow http based components to
run in non strict URI parameter mode, so you are able to add dynamic URI reguest parameters
on the URI configured endpoint. This of course also applies for other types of components
that needs this kind of behavior. Thanks to Stephan for the unit test to verify the bug.

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
    activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithHeadersTest.java
    activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java Mon Aug 11
01:32:12 2008
@@ -113,4 +113,21 @@
     
     @Deprecated
     void setContext(CamelContext context);
+
+    /**
+     * Should all properties be known or does the endpoint allow unknown options?
+     * <p/>
+     * <tt>Lenient = false</tt> means that the endpoint should validate that
all
+     * given options is known and configured properly
+     * <tt>lenient = true</tt> means that the endpoint allows additional unknown
options to
+     * be passed to it but does not throw a ResolveEndpointFailedException when creating
+     * the endpoint.
+     * <p/>
+     * This options is used by a few components for instance the HTTP based that can have
+     * dynamic URI options appended that is targeted for an external system.
+     * <p/>
+     * Most endpoints is configued to be <b>not</b> lenient.
+     */
+    boolean isLenientProperties();
+    
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
Mon Aug 11 01:32:12 2008
@@ -87,8 +87,9 @@
                 setProperties(endpoint, parameters);
             }
 
+            // if endpoint is strict (not lenient) and we have unknown parameters configured
then
             // fail if there are parameters that could not be set, then they are probably
miss spelt or not supported at all
-            if (parameters.size() > 0) {
+            if (!endpoint.isLenientProperties() && parameters.size() > 0) {
                 throw new ResolveEndpointFailedException(uri, "There are " + parameters.size()
                     + " parameters that couldn't be set on the endpoint."
                     + " Check the uri if the parameters are spelt correctly and that they
are properties of the endpoint."

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
Mon Aug 11 01:32:12 2008
@@ -208,4 +208,9 @@
         setCamelContext(context);
     }
 
+    public boolean isLenientProperties() {
+        // default should be false for most components
+        return false;
+    }
+
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
(original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
Mon Aug 11 01:32:12 2008
@@ -178,4 +178,9 @@
     public HeaderFilterStrategy getHeaderFilterStrategy() {
         return headerFilterStrategy;
     }
+
+    public boolean isLenientProperties() {
+        return false;
+    }
+
 }

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
(original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
Mon Aug 11 01:32:12 2008
@@ -105,6 +105,5 @@
 
     public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
         headerFilterStrategy = strategy;
-        
     }
 }

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
(original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
Mon Aug 11 01:32:12 2008
@@ -98,6 +98,11 @@
         component.disconnect(consumer);
     }
 
+    @Override
+    public boolean isLenientProperties() {
+        // true to allow dynamic URI options to be configured and passed to external system
for eg. the HttpProducer
+        return true;
+    }
 
     // Properties
     //-------------------------------------------------------------------------

Modified: activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithHeadersTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithHeadersTest.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithHeadersTest.java
(original)
+++ activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithHeadersTest.java
Mon Aug 11 01:32:12 2008
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.http;
 
 import org.apache.camel.builder.RouteBuilder;

Modified: activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java?rev=684667&r1=684666&r2=684667&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
(original)
+++ activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithQueryParamsTest.java
Mon Aug 11 01:32:12 2008
@@ -16,12 +16,8 @@
  */
 package org.apache.camel.component.http;
 
-
 /**
- * TODO Provide description for HttpGetWithQueryParamsTest.
- *
- * @author <a href="mailto:nsandhu@raleys.com">nsandhu</a>
- *
+ * @version $Revision$ 
  */
 public class HttpGetWithQueryParamsTest extends HttpGetTest {
     protected void setUp() throws Exception {



Mime
View raw message