You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/03/12 15:08:10 UTC
[camel] 01/02: CAMEL-14702: Remove JAXB XmlAdapter from model.
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
commit 4508bdb502a008b31301dc1fa6c9614a2b9488bc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 12 15:46:50 2020 +0100
CAMEL-14702: Remove JAXB XmlAdapter from model.
Remove not needed glashfish jaxb-runtime from Java9+ profile for core modules
---
.../org/apache/camel/dataformat/any23/any23.json | 1 +
.../src/main/docs/any23-dataformat.adoc | 3 +-
.../any23/spring/SpringAny23DataFormatTest.xml | 4 +-
.../xstream/XStreamDataFormatConfigurer.java | 2 +-
.../apache/camel/dataformat/xstream/xstream.json | 8 +-
.../src/main/docs/xstream-dataformat.adoc | 6 +-
.../dataformat/xstream/AbstractXStreamWrapper.java | 41 +-
.../xstream/XStreamConfigurationTest.java | 24 +-
.../xstream/XStreamDataFormatOmitFieldsTest.java | 4 +-
.../xstream/SpringMarshalOmitFieldsTest.xml | 6 +-
.../xstream/SpringXStreamConfigurationTest.xml | 28 +-
core/camel-core-engine/pom.xml | 18 +-
.../org/apache/camel/model/dataformat/any23.json | 1 +
.../org/apache/camel/model/dataformat/jaxb.index | 8 -
.../org/apache/camel/model/dataformat/xstream.json | 8 +-
.../camel/model/PropertyDescriptionsAdapter.java | 50 ---
.../org/apache/camel/model/TimeUnitAdapter.java | 50 ---
.../camel/model/dataformat/Any23DataFormat.java | 52 ++-
.../camel/model/dataformat/XStreamDataFormat.java | 442 ++++-----------------
.../reifier/dataformat/Any23DataFormatReifier.java | 2 +-
.../dataformat/XStreamDataFormatReifier.java | 8 +-
.../xml/AbstractCamelThreadPoolFactoryBean.java | 20 +-
.../model/dataformat/Any23DataFormatTest.java | 8 +-
core/camel-management-api/pom.xml | 12 -
core/camel-management/pom.xml | 12 -
core/camel-xml-io/pom.xml | 7 -
.../java/org/apache/camel/xml/in/ModelParser.java | 99 +----
.../java/org/apache/camel/xml/in/BaseParser.java | 10 -
.../modules/ROOT/pages/camel-3x-upgrade-guide.adoc | 74 ++++
29 files changed, 280 insertions(+), 728 deletions(-)
diff --git a/components/camel-any23/src/generated/resources/org/apache/camel/dataformat/any23/any23.json b/components/camel-any23/src/generated/resources/org/apache/camel/dataformat/any23/any23.json
index 4e204a5..8cd40a0 100644
--- a/components/camel-any23/src/generated/resources/org/apache/camel/dataformat/any23/any23.json
+++ b/components/camel-any23/src/generated/resources/org/apache/camel/dataformat/any23/any23.json
@@ -17,6 +17,7 @@
},
"properties": {
"outputFormat": { "kind": "attribute", "displayName": "Output Format", "required": false, "type": "enum", "javaType": "org.apache.camel.dataformat.any23.Any23OutputFormat", "enum": [ "JSONLD", "NQUADS", "NTRIPLES", "RDF4JMODEL", "RDFJSON", "RDFXML", "TURTLE" ], "deprecated": false, "secret": false, "defaultValue": "RDF4JMODEL", "description": "What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL." },
+ "configuration": { "kind": "element", "displayName": "Configuration", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "secret": false, "description": "Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used." },
"extractors": { "kind": "element", "displayName": "Extractors", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "secret": false, "description": "List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used." },
"baseURI": { "kind": "attribute", "displayName": "Base URI", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The URI to use as base for building RDF entities if only relative paths are provided." },
"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-any23/src/main/docs/any23-dataformat.adoc b/components/camel-any23/src/main/docs/any23-dataformat.adoc
index e1d4600..c5fae04 100644
--- a/components/camel-any23/src/main/docs/any23-dataformat.adoc
+++ b/components/camel-any23/src/main/docs/any23-dataformat.adoc
@@ -13,7 +13,7 @@ Any23 is a Data Format that is intended to convert HTML from a site (or file) in
== Any23 Options
// dataformat options: START
-The Any23 dataformat supports 4 options, which are listed below.
+The Any23 dataformat supports 5 options, which are listed below.
@@ -21,6 +21,7 @@ The Any23 dataformat supports 4 options, which are listed below.
|===
| Name | Default | Java Type | Description
| outputFormat | RDF4JMODEL | Any23OutputFormat | What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL. The value can be one of: JSONLD, NQUADS, NTRIPLES, RDF4JMODEL, RDFJSON, RDFXML, TURTLE
+| configuration | | List | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used.
| extractors | | List | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used.
| baseURI | | String | The URI to use as base for building RDF entities if only relative paths are provided.
| 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.
diff --git a/components/camel-any23/src/test/resources/org/apache/camel/dataformat/any23/spring/SpringAny23DataFormatTest.xml b/components/camel-any23/src/test/resources/org/apache/camel/dataformat/any23/spring/SpringAny23DataFormatTest.xml
index f9a4ff6..93c89a9 100644
--- a/components/camel-any23/src/test/resources/org/apache/camel/dataformat/any23/spring/SpringAny23DataFormatTest.xml
+++ b/components/camel-any23/src/test/resources/org/apache/camel/dataformat/any23/spring/SpringAny23DataFormatTest.xml
@@ -29,9 +29,7 @@
<dataFormats>
<any23 id="any23" baseURI ="http://mock.foo/bar" outputFormat="TURTLE" >
- <configuration>
- <property key="any23.extraction.metadata.nesting" value="off" />
- </configuration>
+ <configuration key="any23.extraction.metadata.nesting" value="off"/>
<extractors>html-head-title</extractors>
</any23>
</dataFormats>
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 e438777..c0c5c0a 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
@@ -19,7 +19,7 @@ public class XStreamDataFormatConfigurer extends PropertyConfigurerSupport imple
XStreamDataFormat dataformat = (XStreamDataFormat) target;
switch (ignoreCase ? name.toLowerCase() : name) {
case "encoding": dataformat.setEncoding(property(camelContext, java.lang.String.class, value)); return true;
- case "converters": dataformat.setConverters(property(camelContext, java.util.List.class, value)); return true;
+ case "converters": dataformat.setConverters(property(camelContext, java.util.Map.class, value)); return true;
case "aliases": dataformat.setAliases(property(camelContext, java.util.Map.class, value)); return true;
case "omitfields":
case "omitFields": dataformat.setOmitFields(property(camelContext, java.util.Map.class, value)); return true;
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 017ba0e..dec672e 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
@@ -21,10 +21,10 @@
"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<java.lang.String>", "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": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "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": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String[]>", "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." },
- "implicitCollections": { "kind": "element", "displayName": "Implicit Collections", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String[]>", "deprecated": false, "secret": false, "description": "Adds a default implicit collection which is used for any unmapped XML tag." },
+ "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" }
}
diff --git a/components/camel-xstream/src/main/docs/xstream-dataformat.adoc b/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
index 93afea2..27d2ae2 100644
--- a/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/xstream-dataformat.adoc
@@ -39,9 +39,9 @@ The XStream dataformat supports 10 options, which are listed below.
| 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 | | Map | Alias a Class to a shorter name to be used in XML elements.
-| omitFields | | Map | 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.
-| implicitCollections | | Map | Adds a default implicit collection which is used for any unmapped XML tag.
+| aliases | | List | Alias a Class to a shorter name to be used in XML elements.
+| omitFields | | List | 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 | | List | Adds a default implicit collection which is used for any unmapped XML tag. Multiple values can be separated by comma.
| 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-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 bf63f19..ec2d4ec 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
@@ -56,10 +56,10 @@ public abstract class AbstractXStreamWrapper extends ServiceSupport implements C
private CamelContext camelContext;
private XStream xstream;
private HierarchicalStreamDriver xstreamDriver;
- private List<String> converters;
+ private Map<String, String> converters;
private Map<String, String> aliases;
- private Map<String, String[]> omitFields;
- private Map<String, String[]> implicitCollections;
+ private Map<String, String> omitFields;
+ private Map<String, String> implicitCollections;
private String permissions;
private String mode;
private boolean contentTypeHeader = true;
@@ -131,8 +131,9 @@ public abstract class AbstractXStreamWrapper extends ServiceSupport implements C
try {
if (this.implicitCollections != null) {
- for (Entry<String, String[]> entry : this.implicitCollections.entrySet()) {
- for (String name : entry.getValue()) {
+ for (Entry<String, String> entry : this.implicitCollections.entrySet()) {
+ String[] values = entry.getValue().split(",");
+ for (String name : values) {
xstream.addImplicitCollection(resolver.resolveMandatoryClass(entry.getKey()), name);
}
}
@@ -147,16 +148,18 @@ public abstract class AbstractXStreamWrapper extends ServiceSupport implements C
}
if (this.omitFields != null) {
- for (Entry<String, String[]> entry : this.omitFields.entrySet()) {
- for (String name : entry.getValue()) {
+ for (Entry<String, String> entry : this.omitFields.entrySet()) {
+ String[] values = entry.getValue().split(",");
+ for (String name : values) {
xstream.omitField(resolver.resolveMandatoryClass(entry.getKey()), name);
}
}
}
if (this.converters != null) {
- for (String name : this.converters) {
- Class<Converter> converterClass = resolver.resolveMandatoryClass(name, Converter.class);
+ for (Entry<String, String> entry : this.converters.entrySet()) {
+ String fqn = entry.getValue();
+ Class<Converter> converterClass = resolver.resolveMandatoryClass(fqn, Converter.class);
Converter converter;
Constructor<Converter> con = null;
@@ -262,11 +265,11 @@ public abstract class AbstractXStreamWrapper extends ServiceSupport implements C
return result;
}
- public List<String> getConverters() {
+ public Map<String, String> getConverters() {
return converters;
}
- public void setConverters(List<String> converters) {
+ public void setConverters(Map<String, String> converters) {
this.converters = converters;
}
@@ -278,20 +281,20 @@ public abstract class AbstractXStreamWrapper extends ServiceSupport implements C
this.aliases = aliases;
}
- public Map<String, String[]> getImplicitCollections() {
- return implicitCollections;
+ public Map<String, String> getOmitFields() {
+ return omitFields;
}
- public void setImplicitCollections(Map<String, String[]> implicitCollections) {
- this.implicitCollections = implicitCollections;
+ public void setOmitFields(Map<String, String> omitFields) {
+ this.omitFields = omitFields;
}
- public Map<String, String[]> getOmitFields() {
- return omitFields;
+ public Map<String, String> getImplicitCollections() {
+ return implicitCollections;
}
- public void setOmitFields(Map<String, String[]> omitFields) {
- this.omitFields = omitFields;
+ public void setImplicitCollections(Map<String, String> implicitCollections) {
+ this.implicitCollections = implicitCollections;
}
public HierarchicalStreamDriver getXstreamDriver() {
diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java
index 9df44ff..ff904ec 100644
--- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java
+++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java
@@ -42,7 +42,7 @@ public class XStreamConfigurationTest extends CamelTestSupport {
private static volatile boolean constructorInjected;
private static volatile boolean methodInjected;
-
+
@Override
@Before
public void setUp() throws Exception {
@@ -51,11 +51,6 @@ public class XStreamConfigurationTest extends CamelTestSupport {
methodInjected = false;
}
- public void testXStreamInjection() {
- assertTrue(constructorInjected);
- assertTrue(methodInjected);
- }
-
@Test
public void testCustomMarshalDomainObject() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -143,15 +138,15 @@ public class XStreamConfigurationTest extends CamelTestSupport {
xstreamDefinition.setAliases(aliases);
xstreamDefinition.setPermissions(PurchaseOrder.class, PurchaseHistory.class);
- List<String> converters = new ArrayList<>();
- converters.add(PurchaseOrderConverter.class.getName());
- converters.add(CheckMethodInjection.class.getName());
- converters.add(CheckConstructorInjection.class.getName());
+ Map<String, String> converters = new HashMap<>();
+ converters.put("1", PurchaseOrderConverter.class.getName());
+ converters.put("2", CheckMethodInjection.class.getName());
+ converters.put("3", CheckConstructorInjection.class.getName());
xstreamDefinition.setConverters(converters);
- Map<String, String[]> implicits = new HashMap<>();
- implicits.put(PurchaseHistory.class.getName(), new String[] {"history"});
+ Map<String, String> implicits = new HashMap<>();
+ implicits.put(PurchaseHistory.class.getName(), "history");
xstreamDefinition.setImplicitCollections(implicits);
from("direct:marshal").marshal(xstreamDefinition).to("mock:result");
@@ -164,8 +159,9 @@ public class XStreamConfigurationTest extends CamelTestSupport {
xstreamDefinition.setAliases(aliases);
xstreamDefinition.setPermissions(PurchaseOrder.class, PurchaseHistory.class);
- converters = new ArrayList<>();
- converters.add(PurchaseOrderConverter.class.getName());
+ converters = new HashMap<>();
+ converters.put("1", PurchaseOrderConverter.class.getName());
+
xstreamDefinition.setConverters(converters);
from("direct:marshal-json").marshal(xstreamDefinition).to("mock:result");
from("direct:unmarshal-json").unmarshal(xstreamDefinition).to("mock:result");
diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java
index b9df598..a469fec 100644
--- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java
+++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java
@@ -55,8 +55,8 @@ public class XStreamDataFormatOmitFieldsTest extends CamelTestSupport {
return new RouteBuilder() {
public void configure() {
XStreamDataFormat xStreamDataFormat = new XStreamDataFormat();
- Map<String, String[]> omitFields = new HashMap<>();
- omitFields.put(PurchaseOrder.class.getName(), new String[]{"price"});
+ Map<String, String> omitFields = new HashMap<>();
+ omitFields.put(PurchaseOrder.class.getName(), "price");
xStreamDataFormat.setOmitFields(omitFields);
from("direct:start").
diff --git a/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.xml b/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.xml
index bc32de6..89b9c2a 100644
--- a/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.xml
+++ b/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.xml
@@ -30,11 +30,7 @@
<dataFormats>
<xstream id="xstream" permissions="org.apache.camel.dataformat.stream.*">
<!-- omit the price file from the PurchaseOrder class -->
- <omitFields>
- <omitField class="org.apache.camel.dataformat.xstream.PurchaseOrder">
- <field>price</field>
- </omitField>
- </omitFields>
+ <omitFields key="org.apache.camel.dataformat.xstream.PurchaseOrder" value="price"/>
</xstream>
</dataFormats>
<!-- END SNIPPET: e1 -->
diff --git a/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml b/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml
index 69c9194..babf6d5 100644
--- a/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml
+++ b/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml
@@ -33,31 +33,15 @@
<dataFormats>
<xstream id="xstream-1" mode="NO_REFERENCES"
permissions="-org.apache.camel.dataformat.xstream.*,org.apache.camel.dataformat.xstream.PurchaseHistory,org.apache.camel.dataformat.xstream.PurchaseOrder">
- <converters>
- <converter class="org.apache.camel.dataformat.xstream.XStreamConfigurationTest$PurchaseOrderConverter" />
- </converters>
- <aliases>
- <alias name="purchase-order" class="org.apache.camel.dataformat.xstream.PurchaseOrder" />
- </aliases>
- <implicitCollections>
- <class name="org.apache.camel.dataformat.xstream.PurchaseHistory">
- <field>history</field>
- </class>
- </implicitCollections>
+ <converters key="purchase-converter" value="org.apache.camel.dataformat.xstream.XStreamConfigurationTest$PurchaseOrderConverter"/>
+ <aliases key="purchase-order" value="org.apache.camel.dataformat.xstream.PurchaseOrder"/>
+ <implicitCollections key="org.apache.camel.dataformat.xstream.PurchaseHistory" value="history"/>
</xstream>
<xstream id="xstream-json" driver="json" permissions="org.apache.camel.dataformat.xstream.*">
- <converters>
- <converter class="org.apache.camel.dataformat.xstream.XStreamConfigurationTest$PurchaseOrderConverter" />
- </converters>
- <aliases>
- <alias name="purchase-order" class="org.apache.camel.dataformat.xstream.PurchaseOrder" />
- </aliases>
- <implicitCollections>
- <class name="org.apache.camel.dataformat.xstream.PurchaseHistory">
- <field>history</field>
- </class>
- </implicitCollections>
+ <converters key="purchase-converter" value="org.apache.camel.dataformat.xstream.XStreamConfigurationTest$PurchaseOrderConverter"/>
+ <aliases key="purchase-order" value="org.apache.camel.dataformat.xstream.PurchaseOrder"/>
+ <implicitCollections key="org.apache.camel.dataformat.xstream.PurchaseHistory" value="history"/>
</xstream>
<xstream id="xstream-driver" driverRef="myDriver" permissions="org.apache.camel.dataformat.xstream.*"/>
diff --git a/core/camel-core-engine/pom.xml b/core/camel-core-engine/pom.xml
index 351d4ae..56a2d04 100644
--- a/core/camel-core-engine/pom.xml
+++ b/core/camel-core-engine/pom.xml
@@ -51,9 +51,9 @@
<!-- JAXB annotations are used for the EIP models -->
<!-- but they are only used at runtime when using camel-xml-jaxb -->
<dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-core</artifactId>
- <scope>provided</scope>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
+ <version>${jakarta-jaxb-version}</version>
</dependency>
<!-- required dependencies by camel-core -->
@@ -362,18 +362,6 @@
<FOO_SERVICE_PORT>8081</FOO_SERVICE_PORT>
</environmentVariables>
</configuration>
- <dependencies>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <version>${jakarta-jaxb-version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>jaxb-runtime</artifactId>
- <version>${glassfish-jaxb-runtime-version}</version>
- </dependency>
- </dependencies>
</plugin>
</plugins>
</build>
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/any23.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/any23.json
index 53361e0..d1892a1 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/any23.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/any23.json
@@ -13,6 +13,7 @@
},
"properties": {
"outputFormat": { "kind": "attribute", "displayName": "Output Format", "required": false, "type": "enum", "javaType": "org.apache.camel.dataformat.any23.Any23OutputFormat", "enum": [ "JSONLD", "NQUADS", "NTRIPLES", "RDF4JMODEL", "RDFJSON", "RDFXML", "TURTLE" ], "deprecated": false, "secret": false, "defaultValue": "RDF4JMODEL", "description": "What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL." },
+ "configuration": { "kind": "element", "displayName": "Configuration", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "secret": false, "description": "Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used." },
"extractors": { "kind": "element", "displayName": "Extractors", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "secret": false, "description": "List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used." },
"baseURI": { "kind": "attribute", "displayName": "Base URI", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The URI to use as base for building RDF entities if only relative paths are provided." },
"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/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index
index 8b92dcf..3c81a9c 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index
@@ -41,14 +41,6 @@ UniVocityHeader
UniVocityTsvDataFormat
XMLSecurityDataFormat
XStreamDataFormat
-XStreamDataFormat$AliasEntry
-XStreamDataFormat$AliasList
-XStreamDataFormat$ConverterEntry
-XStreamDataFormat$ConverterList
-XStreamDataFormat$ImplicitCollectionEntry
-XStreamDataFormat$ImplicitCollectionList
-XStreamDataFormat$OmitFieldEntry
-XStreamDataFormat$OmitFieldList
XmlRpcDataFormat
YAMLDataFormat
YAMLLibrary
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/xstream.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/xstream.json
index e82b80a..7dbe9b8 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/xstream.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/dataformat/xstream.json
@@ -17,10 +17,10 @@
"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<java.lang.String>", "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": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "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": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String[]>", "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." },
- "implicitCollections": { "kind": "element", "displayName": "Implicit Collections", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String[]>", "deprecated": false, "secret": false, "description": "Adds a default implicit collection which is used for any unmapped XML tag." },
+ "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" }
}
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/PropertyDescriptionsAdapter.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/PropertyDescriptionsAdapter.java
deleted file mode 100644
index 1042a7a..0000000
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/PropertyDescriptionsAdapter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.model;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-public class PropertyDescriptionsAdapter extends XmlAdapter<PropertyDefinitions, Map<String, String>> {
-
- @Override
- public Map<String, String> unmarshal(PropertyDefinitions value) throws Exception {
- Map<String, String> ret = new HashMap<>();
-
- if (value != null) {
- value.getProperties().forEach(p -> ret.put(p.getKey(), p.getValue()));
- }
-
- return ret;
- }
-
- @Override
- public PropertyDefinitions marshal(Map<String, String> value) throws Exception {
- PropertyDefinitions ret = new PropertyDefinitions();
-
- if (value != null) {
- final List<PropertyDefinition> properties = ret.getProperties();
- value.forEach((k, v) -> properties.add(new PropertyDefinition(k, v)));
- }
-
- return ret;
- }
-
-}
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/TimeUnitAdapter.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/TimeUnitAdapter.java
deleted file mode 100644
index e22ed76..0000000
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/TimeUnitAdapter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.model;
-
-import java.util.Locale;
-import java.util.concurrent.TimeUnit;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-/**
- * <code>TimeUnitAdapter</code> is a simple adapter to convert between Strings
- * and instances of the {@link TimeUnit} enumeration
- */
-@XmlJavaTypeAdapter(value = TimeUnitAdapter.class)
-public class TimeUnitAdapter extends XmlAdapter<String, TimeUnit> {
-
- @Override
- public String marshal(TimeUnit v) throws Exception {
- String result = null;
- if (v != null) {
- result = v.toString();
- }
- return result;
- }
-
- @Override
- public TimeUnit unmarshal(String v) throws Exception {
- TimeUnit result = null;
- if (v != null) {
- result = TimeUnit.valueOf(v.toUpperCase(Locale.ENGLISH));
- }
- return result;
- }
-
-}
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java
index 81834b2..a834be6 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java
@@ -16,19 +16,19 @@
*/
package org.apache.camel.model.dataformat;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.XmlTransient;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.model.PropertyDescriptionsAdapter;
+import org.apache.camel.model.PropertyDefinition;
import org.apache.camel.spi.Metadata;
/**
@@ -43,8 +43,10 @@ public class Any23DataFormat extends DataFormatDefinition {
@Metadata(defaultValue = "RDF4JMODEL", enums = "NTRIPLES,TURTLE,NQUADS,RDFXML,JSONLD,RDFJSON,RDF4JMODEL",
javaType = "org.apache.camel.dataformat.any23.Any23OutputFormat")
private String outputFormat;
- @XmlJavaTypeAdapter(PropertyDescriptionsAdapter.class)
- private Map<String, String> configuration = new HashMap<>();
+ @XmlElement(name = "configuration")
+ private List<PropertyDefinition> configuration;
+ @XmlTransient
+ private Map<String, String> configurations;
@XmlElement
private List<String> extractors;
@XmlAttribute
@@ -67,13 +69,13 @@ public class Any23DataFormat extends DataFormatDefinition {
public Any23DataFormat(String baseuri, Any23Type outputFormat, Map<String, String> configurations) {
this(baseuri, outputFormat);
this.outputFormat = outputFormat.name();
- this.configuration = configurations;
+ this.configurations = configurations;
}
public Any23DataFormat(String baseuri, Any23Type outputFormat, Map<String, String> configurations, List<String> extractors) {
this(baseuri, outputFormat, configurations);
this.outputFormat = outputFormat.name();
- this.configuration = configurations;
+ this.configurations = configurations;
this.extractors = extractors;
}
@@ -89,7 +91,19 @@ public class Any23DataFormat extends DataFormatDefinition {
this.outputFormat = outputFormat;
}
- public Map<String, String> getConfiguration() {
+ public Map<String, String> getConfigurationAsMap() {
+ if (configurations == null && configuration != null) {
+ configurations = new HashMap<>();
+ }
+ if (configuration != null) {
+ for (PropertyDefinition def : configuration) {
+ configurations.put(def.getKey(), def.getValue());
+ }
+ }
+ return configurations;
+ }
+
+ public List<PropertyDefinition> getConfiguration() {
return configuration;
}
@@ -100,8 +114,20 @@ public class Any23DataFormat extends DataFormatDefinition {
* "https://github.com/apache/any23/blob/master/api/src/main/resources/default-configuration.properties">here</a>.
* If not provided, a default configuration is used.
*/
- public void setConfiguration(Map<String, String> configurations) {
- this.configuration = configurations;
+ public void setConfiguration(List<PropertyDefinition> configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
+ * Configurations for Apache Any23 as key-value pairs in order to customize
+ * the extraction process. The list of supported parameters can be found
+ * <a href=
+ * "https://github.com/apache/any23/blob/master/api/src/main/resources/default-configuration.properties">here</a>.
+ * If not provided, a default configuration is used.
+ */
+ public void setConfiguration(Map<String, String> configuration) {
+ this.configuration = new ArrayList<>();
+ configuration.forEach((k, v) -> this.configuration.add(new PropertyDefinition(k, v)));
}
public List<String> getExtractors() {
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
index 50ddc8d..83b1238 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
@@ -16,24 +16,18 @@
*/
package org.apache.camel.model.dataformat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.model.PropertyDefinition;
import org.apache.camel.spi.Metadata;
import org.apache.camel.util.CollectionStringBuffer;
@@ -56,18 +50,14 @@ public class XStreamDataFormat extends DataFormatDefinition {
@XmlAttribute
private String mode;
- @XmlJavaTypeAdapter(ConvertersAdapter.class)
@XmlElement(name = "converters")
- private List<String> converters;
- @XmlJavaTypeAdapter(AliasAdapter.class)
+ private List<PropertyDefinition> converters;
@XmlElement(name = "aliases")
- private Map<String, String> aliases;
- @XmlJavaTypeAdapter(OmitFieldsAdapter.class)
+ private List<PropertyDefinition> aliases;
@XmlElement(name = "omitFields")
- private Map<String, String[]> omitFields;
- @XmlJavaTypeAdapter(ImplicitCollectionsAdapter.class)
+ private List<PropertyDefinition> omitFields;
@XmlElement(name = "implicitCollections")
- private Map<String, String[]> implicitCollections;
+ private List<PropertyDefinition> implicitCollections;
public XStreamDataFormat() {
super("xstream");
@@ -138,54 +128,118 @@ public class XStreamDataFormat extends DataFormatDefinition {
this.mode = mode;
}
- public List<String> getConverters() {
+ public List<PropertyDefinition> getConverters() {
return converters;
}
+ public Map<String, String> getConvertersAsMap() {
+ if (converters == null || converters.isEmpty()) {
+ return null;
+ }
+ Map<String, String> answer = new LinkedHashMap<>();
+ for (PropertyDefinition def : converters) {
+ answer.put(def.getKey(), def.getValue());
+ }
+ return answer;
+ }
+
/**
* List of class names for using custom XStream converters. The classes must
* be of type com.thoughtworks.xstream.converters.Converter
*/
- public void setConverters(List<String> converters) {
+ public void setConverters(List<PropertyDefinition> converters) {
this.converters = converters;
}
- public Map<String, String> getAliases() {
+ public void setConverters(Map<String, String> converters) {
+ this.converters = new ArrayList<>();
+ converters.forEach((k, v) -> this.converters.add(new PropertyDefinition(k, v)));
+ }
+
+ public List<PropertyDefinition> getAliases() {
return aliases;
}
+ public Map<String, String> getAliasesAsMap() {
+ if (aliases == null || aliases.isEmpty()) {
+ return null;
+ }
+ Map<String, String> answer = new LinkedHashMap<>();
+ for (PropertyDefinition def : aliases) {
+ answer.put(def.getKey(), def.getValue());
+ }
+ return answer;
+ }
+
/**
* Alias a Class to a shorter name to be used in XML elements.
*/
- public void setAliases(Map<String, String> aliases) {
+ public void setAliases(List<PropertyDefinition> aliases) {
this.aliases = aliases;
}
- public Map<String, String[]> getOmitFields() {
+ public void setAliases(Map<String, String> aliases) {
+ this.aliases = new ArrayList<>();
+ aliases.forEach((k, v) -> this.aliases.add(new PropertyDefinition(k, v)));
+ }
+
+ public List<PropertyDefinition> getOmitFields() {
return omitFields;
}
/**
* 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.
+ * converted. Multiple values can be separated by comma.
*/
- public void setOmitFields(Map<String, String[]> omitFields) {
+ public void setOmitFields(List<PropertyDefinition> omitFields) {
this.omitFields = omitFields;
}
- public Map<String, String[]> getImplicitCollections() {
+ public void setOmitFields(Map<String, String> aliases) {
+ this.omitFields = new ArrayList<>();
+ aliases.forEach((k, v) -> this.omitFields.add(new PropertyDefinition(k, v)));
+ }
+
+ public Map<String, String> getOmitFieldsAsMap() {
+ if (omitFields == null || omitFields.isEmpty()) {
+ return null;
+ }
+ Map<String, String> answer = new LinkedHashMap<>();
+ for (PropertyDefinition def : omitFields) {
+ answer.put(def.getKey(), def.getValue());
+ }
+ return answer;
+ }
+
+ public List<PropertyDefinition> getImplicitCollections() {
return implicitCollections;
}
/**
- * Adds a default implicit collection which is used for any unmapped XML
- * tag.
+ * Adds a default implicit collection which is used for any unmapped XML tag.
+ * Multiple values can be separated by comma.
*/
- public void setImplicitCollections(Map<String, String[]> implicitCollections) {
+ public void setImplicitCollections(List<PropertyDefinition> implicitCollections) {
this.implicitCollections = implicitCollections;
}
+ public void setImplicitCollections(Map<String, String> implicitCollections) {
+ this.implicitCollections = new ArrayList<>();
+ implicitCollections.forEach((k, v) -> this.implicitCollections.add(new PropertyDefinition(k, v)));
+ }
+
+ public Map<String, String> getImplicitCollectionsAsMap() {
+ if (implicitCollections == null || implicitCollections.isEmpty()) {
+ return null;
+ }
+ Map<String, String> answer = new LinkedHashMap<>();
+ for (PropertyDefinition def : implicitCollections) {
+ answer.put(def.getKey(), def.getValue());
+ }
+ return answer;
+ }
+
public String getPermissions() {
return permissions;
}
@@ -225,332 +279,4 @@ public class XStreamDataFormat extends DataFormatDefinition {
setPermissions(csb.toString());
}
- @XmlTransient
- public static class ConvertersAdapter extends XmlAdapter<ConverterList, List<String>> {
- @Override
- public ConverterList marshal(List<String> v) throws Exception {
- if (v == null) {
- return null;
- }
-
- List<ConverterEntry> list = new ArrayList<>();
- for (String str : v) {
- ConverterEntry entry = new ConverterEntry();
- entry.setClsName(str);
- list.add(entry);
- }
- ConverterList converterList = new ConverterList();
- converterList.setList(list);
- return converterList;
- }
-
- @Override
- public List<String> unmarshal(ConverterList v) throws Exception {
- if (v == null) {
- return null;
- }
-
- List<String> list = new ArrayList<>();
- for (ConverterEntry entry : v.getList()) {
- list.add(entry.getClsName());
- }
- return list;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "converterList", namespace = "http://camel.apache.org/schema/spring")
- public static class ConverterList {
- @XmlElement(name = "converter", namespace = "http://camel.apache.org/schema/spring")
- private List<ConverterEntry> list;
-
- public List<ConverterEntry> getList() {
- return list;
- }
-
- public void setList(List<ConverterEntry> list) {
- this.list = list;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "converterEntry", namespace = "http://camel.apache.org/schema/spring")
- public static class ConverterEntry {
- @XmlAttribute(name = "class")
- private String clsName;
-
- public String getClsName() {
- return clsName;
- }
-
- public void setClsName(String clsName) {
- this.clsName = clsName;
- }
- }
-
- @XmlTransient
- public static class ImplicitCollectionsAdapter extends XmlAdapter<ImplicitCollectionList, Map<String, String[]>> {
-
- @Override
- public ImplicitCollectionList marshal(Map<String, String[]> v) throws Exception {
- if (v == null || v.isEmpty()) {
- return null;
- }
-
- List<ImplicitCollectionEntry> list = new ArrayList<>();
- for (Entry<String, String[]> e : v.entrySet()) {
- ImplicitCollectionEntry entry = new ImplicitCollectionEntry(e.getKey(), e.getValue());
- list.add(entry);
- }
-
- ImplicitCollectionList collectionList = new ImplicitCollectionList();
- collectionList.setList(list);
-
- return collectionList;
- }
-
- @Override
- public Map<String, String[]> unmarshal(ImplicitCollectionList v) throws Exception {
- if (v == null) {
- return null;
- }
-
- Map<String, String[]> map = new HashMap<>();
- for (ImplicitCollectionEntry entry : v.getList()) {
- map.put(entry.getClsName(), entry.getFields());
- }
- return map;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "implicitCollectionList", namespace = "http://camel.apache.org/schema/spring")
- public static class ImplicitCollectionList {
- @XmlElement(name = "class", namespace = "http://camel.apache.org/schema/spring")
- private List<ImplicitCollectionEntry> list;
-
- public List<ImplicitCollectionEntry> getList() {
- return list;
- }
-
- public void setList(List<ImplicitCollectionEntry> list) {
- this.list = list;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "implicitCollectionEntry", namespace = "http://camel.apache.org/schema/spring")
- public static class ImplicitCollectionEntry {
- @XmlAttribute(name = "name")
- private String clsName;
-
- @XmlElement(name = "field", namespace = "http://camel.apache.org/schema/spring")
- private String[] fields;
-
- public ImplicitCollectionEntry() {
- }
-
- public ImplicitCollectionEntry(String clsName, String[] fields) {
- this.clsName = clsName;
- this.fields = fields;
- }
-
- public String getClsName() {
- return clsName;
- }
-
- public void setClsName(String clsName) {
- this.clsName = clsName;
- }
-
- public String[] getFields() {
- return fields;
- }
-
- public void setFields(String[] fields) {
- this.fields = fields;
- }
-
- @Override
- public String toString() {
- return "Alias[ImplicitCollection=" + clsName + ", fields=" + Arrays.asList(this.fields) + "]";
- }
- }
-
- @XmlTransient
- public static class AliasAdapter extends XmlAdapter<AliasList, Map<String, String>> {
-
- @Override
- public AliasList marshal(Map<String, String> value) throws Exception {
- if (value == null || value.isEmpty()) {
- return null;
- }
-
- List<AliasEntry> ret = new ArrayList<>(value.size());
- for (Map.Entry<String, String> entry : value.entrySet()) {
- ret.add(new AliasEntry(entry.getKey(), entry.getValue()));
- }
- AliasList jaxbMap = new AliasList();
- jaxbMap.setList(ret);
- return jaxbMap;
- }
-
- @Override
- public Map<String, String> unmarshal(AliasList value) throws Exception {
- if (value == null || value.getList() == null || value.getList().isEmpty()) {
- return null;
- }
-
- Map<String, String> answer = new HashMap<>();
- for (AliasEntry alias : value.getList()) {
- answer.put(alias.getName(), alias.getClsName());
- }
- return answer;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "aliasList", namespace = "http://camel.apache.org/schema/spring")
- public static class AliasList {
- @XmlElement(name = "alias", namespace = "http://camel.apache.org/schema/spring")
- private List<AliasEntry> list;
-
- public List<AliasEntry> getList() {
- return list;
- }
-
- public void setList(List<AliasEntry> list) {
- this.list = list;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "aliasEntry", namespace = "http://camel.apache.org/schema/spring")
- public static class AliasEntry {
-
- @XmlAttribute
- private String name;
-
- @XmlAttribute(name = "class")
- private String clsName;
-
- public AliasEntry() {
- }
-
- public AliasEntry(String key, String clsName) {
- this.name = key;
- this.clsName = clsName;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getClsName() {
- return clsName;
- }
-
- public void setClsName(String clsName) {
- this.clsName = clsName;
- }
-
- @Override
- public String toString() {
- return "Alias[name=" + name + ", class=" + clsName + "]";
- }
- }
-
- @XmlTransient
- public static class OmitFieldsAdapter extends XmlAdapter<OmitFieldList, Map<String, String[]>> {
-
- @Override
- public OmitFieldList marshal(Map<String, String[]> v) throws Exception {
- if (v == null || v.isEmpty()) {
- return null;
- }
-
- List<OmitFieldEntry> list = new ArrayList<>();
- for (Entry<String, String[]> e : v.entrySet()) {
- OmitFieldEntry entry = new OmitFieldEntry(e.getKey(), e.getValue());
- list.add(entry);
- }
-
- OmitFieldList collectionList = new OmitFieldList();
- collectionList.setList(list);
-
- return collectionList;
- }
-
- @Override
- public Map<String, String[]> unmarshal(OmitFieldList v) throws Exception {
- if (v == null || v.getList() == null || v.getList().isEmpty()) {
- return null;
- }
-
- Map<String, String[]> map = new HashMap<>();
- for (OmitFieldEntry entry : v.getList()) {
- map.put(entry.getClsName(), entry.getFields());
- }
- return map;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "omitFieldList", namespace = "http://camel.apache.org/schema/spring")
- public static class OmitFieldList {
- @XmlElement(name = "omitField", namespace = "http://camel.apache.org/schema/spring")
- private List<OmitFieldEntry> list;
-
- public List<OmitFieldEntry> getList() {
- return list;
- }
-
- public void setList(List<OmitFieldEntry> list) {
- this.list = list;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "omitFieldEntry", namespace = "http://camel.apache.org/schema/spring")
- public static class OmitFieldEntry {
-
- @XmlAttribute(name = "class")
- private String clsName;
-
- @XmlElement(name = "field", namespace = "http://camel.apache.org/schema/spring")
- private String[] fields;
-
- public OmitFieldEntry() {
- }
-
- public OmitFieldEntry(String clsName, String[] fields) {
- this.clsName = clsName;
- this.fields = fields;
- }
-
- public String getClsName() {
- return clsName;
- }
-
- public void setClsName(String clsName) {
- this.clsName = clsName;
- }
-
- public String[] getFields() {
- return fields;
- }
-
- public void setFields(String[] fields) {
- this.fields = fields;
- }
-
- @Override
- public String toString() {
- return "OmitField[" + clsName + ", fields=" + Arrays.asList(this.fields) + "]";
- }
- }
}
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/Any23DataFormatReifier.java b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/Any23DataFormatReifier.java
index 0ae6d4e..92e1650 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/Any23DataFormatReifier.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/Any23DataFormatReifier.java
@@ -31,7 +31,7 @@ public class Any23DataFormatReifier extends DataFormatReifier<Any23DataFormat> {
@Override
protected void prepareDataFormatConfig(Map<String, Object> properties) {
properties.put("outputFormat", definition.getOutputFormat());
- properties.put("configurations", definition.getConfiguration());
+ properties.put("configurations", definition.getConfigurationAsMap());
properties.put("extractors", definition.getExtractors());
properties.put("baseURI", definition.getBaseURI());
}
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/XStreamDataFormatReifier.java b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/XStreamDataFormatReifier.java
index 5c2ea5e..e2c7034 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/XStreamDataFormatReifier.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/XStreamDataFormatReifier.java
@@ -33,10 +33,10 @@ public class XStreamDataFormatReifier extends DataFormatReifier<XStreamDataForma
properties.put("xstreamDriver", asRef(definition.getDriverRef()));
properties.put("permissions", definition.getPermissions());
properties.put("encoding", definition.getEncoding());
- properties.put("converters", definition.getConverters());
- properties.put("aliases", definition.getAliases());
- properties.put("omitFields", definition.getOmitFields());
- properties.put("implicitCollections", definition.getImplicitCollections());
+ properties.put("converters", definition.getConvertersAsMap());
+ properties.put("aliases", definition.getAliasesAsMap());
+ properties.put("omitFields", definition.getOmitFieldsAsMap());
+ properties.put("implicitCollections", definition.getImplicitCollectionsAsMap());
properties.put("mode", definition.getMode());
}
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
index f762496..94d9e56 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
@@ -16,16 +16,13 @@
*/
package org.apache.camel.core.xml;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
import org.apache.camel.builder.ThreadPoolProfileBuilder;
-import org.apache.camel.model.TimeUnitAdapter;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.ThreadPoolProfile;
import org.apache.camel.support.CamelContextHelper;
@@ -47,9 +44,9 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
@Metadata(description = "Sets the keep alive time for inactive threads")
private String keepAliveTime;
@XmlAttribute
- @XmlJavaTypeAdapter(TimeUnitAdapter.class)
- @Metadata(description = "Sets the time unit used for keep alive time", defaultValue = "SECONDS")
- private TimeUnit timeUnit = TimeUnit.SECONDS;
+ @Metadata(description = "Sets the time unit used for keep alive time", defaultValue = "SECONDS", javaType = "java.util.concurrent.TimeUnit",
+ enums = "NANOSECONDS,MICROSECONDS,MILLISECONDS,SECONDS,MINUTES,HOURS,DAYS")
+ private String timeUnit = TimeUnit.SECONDS.name();
@XmlAttribute
@Metadata(description = "Sets the maximum number of tasks in the work queue. Use -1 for an unbounded queue")
private String maxQueueSize;
@@ -92,11 +89,12 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
if (allowCoreThreadTimeOut != null) {
allow = CamelContextHelper.parseBoolean(getCamelContext(), allowCoreThreadTimeOut);
}
+ TimeUnit tu = CamelContextHelper.parse(getCamelContext(), TimeUnit.class, timeUnit);
ThreadPoolProfile profile = new ThreadPoolProfileBuilder(getId())
.poolSize(size)
.maxPoolSize(max)
- .keepAliveTime(keepAlive, timeUnit)
+ .keepAliveTime(keepAlive, tu)
.maxQueueSize(queueSize)
.allowCoreThreadTimeOut(allow)
.rejectedPolicy(rejectedPolicy)
@@ -140,11 +138,11 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
this.keepAliveTime = keepAliveTime;
}
- public TimeUnit getTimeUnit() {
+ public String getTimeUnit() {
return timeUnit;
}
- public void setTimeUnit(TimeUnit timeUnit) {
+ public void setTimeUnit(String timeUnit) {
this.timeUnit = timeUnit;
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/model/dataformat/Any23DataFormatTest.java b/core/camel-core/src/test/java/org/apache/camel/model/dataformat/Any23DataFormatTest.java
index 8680a1e..867290f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/model/dataformat/Any23DataFormatTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/model/dataformat/Any23DataFormatTest.java
@@ -32,10 +32,8 @@ public class Any23DataFormatTest {
private final String xml = "<?xml version=\"1.0\"?>"
+ "<any23 xmlns=\"http://camel.apache.org/schema/spring\">"
- + "<configuration>"
- + "<property key=\"k1\" value=\"v1\" />"
- + "<property key=\"k2\" value=\"v2\" />"
- + "</configuration>"
+ + "<configuration key=\"k1\" value=\"v1\" />"
+ + "<configuration key=\"k2\" value=\"v2\" />"
+ "</any23>";
@Test
@@ -47,6 +45,6 @@ public class Any23DataFormatTest {
final StringReader reader = new StringReader(xml);
final Any23DataFormat any23DataFormat = (Any23DataFormat) unmarshaller.unmarshal(reader);
- assertThat(any23DataFormat.getConfiguration()).containsOnly(entry("k1", "v1"), entry("k2", "v2"));
+ assertThat(any23DataFormat.getConfigurationAsMap()).containsOnly(entry("k1", "v1"), entry("k2", "v2"));
}
}
diff --git a/core/camel-management-api/pom.xml b/core/camel-management-api/pom.xml
index d9663fb..ebea157 100644
--- a/core/camel-management-api/pom.xml
+++ b/core/camel-management-api/pom.xml
@@ -287,18 +287,6 @@
<FOO_SERVICE_PORT>8081</FOO_SERVICE_PORT>
</environmentVariables>
</configuration>
- <dependencies>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <version>${jakarta-jaxb-version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>jaxb-runtime</artifactId>
- <version>${glassfish-jaxb-runtime-version}</version>
- </dependency>
- </dependencies>
</plugin>
</plugins>
</build>
diff --git a/core/camel-management/pom.xml b/core/camel-management/pom.xml
index 4bc6aee..bc323eb 100644
--- a/core/camel-management/pom.xml
+++ b/core/camel-management/pom.xml
@@ -375,18 +375,6 @@
<FOO_SERVICE_PORT>8081</FOO_SERVICE_PORT>
</environmentVariables>
</configuration>
- <dependencies>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <version>${jakarta-jaxb-version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jaxb</groupId>
- <artifactId>jaxb-runtime</artifactId>
- <version>${glassfish-jaxb-runtime-version}</version>
- </dependency>
- </dependencies>
</plugin>
</plugins>
</build>
diff --git a/core/camel-xml-io/pom.xml b/core/camel-xml-io/pom.xml
index ec6ad14..4dea30f 100644
--- a/core/camel-xml-io/pom.xml
+++ b/core/camel-xml-io/pom.xml
@@ -37,13 +37,6 @@
<dependencies>
- <!-- need JAXB API for @XmlAdapter -->
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- <version>${jakarta-jaxb-version}</version>
- </dependency>
-
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 0520c5e..0cf7eaa 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -1634,7 +1634,7 @@ public class ModelParser extends BaseParser {
return true;
}, (def, key) -> {
switch (key) {
- case "configuration": def.setConfiguration(unmarshal(new PropertyDescriptionsAdapter(), doParsePropertyDefinitions())); break;
+ case "configuration": doAdd(doParsePropertyDefinition(), def.getConfiguration(), def::setConfiguration); break;
case "extractors": doAdd(doParseText(), def.getExtractors(), def::setExtractors); break;
default: return false;
}
@@ -2171,104 +2171,15 @@ public class ModelParser extends BaseParser {
return true;
}, (def, key) -> {
switch (key) {
- case "aliases": def.setAliases(unmarshal(new XStreamDataFormat.AliasAdapter(), doParseAliasList())); break;
- case "converters": def.setConverters(unmarshal(new XStreamDataFormat.ConvertersAdapter(), doParseConverterList())); break;
- case "implicitCollections": def.setImplicitCollections(unmarshal(new XStreamDataFormat.ImplicitCollectionsAdapter(), doParseImplicitCollectionList())); break;
- case "omitFields": def.setOmitFields(unmarshal(new XStreamDataFormat.OmitFieldsAdapter(), doParseOmitFieldList())); break;
+ case "aliases": doAdd(doParsePropertyDefinition(), def.getAliases(), def::setAliases); break;
+ case "converters": doAdd(doParsePropertyDefinition(), def.getConverters(), def::setConverters); break;
+ case "implicitCollections": doAdd(doParsePropertyDefinition(), def.getImplicitCollections(), def::setImplicitCollections); break;
+ case "omitFields": doAdd(doParsePropertyDefinition(), def.getOmitFields(), def::setOmitFields); break;
default: return false;
}
return true;
}, noValueHandler());
}
- protected XStreamDataFormat.ConverterList doParseConverterList() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.ConverterList(),
- noAttributeHandler(), (def, key) -> {
- if ("converter".equals(key)) {
- doAdd(doParseConverterEntry(), def.getList(), def::setList);
- return true;
- }
- return false;
- }, noValueHandler());
- }
- protected XStreamDataFormat.AliasList doParseAliasList() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.AliasList(),
- noAttributeHandler(), (def, key) -> {
- if ("alias".equals(key)) {
- doAdd(doParseAliasEntry(), def.getList(), def::setList);
- return true;
- }
- return false;
- }, noValueHandler());
- }
- protected XStreamDataFormat.OmitFieldList doParseOmitFieldList() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.OmitFieldList(),
- noAttributeHandler(), (def, key) -> {
- if ("omitField".equals(key)) {
- doAdd(doParseOmitFieldEntry(), def.getList(), def::setList);
- return true;
- }
- return false;
- }, noValueHandler());
- }
- protected XStreamDataFormat.ImplicitCollectionList doParseImplicitCollectionList() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.ImplicitCollectionList(),
- noAttributeHandler(), (def, key) -> {
- if ("class".equals(key)) {
- doAdd(doParseImplicitCollectionEntry(), def.getList(), def::setList);
- return true;
- }
- return false;
- }, noValueHandler());
- }
- protected XStreamDataFormat.AliasEntry doParseAliasEntry() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.AliasEntry(), (def, key, val) -> {
- switch (key) {
- case "class": def.setClsName(val); break;
- case "name": def.setName(val); break;
- default: return false;
- }
- return true;
- }, noElementHandler(), noValueHandler());
- }
- protected XStreamDataFormat.ConverterEntry doParseConverterEntry() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.ConverterEntry(), (def, key, val) -> {
- if ("class".equals(key)) {
- def.setClsName(val);
- return true;
- }
- return false;
- }, noElementHandler(), noValueHandler());
- }
- protected XStreamDataFormat.ImplicitCollectionEntry doParseImplicitCollectionEntry() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.ImplicitCollectionEntry(), (def, key, val) -> {
- if ("name".equals(key)) {
- def.setClsName(val);
- return true;
- }
- return false;
- }, (def, key) -> {
- if ("field".equals(key)) {
- doAdd(doParseText(), def.getFields(), def::setFields);
- return true;
- }
- return false;
- }, noValueHandler());
- }
- protected XStreamDataFormat.OmitFieldEntry doParseOmitFieldEntry() throws IOException, XmlPullParserException {
- return doParse(new XStreamDataFormat.OmitFieldEntry(), (def, key, val) -> {
- if ("class".equals(key)) {
- def.setClsName(val);
- return true;
- }
- return false;
- }, (def, key) -> {
- if ("field".equals(key)) {
- doAdd(doParseText(), def.getFields(), def::setFields);
- return true;
- }
- return false;
- }, noValueHandler());
- }
protected XmlRpcDataFormat doParseXmlRpcDataFormat() throws IOException, XmlPullParserException {
return doParse(new XmlRpcDataFormat(), (def, key, val) -> {
if ("request".equals(key)) {
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/BaseParser.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/BaseParser.java
index 642b32e..8b166e6 100644
--- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/BaseParser.java
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/BaseParser.java
@@ -29,8 +29,6 @@ import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.xml.io.MXParser;
import org.apache.camel.xml.io.XmlPullParser;
@@ -138,14 +136,6 @@ public class BaseParser {
existing.add(element);
}
- protected <V, B> B unmarshal(XmlAdapter<V, B> adapter, V value) throws XmlPullParserException {
- try {
- return adapter.unmarshal(value);
- } catch (Exception e) {
- throw new XmlPullParserException("Unable to unmarshal value", parser, e);
- }
- }
-
@SuppressWarnings("unchecked")
protected <T> void doAdd(T element, T[] existing, Consumer<T[]> setter) {
int len = existing != null ? existing.length : 0;
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
index 08dd296..bd1a648 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide.adoc
@@ -643,6 +643,37 @@ After:
camel.component.activemq.broker-url=tcp://localhost:61616
----
+=== camel-any23
+
+The XML DSL has changed for the `<configuration>` element, which now
+is flattened so the key/values should be configured on it directly:
+
+Before:
+[source,mxl]
+----
+ <dataFormats>
+ <any23 id="any23" baseURI ="http://mock.foo/bar" outputFormat="TURTLE" >
+ <configuration>
+ <property key="any23.extraction.metadata.nesting" value="off" />
+ <property key="another-key" value="another-value" />
+ </configuration>
+ <extractors>html-head-title</extractors>
+ </any23>
+ </dataFormats>
+----
+
+After:
+[source,mxl]
+----
+ <dataFormats>
+ <any23 id="any23" baseURI ="http://mock.foo/bar" outputFormat="TURTLE" >
+ <configuration key="any23.extraction.metadata.nesting" value="off"/>
+ <configuration key="another-key" value="another-value"/>
+ <extractors>html-head-title</extractors>
+ </any23>
+ </dataFormats>
+----
+
=== camel-infinispan
Camel now requires endpoint URIs to include context-path which means
@@ -654,6 +685,49 @@ The google-pubnub component has been improved to use a new Java library and beco
Support for Apache Karaf has been removed.
+=== camel-xstream
+
+The XML DSL has changed for the `<converters>`, `<alias>`, `implicitCollections`, and `omitFields` elements,
+which now is flattened so the key/values should be configured on it directly.
+
+Before:
+[source,xml]
+----
+<xstream id="xstream-1" mode="NO_REFERENCES"
+ permissions="-org.apache.camel.dataformat.xstream.*,org.apache.camel.dataformat.xstream.PurchaseHistory,org.apache.camel.dataformat.xstream.PurchaseOrder">
+ <converters>
+ <converter class="org.apache.camel.dataformat.xstream.XStreamConfigurationTest$PurchaseOrderConverter" />
+ </converters>
+ <aliases>
+ <alias name="purchase-order" class="org.apache.camel.dataformat.xstream.PurchaseOrder" />
+ </aliases>
+ <implicitCollections>
+ <class name="org.apache.camel.dataformat.xstream.PurchaseHistory">
+ <field>history</field>
+ </class>
+ </implicitCollections>
+</xstream>
+----
+
+After:
+[source,xml]
+----
+<xstream id="xstream-1" mode="NO_REFERENCES"
+ permissions="-org.apache.camel.dataformat.xstream.*,org.apache.camel.dataformat.xstream.PurchaseHistory,org.apache.camel.dataformat.xstream.PurchaseOrder">
+ <converters key="purchase-converter" value="org.apache.camel.dataformat.xstream.XStreamConfigurationTest$PurchaseOrderConverter"/>
+ <aliases key="purchase-order" value="org.apache.camel.dataformat.xstream.PurchaseOrder"/>
+ <implicitCollections key="org.apache.camel.dataformat.xstream.PurchaseHistory" value="history"/>
+</xstream>
+----
+
+Multiple values for `implicitCollections` and `omitFields` can be separated by comma
+
+For example:
+[source,xml]
+----
+ <implicitCollections key="org.apache.camel.dataformat.xstream.PurchaseHistory" value="history,adress"/>
+----
+
=== Endpoint URIs without context path
Previously Camel components may work by referring to their name only without a colon and context path (eg `log`)