camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject git commit: CAMEL-6728: Configuring data format should have easier access to CamelContext. CAMEL-6677: Allow customization of the JAXB underlying XMLStreamWriter. Thanks to Christian Posta for the patch.
Date Wed, 11 Sep 2013 09:59:53 GMT
Updated Branches:
  refs/heads/camel-2.12.x 812524a64 -> 88b24c480


CAMEL-6728: Configuring data format should have easier access to CamelContext. CAMEL-6677: Allow customization of the JAXB underlying XMLStreamWriter. Thanks to Christian Posta for the patch.


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

Branch: refs/heads/camel-2.12.x
Commit: 88b24c480c2bf2e6aea591b3b90ee5109a182143
Parents: 812524a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Sep 11 11:58:42 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Sep 11 11:59:49 2013 +0200

----------------------------------------------------------------------
 .../camel/model/DataFormatDefinition.java       |  39 +++-
 .../camel/model/dataformat/AvroDataFormat.java  |   8 +-
 .../model/dataformat/Base64DataFormat.java      |   9 +-
 .../model/dataformat/BeanioDataFormat.java      |  15 +-
 .../camel/model/dataformat/BindyDataFormat.java |   9 +-
 .../model/dataformat/CastorDataFormat.java      |  13 +-
 .../model/dataformat/CryptoDataFormat.java      |  25 +--
 .../camel/model/dataformat/CsvDataFormat.java   |  15 +-
 .../camel/model/dataformat/HL7DataFormat.java   |   7 +-
 .../camel/model/dataformat/JaxbDataFormat.java  |  45 +++--
 .../camel/model/dataformat/JibxDataFormat.java  |   5 +-
 .../camel/model/dataformat/JsonDataFormat.java  |  15 +-
 .../camel/model/dataformat/PGPDataFormat.java   |  13 +-
 .../model/dataformat/ProtobufDataFormat.java    |   7 +-
 .../model/dataformat/SoapJaxbDataFormat.java    |  15 +-
 .../model/dataformat/TidyMarkupDataFormat.java  |   5 +-
 .../model/dataformat/XMLSecurityDataFormat.java |  33 ++--
 .../model/dataformat/XStreamDataFormat.java     |  17 +-
 .../model/dataformat/XmlJsonDataFormat.java     |  27 +--
 .../model/dataformat/XmlRpcDataFormat.java      |   5 +-
 .../model/dataformat/ZipFileDataFormat.java     |   5 +-
 .../camel/converter/jaxb/JaxbDataFormat.java    |  28 ++-
 .../jaxb/JaxbXmlStreamWriterWrapper.java        |  12 ++
 .../jaxb/NoopXmlStreamWriterWrapper.java        |  11 ++
 .../org/apache/camel/jaxb/CamelJaxbTest.java    |  46 +++++
 .../apache/camel/jaxb/TestXmlStreamWriter.java  | 177 +++++++++++++++++++
 .../org/apache/camel/jaxb/CamelJaxbTest.xml     |  20 ++-
 27 files changed, 480 insertions(+), 146 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java b/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
index 6115f8e..6125068 100644
--- a/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
@@ -21,15 +21,16 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
 
