You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/04/04 13:40:42 UTC

[camel] 05/08: CAMEL-17792: Add doc about the message headers of camel-printer

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 bb8d654879c577385c835db845cfc9ccfbd8e95b
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Mon Apr 4 13:05:55 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-printer
---
 .../resources/org/apache/camel/component/printer/lpr.json      |  3 +++
 components/camel-printer/src/main/docs/lpr-component.adoc      | 10 ++++++----
 .../org/apache/camel/component/printer/PrinterEndpoint.java    |  4 +++-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/components/camel-printer/src/generated/resources/org/apache/camel/component/printer/lpr.json b/components/camel-printer/src/generated/resources/org/apache/camel/component/printer/lpr.json
index acd7f4aeaee..e5418ca2bff 100644
--- a/components/camel-printer/src/generated/resources/org/apache/camel/component/printer/lpr.json
+++ b/components/camel-printer/src/generated/resources/org/apache/camel/component/printer/lpr.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": {
+    "PrinterJobName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the job" }
+  },
   "properties": {
     "hostname": { "kind": "path", "displayName": "Hostname", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.printer.PrinterConfiguration", "configurationField": "config", "description": "Hostname of the printer" },
     "port": { "kind": "path", "displayName": "Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.printer.PrinterConfiguration", "configurationField": "config", "description": "Port number of the printer" },
diff --git a/components/camel-printer/src/main/docs/lpr-component.adoc b/components/camel-printer/src/main/docs/lpr-component.adoc
index 01665599d46..5c2a0f50a74 100644
--- a/components/camel-printer/src/main/docs/lpr-component.adoc
+++ b/components/camel-printer/src/main/docs/lpr-component.adoc
@@ -59,7 +59,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
 
 == Sending Messages to a Printer
 
@@ -77,7 +79,7 @@ route.
 -----------------------------------------------
 RouteBuilder builder = new RouteBuilder() {
     public void configure() {
-       from(file://inputdir/?delete=true)
+       from("file://inputdir/?delete=true")
        .to("lpr://localhost/default?copies=2" +
            "&flavor=DocFlavor.INPUT_STREAM&" +
            "&mimeType=AUTOSENSE" +
@@ -92,7 +94,7 @@ RouteBuilder builder = new RouteBuilder() {
 --------------------------------------------------
 RouteBuilder builder = new RouteBuilder() {
     public void configure() {
-       from(file://inputdir/?delete=true)
+       from("file://inputdir/?delete=true")
        .to("lpr://remotehost/sales/salesprinter" +
            "?copies=2&sides=one-sided" +
            "&mimeType=GIF&mediaSize=ISO_A4" +
@@ -106,7 +108,7 @@ RouteBuilder builder = new RouteBuilder() {
 --------------------------------------------------
 RouteBuilder builder = new RouteBuilder() {
     public void configure() {
-       from(file://inputdir/?delete=true)
+       from("file://inputdir/?delete=true")
        .to("lpr://remotehost/sales/salesprinter" +
            "?copies=2&sides=one-sided" +
            "&mimeType=JPEG" +
diff --git a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterEndpoint.java b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterEndpoint.java
index 5292f331957..1fb042a23a4 100644
--- a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterEndpoint.java
+++ b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterEndpoint.java
@@ -21,6 +21,7 @@ import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
@@ -35,9 +36,10 @@ import org.apache.camel.support.DefaultEndpoint;
  * printer using the javax printing API under the covers.
  */
 @UriEndpoint(firstVersion = "2.1.0", scheme = "lpr", title = "Printer", syntax = "lpr:hostname:port/printername",
-             producerOnly = true, category = { Category.PRINTING })
+             producerOnly = true, category = { Category.PRINTING }, headersClass = PrinterEndpoint.class)
 public class PrinterEndpoint extends DefaultEndpoint {
 
+    @Metadata(label = "producer", description = "The name of the job", javaType = "String")
     public static final String JOB_NAME = "PrinterJobName";
 
     @UriParam