This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6ab02d90f1c9be1a3d571a92009c4cb34a6354c1 Author: Nicolas Filotto <[email protected]> AuthorDate: Wed Apr 6 17:03:07 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-xj --- .../src/generated/resources/org/apache/camel/component/xj/xj.json | 3 +++ components/camel-xj/src/main/docs/xj-component.adoc | 4 +++- .../org/apache/camel/component/xj/JsonFileResultHandlerFactory.java | 2 +- .../src/main/java/org/apache/camel/component/xj/XJConstants.java | 4 ++++ .../src/main/java/org/apache/camel/component/xj/XJEndpoint.java | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/components/camel-xj/src/generated/resources/org/apache/camel/component/xj/xj.json b/components/camel-xj/src/generated/resources/org/apache/camel/component/xj/xj.json index d40c46898a2..787dabb006e 100644 --- a/components/camel-xj/src/generated/resources/org/apache/camel/component/xj/xj.json +++ b/components/camel-xj/src/generated/resources/org/apache/camel/component/xj/xj.json @@ -33,6 +33,9 @@ "uriResolver": { "kind": "property", "displayName": "Uri Resolver", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "javax.xml.transform.URIResolver", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom UriResolver. Should not be used together with the option 'uriResolverFactory'." }, "uriResolverFactory": { "kind": "property", "displayName": "Uri Resolver Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.xslt.XsltUriResolverFactory", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom UriResolver which depends on a dynamic endpoint resource URI. Should not be used together with the option 'uriResolver'." } }, + "headers": { + "CamelXsltFileName": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The XSLT file name" } + }, "properties": { "resourceUri": { "kind": "path", "displayName": "Resource Uri", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the template. The following is supported by the default URIResolver. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). [...] "allowStAX": { "kind": "parameter", "displayName": "Allow StAX", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to allow using StAX as the javax.xml.transform.Source. You can enable this if the XSLT library supports StAX such as the Saxon library (camel-saxon). The Xalan library (default in JVM) does not support StAXSource." }, diff --git a/components/camel-xj/src/main/docs/xj-component.adoc b/components/camel-xj/src/main/docs/xj-component.adoc index eec65ba2855..73a883a00ff 100644 --- a/components/camel-xj/src/main/docs/xj-component.adoc +++ b/components/camel-xj/src/main/docs/xj-component.adoc @@ -63,7 +63,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Using XJ endpoints diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java index 59ce3a23438..07cf5219707 100644 --- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java +++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/JsonFileResultHandlerFactory.java @@ -44,7 +44,7 @@ public class JsonFileResultHandlerFactory implements ResultHandlerFactory { */ @Override public ResultHandler createResult(Exchange exchange) throws Exception { - final String fileName = ExchangeHelper.getMandatoryHeader(exchange, Exchange.XSLT_FILE_NAME, String.class); + final String fileName = ExchangeHelper.getMandatoryHeader(exchange, XJConstants.XSLT_FILE_NAME, String.class); return new JsonFileResultHandler(jsonFactory, new File(fileName)); } } diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java index 3270de21232..6ae3ceab51d 100644 --- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java +++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJConstants.java @@ -22,6 +22,8 @@ import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.core.JsonToken; +import org.apache.camel.Exchange; +import org.apache.camel.spi.Metadata; public final class XJConstants { @@ -46,6 +48,8 @@ public final class XJConstants { * converting to xml the attribute holds the type that was in the original json document. */ public static final String TYPE_HINT_TYPE = "type"; + @Metadata(description = "The XSLT file name", javaType = "String") + public static final String XSLT_FILE_NAME = Exchange.XSLT_FILE_NAME; /** * Mapping from json-types to typehint names diff --git a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java index e0aab49c689..e0716eee50e 100644 --- a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java +++ b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java @@ -32,7 +32,7 @@ import org.apache.camel.spi.UriParam; */ @ManagedResource(description = "Managed XJEndpoint") @UriEndpoint(firstVersion = "3.0.0", scheme = "xj", title = "XJ", syntax = "xj:resourceUri", producerOnly = true, - label = "transformation") + label = "transformation", headersClass = XJConstants.class) public class XJEndpoint extends XsltSaxonEndpoint { private final JsonFactory jsonFactory = new JsonFactory();