+import static org.apache.camel.util.EndpointHelper.isReferenceParameter;
+
 /**
  * Represents the base XML type for DataFormat.
- *
- * @version 
  */
 @XmlType(name = "dataFormat")
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -63,7 +64,7 @@ public class DataFormatDefinition extends IdentifiedType {
             ObjectHelper.notNull(ref, "ref or type");
 
             // try to let resolver see if it can resolve it, its not always possible
-            type = ((ModelCamelContext)routeContext.getCamelContext()).resolveDataFormatDefinition(ref);
+            type = ((ModelCamelContext) routeContext.getCamelContext()).resolveDataFormatDefinition(ref);
 
             if (type != null) {
                 return type.getDataFormat(routeContext);
@@ -84,11 +85,11 @@ public class DataFormatDefinition extends IdentifiedType {
         if (dataFormat == null) {
             dataFormat = createDataFormat(routeContext);
             if (dataFormat != null) {
-                configureDataFormat(dataFormat);
+                configureDataFormat(dataFormat, routeContext.getCamelContext());
             } else {
                 throw new IllegalArgumentException(
-                    "Data format '" + (dataFormatName != null ? dataFormatName : "<null>") + "' could not be created. "
-                    + "Ensure that the data format is valid and the associated Camel component is present on the classpath");
+                        "Data format '" + (dataFormatName != null ? dataFormatName : "<null>") + "' could not be created. "
+                                + "Ensure that the data format is valid and the associated Camel component is present on the classpath");
             }
         }
         return dataFormat;
@@ -106,16 +107,40 @@ public class DataFormatDefinition extends IdentifiedType {
 
     /**
      * Allows derived classes to customize the data format
+     *
+     * @deprecated use {@link #configureDataFormat(org.apache.camel.spi.DataFormat, org.apache.camel.CamelContext)}
      */
+    @Deprecated
     protected void configureDataFormat(DataFormat dataFormat) {
     }
 
     /**
+     * Allows derived classes to customize the data format
+     */
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
+    }
+
+    /**
      * Sets a named property on the data format instance using introspection
+     *
+     * @deprecated use {@link #setProperty(org.apache.camel.CamelContext, Object, String, Object)}
      */
+    @Deprecated
     protected void setProperty(Object bean, String name, Object value) {
+        setProperty(null, bean, name, value);
+    }
+
+    /**
+     * Sets a named property on the data format instance using introspection
+     */
+    protected void setProperty(CamelContext camelContext, Object bean, String name, Object value) {
         try {
-            IntrospectionSupport.setProperty(bean, name, value);
+            String ref = value instanceof String ? value.toString() : null;
+            if (isReferenceParameter(ref) && camelContext != null) {
+                IntrospectionSupport.setProperty(camelContext, camelContext.getTypeConverter(), bean, name, null, ref, true);
+            } else {
+                IntrospectionSupport.setProperty(bean, name, value);
+            }
         } catch (Exception e) {
             throw new IllegalArgumentException("Failed to set property: " + name + " on: " + bean + ". Reason: " + e, e);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
index dcd4242..965e4dd 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
@@ -21,6 +21,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
+
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -63,12 +65,12 @@ public class AvroDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (this.instanceClassName != null) {
-            setProperty(dataFormat, "instanceClass", instanceClassName);
+            setProperty(camelContext, dataFormat, "instanceClass", instanceClassName);
         }
         if (this.schema != null) {
-            setProperty(dataFormat, "schema", schema);
+            setProperty(camelContext, dataFormat, "schema", schema);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/Base64DataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/Base64DataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/Base64DataFormat.java
index 9197c13..bb89371 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/Base64DataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/Base64DataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -45,17 +46,17 @@ public class Base64DataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (getLineLength() != null) {
-            setProperty(dataFormat, "lineLength", getLineLength());
+            setProperty(camelContext, dataFormat, "lineLength", getLineLength());
         }
         if (getUrlSafe() != null) {
-            setProperty(dataFormat, "urlSafe", getUrlSafe());
+            setProperty(camelContext, dataFormat, "urlSafe", getUrlSafe());
         }
         if (getLineSeparator() != null) {
             // line separator must be a byte[]
             byte[] bytes = getLineSeparator().getBytes();
-            setProperty(dataFormat, "lineSeparator", bytes);
+            setProperty(camelContext, dataFormat, "lineSeparator", bytes);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
index a9c84c4..d75b8c8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -51,20 +52,20 @@ public class BeanioDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
-        setProperty(dataFormat, "mapping", mapping);
-        setProperty(dataFormat, "streamName", streamName);
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
+        setProperty(camelContext, dataFormat, "mapping", mapping);
+        setProperty(camelContext, dataFormat, "streamName", streamName);
         if (ignoreUnidentifiedRecords != null) {
-            setProperty(dataFormat, "ignoreUnidentifiedRecords", ignoreUnidentifiedRecords);
+            setProperty(camelContext, dataFormat, "ignoreUnidentifiedRecords", ignoreUnidentifiedRecords);
         }
         if (ignoreUnexpectedRecords != null) {
-            setProperty(dataFormat, "ignoreUnexpectedRecords", ignoreUnexpectedRecords);
+            setProperty(camelContext, dataFormat, "ignoreUnexpectedRecords", ignoreUnexpectedRecords);
         }
         if (ignoreInvalidRecords != null) {
-            setProperty(dataFormat, "ignoreInvalidRecords", ignoreInvalidRecords);
+            setProperty(camelContext, dataFormat, "ignoreInvalidRecords", ignoreInvalidRecords);
         }
         if (encoding != null) {
-            setProperty(dataFormat, "encoding", encoding);
+            setProperty(camelContext, dataFormat, "encoding", encoding);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
index 88ebe8b..62a85e8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
@@ -112,10 +113,10 @@ public class BindyDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
-        setProperty(dataFormat, "packages", packages);
-        setProperty(dataFormat, "locale", locale);
-        setProperty(dataFormat, "classType", clazz);
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
+        setProperty(camelContext, dataFormat, "packages", packages);
+        setProperty(camelContext, dataFormat, "locale", locale);
+        setProperty(camelContext, dataFormat, "classType", clazz);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
index 4dd41ca..fda16a0 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -93,20 +94,20 @@ public class CastorDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (mappingFile != null) {
-            setProperty(dataFormat, "mappingFile", mappingFile);
+            setProperty(camelContext, dataFormat, "mappingFile", mappingFile);
         }
-        setProperty(dataFormat, "validation", isValidation());
+        setProperty(camelContext, dataFormat, "validation", isValidation());
 
         if (encoding != null) {
-            setProperty(dataFormat, "encoding", encoding);
+            setProperty(camelContext, dataFormat, "encoding", encoding);
         }
         if (packages != null) {
-            setProperty(dataFormat, "packages", packages);
+            setProperty(camelContext, dataFormat, "packages", packages);
         }
         if (classes != null) {
-            setProperty(dataFormat, "classes", classes);
+            setProperty(camelContext, dataFormat, "classes", classes);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/CryptoDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/CryptoDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/CryptoDataFormat.java
index b2b5e52..b7bb888 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/CryptoDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/CryptoDataFormat.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
@@ -61,45 +62,45 @@ public class CryptoDataFormat extends DataFormatDefinition {
 
         if (ObjectHelper.isNotEmpty(keyRef)) {
             Key key = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), keyRef, Key.class);
-            setProperty(cryptoFormat, "key", key);
+            setProperty(routeContext.getCamelContext(), cryptoFormat, "key", key);
         }
         if (ObjectHelper.isNotEmpty(algorithmParameterRef)) {
             AlgorithmParameterSpec spec = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(),
                     algorithmParameterRef, AlgorithmParameterSpec.class);
-            setProperty(cryptoFormat, "AlgorithmParameterSpec", spec);
+            setProperty(routeContext.getCamelContext(), cryptoFormat, "AlgorithmParameterSpec", spec);
         }
         if (ObjectHelper.isNotEmpty(initVectorRef)) {
             byte[] iv = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), initVectorRef, byte[].class);
-            setProperty(cryptoFormat, "InitializationVector", iv);
+            setProperty(routeContext.getCamelContext(), cryptoFormat, "InitializationVector", iv);
         }
         return cryptoFormat;
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         Boolean answer = ObjectHelper.toBoolean(shouldAppendHMAC);
         if (answer != null && !answer) {
-            setProperty(dataFormat, "shouldAppendHMAC", Boolean.FALSE);
+            setProperty(camelContext, dataFormat, "shouldAppendHMAC", Boolean.FALSE);
         } else {
-            setProperty(dataFormat, "shouldAppendHMAC", Boolean.TRUE);
+            setProperty(camelContext, dataFormat, "shouldAppendHMAC", Boolean.TRUE);
         }
         answer = ObjectHelper.toBoolean(inline);
         if (answer != null && answer) {
-            setProperty(dataFormat, "shouldInlineInitializationVector", Boolean.TRUE);
+            setProperty(camelContext, dataFormat, "shouldInlineInitializationVector", Boolean.TRUE);
         } else {
-            setProperty(dataFormat, "shouldInlineInitializationVector", Boolean.FALSE);
+            setProperty(camelContext, dataFormat, "shouldInlineInitializationVector", Boolean.FALSE);
         }
         if (algorithm != null) {
-            setProperty(dataFormat, "algorithm", algorithm);
+            setProperty(camelContext, dataFormat, "algorithm", algorithm);
         }
         if (cryptoProvider != null) {
-            setProperty(dataFormat, "cryptoProvider", cryptoProvider);
+            setProperty(camelContext, dataFormat, "cryptoProvider", cryptoProvider);
         }
         if (macAlgorithm != null) {
-            setProperty(dataFormat, "macAlgorithm", macAlgorithm);
+            setProperty(camelContext, dataFormat, "macAlgorithm", macAlgorithm);
         }
         if (buffersize != null) {
-            setProperty(dataFormat, "buffersize", buffersize);
+            setProperty(camelContext, dataFormat, "buffersize", buffersize);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
index 0186d53..3d5d534 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
@@ -101,34 +102,34 @@ public class CsvDataFormat extends DataFormatDefinition {
 
         if (ObjectHelper.isNotEmpty(configRef)) {
             Object config = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), configRef);
-            setProperty(csvFormat, "config", config);
+            setProperty(routeContext.getCamelContext(), csvFormat, "config", config);
         }
         if (ObjectHelper.isNotEmpty(strategyRef)) {
             Object strategy = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), strategyRef);
-            setProperty(csvFormat, "strategy", strategy);
+            setProperty(routeContext.getCamelContext(), csvFormat, "strategy", strategy);
         }
 
         return csvFormat;
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (autogenColumns != null) {
-            setProperty(dataFormat, "autogenColumns", autogenColumns);
+            setProperty(camelContext, dataFormat, "autogenColumns", autogenColumns);
         }
 
         if (delimiter != null) {
             if (delimiter.length() > 1) {
                 throw new IllegalArgumentException("Delimiter must have a length of one!");
             }
-            setProperty(dataFormat, "delimiter", delimiter);
+            setProperty(camelContext, dataFormat, "delimiter", delimiter);
         } else {
             // the default delimiter is ','
-            setProperty(dataFormat, "delimiter", ",");
+            setProperty(camelContext, dataFormat, "delimiter", ",");
         }
 
         if (skipFirstLine != null) {
-            setProperty(dataFormat, "skipFirstLine", skipFirstLine);
+            setProperty(camelContext, dataFormat, "skipFirstLine", skipFirstLine);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java
index a2c6acb..c445409 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -64,11 +65,11 @@ public class HL7DataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (getParser() != null) {
-            setProperty(dataFormat, "parser", getParser());
+            setProperty(camelContext, dataFormat, "parser", getParser());
         }
-        setProperty(dataFormat, "validate", isValidate());
+        setProperty(camelContext, dataFormat, "validate", isValidate());
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/JaxbDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JaxbDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JaxbDataFormat.java
index ea25ee3..bdd0c50 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JaxbDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JaxbDataFormat.java
@@ -22,8 +22,10 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.namespace.QName;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -55,6 +57,8 @@ public class JaxbDataFormat extends DataFormatDefinition {
     private String partNamespace;
     @XmlAttribute
     private String namespacePrefixRef;
+    @XmlAttribute
+    private String xmlStreamWriterWrapper;
 
     public JaxbDataFormat() {
         super("jaxb");
@@ -145,47 +149,58 @@ public class JaxbDataFormat extends DataFormatDefinition {
         this.namespacePrefixRef = namespacePrefixRef;
     }
 
+    public String getXmlStreamWriterWrapper() {
+        return xmlStreamWriterWrapper;
+    }
+
+    public void setXmlStreamWriterWrapper(String xmlStreamWriterWrapperRef) {
+        this.xmlStreamWriterWrapper = xmlStreamWriterWrapperRef;
+    }
+
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         Boolean answer = ObjectHelper.toBoolean(getPrettyPrint());
         if (answer != null && !answer) {
-            setProperty(dataFormat, "prettyPrint", Boolean.FALSE);
+            setProperty(camelContext, dataFormat, "prettyPrint", Boolean.FALSE);
         } else { // the default value is true
-            setProperty(dataFormat, "prettyPrint", Boolean.TRUE);
+            setProperty(camelContext, dataFormat, "prettyPrint", Boolean.TRUE);
         }
         answer = ObjectHelper.toBoolean(getIgnoreJAXBElement());
         if (answer != null && !answer) {
-            setProperty(dataFormat, "ignoreJAXBElement", Boolean.FALSE);
+            setProperty(camelContext, dataFormat, "ignoreJAXBElement", Boolean.FALSE);
         } else { // the default value is true
-            setProperty(dataFormat, "ignoreJAXBElement", Boolean.TRUE);
+            setProperty(camelContext, dataFormat, "ignoreJAXBElement", Boolean.TRUE);
         }
         answer = ObjectHelper.toBoolean(getFilterNonXmlChars());
         if (answer != null && answer) {
-            setProperty(dataFormat, "filterNonXmlChars", Boolean.TRUE);
+            setProperty(camelContext, dataFormat, "filterNonXmlChars", Boolean.TRUE);
         } else { // the default value is false
-            setProperty(dataFormat, "filterNonXmlChars", Boolean.FALSE);
+            setProperty(camelContext, dataFormat, "filterNonXmlChars", Boolean.FALSE);
         }
         answer = ObjectHelper.toBoolean(getFragment());
         if (answer != null && answer) {
-            setProperty(dataFormat, "fragment", Boolean.TRUE);
+            setProperty(camelContext, dataFormat, "fragment", Boolean.TRUE);
         } else { // the default value is false
-            setProperty(dataFormat, "fragment", Boolean.FALSE);
+            setProperty(camelContext, dataFormat, "fragment", Boolean.FALSE);
         }
         if (partClass != null) {
-            setProperty(dataFormat, "partClass", partClass);
+            setProperty(camelContext, dataFormat, "partClass", partClass);
         }
         if (partNamespace != null) {
-            setProperty(dataFormat, "partNamespace", QName.valueOf(partNamespace));
+            setProperty(camelContext, dataFormat, "partNamespace", QName.valueOf(partNamespace));
         }
         if (encoding != null) {
-            setProperty(dataFormat, "encoding", encoding);
+            setProperty(camelContext, dataFormat, "encoding", encoding);
         }
         if (namespacePrefixRef != null) {
-            setProperty(dataFormat, "namespacePrefixRef", namespacePrefixRef);
+            setProperty(camelContext, dataFormat, "namespacePrefixRef", namespacePrefixRef);
         }
-        setProperty(dataFormat, "contextPath", contextPath);
+        setProperty(camelContext, dataFormat, "contextPath", contextPath);
         if (schema != null) {
-            setProperty(dataFormat, "schema", schema);
+            setProperty(camelContext, dataFormat, "schema", schema);
+        }
+        if (xmlStreamWriterWrapper != null) {
+            setProperty(camelContext, dataFormat, "xmlStreamWriterWrapper", xmlStreamWriterWrapper);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
index 24bf47c..c9ffe8d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
@@ -77,9 +78,9 @@ public class JibxDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (unmarshallClass != null) {
-            setProperty(dataFormat, "unmarshallClass", unmarshallClass);
+            setProperty(camelContext, dataFormat, "unmarshallClass", unmarshallClass);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index 027e6d3..2cf7cf7 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
@@ -96,11 +97,11 @@ public class JsonDataFormat extends DataFormatDefinition {
     @Override
     protected DataFormat createDataFormat(RouteContext routeContext) {
         if (library == JsonLibrary.XStream) {
-            setProperty(this, "dataFormatName", "json-xstream");
+            setProperty(routeContext.getCamelContext(), this, "dataFormatName", "json-xstream");
         } else if (library == JsonLibrary.Jackson) {
-            setProperty(this, "dataFormatName", "json-jackson");
+            setProperty(routeContext.getCamelContext(), this, "dataFormatName", "json-jackson");
         } else {
-            setProperty(this, "dataFormatName", "json-gson");
+            setProperty(routeContext.getCamelContext(), this, "dataFormatName", "json-gson");
         }
 
         if (unmarshalType == null && unmarshalTypeName != null) {
@@ -115,16 +116,16 @@ public class JsonDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (unmarshalType != null) {
-            setProperty(dataFormat, "unmarshalType", unmarshalType);
+            setProperty(camelContext, dataFormat, "unmarshalType", unmarshalType);
         }
         if (prettyPrint != null) {
-            setProperty(dataFormat, "prettyPrint", unmarshalType);
+            setProperty(camelContext, dataFormat, "prettyPrint", unmarshalType);
         }
 
         if (jsonView != null) {
-            setProperty(dataFormat, "jsonView", jsonView);
+            setProperty(camelContext, dataFormat, "jsonView", jsonView);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/PGPDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/PGPDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/PGPDataFormat.java
index e1fa43c..6f9fa26 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/PGPDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/PGPDataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -47,21 +48,21 @@ public class PGPDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (keyUserid != null) {
-            setProperty(dataFormat, "keyUserid", keyUserid);
+            setProperty(camelContext, dataFormat, "keyUserid", keyUserid);
         }
         if (password != null) {
-            setProperty(dataFormat, "password", password);
+            setProperty(camelContext, dataFormat, "password", password);
         }
         if (keyFileName != null) {
-            setProperty(dataFormat, "keyFileName", keyFileName);
+            setProperty(camelContext, dataFormat, "keyFileName", keyFileName);
         }
         if (armored != null) {
-            setProperty(dataFormat, "armored", armored);
+            setProperty(camelContext, dataFormat, "armored", armored);
         }
         if (integrity != null) {
-            setProperty(dataFormat, "integrity", integrity);
+            setProperty(camelContext, dataFormat, "integrity", integrity);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
index b03a686..cdaaafd 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -64,12 +65,12 @@ public class ProtobufDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (this.instanceClass != null) {
-            setProperty(dataFormat, "instanceClass", instanceClass);
+            setProperty(camelContext, dataFormat, "instanceClass", instanceClass);
         }
         if (this.defaultInstance != null) {
-            setProperty(dataFormat, "defaultInstance", defaultInstance);
+            setProperty(camelContext, dataFormat, "defaultInstance", defaultInstance);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/SoapJaxbDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/SoapJaxbDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/SoapJaxbDataFormat.java
index 2336e04..6c01f68 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/SoapJaxbDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/SoapJaxbDataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -111,23 +112,23 @@ public class SoapJaxbDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (elementNameStrategy != null) {
-            setProperty(dataFormat, "elementNameStrategy", elementNameStrategy);
+            setProperty(camelContext, dataFormat, "elementNameStrategy", elementNameStrategy);
         }
         if (elementNameStrategyRef != null) {
-            setProperty(dataFormat, "elementNameStrategyRef", elementNameStrategyRef);
+            setProperty(camelContext, dataFormat, "elementNameStrategyRef", elementNameStrategyRef);
         }
         if (encoding != null) {
-            setProperty(dataFormat, "encoding", encoding);
+            setProperty(camelContext, dataFormat, "encoding", encoding);
         }
         if (version != null) {
-            setProperty(dataFormat, "version", version);
+            setProperty(camelContext, dataFormat, "version", version);
         }
         if (namespacePrefixRef != null) {
-            setProperty(dataFormat, "namespacePrefixRef", namespacePrefixRef);
+            setProperty(camelContext, dataFormat, "namespacePrefixRef", namespacePrefixRef);
         }
-        setProperty(dataFormat, "contextPath", contextPath);
+        setProperty(camelContext, dataFormat, "contextPath", contextPath);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
index 0d56633..03802de 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.w3c.dom.Node;
 
 import org.apache.camel.model.DataFormatDefinition;
@@ -83,9 +84,9 @@ public class TidyMarkupDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (dataObjectType != null) {
-            setProperty(dataFormat, "dataObjectType", dataObjectType);
+            setProperty(camelContext, dataFormat, "dataObjectType", dataObjectType);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
index f7a7071..1cefdba 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.NamespaceAware;
@@ -230,48 +231,48 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (getSecureTag() != null) {
-            setProperty(dataFormat, "secureTag", getSecureTag());
+            setProperty(camelContext, dataFormat, "secureTag", getSecureTag());
         } else {
-            setProperty(dataFormat, "secureTag", "");
+            setProperty(camelContext, dataFormat, "secureTag", "");
         }
 
-        setProperty(dataFormat, "secureTagContents", isSecureTagContents());
+        setProperty(camelContext, dataFormat, "secureTagContents", isSecureTagContents());
 
         if (passPhrase != null) {
-            setProperty(dataFormat, "passPhrase", getPassPhrase().getBytes());
+            setProperty(camelContext, dataFormat, "passPhrase", getPassPhrase().getBytes());
         } else {
-            setProperty(dataFormat, "passPhrase", "Just another 24 Byte key".getBytes());
+            setProperty(camelContext, dataFormat, "passPhrase", "Just another 24 Byte key".getBytes());
         }
         if (getXmlCipherAlgorithm() != null) {
-            setProperty(dataFormat, "xmlCipherAlgorithm", getXmlCipherAlgorithm());
+            setProperty(camelContext, dataFormat, "xmlCipherAlgorithm", getXmlCipherAlgorithm());
         } else {
-            setProperty(dataFormat, "xmlCipherAlgorithm", TRIPLEDES);
+            setProperty(camelContext, dataFormat, "xmlCipherAlgorithm", TRIPLEDES);
         }
         if (getKeyCipherAlgorithm() != null) {
-            setProperty(dataFormat, "keyCipherAlgorithm", getKeyCipherAlgorithm());
+            setProperty(camelContext, dataFormat, "keyCipherAlgorithm", getKeyCipherAlgorithm());
         }
         if (getRecipientKeyAlias() != null) {
-            setProperty(dataFormat, "recipientKeyAlias", getRecipientKeyAlias());
+            setProperty(camelContext, dataFormat, "recipientKeyAlias", getRecipientKeyAlias());
         }
         if (getKeyOrTrustStoreParametersId() != null) {
-            setProperty(dataFormat, "keyOrTrustStoreParametersId", getKeyOrTrustStoreParametersId());
+            setProperty(camelContext, dataFormat, "keyOrTrustStoreParametersId", getKeyOrTrustStoreParametersId());
         }
         if (keyOrTrustStoreParameters != null) {
-            setProperty(dataFormat, "keyOrTrustStoreParameters", this.keyOrTrustStoreParameters);
+            setProperty(camelContext, dataFormat, "keyOrTrustStoreParameters", this.keyOrTrustStoreParameters);
         }
         if (namespaces != null) {
-            setProperty(dataFormat, "namespaces", this.namespaces);
+            setProperty(camelContext, dataFormat, "namespaces", this.namespaces);
         }
         if (keyPassword != null) {
-            setProperty(dataFormat, "keyPassword", this.getKeyPassword());
+            setProperty(camelContext, dataFormat, "keyPassword", this.getKeyPassword());
         }
         if (digestAlgorithm != null) {
-            setProperty(dataFormat, "digestAlgorithm", this.getDigestAlgorithm());
+            setProperty(camelContext, dataFormat, "digestAlgorithm", this.getDigestAlgorithm());
         }
         if (mgfAlgorithm != null) {
-            setProperty(dataFormat, "mgfAlgorithm", this.getMgfAlgorithm());
+            setProperty(camelContext, dataFormat, "mgfAlgorithm", this.getMgfAlgorithm());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
index 7e60b6f..6ea2ab8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
@@ -33,6 +33,7 @@ import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
@@ -134,32 +135,32 @@ public class XStreamDataFormat extends DataFormatDefinition {
     @Override
     protected DataFormat createDataFormat(RouteContext routeContext) {
         if ("json".equals(this.driver)) {
-            setProperty(this, "dataFormatName", "json-xstream");
+            setProperty(routeContext.getCamelContext(), this, "dataFormatName", "json-xstream");
         }
         DataFormat answer = super.createDataFormat(routeContext);
         // need to lookup the reference for the xstreamDriver
         if (ObjectHelper.isNotEmpty(driverRef)) {
-            setProperty(answer, "xstreamDriver", CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), driverRef));
+            setProperty(routeContext.getCamelContext(), answer, "xstreamDriver", CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), driverRef));
         }
         return answer;
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (encoding != null) {
-            setProperty(dataFormat, "encoding", encoding);
+            setProperty(camelContext, dataFormat, "encoding", encoding);
         }
         if (this.converters != null) {
-            setProperty(dataFormat, "converters", this.converters);
+            setProperty(camelContext, dataFormat, "converters", this.converters);
         }
         if (this.aliases != null) {
-            setProperty(dataFormat, "aliases", this.aliases);
+            setProperty(camelContext, dataFormat, "aliases", this.aliases);
         }
         if (this.omitFields != null) {
-            setProperty(dataFormat, "omitFields", this.omitFields);
+            setProperty(camelContext, dataFormat, "omitFields", this.omitFields);
         }
         if (this.implicitCollections != null) {
-            setProperty(dataFormat, "implicitCollections", this.implicitCollections);
+            setProperty(camelContext, dataFormat, "implicitCollections", this.implicitCollections);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlJsonDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlJsonDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlJsonDataFormat.java
index ff36a89..b29f4ed 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlJsonDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlJsonDataFormat.java
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlList;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -121,54 +122,54 @@ public class XmlJsonDataFormat extends DataFormatDefinition {
     }
 
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (encoding != null) {
-            setProperty(dataFormat, ENCODING, encoding);
+            setProperty(camelContext, dataFormat, ENCODING, encoding);
         }
 
         if (forceTopLevelObject != null) {
-            setProperty(dataFormat, FORCE_TOP_LEVEL_OBJECT, forceTopLevelObject);
+            setProperty(camelContext, dataFormat, FORCE_TOP_LEVEL_OBJECT, forceTopLevelObject);
         }
 
         if (namespaceLenient != null) {
-            setProperty(dataFormat, NAMESPACE_LENIENT, namespaceLenient);
+            setProperty(camelContext, dataFormat, NAMESPACE_LENIENT, namespaceLenient);
         }
 
         if (rootName != null) {
-            setProperty(dataFormat, ROOT_NAME, rootName);
+            setProperty(camelContext, dataFormat, ROOT_NAME, rootName);
         }
         
         if (elementName != null) {
-            setProperty(dataFormat, ELEMENT_NAME, elementName);
+            setProperty(camelContext, dataFormat, ELEMENT_NAME, elementName);
         }
 
         if (arrayName != null) {
-            setProperty(dataFormat, ARRAY_NAME, arrayName);
+            setProperty(camelContext, dataFormat, ARRAY_NAME, arrayName);
         }
 
         if (expandableProperties != null && expandableProperties.size() != 0) {
-            setProperty(dataFormat, EXPANDABLE_PROPERTIES, expandableProperties);
+            setProperty(camelContext, dataFormat, EXPANDABLE_PROPERTIES, expandableProperties);
         }
 
         if (skipWhitespace != null) {
-            setProperty(dataFormat, SKIP_WHITESPACE, skipWhitespace);
+            setProperty(camelContext, dataFormat, SKIP_WHITESPACE, skipWhitespace);
         }
 
         if (trimSpaces != null) {
-            setProperty(dataFormat, TRIM_SPACES, trimSpaces);
+            setProperty(camelContext, dataFormat, TRIM_SPACES, trimSpaces);
         }
 
         if (skipNamespaces != null) {
-            setProperty(dataFormat, SKIP_NAMESPACES, skipNamespaces);
+            setProperty(camelContext, dataFormat, SKIP_NAMESPACES, skipNamespaces);
         }
 
         if (removeNamespacePrefixes != null) {
-            setProperty(dataFormat, REMOVE_NAMESPACE_PREFIXES, removeNamespacePrefixes);
+            setProperty(camelContext, dataFormat, REMOVE_NAMESPACE_PREFIXES, removeNamespacePrefixes);
         }
 
         // will end up calling the setTypeHints(String s) which does the parsing from the Enum String key to the Enum value
         if (typeHints != null) {
-            setProperty(typeHints, TYPE_HINTS, typeHints);
+            setProperty(camelContext, typeHints, TYPE_HINTS, typeHints);
         }
 
         //TODO: xmljson: element-namespace mapping is not implemented in the XML DSL

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlRpcDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlRpcDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlRpcDataFormat.java
index b22e4f7..61430cc 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlRpcDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/XmlRpcDataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -38,9 +39,9 @@ public class XmlRpcDataFormat extends DataFormatDefinition {
     }
     
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (request != null) {
-            setProperty(dataFormat, "request", request);
+            setProperty(camelContext, dataFormat, "request", request);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/camel-core/src/main/java/org/apache/camel/model/dataformat/ZipFileDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/ZipFileDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/ZipFileDataFormat.java
index c0b7712..82a1da4 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/ZipFileDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/ZipFileDataFormat.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 
@@ -38,9 +39,9 @@ public class ZipFileDataFormat extends DataFormatDefinition {
     }
     
     @Override
-    protected void configureDataFormat(DataFormat dataFormat) {
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
         if (usingIterator != null) {
-            setProperty(dataFormat, "usingIterator", usingIterator);
+            setProperty(camelContext, dataFormat, "usingIterator", usingIterator);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index bf06318..c29ab2d 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -90,7 +90,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
     private String namespacePrefixRef;
     private Map<String, String> namespacePrefix;
     private JaxbNamespacePrefixMapper namespacePrefixMapper;
-
+    private JaxbXmlStreamWriterWrapper xmlStreamWriterWrapper;
     private TypeConverter typeConverter;
 
     public JaxbDataFormat() {
@@ -144,18 +144,22 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
             e = new JAXBElement<Object>(getPartNamespace(), partialClass, graph);
         }
 
-        if (needFiltering(exchange)) {
-            marshaller.marshal(e, createFilteringWriter(stream));
+        if (asXmlStreamWriter(exchange)) {
+            XMLStreamWriter writer = typeConverter.convertTo(XMLStreamWriter.class, stream);
+            if (needFiltering(exchange)) {
+                writer = new FilteringXmlStreamWriter(writer);
+            }
+            if (xmlStreamWriterWrapper != null) {
+                writer = xmlStreamWriterWrapper.wrapWriter(writer);
+            }
+            marshaller.marshal(e, writer);
         } else {
             marshaller.marshal(e, stream);
         }
     }
 
-    private FilteringXmlStreamWriter createFilteringWriter(OutputStream stream)
-        throws XMLStreamException, FactoryConfigurationError {
-        XMLStreamWriter writer = typeConverter.convertTo(XMLStreamWriter.class, stream);
-        FilteringXmlStreamWriter filteringWriter = new FilteringXmlStreamWriter(writer);
-        return filteringWriter;
+    private boolean asXmlStreamWriter(Exchange exchange) {
+        return needFiltering(exchange) || (xmlStreamWriterWrapper != null);
     }
 
     public Object unmarshal(Exchange exchange, InputStream stream) throws IOException, SAXException {
@@ -310,6 +314,14 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
         this.camelContext = camelContext;
     }
 
+    public JaxbXmlStreamWriterWrapper getXmlStreamWriterWrapper() {
+        return xmlStreamWriterWrapper;
+    }
+
+    public void setXmlStreamWriterWrapper(JaxbXmlStreamWriterWrapper xmlStreamWriterWrapper) {
+        this.xmlStreamWriterWrapper = xmlStreamWriterWrapper;
+    }
+
     @Override
     @SuppressWarnings("unchecked")
     protected void doStart() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbXmlStreamWriterWrapper.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbXmlStreamWriterWrapper.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbXmlStreamWriterWrapper.java
new file mode 100644
index 0000000..ed5010e
--- /dev/null
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbXmlStreamWriterWrapper.java
@@ -0,0 +1,12 @@
+package org.apache.camel.converter.jaxb;
+
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * A wrapper which allows to customize the {@link XMLStreamWriter}.
+ */
+public interface JaxbXmlStreamWriterWrapper {
+
+    XMLStreamWriter wrapWriter(XMLStreamWriter writer);
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/NoopXmlStreamWriterWrapper.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/NoopXmlStreamWriterWrapper.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/NoopXmlStreamWriterWrapper.java
new file mode 100644
index 0000000..d95506f
--- /dev/null
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/NoopXmlStreamWriterWrapper.java
@@ -0,0 +1,11 @@
+package org.apache.camel.converter.jaxb;
+
+import javax.xml.stream.XMLStreamWriter;
+
+public class NoopXmlStreamWriterWrapper implements JaxbXmlStreamWriterWrapper {
+
+    @Override
+    public XMLStreamWriter wrapWriter(XMLStreamWriter writer) {
+        return writer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java
index 5e05c35..010f80e 100644
--- a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java
+++ b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbTest.java
@@ -81,6 +81,38 @@ public class CamelJaxbTest extends CamelTestSupport {
     }
 
     @Test
+    public void testCustomXmlStreamWriter() throws InterruptedException {
+        PersonType person = new PersonType();
+        person.setFirstName("foo");
+        person.setLastName("bar");
+
+        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+        resultEndpoint.expectedMessageCount(1);
+        template.sendBody("direct:marshalCustomWriter", person);
+        resultEndpoint.assertIsSatisfied();
+
+        String body = resultEndpoint.getReceivedExchanges().get(0).getIn().getBody(String.class);
+        assertTrue("Body did not get processed correctly by custom filter", body.contains("-Foo"));
+    }
+
+    @Test
+    public void testCustomXmlStreamWriterAndFiltering() throws InterruptedException {
+        PersonType person = new PersonType();
+        person.setFirstName("foo\u0004");
+        person.setLastName("bar");
+
+        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+        resultEndpoint.expectedMessageCount(1);
+        template.sendBody("direct:marshalCustomWriterAndFiltering", person);
+        resultEndpoint.assertIsSatisfied();
+
+        String body = resultEndpoint.getReceivedExchanges().get(0).getIn().getBody(String.class);
+        assertFalse("Non-xml character unexpectedly did not get into marshalled contents", body
+                .contains("\u0004"));
+        assertTrue("Body did not get processed correctly by custom filter", body.contains("-Foo"));
+    }
+
+    @Test
     public void testUnmarshal() throws Exception {
         final String xml = "<Person><firstName>FOO</firstName><lastName>BAR</lastName></Person>";
         PersonType expected = new PersonType();
@@ -110,6 +142,13 @@ public class CamelJaxbTest extends CamelTestSupport {
                 JaxbDataFormat filterEnabledFormat = new JaxbDataFormat("org.apache.camel.foo.bar");
                 filterEnabledFormat.setFilterNonXmlChars(true);
 
+                JaxbDataFormat customWriterFormat = new JaxbDataFormat("org.apache.camel.foo.bar");
+                customWriterFormat.setXmlStreamWriterWrapper(new TestXmlStreamWriter());
+
+                JaxbDataFormat customWriterAndFilterFormat = new JaxbDataFormat("org.apache.camel.foo.bar");
+                customWriterAndFilterFormat.setFilterNonXmlChars(true);
+                customWriterAndFilterFormat.setXmlStreamWriterWrapper(new TestXmlStreamWriter());
+
                 from("direct:getJAXBElementValue")
                     .unmarshal(new JaxbDataFormat("org.apache.camel.foo.bar"))                        
                         .to("mock:result");
@@ -130,6 +169,13 @@ public class CamelJaxbTest extends CamelTestSupport {
                     .marshal(filterEnabledFormat)
                     .to("mock:result");
 
+                from("direct:marshalCustomWriter")
+                        .marshal(customWriterFormat)
+                        .to("mock:result");
+                from("direct:marshalCustomWriterAndFiltering")
+                        .marshal(customWriterAndFilterFormat)
+                        .to("mock:result");
+
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TestXmlStreamWriter.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TestXmlStreamWriter.java b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TestXmlStreamWriter.java
new file mode 100644
index 0000000..d15c895
--- /dev/null
+++ b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TestXmlStreamWriter.java
@@ -0,0 +1,177 @@
+package org.apache.camel.jaxb;
+
+import org.apache.camel.converter.jaxb.JaxbXmlStreamWriterWrapper;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="http://christianposta.com/blog">Christian Posta</a>
+ */
+public class TestXmlStreamWriter implements JaxbXmlStreamWriterWrapper {
+    @Override
+    public XMLStreamWriter wrapWriter(final XMLStreamWriter writer) {
+        return new XMLStreamWriter() {
+            @Override
+            public void writeStartElement(String s) throws XMLStreamException {
+                writer.writeStartElement(s+"-Foo");
+            }
+
+            @Override
+            public void writeStartElement(String s, String s2) throws XMLStreamException {
+                writer.writeStartElement(s, s2+"-Foo");
+            }
+
+            @Override
+            public void writeStartElement(String s, String s2, String s3) throws XMLStreamException {
+                writer.writeStartElement(s, s2+"-Foo", s3);
+            }
+
+            @Override
+            public void writeEmptyElement(String s, String s2) throws XMLStreamException {
+                writer.writeEmptyElement(s, s2);
+            }
+
+            @Override
+            public void writeEmptyElement(String s, String s2, String s3) throws XMLStreamException {
+                writer.writeEmptyElement(s, s2, s3);
+            }
+
+            @Override
+            public void writeEmptyElement(String s) throws XMLStreamException {
+                writer.writeEmptyElement(s);
+            }
+
+            @Override
+            public void writeEndElement() throws XMLStreamException {
+                writer.writeEndElement();
+            }
+
+            @Override
+            public void writeEndDocument() throws XMLStreamException {
+                writer.writeEndDocument();
+            }
+
+            @Override
+            public void close() throws XMLStreamException {
+                writer.close();
+            }
+
+            @Override
+            public void flush() throws XMLStreamException {
+                writer.flush();
+            }
+
+            @Override
+            public void writeAttribute(String s, String s2) throws XMLStreamException {
+                writer.writeAttribute(s, s2);
+            }
+
+            @Override
+            public void writeAttribute(String s, String s2, String s3, String s4) throws XMLStreamException {
+                writer.writeAttribute(s, s2, s3, s4);
+            }
+
+            @Override
+            public void writeAttribute(String s, String s2, String s3) throws XMLStreamException {
+                writer.writeAttribute(s, s2, s3);
+            }
+
+            @Override
+            public void writeNamespace(String s, String s2) throws XMLStreamException {
+                writer.writeNamespace(s, s2);
+            }
+
+            @Override
+            public void writeDefaultNamespace(String s) throws XMLStreamException {
+                writer.writeDefaultNamespace(s);
+            }
+
+            @Override
+            public void writeComment(String s) throws XMLStreamException {
+                writer.writeComment(s);
+            }
+
+            @Override
+            public void writeProcessingInstruction(String s) throws XMLStreamException {
+                writer.writeProcessingInstruction(s);
+            }
+
+            @Override
+            public void writeProcessingInstruction(String s, String s2) throws XMLStreamException {
+                writer.writeProcessingInstruction(s, s2);
+            }
+
+            @Override
+            public void writeCData(String s) throws XMLStreamException {
+                writer.writeCData(s);
+            }
+
+            @Override
+            public void writeDTD(String s) throws XMLStreamException {
+                writer.writeDTD(s);
+            }
+
+            @Override
+            public void writeEntityRef(String s) throws XMLStreamException {
+                writer.writeEntityRef(s);
+            }
+
+            @Override
+            public void writeStartDocument() throws XMLStreamException {
+                writer.writeStartDocument();
+            }
+
+            @Override
+            public void writeStartDocument(String s) throws XMLStreamException {
+                writer.writeStartDocument(s);
+            }
+
+            @Override
+            public void writeStartDocument(String s, String s2) throws XMLStreamException {
+                writer.writeStartDocument(s, s2);
+            }
+
+            @Override
+            public void writeCharacters(String s) throws XMLStreamException {
+                writer.writeCharacters(s);
+            }
+
+            @Override
+            public void writeCharacters(char[] chars, int i, int i2) throws XMLStreamException {
+                writer.writeCharacters(chars, i, i2);
+            }
+
+            @Override
+            public String getPrefix(String s) throws XMLStreamException {
+               return writer.getPrefix(s);
+            }
+
+            @Override
+            public void setPrefix(String s, String s2) throws XMLStreamException {
+                writer.setPrefix(s, s2);
+            }
+
+            @Override
+            public void setDefaultNamespace(String s) throws XMLStreamException {
+                writer.setDefaultNamespace(s);
+            }
+
+            @Override
+            public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException {
+                writer.setNamespaceContext(namespaceContext);
+            }
+
+            @Override
+            public NamespaceContext getNamespaceContext() {
+                return writer.getNamespaceContext();
+            }
+
+            @Override
+            public Object getProperty(String s) throws IllegalArgumentException {
+                return writer.getProperty(s);
+            }
+        };  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/88b24c48/components/camel-jaxb/src/test/resources/org/apache/camel/jaxb/CamelJaxbTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/test/resources/org/apache/camel/jaxb/CamelJaxbTest.xml b/components/camel-jaxb/src/test/resources/org/apache/camel/jaxb/CamelJaxbTest.xml
index c4740ec..e7331c5 100644
--- a/components/camel-jaxb/src/test/resources/org/apache/camel/jaxb/CamelJaxbTest.xml
+++ b/components/camel-jaxb/src/test/resources/org/apache/camel/jaxb/CamelJaxbTest.xml
@@ -21,8 +21,9 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
-    
-  
+
+    <bean id="testXmlStreamWriterWrapper" class="org.apache.camel.jaxb.TestXmlStreamWriter"/>
+
   <!-- START SNIPPET: example -->
   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
     <route>
@@ -60,6 +61,21 @@
       </marshal>          
       <to uri="mock:result"/>
     </route>
+
+      <route>
+          <from uri="direct:marshalCustomWriter"/>
+          <marshal>
+              <jaxb filterNonXmlChars="false"  contextPath="org.apache.camel.foo.bar" xmlStreamWriterWrapper="#testXmlStreamWriterWrapper"/>
+          </marshal>
+          <to uri="mock:result"/>
+      </route>
+      <route>
+          <from uri="direct:marshalCustomWriterAndFiltering"/>
+          <marshal>
+              <jaxb filterNonXmlChars="true"  contextPath="org.apache.camel.foo.bar" xmlStreamWriterWrapper="#testXmlStreamWriterWrapper" />
+          </marshal>
+          <to uri="mock:result"/>
+      </route>
   </camelContext>
   <!-- END SNIPPET: example -->
 


Mime
View raw message