You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/07 12:24:01 UTC

[1/2] camel git commit: Support for PATCH method in Rest DSL

Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x cef2609c5 -> 18eef8c05
  refs/heads/master b494104ad -> 0832d3c97


Support for PATCH method in Rest DSL

Added new verb to the Rest model, the PatchVerbDefinition and made made
the jaxb parser aware of this new file.
Added instructions in RestDefinition and VerbDefinition on how to handle
this new verb.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/18eef8c0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/18eef8c0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/18eef8c0

Branch: refs/heads/camel-2.17.x
Commit: 18eef8c05656a37fbf00db0f30cdb467e38b92a2
Parents: cef2609
Author: Martin Lind <ma...@spegelreflex.se>
Authored: Thu Apr 7 08:58:38 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 12:17:44 2016 +0200

----------------------------------------------------------------------
 .../camel/model/rest/PatchVerbDefinition.java   | 33 ++++++++++++++++++++
 .../apache/camel/model/rest/RestDefinition.java | 10 ++++++
 .../apache/camel/model/rest/VerbDefinition.java |  2 ++
 .../org/apache/camel/model/rest/jaxb.index      |  3 +-
 4 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/18eef8c0/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java
new file mode 100644
index 0000000..0fd7980
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java
@@ -0,0 +1,33 @@
+/**
+ * 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.model.rest;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.camel.spi.Metadata;
+
+/**
+ * Rest PATCH command
+ */
+@Metadata(label = "rest")
+@XmlRootElement(name = "patch")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PatchVerbDefinition extends VerbDefinition {
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/18eef8c0/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 85ddc08..5084b38 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -236,6 +236,14 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         return addVerb("put", uri);
     }
 
+    public RestDefinition patch() {
+        return addVerb("patch", null);
+    }
+
+    public RestDefinition patch(String uri) {
+        return addVerb("patch", uri);
+    }
+
     public RestDefinition delete() {
         return addVerb("delete", null);
     }
@@ -564,6 +572,8 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
             answer = new HeadVerbDefinition();
         } else if ("put".equals(verb)) {
             answer = new PutVerbDefinition();
+        } else if ("patch".equals(verb)) {
+            answer = new PatchVerbDefinition();
         } else if ("options".equals(verb)) {
             answer = new OptionsVerbDefinition();
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/18eef8c0/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 744a99c..be27799 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -393,6 +393,8 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
             return "post";
         } else if (this instanceof PutVerbDefinition) {
             return "put";
+        } else if (this instanceof PatchVerbDefinition) {
+            return "patch";
         } else if (this instanceof DeleteVerbDefinition) {
             return "delete";
         } else if (this instanceof HeadVerbDefinition) {

http://git-wip-us.apache.org/repos/asf/camel/blob/18eef8c0/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
----------------------------------------------------------------------
diff --git a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
index 809e195..3951a7e 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
@@ -21,6 +21,7 @@ HeadVerbDefinition
 OptionsVerbDefinition
 PostVerbDefinition
 PutVerbDefinition
+PatchVerbDefinition
 RestBindingDefinition
 RestBindingMode
 RestConfigurationDefinition
@@ -32,4 +33,4 @@ RestOperationResponseHeaderDefinition
 RestParamType
 RestPropertyDefinition
 RestsDefinition
-VerbDefinition
\ No newline at end of file
+VerbDefinition


[2/2] camel git commit: Support for PATCH method in Rest DSL

Posted by da...@apache.org.
Support for PATCH method in Rest DSL

Added new verb to the Rest model, the PatchVerbDefinition and made made
the jaxb parser aware of this new file.
Added instructions in RestDefinition and VerbDefinition on how to handle
this new verb.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0832d3c9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0832d3c9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0832d3c9

Branch: refs/heads/master
Commit: 0832d3c97ac233b2ad9cf687bcabdd644ea87b29
Parents: b494104
Author: Martin Lind <ma...@spegelreflex.se>
Authored: Thu Apr 7 08:58:38 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 12:18:06 2016 +0200

----------------------------------------------------------------------
 .../camel/model/rest/PatchVerbDefinition.java   | 33 ++++++++++++++++++++
 .../apache/camel/model/rest/RestDefinition.java | 10 ++++++
 .../apache/camel/model/rest/VerbDefinition.java |  2 ++
 .../org/apache/camel/model/rest/jaxb.index      |  3 +-
 4 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0832d3c9/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java
new file mode 100644
index 0000000..0fd7980
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/PatchVerbDefinition.java
@@ -0,0 +1,33 @@
+/**
+ * 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.model.rest;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.camel.spi.Metadata;
+
+/**
+ * Rest PATCH command
+ */
+@Metadata(label = "rest")
+@XmlRootElement(name = "patch")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PatchVerbDefinition extends VerbDefinition {
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0832d3c9/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 85ddc08..5084b38 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -236,6 +236,14 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         return addVerb("put", uri);
     }
 
+    public RestDefinition patch() {
+        return addVerb("patch", null);
+    }
+
+    public RestDefinition patch(String uri) {
+        return addVerb("patch", uri);
+    }
+
     public RestDefinition delete() {
         return addVerb("delete", null);
     }
@@ -564,6 +572,8 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
             answer = new HeadVerbDefinition();
         } else if ("put".equals(verb)) {
             answer = new PutVerbDefinition();
+        } else if ("patch".equals(verb)) {
+            answer = new PatchVerbDefinition();
         } else if ("options".equals(verb)) {
             answer = new OptionsVerbDefinition();
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/0832d3c9/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 744a99c..be27799 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -393,6 +393,8 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
             return "post";
         } else if (this instanceof PutVerbDefinition) {
             return "put";
+        } else if (this instanceof PatchVerbDefinition) {
+            return "patch";
         } else if (this instanceof DeleteVerbDefinition) {
             return "delete";
         } else if (this instanceof HeadVerbDefinition) {

http://git-wip-us.apache.org/repos/asf/camel/blob/0832d3c9/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
----------------------------------------------------------------------
diff --git a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
index 809e195..3951a7e 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
@@ -21,6 +21,7 @@ HeadVerbDefinition
 OptionsVerbDefinition
 PostVerbDefinition
 PutVerbDefinition
+PatchVerbDefinition
 RestBindingDefinition
 RestBindingMode
 RestConfigurationDefinition
@@ -32,4 +33,4 @@ RestOperationResponseHeaderDefinition
 RestParamType
 RestPropertyDefinition
 RestsDefinition
-VerbDefinition
\ No newline at end of file
+VerbDefinition