This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 37550a5 CAMEL-14592: json dataformat splitup options so each
implementation only includes in tooling metadata/docs what options it uses.
37550a5 is described below
commit 37550a57b0e9c005c6c5b69c9b572289d624d704
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Mar 19 17:21:01 2020 +0100
CAMEL-14592: json dataformat splitup options so each implementation only
includes in tooling metadata/docs what options it uses.
---
.../fastjson/FastjsonDataFormatConfigurer.java | 4 +-
.../camel/component/fastjson/json-fastjson.json | 23 +---------
.../src/main/docs/json-fastjson-dataformat.adoc | 22 +--------
.../component/fastjson/FastjsonDataFormat.java | 2 +
.../component/gson/GsonDataFormatConfigurer.java | 2 +
.../org/apache/camel/component/gson/json-gson.json | 22 +--------
.../src/main/docs/json-gson-dataformat.adoc | 21 +--------
.../camel/component/gson/GsonDataFormat.java | 2 +
.../jackson/JacksonDataFormatConfigurer.java | 2 +
.../camel/component/jackson/json-jackson.json | 5 --
.../src/main/docs/json-jackson-dataformat.adoc | 7 +--
.../camel/component/jackson/JacksonDataFormat.java | 2 +
.../johnzon/JohnzonDataFormatConfigurer.java | 2 +
.../camel/component/johnzon/json-johnzon.json | 22 +--------
.../src/main/docs/json-johnzon-dataformat.adoc | 21 +--------
.../camel/component/johnzon/JohnzonDataFormat.java | 14 +++---
.../xstream/JsonDataFormatConfigurer.java | 3 +-
.../xstream/XStreamDataFormatConfigurer.java | 2 +
.../camel/dataformat/xstream/json-xstream.json | 21 +--------
.../apache/camel/dataformat/xstream/xstream.json | 5 +-
.../src/main/docs/json-xstream-dataformat.adoc | 38 +---------------
.../src/main/docs/xstream-dataformat.adoc | 4 +-
.../dataformat/xstream/AbstractXStreamWrapper.java | 1 -
.../camel/dataformat/xstream/JsonDataFormat.java | 2 +
.../dataformat/xstream/XStreamDataFormat.java | 2 +
.../java/org/apache/camel/spi/Metadata.java | 16 +++++++
.../java/org/apache/camel/spi/UriEndpoint.java | 3 ++
.../modules/eips/pages/circuitBreaker-eip.adoc | 15 +++++-
.../reifier/dataformat/JsonDataFormatReifier.java | 2 +-
.../pages/json-fastjson-dataformat.adoc | 22 +--------
.../dataformats/pages/json-gson-dataformat.adoc | 21 +--------
.../dataformats/pages/json-jackson-dataformat.adoc | 7 +--
.../dataformats/pages/json-johnzon-dataformat.adoc | 21 +--------
.../dataformats/pages/json-xstream-dataformat.adoc | 38 +---------------
.../dataformats/pages/xstream-dataformat.adoc | 4 +-
.../maven/packaging/PackageDataFormatMojo.java | 53 ++++++++++++++++++++--
.../main/java/org/apache/camel/spi/Metadata.java | 16 +++++++
.../java/org/apache/camel/spi/UriEndpoint.java | 3 ++
38 files changed, 149 insertions(+), 323 deletions(-)
diff --git
a/components/camel-fastjson/src/generated/java/org/apache/camel/component/fastjson/FastjsonDataFormatConfigurer.java
b/components/camel-fastjson/src/generated/java/org/apache/camel/component/fastjson/FastjsonDataFormatConfigurer.java
index 5c11918..d9b926e 100644
---
a/components/camel-fastjson/src/generated/java/org/apache/camel/component/fastjson/FastjsonDataFormatConfigurer.java
+++
b/components/camel-fastjson/src/generated/java/org/apache/camel/component/fastjson/FastjsonDataFormatConfigurer.java
@@ -18,8 +18,8 @@ public class FastjsonDataFormatConfigurer extends
PropertyConfigurerSupport impl
public boolean configure(CamelContext camelContext, Object target, String
name, Object value, boolean ignoreCase) {
FastjsonDataFormat dataformat = (FastjsonDataFormat) target;
switch (ignoreCase ? name.toLowerCase() : name) {
- case "prettyprint":
- case "prettyPrint": dataformat.setPrettyPrint(property(camelContext,
boolean.class, value)); return true;
+ case "contenttypeheader":
+ case "contentTypeHeader":
dataformat.setContentTypeHeader(property(camelContext, boolean.class, value));
return true;
default: return false;
}
}
diff --git
a/components/camel-fastjson/src/generated/resources/org/apache/camel/component/fastjson/json-fastjson.json
b/components/camel-fastjson/src/generated/resources/org/apache/camel/component/fastjson/json-fastjson.json
index 6fac152..c2005da 100644
---
a/components/camel-fastjson/src/generated/resources/org/apache/camel/component/fastjson/json-fastjson.json
+++
b/components/camel-fastjson/src/generated/resources/org/apache/camel/component/fastjson/json-fastjson.json
@@ -16,27 +16,6 @@
"version": "3.2.0-SNAPSHOT"
},
"properties": {
- "objectMapper": { "kind": "attribute", "displayName": "Object Mapper",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Lookup and use the
existing ObjectMapper with the given id when using Jackson." },
- "useDefaultObjectMapper": { "kind": "attribute", "displayName": "Use
Default Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
true, "description": "Whether to lookup and use default Jackson ObjectMapper
from the registry." },
- "prettyPrint": { "kind": "attribute", "displayName": "Pretty Print",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description": "To
enable pretty printing output nicely formatted. Is by default false." },
- "library": { "kind": "attribute", "displayName": "Library", "required":
false, "type": "enum", "javaType":
"org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson",
"Jackson", "Johnzon", "XStream" ], "deprecated": false, "secret": false,
"defaultValue": "Jackson", "description": "Which json library to use." },
- "unmarshalTypeName": { "kind": "attribute", "displayName": "Unmarshal Type
Name", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Class name of the java
type to use when unmarshalling" },
- "jsonView": { "kind": "attribute", "displayName": "Json View", "required":
false, "type": "string", "javaType": "java.lang.Class<java.lang.Object>",
"deprecated": false, "secret": false, "description": "When marshalling a POJO
to JSON you might want to exclude certain fields from the JSON output. With
Jackson you can use JSON views to accomplish this. This option is to refer to
the class which has JsonView annotations" },
- "include": { "kind": "attribute", "displayName": "Include", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If you want to marshal a pojo to JSON, and the
pojo has some fields with null values. And you want to skip these null values,
you can set this option to NON_NULL" },
- "allowJmsType": { "kind": "attribute", "displayName": "Allow Jms Type",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Used for JMS users to allow the JMSType header from the JMS spec to specify a
FQN classname to use to unmarshal to." },
- "collectionTypeName": { "kind": "attribute", "displayName": "Collection
Type Name", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description":
"Refers to a custom collection type to lookup in the registry to use. This
option should rarely be used, but allows to use different collection types than
java.util.Collection based as default." },
- "useList": { "kind": "attribute", "displayName": "Use List", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"secret": false, "defaultValue": false, "description": "To unmarshal to a List
of Map or a List of Pojo." },
- "enableJaxbAnnotationModule": { "kind": "attribute", "displayName":
"Enable Jaxb Annotation Module", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether to enable the JAXB annotations
module when using jackson. When enabled then JAXB annotations can be used by
Jackson." },
- "moduleClassNames": { "kind": "attribute", "displayName": "Module Class
Names", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules com.fasterxml.jackson.databind.Module specified as a String with FQN
class names. Multiple classes can be separated by comma." },
- "moduleRefs": { "kind": "attribute", "displayName": "Module Refs",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules referred from the Camel registry. Multiple modules can be separated by
comma." },
- "enableFeatures": { "kind": "attribute", "displayName": "Enable Features",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to enable
on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should
be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperF [...]
- "disableFeatures": { "kind": "attribute", "displayName": "Disable
Features", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to
disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The
features should be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.Mapp [...]
- "permissions": { "kind": "attribute", "displayName": "Permissions",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Adds permissions that
controls which Java packages and classes XStream is allowed to use during
unmarshal from xml\/json to Java beans. A permission must be configured either
here or globally using a JVM system property. The permission can be specified
in a syntax where a plus sign is allow, and [...]
- "allowUnmarshallType": { "kind": "attribute", "displayName": "Allow
Unmarshall Type", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If enabled then Jackson is allowed to attempt to use the
CamelJacksonUnmarshalType header during the unmarshalling. This should only be
enabled when desired to be used." },
- "timezone": { "kind": "attribute", "displayName": "Timezone", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If set then Jackson will use the Timezone when
marshalling\/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream." },
- "autoDiscoverObjectMapper": { "kind": "attribute", "displayName": "Auto
Discover Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If set to true then Jackson will lookup for an
objectMapper into the registry" },
- "dropRootNode": { "kind": "attribute", "displayName": "Drop Root Node",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Whether XStream will drop the root node in the generated JSon. You may want to
enable this when using POJOs; as then the written object will include the class
name as root node, which is often not intended to be written in the JSon
output." },
- "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
- "id": { "kind": "attribute", "displayName": "Id", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "The id of this node" }
+ "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
}
}
diff --git
a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
index c2f2219..13460d6 100644
--- a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
+++ b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
@@ -17,33 +17,13 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon Fastjson dataformat supports 21 options, which are listed below.
+The JSon Fastjson dataformat supports 1 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
-| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Jackson | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/components/camel-fastjson/src/main/java/org/apache/camel/component/fastjson/FastjsonDataFormat.java
b/components/camel-fastjson/src/main/java/org/apache/camel/component/fastjson/FastjsonDataFormat.java
index 5ac62be..0fbe566 100644
---
a/components/camel-fastjson/src/main/java/org/apache/camel/component/fastjson/FastjsonDataFormat.java
+++
b/components/camel-fastjson/src/main/java/org/apache/camel/component/fastjson/FastjsonDataFormat.java
@@ -29,6 +29,7 @@ import org.apache.camel.Message;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatContentTypeHeader;
import org.apache.camel.spi.DataFormatName;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
import org.apache.camel.support.service.ServiceSupport;
@@ -37,6 +38,7 @@ import org.apache.camel.support.service.ServiceSupport;
* using <a href="https://github.com/alibaba/fastjson">Fastjson</a> to marshal
to and from JSON.
*/
@Dataformat("json-fastjson")
+@Metadata(includeProperties = "prettyprint,contentTypeHeader")
public class FastjsonDataFormat extends ServiceSupport implements DataFormat,
DataFormatName, DataFormatContentTypeHeader {
private FastJsonConfig config;
diff --git
a/components/camel-gson/src/generated/java/org/apache/camel/component/gson/GsonDataFormatConfigurer.java
b/components/camel-gson/src/generated/java/org/apache/camel/component/gson/GsonDataFormatConfigurer.java
index e5761be..c3474ad 100644
---
a/components/camel-gson/src/generated/java/org/apache/camel/component/gson/GsonDataFormatConfigurer.java
+++
b/components/camel-gson/src/generated/java/org/apache/camel/component/gson/GsonDataFormatConfigurer.java
@@ -20,6 +20,8 @@ public class GsonDataFormatConfigurer extends
PropertyConfigurerSupport implemen
switch (ignoreCase ? name.toLowerCase() : name) {
case "prettyprint":
case "prettyPrint": dataformat.setPrettyPrint(property(camelContext,
boolean.class, value)); return true;
+ case "contenttypeheader":
+ case "contentTypeHeader":
dataformat.setContentTypeHeader(property(camelContext, boolean.class, value));
return true;
default: return false;
}
}
diff --git
a/components/camel-gson/src/generated/resources/org/apache/camel/component/gson/json-gson.json
b/components/camel-gson/src/generated/resources/org/apache/camel/component/gson/json-gson.json
index afdf10a..95061dd 100644
---
a/components/camel-gson/src/generated/resources/org/apache/camel/component/gson/json-gson.json
+++
b/components/camel-gson/src/generated/resources/org/apache/camel/component/gson/json-gson.json
@@ -16,27 +16,7 @@
"version": "3.2.0-SNAPSHOT"
},
"properties": {
- "objectMapper": { "kind": "attribute", "displayName": "Object Mapper",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Lookup and use the
existing ObjectMapper with the given id when using Jackson." },
- "useDefaultObjectMapper": { "kind": "attribute", "displayName": "Use
Default Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
true, "description": "Whether to lookup and use default Jackson ObjectMapper
from the registry." },
"prettyPrint": { "kind": "attribute", "displayName": "Pretty Print",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description": "To
enable pretty printing output nicely formatted. Is by default false." },
- "library": { "kind": "attribute", "displayName": "Library", "required":
false, "type": "enum", "javaType":
"org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson",
"Jackson", "Johnzon", "XStream" ], "deprecated": false, "secret": false,
"defaultValue": "Gson", "description": "Which json library to use." },
- "unmarshalTypeName": { "kind": "attribute", "displayName": "Unmarshal Type
Name", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Class name of the java
type to use when unmarshalling" },
- "jsonView": { "kind": "attribute", "displayName": "Json View", "required":
false, "type": "string", "javaType": "java.lang.Class<java.lang.Object>",
"deprecated": false, "secret": false, "description": "When marshalling a POJO
to JSON you might want to exclude certain fields from the JSON output. With
Jackson you can use JSON views to accomplish this. This option is to refer to
the class which has JsonView annotations" },
- "include": { "kind": "attribute", "displayName": "Include", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If you want to marshal a pojo to JSON, and the
pojo has some fields with null values. And you want to skip these null values,
you can set this option to NON_NULL" },
- "allowJmsType": { "kind": "attribute", "displayName": "Allow Jms Type",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Used for JMS users to allow the JMSType header from the JMS spec to specify a
FQN classname to use to unmarshal to." },
- "collectionTypeName": { "kind": "attribute", "displayName": "Collection
Type Name", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description":
"Refers to a custom collection type to lookup in the registry to use. This
option should rarely be used, but allows to use different collection types than
java.util.Collection based as default." },
- "useList": { "kind": "attribute", "displayName": "Use List", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"secret": false, "defaultValue": false, "description": "To unmarshal to a List
of Map or a List of Pojo." },
- "enableJaxbAnnotationModule": { "kind": "attribute", "displayName":
"Enable Jaxb Annotation Module", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether to enable the JAXB annotations
module when using jackson. When enabled then JAXB annotations can be used by
Jackson." },
- "moduleClassNames": { "kind": "attribute", "displayName": "Module Class
Names", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules com.fasterxml.jackson.databind.Module specified as a String with FQN
class names. Multiple classes can be separated by comma." },
- "moduleRefs": { "kind": "attribute", "displayName": "Module Refs",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules referred from the Camel registry. Multiple modules can be separated by
comma." },
- "enableFeatures": { "kind": "attribute", "displayName": "Enable Features",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to enable
on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should
be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperF [...]
- "disableFeatures": { "kind": "attribute", "displayName": "Disable
Features", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to
disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The
features should be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.Mapp [...]
- "permissions": { "kind": "attribute", "displayName": "Permissions",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Adds permissions that
controls which Java packages and classes XStream is allowed to use during
unmarshal from xml\/json to Java beans. A permission must be configured either
here or globally using a JVM system property. The permission can be specified
in a syntax where a plus sign is allow, and [...]
- "allowUnmarshallType": { "kind": "attribute", "displayName": "Allow
Unmarshall Type", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If enabled then Jackson is allowed to attempt to use the
CamelJacksonUnmarshalType header during the unmarshalling. This should only be
enabled when desired to be used." },
- "timezone": { "kind": "attribute", "displayName": "Timezone", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If set then Jackson will use the Timezone when
marshalling\/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream." },
- "autoDiscoverObjectMapper": { "kind": "attribute", "displayName": "Auto
Discover Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If set to true then Jackson will lookup for an
objectMapper into the registry" },
- "dropRootNode": { "kind": "attribute", "displayName": "Drop Root Node",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Whether XStream will drop the root node in the generated JSon. You may want to
enable this when using POJOs; as then the written object will include the class
name as root node, which is often not intended to be written in the JSon
output." },
- "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
- "id": { "kind": "attribute", "displayName": "Id", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "The id of this node" }
+ "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
}
}
diff --git a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
index 661a4cb..de9d209 100644
--- a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
+++ b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
@@ -17,33 +17,14 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon GSon dataformat supports 21 options, which are listed below.
+The JSon GSon dataformat supports 2 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Gson | JsonLibrary | Which json library to use. The value can be
one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
index 779ee51..fe4d9bb 100644
---
a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
+++
b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
@@ -36,6 +36,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatContentTypeHeader;
import org.apache.camel.spi.DataFormatName;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
import org.apache.camel.support.ExchangeHelper;
import org.apache.camel.support.service.ServiceSupport;
@@ -46,6 +47,7 @@ import org.apache.camel.util.IOHelper;
* using <a href="http://code.google.com/p/google-gson/">Gson</a> to marshal
to and from JSON.
*/
@Dataformat("json-gson")
+@Metadata(includeProperties = "prettyPrint,contentTypeHeader")
public class GsonDataFormat extends ServiceSupport implements DataFormat,
DataFormatName, DataFormatContentTypeHeader {
private Gson gson;
diff --git
a/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java
b/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java
index 2c8ed46..f5ecd52 100644
---
a/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java
+++
b/components/camel-jackson/src/generated/java/org/apache/camel/component/jackson/JacksonDataFormatConfigurer.java
@@ -43,6 +43,8 @@ public class JacksonDataFormatConfigurer extends
PropertyConfigurerSupport imple
case "disableFeatures":
dataformat.setDisableFeatures(property(camelContext, java.lang.String.class,
value)); return true;
case "allowunmarshalltype":
case "allowUnmarshallType":
dataformat.setAllowUnmarshallType(property(camelContext, boolean.class,
value)); return true;
+ case "contenttypeheader":
+ case "contentTypeHeader":
dataformat.setContentTypeHeader(property(camelContext, boolean.class, value));
return true;
case "timezone": dataformat.setTimezone(property(camelContext,
java.util.TimeZone.class, value)); return true;
case "autodiscoverobjectmapper":
case "autoDiscoverObjectMapper":
dataformat.setAutoDiscoverObjectMapper(property(camelContext, boolean.class,
value)); return true;
diff --git
a/components/camel-jackson/src/generated/resources/org/apache/camel/component/jackson/json-jackson.json
b/components/camel-jackson/src/generated/resources/org/apache/camel/component/jackson/json-jackson.json
index bec16f9..66bf4d8 100644
---
a/components/camel-jackson/src/generated/resources/org/apache/camel/component/jackson/json-jackson.json
+++
b/components/camel-jackson/src/generated/resources/org/apache/camel/component/jackson/json-jackson.json
@@ -19,23 +19,18 @@
"objectMapper": { "kind": "attribute", "displayName": "Object Mapper",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Lookup and use the
existing ObjectMapper with the given id when using Jackson." },
"useDefaultObjectMapper": { "kind": "attribute", "displayName": "Use
Default Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
true, "description": "Whether to lookup and use default Jackson ObjectMapper
from the registry." },
"prettyPrint": { "kind": "attribute", "displayName": "Pretty Print",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description": "To
enable pretty printing output nicely formatted. Is by default false." },
- "library": { "kind": "attribute", "displayName": "Library", "required":
false, "type": "enum", "javaType":
"org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson",
"Jackson", "Johnzon", "XStream" ], "deprecated": false, "secret": false,
"defaultValue": "Jackson", "description": "Which json library to use." },
- "unmarshalTypeName": { "kind": "attribute", "displayName": "Unmarshal Type
Name", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Class name of the java
type to use when unmarshalling" },
"jsonView": { "kind": "attribute", "displayName": "Json View", "required":
false, "type": "string", "javaType": "java.lang.Class<java.lang.Object>",
"deprecated": false, "secret": false, "description": "When marshalling a POJO
to JSON you might want to exclude certain fields from the JSON output. With
Jackson you can use JSON views to accomplish this. This option is to refer to
the class which has JsonView annotations" },
"include": { "kind": "attribute", "displayName": "Include", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If you want to marshal a pojo to JSON, and the
pojo has some fields with null values. And you want to skip these null values,
you can set this option to NON_NULL" },
"allowJmsType": { "kind": "attribute", "displayName": "Allow Jms Type",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Used for JMS users to allow the JMSType header from the JMS spec to specify a
FQN classname to use to unmarshal to." },
- "collectionTypeName": { "kind": "attribute", "displayName": "Collection
Type Name", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description":
"Refers to a custom collection type to lookup in the registry to use. This
option should rarely be used, but allows to use different collection types than
java.util.Collection based as default." },
"useList": { "kind": "attribute", "displayName": "Use List", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"secret": false, "defaultValue": false, "description": "To unmarshal to a List
of Map or a List of Pojo." },
"enableJaxbAnnotationModule": { "kind": "attribute", "displayName":
"Enable Jaxb Annotation Module", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether to enable the JAXB annotations
module when using jackson. When enabled then JAXB annotations can be used by
Jackson." },
"moduleClassNames": { "kind": "attribute", "displayName": "Module Class
Names", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules com.fasterxml.jackson.databind.Module specified as a String with FQN
class names. Multiple classes can be separated by comma." },
"moduleRefs": { "kind": "attribute", "displayName": "Module Refs",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules referred from the Camel registry. Multiple modules can be separated by
comma." },
"enableFeatures": { "kind": "attribute", "displayName": "Enable Features",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to enable
on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should
be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperF [...]
"disableFeatures": { "kind": "attribute", "displayName": "Disable
Features", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to
disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The
features should be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.Mapp [...]
- "permissions": { "kind": "attribute", "displayName": "Permissions",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Adds permissions that
controls which Java packages and classes XStream is allowed to use during
unmarshal from xml\/json to Java beans. A permission must be configured either
here or globally using a JVM system property. The permission can be specified
in a syntax where a plus sign is allow, and [...]
"allowUnmarshallType": { "kind": "attribute", "displayName": "Allow
Unmarshall Type", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If enabled then Jackson is allowed to attempt to use the
CamelJacksonUnmarshalType header during the unmarshalling. This should only be
enabled when desired to be used." },
"timezone": { "kind": "attribute", "displayName": "Timezone", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If set then Jackson will use the Timezone when
marshalling\/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream." },
"autoDiscoverObjectMapper": { "kind": "attribute", "displayName": "Auto
Discover Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If set to true then Jackson will lookup for an
objectMapper into the registry" },
- "dropRootNode": { "kind": "attribute", "displayName": "Drop Root Node",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Whether XStream will drop the root node in the generated JSon. You may want to
enable this when using POJOs; as then the written object will include the class
name as root node, which is often not intended to be written in the JSon
output." },
"contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
"id": { "kind": "attribute", "displayName": "Id", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "The id of this node" }
}
diff --git
a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
index 72e7d6b..234e553 100644
--- a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
+++ b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
@@ -18,7 +18,7 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon Jackson dataformat supports 21 options, which are listed below.
+The JSon Jackson dataformat supports 16 options, which are listed below.
@@ -28,23 +28,18 @@ The JSon Jackson dataformat supports 21 options, which are
listed below.
| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Jackson | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
index f857a23..1158525 100644
---
a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
+++
b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
@@ -41,6 +41,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatContentTypeHeader;
import org.apache.camel.spi.DataFormatName;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.ObjectHelper;
@@ -54,6 +55,7 @@ import org.slf4j.LoggerFactory;
* to marshal to and from JSON.
*/
@Dataformat("json-jackson")
+@Metadata(excludeProperties =
"unmarshalTypeName,collectionTypeName,library,permissions,dropRootNode")
public class JacksonDataFormat extends ServiceSupport implements DataFormat,
DataFormatName, DataFormatContentTypeHeader, CamelContextAware {
private static final Logger LOG =
LoggerFactory.getLogger(JacksonDataFormat.class);
diff --git
a/components/camel-johnzon/src/generated/java/org/apache/camel/component/johnzon/JohnzonDataFormatConfigurer.java
b/components/camel-johnzon/src/generated/java/org/apache/camel/component/johnzon/JohnzonDataFormatConfigurer.java
index 36073f9..ae64322 100644
---
a/components/camel-johnzon/src/generated/java/org/apache/camel/component/johnzon/JohnzonDataFormatConfigurer.java
+++
b/components/camel-johnzon/src/generated/java/org/apache/camel/component/johnzon/JohnzonDataFormatConfigurer.java
@@ -20,6 +20,8 @@ public class JohnzonDataFormatConfigurer extends
PropertyConfigurerSupport imple
switch (ignoreCase ? name.toLowerCase() : name) {
case "objectmapper":
case "objectMapper": dataformat.setObjectMapper(property(camelContext,
org.apache.johnzon.mapper.Mapper.class, value)); return true;
+ case "prettyprint":
+ case "prettyPrint": dataformat.setPrettyPrint(property(camelContext,
boolean.class, value)); return true;
default: return false;
}
}
diff --git
a/components/camel-johnzon/src/generated/resources/org/apache/camel/component/johnzon/json-johnzon.json
b/components/camel-johnzon/src/generated/resources/org/apache/camel/component/johnzon/json-johnzon.json
index 03e444a..378ac9d 100644
---
a/components/camel-johnzon/src/generated/resources/org/apache/camel/component/johnzon/json-johnzon.json
+++
b/components/camel-johnzon/src/generated/resources/org/apache/camel/component/johnzon/json-johnzon.json
@@ -17,26 +17,6 @@
},
"properties": {
"objectMapper": { "kind": "attribute", "displayName": "Object Mapper",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Lookup and use the
existing ObjectMapper with the given id when using Jackson." },
- "useDefaultObjectMapper": { "kind": "attribute", "displayName": "Use
Default Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
true, "description": "Whether to lookup and use default Jackson ObjectMapper
from the registry." },
- "prettyPrint": { "kind": "attribute", "displayName": "Pretty Print",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description": "To
enable pretty printing output nicely formatted. Is by default false." },
- "library": { "kind": "attribute", "displayName": "Library", "required":
false, "type": "enum", "javaType":
"org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson",
"Jackson", "Johnzon", "XStream" ], "deprecated": false, "secret": false,
"defaultValue": "Johnzon", "description": "Which json library to use." },
- "unmarshalTypeName": { "kind": "attribute", "displayName": "Unmarshal Type
Name", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Class name of the java
type to use when unmarshalling" },
- "jsonView": { "kind": "attribute", "displayName": "Json View", "required":
false, "type": "string", "javaType": "java.lang.Class<java.lang.Object>",
"deprecated": false, "secret": false, "description": "When marshalling a POJO
to JSON you might want to exclude certain fields from the JSON output. With
Jackson you can use JSON views to accomplish this. This option is to refer to
the class which has JsonView annotations" },
- "include": { "kind": "attribute", "displayName": "Include", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If you want to marshal a pojo to JSON, and the
pojo has some fields with null values. And you want to skip these null values,
you can set this option to NON_NULL" },
- "allowJmsType": { "kind": "attribute", "displayName": "Allow Jms Type",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Used for JMS users to allow the JMSType header from the JMS spec to specify a
FQN classname to use to unmarshal to." },
- "collectionTypeName": { "kind": "attribute", "displayName": "Collection
Type Name", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description":
"Refers to a custom collection type to lookup in the registry to use. This
option should rarely be used, but allows to use different collection types than
java.util.Collection based as default." },
- "useList": { "kind": "attribute", "displayName": "Use List", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"secret": false, "defaultValue": false, "description": "To unmarshal to a List
of Map or a List of Pojo." },
- "enableJaxbAnnotationModule": { "kind": "attribute", "displayName":
"Enable Jaxb Annotation Module", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether to enable the JAXB annotations
module when using jackson. When enabled then JAXB annotations can be used by
Jackson." },
- "moduleClassNames": { "kind": "attribute", "displayName": "Module Class
Names", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules com.fasterxml.jackson.databind.Module specified as a String with FQN
class names. Multiple classes can be separated by comma." },
- "moduleRefs": { "kind": "attribute", "displayName": "Module Refs",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules referred from the Camel registry. Multiple modules can be separated by
comma." },
- "enableFeatures": { "kind": "attribute", "displayName": "Enable Features",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to enable
on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should
be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperF [...]
- "disableFeatures": { "kind": "attribute", "displayName": "Disable
Features", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to
disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The
features should be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.Mapp [...]
- "permissions": { "kind": "attribute", "displayName": "Permissions",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Adds permissions that
controls which Java packages and classes XStream is allowed to use during
unmarshal from xml\/json to Java beans. A permission must be configured either
here or globally using a JVM system property. The permission can be specified
in a syntax where a plus sign is allow, and [...]
- "allowUnmarshallType": { "kind": "attribute", "displayName": "Allow
Unmarshall Type", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If enabled then Jackson is allowed to attempt to use the
CamelJacksonUnmarshalType header during the unmarshalling. This should only be
enabled when desired to be used." },
- "timezone": { "kind": "attribute", "displayName": "Timezone", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If set then Jackson will use the Timezone when
marshalling\/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream." },
- "autoDiscoverObjectMapper": { "kind": "attribute", "displayName": "Auto
Discover Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If set to true then Jackson will lookup for an
objectMapper into the registry" },
- "dropRootNode": { "kind": "attribute", "displayName": "Drop Root Node",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Whether XStream will drop the root node in the generated JSon. You may want to
enable this when using POJOs; as then the written object will include the class
name as root node, which is often not intended to be written in the JSon
output." },
- "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
- "id": { "kind": "attribute", "displayName": "Id", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "The id of this node" }
+ "prettyPrint": { "kind": "attribute", "displayName": "Pretty Print",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description": "To
enable pretty printing output nicely formatted. Is by default false." }
}
}
diff --git
a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
index 9a8deb2..ae3eb3b 100644
--- a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
+++ b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
@@ -18,7 +18,7 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon Johnzon dataformat supports 21 options, which are listed below.
+The JSon Johnzon dataformat supports 2 options, which are listed below.
@@ -26,26 +26,7 @@ The JSon Johnzon dataformat supports 21 options, which are
listed below.
|===
| Name | Default | Java Type | Description
| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Johnzon | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
-| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/components/camel-johnzon/src/main/java/org/apache/camel/component/johnzon/JohnzonDataFormat.java
b/components/camel-johnzon/src/main/java/org/apache/camel/component/johnzon/JohnzonDataFormat.java
index 92b6780..a57ae37 100644
---
a/components/camel-johnzon/src/main/java/org/apache/camel/component/johnzon/JohnzonDataFormat.java
+++
b/components/camel-johnzon/src/main/java/org/apache/camel/component/johnzon/JohnzonDataFormat.java
@@ -25,6 +25,7 @@ import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatName;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
import org.apache.camel.support.service.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
@@ -37,6 +38,7 @@ import
org.apache.johnzon.mapper.reflection.JohnzonParameterizedType;
* using <a href="http://johnzon.apache.org/">Johnzon</a> to marshal to and
from JSON.
*/
@Dataformat("json-johnzon")
+@Metadata(includeProperties = "objectMapper,prettyPrint")
public class JohnzonDataFormat extends ServiceSupport implements DataFormat,
DataFormatName, CamelContextAware {
private CamelContext camelContext;
@@ -44,7 +46,7 @@ public class JohnzonDataFormat extends ServiceSupport
implements DataFormat, Dat
private Class<?> unmarshalType;
private JohnzonParameterizedType parameterizedType;
private Comparator<String> attributeOrder;
- private boolean pretty;
+ private boolean prettyPrint;
private String encoding;
private boolean skipEmptyArray;
private boolean skipNull;
@@ -134,12 +136,12 @@ public class JohnzonDataFormat extends ServiceSupport
implements DataFormat, Dat
this.parameterizedType = parameterizedType;
}
- public boolean isPretty() {
- return pretty;
+ public boolean isPrettyPrint() {
+ return prettyPrint;
}
- public void setPretty(boolean pretty) {
- this.pretty = pretty;
+ public void setPrettyPrint(boolean prettyPrint) {
+ this.prettyPrint = prettyPrint;
}
public String getEncoding() {
@@ -198,7 +200,7 @@ public class JohnzonDataFormat extends ServiceSupport
implements DataFormat, Dat
protected void doStart() throws Exception {
if (objectMapper == null) {
MapperBuilder builder = new MapperBuilder();
- builder.setPretty(pretty);
+ builder.setPretty(prettyPrint);
builder.setSkipNull(skipNull);
builder.setSkipEmptyArray(skipEmptyArray);
if (ObjectHelper.isNotEmpty(encoding)) {
diff --git
a/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/JsonDataFormatConfigurer.java
b/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/JsonDataFormatConfigurer.java
index a29ed97..b71f2ca 100644
---
a/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/JsonDataFormatConfigurer.java
+++
b/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/JsonDataFormatConfigurer.java
@@ -22,7 +22,8 @@ public class JsonDataFormatConfigurer extends
PropertyConfigurerSupport implemen
case "prettyPrint": dataformat.setPrettyPrint(property(camelContext,
boolean.class, value)); return true;
case "droprootnode":
case "dropRootNode": dataformat.setDropRootNode(property(camelContext,
boolean.class, value)); return true;
- case "permissions": dataformat.setPermissions(property(camelContext,
java.lang.String.class, value)); return true;
+ case "contenttypeheader":
+ case "contentTypeHeader":
dataformat.setContentTypeHeader(property(camelContext, boolean.class, value));
return true;
default: return false;
}
}
diff --git
a/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/XStreamDataFormatConfigurer.java
b/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/XStreamDataFormatConfigurer.java
index c0c5c0a..60436bf 100644
---
a/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/XStreamDataFormatConfigurer.java
+++
b/components/camel-xstream/src/generated/java/org/apache/camel/dataformat/xstream/XStreamDataFormatConfigurer.java
@@ -27,6 +27,8 @@ public class XStreamDataFormatConfigurer extends
PropertyConfigurerSupport imple
case "implicitCollections":
dataformat.setImplicitCollections(property(camelContext, java.util.Map.class,
value)); return true;
case "permissions": dataformat.setPermissions(property(camelContext,
java.lang.String.class, value)); return true;
case "mode": dataformat.setMode(property(camelContext,
java.lang.String.class, value)); return true;
+ case "contenttypeheader":
+ case "contentTypeHeader":
dataformat.setContentTypeHeader(property(camelContext, boolean.class, value));
return true;
default: return false;
}
}
diff --git
a/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/json-xstream.json
b/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/json-xstream.json
index 3b197e8..2363d48 100644
---
a/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/json-xstream.json
+++
b/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/json-xstream.json
@@ -16,27 +16,8 @@
"version": "3.2.0-SNAPSHOT"
},
"properties": {
- "objectMapper": { "kind": "attribute", "displayName": "Object Mapper",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Lookup and use the
existing ObjectMapper with the given id when using Jackson." },
- "useDefaultObjectMapper": { "kind": "attribute", "displayName": "Use
Default Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
true, "description": "Whether to lookup and use default Jackson ObjectMapper
from the registry." },
"prettyPrint": { "kind": "attribute", "displayName": "Pretty Print",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description": "To
enable pretty printing output nicely formatted. Is by default false." },
- "library": { "kind": "attribute", "displayName": "Library", "required":
false, "type": "enum", "javaType":
"org.apache.camel.model.dataformat.JsonLibrary", "enum": [ "Fastjson", "Gson",
"Jackson", "Johnzon", "XStream" ], "deprecated": false, "secret": false,
"defaultValue": "XStream", "description": "Which json library to use." },
- "unmarshalTypeName": { "kind": "attribute", "displayName": "Unmarshal Type
Name", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Class name of the java
type to use when unmarshalling" },
- "jsonView": { "kind": "attribute", "displayName": "Json View", "required":
false, "type": "string", "javaType": "java.lang.Class<java.lang.Object>",
"deprecated": false, "secret": false, "description": "When marshalling a POJO
to JSON you might want to exclude certain fields from the JSON output. With
Jackson you can use JSON views to accomplish this. This option is to refer to
the class which has JsonView annotations" },
- "include": { "kind": "attribute", "displayName": "Include", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If you want to marshal a pojo to JSON, and the
pojo has some fields with null values. And you want to skip these null values,
you can set this option to NON_NULL" },
- "allowJmsType": { "kind": "attribute", "displayName": "Allow Jms Type",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Used for JMS users to allow the JMSType header from the JMS spec to specify a
FQN classname to use to unmarshal to." },
- "collectionTypeName": { "kind": "attribute", "displayName": "Collection
Type Name", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description":
"Refers to a custom collection type to lookup in the registry to use. This
option should rarely be used, but allows to use different collection types than
java.util.Collection based as default." },
- "useList": { "kind": "attribute", "displayName": "Use List", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"secret": false, "defaultValue": false, "description": "To unmarshal to a List
of Map or a List of Pojo." },
- "enableJaxbAnnotationModule": { "kind": "attribute", "displayName":
"Enable Jaxb Annotation Module", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether to enable the JAXB annotations
module when using jackson. When enabled then JAXB annotations can be used by
Jackson." },
- "moduleClassNames": { "kind": "attribute", "displayName": "Module Class
Names", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules com.fasterxml.jackson.databind.Module specified as a String with FQN
class names. Multiple classes can be separated by comma." },
- "moduleRefs": { "kind": "attribute", "displayName": "Module Refs",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To use custom Jackson
modules referred from the Camel registry. Multiple modules can be separated by
comma." },
- "enableFeatures": { "kind": "attribute", "displayName": "Enable Features",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to enable
on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The features should
be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperF [...]
- "disableFeatures": { "kind": "attribute", "displayName": "Disable
Features", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Set of features to
disable on the Jackson com.fasterxml.jackson.databind.ObjectMapper. The
features should be a name that matches a enum from
com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.Mapp [...]
- "permissions": { "kind": "attribute", "displayName": "Permissions",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Adds permissions that
controls which Java packages and classes XStream is allowed to use during
unmarshal from xml\/json to Java beans. A permission must be configured either
here or globally using a JVM system property. The permission can be specified
in a syntax where a plus sign is allow, and [...]
- "allowUnmarshallType": { "kind": "attribute", "displayName": "Allow
Unmarshall Type", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If enabled then Jackson is allowed to attempt to use the
CamelJacksonUnmarshalType header during the unmarshalling. This should only be
enabled when desired to be used." },
- "timezone": { "kind": "attribute", "displayName": "Timezone", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "If set then Jackson will use the Timezone when
marshalling\/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream." },
- "autoDiscoverObjectMapper": { "kind": "attribute", "displayName": "Auto
Discover Object Mapper", "required": false, "type": "boolean", "javaType":
"java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If set to true then Jackson will lookup for an
objectMapper into the registry" },
"dropRootNode": { "kind": "attribute", "displayName": "Drop Root Node",
"required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"Whether XStream will drop the root node in the generated JSon. You may want to
enable this when using POJOs; as then the written object will include the class
name as root node, which is often not intended to be written in the JSon
output." },
- "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
- "id": { "kind": "attribute", "displayName": "Id", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "The id of this node" }
+ "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
}
}
diff --git
a/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/xstream.json
b/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/xstream.json
index dec672e..4ec77c5 100644
---
a/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/xstream.json
+++
b/components/camel-xstream/src/generated/resources/org/apache/camel/dataformat/xstream/xstream.json
@@ -18,14 +18,11 @@
"properties": {
"permissions": { "kind": "attribute", "displayName": "Permissions",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "Adds permissions that
controls which Java packages and classes XStream is allowed to use during
unmarshal from xml\/json to Java beans. A permission must be configured either
here or globally using a JVM system property. The permission can be specified
in a syntax where a plus sign is allow, and [...]
"encoding": { "kind": "attribute", "displayName": "Encoding", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "Sets the encoding to use" },
- "driver": { "kind": "attribute", "displayName": "Driver", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "To use a custom XStream driver. The instance
must be of type com.thoughtworks.xstream.io.HierarchicalStreamDriver" },
- "driverRef": { "kind": "attribute", "displayName": "Driver Ref",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "secret": false, "description": "To refer to a custom
XStream driver to lookup in the registry. The instance must be of type
com.thoughtworks.xstream.io.HierarchicalStreamDriver" },
"mode": { "kind": "attribute", "displayName": "Mode", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "Mode for dealing with duplicate references The
possible values are: NO_REFERENCES ID_REFERENCES XPATH_RELATIVE_REFERENCES
XPATH_ABSOLUTE_REFERENCES SINGLE_NODE_XPATH_RELATIVE_REFERENCES
SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES" },
"converters": { "kind": "element", "displayName": "Converters",
"required": false, "type": "array", "javaType":
"java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated":
false, "secret": false, "description": "List of class names for using custom
XStream converters. The classes must be of type
com.thoughtworks.xstream.converters.Converter" },
"aliases": { "kind": "element", "displayName": "Aliases", "required":
false, "type": "array", "javaType":
"java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated":
false, "secret": false, "description": "Alias a Class to a shorter name to be
used in XML elements." },
"omitFields": { "kind": "element", "displayName": "Omit Fields",
"required": false, "type": "array", "javaType":
"java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated":
false, "secret": false, "description": "Prevents a field from being serialized.
To omit a field you must always provide the declaring type and not necessarily
the type that is converted. Multiple values can be separated by comma." },
"implicitCollections": { "kind": "element", "displayName": "Implicit
Collections", "required": false, "type": "array", "javaType":
"java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated":
false, "secret": false, "description": "Adds a default implicit collection
which is used for any unmapped XML tag. Multiple values can be separated by
comma." },
- "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
- "id": { "kind": "attribute", "displayName": "Id", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "description": "The id of this node" }
+ "contentTypeHeader": { "kind": "attribute", "displayName": "Content Type
Header", "required": false, "type": "boolean", "javaType": "java.lang.Boolean",
"deprecated": false, "secret": false, "defaultValue": false, "description":
"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 application\/json for
data formats marshalling to JS [...]
}
}
diff --git
a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
index 916d414..a49b4ce 100644
--- a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
@@ -28,32 +28,14 @@ Maven users will need to add the following dependency to
their
== Options
// dataformat options: START
-The JSon XStream dataformat supports 21 options, which are listed below.
+The JSon XStream dataformat supports 3 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | XStream | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
@@ -70,22 +52,4 @@ from("activemq:My.Queue").
to("mqseries:Another.Queue");
-----------------------------------------------------------
-If you would like to configure the `XStream` instance used by the Camel
-for the message transformation, you can simply pass a reference to that
-instance on the DSL level.
-
-[source,java]
----------------------------------------------------------
-XStream xStream = new XStream();
-xStream.aliasField("money", PurchaseOrder.class, "cash");
-// new Added setModel option since Camel 2.14
-xStream.setModel("NO_REFERENCES");
-...
-
-from("direct:marshal").
- marshal(new XStreamDataFormat(xStream)).
- to("mock:marshaled");
----------------------------------------------------------
-
-
include::camel-spring-boot::page$xstream-starter.adoc[]
diff --git a/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
b/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
index 27d2ae2..8cd63ac 100644
--- a/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
@@ -26,7 +26,7 @@ Maven users will need to add the following dependency to their
== Options
// dataformat options: START
-The XStream dataformat supports 10 options, which are listed below.
+The XStream dataformat supports 8 options, which are listed below.
@@ -35,8 +35,6 @@ The XStream dataformat supports 10 options, which are listed
below.
| Name | Default | Java Type | Description
| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specify com.foo..
Multiple permissions can be con [...]
| encoding | | String | Sets the encoding to use
-| driver | | String | To use a custom XStream driver. The instance must be of
type com.thoughtworks.xstream.io.HierarchicalStreamDriver
-| driverRef | | String | To refer to a custom XStream driver to lookup in the
registry. The instance must be of type
com.thoughtworks.xstream.io.HierarchicalStreamDriver
| mode | | String | Mode for dealing with duplicate references The possible
values are: NO_REFERENCES ID_REFERENCES XPATH_RELATIVE_REFERENCES
XPATH_ABSOLUTE_REFERENCES SINGLE_NODE_XPATH_RELATIVE_REFERENCES
SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES
| converters | | List | List of class names for using custom XStream
converters. The classes must be of type
com.thoughtworks.xstream.converters.Converter
| aliases | | List | Alias a Class to a shorter name to be used in XML
elements.
diff --git
a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
index 7bf9b43..a6e300f 100644
---
a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
+++
b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
@@ -319,7 +319,6 @@ public abstract class AbstractXStreamWrapper extends
ServiceSupport implements C
this.mode = mode;
}
-
public boolean isContentTypeHeader() {
return contentTypeHeader;
}
diff --git
a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
index 2697f5a..9a1a552 100644
---
a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
+++
b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
@@ -32,6 +32,7 @@ import com.thoughtworks.xstream.io.xml.StaxReader;
import com.thoughtworks.xstream.io.xml.StaxWriter;
import org.apache.camel.Exchange;
import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
import org.codehaus.jettison.mapped.Configuration;
import org.codehaus.jettison.mapped.MappedXMLInputFactory;
@@ -42,6 +43,7 @@ import org.codehaus.jettison.mapped.MappedXMLOutputFactory;
* ({@link org.apache.camel.spi.DataFormat}) using XStream and Jettison to
marshal to and from JSON
*/
@Dataformat("json-xstream")
+@Metadata(includeProperties = "prettyPrint,dropRootNode,contentTypeHeader")
public class JsonDataFormat extends AbstractXStreamWrapper {
private MappedXMLOutputFactory mof;
private MappedXMLInputFactory mif;
diff --git
a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
index 9af787b..f60f86f 100644
---
a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
+++
b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
@@ -32,6 +32,7 @@ import com.thoughtworks.xstream.io.xml.StaxWriter;
import org.apache.camel.Exchange;
import org.apache.camel.spi.ClassResolver;
import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
import org.apache.camel.util.IOHelper;
@@ -40,6 +41,7 @@ import org.apache.camel.util.IOHelper;
* ({@link DataFormat}) using XStream to marshal to and from XML
*/
@Dataformat("xstream")
+@Metadata(includeProperties =
"encoding,converters,aliases,omitFields,implicitCollections,permissions,mode,contentTypeHeader")
public class XStreamDataFormat extends AbstractXStreamWrapper {
private String encoding;
diff --git
a/core/camel-api/src/generated/java/org/apache/camel/spi/Metadata.java
b/core/camel-api/src/generated/java/org/apache/camel/spi/Metadata.java
index 873952d..fbc64e7 100644
--- a/core/camel-api/src/generated/java/org/apache/camel/spi/Metadata.java
+++ b/core/camel-api/src/generated/java/org/apache/camel/spi/Metadata.java
@@ -105,4 +105,20 @@ public @interface Metadata {
*/
boolean skip() default false;
+ /**
+ * To exclude one or more properties.
+ * <p/>
+ * This is for example used when a Camel component extend another
component, and then may need to not use some of the properties from
+ * the parent component. Multiple properties can be separated by comma.
+ */
+ String excludeProperties() default "";
+
+ /**
+ * To include one or more properties.
+ *
+ * Some dataformats share same base but individually they have some
specific options, then this
+ * can be used to specify which options each implementation only supports.
+ */
+ String includeProperties() default "";
+
}
diff --git
a/core/camel-api/src/generated/java/org/apache/camel/spi/UriEndpoint.java
b/core/camel-api/src/generated/java/org/apache/camel/spi/UriEndpoint.java
index 8e770b2..97adf37 100644
--- a/core/camel-api/src/generated/java/org/apache/camel/spi/UriEndpoint.java
+++ b/core/camel-api/src/generated/java/org/apache/camel/spi/UriEndpoint.java
@@ -153,7 +153,10 @@ public @interface UriEndpoint {
* <p/>
* This is used when a Camel component extend another component, and then
may need to not use some of the properties from
* the parent component. Multiple properties can be separated by comma.
+ *
+ * @deprecated use {@link Metadata#excludeProperties()}
*/
+ @Deprecated
String excludeProperties() default "";
/**
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
index 7c60200..6f20ffc 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/circuitBreaker-eip.adoc
@@ -1,3 +1,4 @@
+[[circuitBreaker-eip]]
= Circuit Breaker EIP
The Circuit Breaker pattern is inspired by the real-world electrical circuit
breaker,
@@ -18,6 +19,18 @@ The states are as follows:
see whether it can complete successfully, and depending on the outcome, it
will
transfer to either open or closed state.
+// eip options: START
+The Circuit Breaker EIP supports 3 options which are listed below:
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *hystrixConfiguration* | Configures the circuit breaker to use Hystrix with
the given configuration. | | HystrixConfigurationDefinition
+| *resilience4jConfiguration* | Configures the circuit breaker to use
Resilience4j with the given configuration. | |
Resilience4jConfigurationDefinition
+| *configurationRef* | Refers to a circuit breaker configuration (such as
hystrix, resillience4j, or microprofile-fault-tolerance) to use for configuring
the circuit breaker EIP. | | String
+|===
+// eip options: END
+
== Example
Below is an example route showing a circuit breaker endpoint that protects
against slow operation by falling back to the in-lined fallback route. By
default the timeout request is just *1000ms* so the HTTP endpoint has to be
fairly quick to succeed.
@@ -56,4 +69,4 @@ And in XML DSL:
Camel provides two implementations of this pattern:
* xref:hystrix-eip.adoc[Hystrix] - Using the Netflix Hystrix implementation
-* xref:resilience4j-eip.adoc[Resilience4j] - Using the Resilience4j
implementation
\ No newline at end of file
+* xref:resilience4j-eip.adoc[Resilience4j] - Using the Resilience4j
implementation
diff --git
a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java
b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java
index a934b03..deca945 100644
---
a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java
+++
b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/JsonDataFormatReifier.java
@@ -32,7 +32,7 @@ public class JsonDataFormatReifier extends
DataFormatReifier<JsonDataFormat> {
@Override
protected void prepareDataFormatConfig(Map<String, Object> properties) {
properties.put("objectMapper", asRef(definition.getObjectMapper()));
- if (definition.getLibrary() != JsonLibrary.XStream) {
+ if (definition.getLibrary() == JsonLibrary.Jackson) {
if (definition.getUseDefaultObjectMapper() == null) {
// default true
properties.put("useDefaultObjectMapper", "true");
diff --git
a/docs/components/modules/dataformats/pages/json-fastjson-dataformat.adoc
b/docs/components/modules/dataformats/pages/json-fastjson-dataformat.adoc
index eb94e26..3e68e71 100644
--- a/docs/components/modules/dataformats/pages/json-fastjson-dataformat.adoc
+++ b/docs/components/modules/dataformats/pages/json-fastjson-dataformat.adoc
@@ -18,33 +18,13 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon Fastjson dataformat supports 21 options, which are listed below.
+The JSon Fastjson dataformat supports 1 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
-| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Jackson | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/docs/components/modules/dataformats/pages/json-gson-dataformat.adoc
b/docs/components/modules/dataformats/pages/json-gson-dataformat.adoc
index 86a7c5e..75a3788 100644
--- a/docs/components/modules/dataformats/pages/json-gson-dataformat.adoc
+++ b/docs/components/modules/dataformats/pages/json-gson-dataformat.adoc
@@ -18,33 +18,14 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon GSon dataformat supports 21 options, which are listed below.
+The JSon GSon dataformat supports 2 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Gson | JsonLibrary | Which json library to use. The value can be
one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/docs/components/modules/dataformats/pages/json-jackson-dataformat.adoc
b/docs/components/modules/dataformats/pages/json-jackson-dataformat.adoc
index 0544c3c..9e806c3 100644
--- a/docs/components/modules/dataformats/pages/json-jackson-dataformat.adoc
+++ b/docs/components/modules/dataformats/pages/json-jackson-dataformat.adoc
@@ -19,7 +19,7 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon Jackson dataformat supports 21 options, which are listed below.
+The JSon Jackson dataformat supports 16 options, which are listed below.
@@ -29,23 +29,18 @@ The JSon Jackson dataformat supports 21 options, which are
listed below.
| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Jackson | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/docs/components/modules/dataformats/pages/json-johnzon-dataformat.adoc
b/docs/components/modules/dataformats/pages/json-johnzon-dataformat.adoc
index 3d4287e..a36ad95 100644
--- a/docs/components/modules/dataformats/pages/json-johnzon-dataformat.adoc
+++ b/docs/components/modules/dataformats/pages/json-johnzon-dataformat.adoc
@@ -19,7 +19,7 @@ from("activemq:My.Queue").
// dataformat options: START
-The JSon Johnzon dataformat supports 21 options, which are listed below.
+The JSon Johnzon dataformat supports 2 options, which are listed below.
@@ -27,26 +27,7 @@ The JSon Johnzon dataformat supports 21 options, which are
listed below.
|===
| Name | Default | Java Type | Description
| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | Johnzon | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
-| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
-| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
diff --git
a/docs/components/modules/dataformats/pages/json-xstream-dataformat.adoc
b/docs/components/modules/dataformats/pages/json-xstream-dataformat.adoc
index a90a7c3..2b89e01 100644
--- a/docs/components/modules/dataformats/pages/json-xstream-dataformat.adoc
+++ b/docs/components/modules/dataformats/pages/json-xstream-dataformat.adoc
@@ -29,32 +29,14 @@ Maven users will need to add the following dependency to
their
== Options
// dataformat options: START
-The JSon XStream dataformat supports 21 options, which are listed below.
+The JSon XStream dataformat supports 3 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| objectMapper | | String | Lookup and use the existing ObjectMapper with the
given id when using Jackson.
-| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default
Jackson ObjectMapper from the registry.
| prettyPrint | false | Boolean | To enable pretty printing output nicely
formatted. Is by default false.
-| library | XStream | JsonLibrary | Which json library to use. The value can
be one of: Fastjson, Gson, Jackson, Johnzon, XStream
-| unmarshalTypeName | | String | Class name of the java type to use when
unmarshalling
-| jsonView | | Class | When marshalling a POJO to JSON you might want to
exclude certain fields from the JSON output. With Jackson you can use JSON
views to accomplish this. This option is to refer to the class which has
JsonView annotations
-| include | | String | If you want to marshal a pojo to JSON, and the pojo
has some fields with null values. And you want to skip these null values, you
can set this option to NON_NULL
-| allowJmsType | false | Boolean | Used for JMS users to allow the JMSType
header from the JMS spec to specify a FQN classname to use to unmarshal to.
-| collectionTypeName | | String | Refers to a custom collection type to
lookup in the registry to use. This option should rarely be used, but allows to
use different collection types than java.util.Collection based as default.
-| useList | false | Boolean | To unmarshal to a List of Map or a List of Pojo.
-| enableJaxbAnnotationModule | false | Boolean | Whether to enable the JAXB
annotations module when using jackson. When enabled then JAXB annotations can
be used by Jackson.
-| moduleClassNames | | String | To use custom Jackson modules
com.fasterxml.jackson.databind.Module specified as a String with FQN class
names. Multiple classes can be separated by comma.
-| moduleRefs | | String | To use custom Jackson modules referred from the
Camel registry. Multiple modules can be separated by comma.
-| enableFeatures | | String | Set of features to enable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| disableFeatures | | String | Set of features to disable on the Jackson
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that
matches a enum from com.fasterxml.jackson.databind.SerializationFeature,
com.fasterxml.jackson.databind.DeserializationFeature, or
com.fasterxml.jackson.databind.MapperFeature Multiple features can be separated
by comma
-| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specfy com.foo.. Multiple
permissions can be conf [...]
-| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed
to attempt to use the CamelJacksonUnmarshalType header during the
unmarshalling. This should only be enabled when desired to be used.
-| timezone | | String | If set then Jackson will use the Timezone when
marshalling/unmarshalling. This option will have no effect on the others Json
DataFormat, like gson, fastjson and xstream.
-| autoDiscoverObjectMapper | false | Boolean | If set to true then Jackson
will lookup for an objectMapper into the registry
| dropRootNode | false | Boolean | Whether XStream will drop the root node in
the generated JSon. You may want to enable this when using POJOs; as then the
written object will include the class name as root node, which is often not
intended to be written in the JSon output.
| contentTypeHeader | false | Boolean | 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 application/json for data formats marshalling to JSon etc.
|===
@@ -71,22 +53,4 @@ from("activemq:My.Queue").
to("mqseries:Another.Queue");
-----------------------------------------------------------
-If you would like to configure the `XStream` instance used by the Camel
-for the message transformation, you can simply pass a reference to that
-instance on the DSL level.
-
-[source,java]
----------------------------------------------------------
-XStream xStream = new XStream();
-xStream.aliasField("money", PurchaseOrder.class, "cash");
-// new Added setModel option since Camel 2.14
-xStream.setModel("NO_REFERENCES");
-...
-
-from("direct:marshal").
- marshal(new XStreamDataFormat(xStream)).
- to("mock:marshaled");
----------------------------------------------------------
-
-
include::camel-spring-boot::page$xstream-starter.adoc[]
diff --git a/docs/components/modules/dataformats/pages/xstream-dataformat.adoc
b/docs/components/modules/dataformats/pages/xstream-dataformat.adoc
index 02d3321..e63e7be 100644
--- a/docs/components/modules/dataformats/pages/xstream-dataformat.adoc
+++ b/docs/components/modules/dataformats/pages/xstream-dataformat.adoc
@@ -27,7 +27,7 @@ Maven users will need to add the following dependency to their
== Options
// dataformat options: START
-The XStream dataformat supports 10 options, which are listed below.
+The XStream dataformat supports 8 options, which are listed below.
@@ -36,8 +36,6 @@ The XStream dataformat supports 10 options, which are listed
below.
| Name | Default | Java Type | Description
| permissions | | String | Adds permissions that controls which Java packages
and classes XStream is allowed to use during unmarshal from xml/json to Java
beans. A permission must be configured either here or globally using a JVM
system property. The permission can be specified in a syntax where a plus sign
is allow, and minus sign is deny. Wildcards is supported by using . as prefix.
For example to allow com.foo and all subpackages then specify com.foo..
Multiple permissions can be con [...]
| encoding | | String | Sets the encoding to use
-| driver | | String | To use a custom XStream driver. The instance must be of
type com.thoughtworks.xstream.io.HierarchicalStreamDriver
-| driverRef | | String | To refer to a custom XStream driver to lookup in the
registry. The instance must be of type
com.thoughtworks.xstream.io.HierarchicalStreamDriver
| mode | | String | Mode for dealing with duplicate references The possible
values are: NO_REFERENCES ID_REFERENCES XPATH_RELATIVE_REFERENCES
XPATH_ABSOLUTE_REFERENCES SINGLE_NODE_XPATH_RELATIVE_REFERENCES
SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES
| converters | | List | List of class names for using custom XStream
converters. The classes must be of type
com.thoughtworks.xstream.converters.Converter
| aliases | | List | Alias a Class to a shorter name to be used in XML
elements.
diff --git
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
index 1052b2b..b886210 100644
---
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
+++
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
@@ -31,6 +31,8 @@ import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.tooling.model.DataFormatModel;
import org.apache.camel.tooling.model.DataFormatModel.DataFormatOptionModel;
import org.apache.camel.tooling.model.EipModel;
@@ -38,6 +40,7 @@ import org.apache.camel.tooling.model.EipModel.EipOptionModel;
import org.apache.camel.tooling.model.JsonMapper;
import org.apache.camel.tooling.util.PackageHelper;
import org.apache.camel.tooling.util.Strings;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
@@ -83,6 +86,8 @@ public class PackageDataFormatMojo extends
AbstractGeneratorMojo {
@Parameter(defaultValue = "${project.basedir}/src/generated/resources")
protected File schemaOutDir;
+ protected ClassLoader projectClassLoader;
+
public PackageDataFormatMojo() {
}
@@ -169,7 +174,17 @@ public class PackageDataFormatMojo extends
AbstractGeneratorMojo {
String json = PackageHelper.loadText(new File(core,
"target/classes/org/apache/camel/model/dataformat/" + modelName +
PackageHelper.JSON_SUFIX));
- DataFormatModel dataFormatModel =
extractDataFormatModel(project, json, name, javaType);
+ // any excluded properties
+ Class<?> clazz = loadClass(javaType);
+ Metadata metadata =
clazz.getAnnotation(Metadata.class);
+ String included = "";
+ String excluded = "";
+ if (metadata != null) {
+ included = metadata.includeProperties();
+ excluded = metadata.excludeProperties();
+ }
+
+ DataFormatModel dataFormatModel =
extractDataFormatModel(project, json, name, javaType, included, excluded);
if (log.isDebugEnabled()) {
log.debug("Model: " + dataFormatModel);
}
@@ -194,7 +209,7 @@ public class PackageDataFormatMojo extends
AbstractGeneratorMojo {
List<DataFormatOptionModel> options =
parseConfigurationSource(project, javaType);
options.removeIf(o -> !names.contains(o.getName()));
names.removeAll(options.stream().map(DataFormatOptionModel::getName).collect(Collectors.toList()));
- names.removeAll(Arrays.asList("contentTypeHeader",
"id"));
+ names.removeAll(Arrays.asList("id"));
if (!names.isEmpty()) {
log.warn("Unmapped options: " + String.join(",",
names));
}
@@ -226,7 +241,27 @@ public class PackageDataFormatMojo extends
AbstractGeneratorMojo {
return count;
}
- private static DataFormatModel extractDataFormatModel(MavenProject
project, String json, String name, String javaType) {
+ private Class<?> loadClass(String name) {
+ try {
+ return getProjectClassLoader().loadClass(name);
+ } catch (ClassNotFoundException e) {
+ throw (NoClassDefFoundError) new
NoClassDefFoundError(name).initCause(e);
+ }
+ }
+
+ private ClassLoader getProjectClassLoader() {
+ if (projectClassLoader == null) {
+ try {
+ projectClassLoader =
DynamicClassLoader.createDynamicClassLoader(project.getCompileClasspathElements());
+ } catch (DependencyResolutionRequiredException e) {
+ throw new RuntimeException("Unable to create project
classloader", e);
+ }
+ }
+ return projectClassLoader;
+ }
+
+ private static DataFormatModel extractDataFormatModel(MavenProject
project, String json, String name, String javaType,
+ String
includedProperties, String excludedProperties) {
EipModel def = JsonMapper.generateEipModel(json);
DataFormatModel model = new DataFormatModel();
model.setName(name);
@@ -245,6 +280,16 @@ public class PackageDataFormatMojo extends
AbstractGeneratorMojo {
for (EipOptionModel opt : def.getOptions()) {
DataFormatOptionModel option = new DataFormatOptionModel();
+
+ if (excludedProperties.contains(opt.getName())) {
+ // skip excluded
+ continue;
+ }
+ if (!includedProperties.isEmpty() &&
!includedProperties.contains(opt.getName())) {
+ // skip if not included
+ continue;
+ }
+
option.setName(opt.getName());
option.setKind(opt.getKind());
option.setDisplayName(opt.getDisplayName());
@@ -458,7 +503,7 @@ public class PackageDataFormatMojo extends
AbstractGeneratorMojo {
w.write(" switch (ignoreCase ? name.toLowerCase() : name)
{\n");
for (DataFormatOptionModel option : options) {
String name = option.getName();
- if ("contentTypeHeader".equals(name) || "id".equals(name)) {
+ if ("id".equals(name)) {
continue;
}
String setter = "set" + Character.toUpperCase(name.charAt(0))
+ name.substring(1);
diff --git
a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
index 873952d..fbc64e7 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/Metadata.java
@@ -105,4 +105,20 @@ public @interface Metadata {
*/
boolean skip() default false;
+ /**
+ * To exclude one or more properties.
+ * <p/>
+ * This is for example used when a Camel component extend another
component, and then may need to not use some of the properties from
+ * the parent component. Multiple properties can be separated by comma.
+ */
+ String excludeProperties() default "";
+
+ /**
+ * To include one or more properties.
+ *
+ * Some dataformats share same base but individually they have some
specific options, then this
+ * can be used to specify which options each implementation only supports.
+ */
+ String includeProperties() default "";
+
}
diff --git
a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
index 8e770b2..97adf37 100644
---
a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
+++
b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
@@ -153,7 +153,10 @@ public @interface UriEndpoint {
* <p/>
* This is used when a Camel component extend another component, and then
may need to not use some of the properties from
* the parent component. Multiple properties can be separated by comma.
+ *
+ * @deprecated use {@link Metadata#excludeProperties()}
*/
+ @Deprecated
String excludeProperties() default "";
/**