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 9f5d1d88ac7e9b9c114103ae15910a636e4efbd2 Author: Nicolas Filotto <[email protected]> AuthorDate: Mon Mar 21 15:10:45 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-fop --- .../src/generated/resources/org/apache/camel/component/fop/fop.json | 3 +++ components/camel-fop/src/main/docs/fop-component.adoc | 4 +++- .../src/main/java/org/apache/camel/component/fop/FopConstants.java | 3 +++ .../src/main/java/org/apache/camel/component/fop/FopEndpoint.java | 2 +- .../src/main/java/org/apache/camel/component/fop/FopProducer.java | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/components/camel-fop/src/generated/resources/org/apache/camel/component/fop/fop.json b/components/camel-fop/src/generated/resources/org/apache/camel/component/fop/fop.json index f2cceb2..eeb805e 100644 --- a/components/camel-fop/src/generated/resources/org/apache/camel/component/fop/fop.json +++ b/components/camel-fop/src/generated/resources/org/apache/camel/component/fop/fop.json @@ -25,6 +25,9 @@ "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] }, + "headers": { + "CamelFop.Output.Format": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The output format" } + }, "properties": { "outputType": { "kind": "path", "displayName": "Output Type", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.fop.FopOutputType", "enum": [ "pdf", "ps", "pcl", "png", "jpeg", "svg", "xml", "mif", "rtf", "txt" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The primary output format is PDF but other output formats are also supported." }, "fopFactory": { "kind": "parameter", "displayName": "Fop Factory", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.fop.apps.FopFactory", "deprecated": false, "autowired": false, "secret": false, "description": "Allows to use a custom configured or implementation of org.apache.fop.apps.FopFactory." }, diff --git a/components/camel-fop/src/main/docs/fop-component.adoc b/components/camel-fop/src/main/docs/fop-component.adoc index fda4885..2c76678 100644 --- a/components/camel-fop/src/main/docs/fop-component.adoc +++ b/components/camel-fop/src/main/docs/fop-component.adoc @@ -81,7 +81,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Configuration file diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java index 78c8723..bdb358d 100644 --- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java +++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopConstants.java @@ -16,9 +16,12 @@ */ package org.apache.camel.component.fop; +import org.apache.camel.spi.Metadata; + public interface FopConstants { String CAMEL_FOP_RENDER = "CamelFop.Render."; String CAMEL_FOP_ENCRYPT = "CamelFop.Encrypt."; String CAMEL_FOP_RENDERER_OPTIONS = "CamelFop.RendererOptions."; + @Metadata(description = "The output format", javaType = "String") String CAMEL_FOP_OUTPUT_FORMAT = "CamelFop.Output.Format"; } diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java index 01967b8..97bc0e0 100644 --- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java +++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopEndpoint.java @@ -35,7 +35,7 @@ import org.apache.fop.apps.FopFactory; * Render messages into PDF and other output formats supported by Apache FOP. */ @UriEndpoint(firstVersion = "2.10.0", scheme = "fop", title = "FOP", syntax = "fop:outputType", producerOnly = true, - category = { Category.FILE, Category.TRANSFORMATION }) + category = { Category.FILE, Category.TRANSFORMATION }, headersClass = FopConstants.class) public class FopEndpoint extends DefaultEndpoint { @UriPath diff --git a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java index 82c225b..89c8f58 100644 --- a/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java +++ b/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopProducer.java @@ -73,7 +73,7 @@ public class FopProducer extends DefaultProducer { private String getOutputFormat(Exchange exchange) { String headerOutputFormat = exchange.getIn().getHeader(FopConstants.CAMEL_FOP_OUTPUT_FORMAT, String.class); if (headerOutputFormat != null) { - // it may be a short hand + // it may be a shorthand FopOutputType type = exchange.getContext().getTypeConverter().tryConvertTo(FopOutputType.class, exchange, headerOutputFormat); if (type != null) {
