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 2017/04/11 18:04:48 UTC
[2/5] camel git commit: CAMEL-11135: camel-protobuf component
improvements
http://git-wip-us.apache.org/repos/asf/camel/blob/327dfcbd/components/camel-protobuf/src/test/proto/addressbook.proto
----------------------------------------------------------------------
diff --git a/components/camel-protobuf/src/test/proto/addressbook.proto b/components/camel-protobuf/src/test/proto/addressbook.proto
new file mode 100644
index 0000000..7fce508
--- /dev/null
+++ b/components/camel-protobuf/src/test/proto/addressbook.proto
@@ -0,0 +1,29 @@
+syntax = "proto2";
+
+package org.apache.camel.dataformat.protobuf.generated;
+
+option java_package = "org.apache.camel.dataformat.protobuf.generated";
+option java_outer_classname = "AddressBookProtos";
+
+message Person {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ required PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+}
+
+message AddressBook {
+ repeated Person person = 1;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/327dfcbd/components/camel-protobuf/src/test/proto/readme.txt
----------------------------------------------------------------------
diff --git a/components/camel-protobuf/src/test/proto/readme.txt b/components/camel-protobuf/src/test/proto/readme.txt
new file mode 100644
index 0000000..633a81a
--- /dev/null
+++ b/components/camel-protobuf/src/test/proto/readme.txt
@@ -0,0 +1,5 @@
+Examples taken from the Protobuf Java tutorial https://developers.google.com/protocol-buffers/docs/javatutorial
+
+AddressBookProtos.java generation (if your operating system is not supporting by Protobuf Java code generator maven plugin)
+ cd src/test/resources
+ protoc --java_out=. ./addressbook.proto
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/327dfcbd/components/camel-protobuf/src/test/resources/addressbook.proto
----------------------------------------------------------------------
diff --git a/components/camel-protobuf/src/test/resources/addressbook.proto b/components/camel-protobuf/src/test/resources/addressbook.proto
deleted file mode 100755
index 7832032..0000000
--- a/components/camel-protobuf/src/test/resources/addressbook.proto
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.apache.camel.dataformat.protobuf.generated;
-
-option java_package = "org.apache.camel.dataformat.protobuf.generated";
-option java_outer_classname = "AddressBookProtos";
-
-message Person {
- required string name = 1;
- required int32 id = 2;
- optional string email = 3;
-
- enum PhoneType {
- MOBILE = 0;
- HOME = 1;
- WORK = 2;
- }
-
- message PhoneNumber {
- required string number = 1;
- optional PhoneType type = 2 [default = HOME];
- }
-
- repeated PhoneNumber phone = 4;
-}
-
-message AddressBook {
- repeated Person person = 1;
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/327dfcbd/components/camel-protobuf/src/test/resources/readme.txt
----------------------------------------------------------------------
diff --git a/components/camel-protobuf/src/test/resources/readme.txt b/components/camel-protobuf/src/test/resources/readme.txt
deleted file mode 100755
index 5d1b22e..0000000
--- a/components/camel-protobuf/src/test/resources/readme.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Examples taken from the Protobuf Java tutorial http://code.google.com/apis/protocolbuffers/docs/javatutorial.html
-
-AddressBookProtos.java generation
- cd src/test/resources
- protoc --java_out=. ./addressbook.proto
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/327dfcbd/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatConfiguration.java
index 02fbd99..be7267c 100644
--- a/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatConfiguration.java
@@ -31,6 +31,12 @@ public class ProtobufDataFormatConfiguration {
*/
private String instanceClass;
/**
+ * Defines a content type format in which protobuf message will be
+ * serialized/deserialized from(to) the Java been. It can be native protobuf
+ * format or json fields representation. The default value is 'native'.
+ */
+ private String contentTypeFormat;
+ /**
* Whether the data format should set the Content-Type header with the type
* from the data format if the data format is capable of doing so. For
* example application/xml for data formats marshalling to XML or
@@ -46,6 +52,14 @@ public class ProtobufDataFormatConfiguration {
this.instanceClass = instanceClass;
}
+ public String getContentTypeFormat() {
+ return contentTypeFormat;
+ }
+
+ public void setContentTypeFormat(String contentTypeFormat) {
+ this.contentTypeFormat = contentTypeFormat;
+ }
+
public Boolean getContentTypeHeader() {
return contentTypeHeader;
}