---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: lpr
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: lpr
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: lpr
        spec:
          containers:
          - image: funktion/connector-lpr:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: lpr
      syntax: lpr:hostname:port/printername
      title: Printer
      description: The printer component is used for sending messages to printers as print jobs.
      label: printing
      deprecated: false
      async: false
      producerOnly: true
      javaType: org.apache.camel.component.printer.PrinterComponent
      groupId: org.apache.camel
      artifactId: camel-printer
      version: 2.18.3
    componentProperties: {}
    properties:
      hostname:
        kind: path
        group: producer
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Hostname of the printer
        order: 0
      port:
        kind: path
        group: producer
        type: integer
        javaType: int
        deprecated: false
        secret: false
        description: Port number of the printer
        order: 1
      printername:
        kind: path
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Name of the printer
        order: 2
      copies:
        kind: parameter
        group: producer
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "1"
        description: Number of copies to print
        order: 3
      docFlavor:
        kind: parameter
        group: producer
        type: object
        javaType: javax.print.DocFlavor
        deprecated: false
        secret: false
        description: Sets DocFlavor to use.
        order: 4
      flavor:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Sets DocFlavor to use.
        order: 5
      mediaSize:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        defaultValue: na-letter
        description: Sets the stationary as defined by enumeration names in the javax.print.attribute.standard.MediaSizeName API. The default setting is to use North American Letter sized stationary. The value's case is ignored e.g. values of iso_a4 and ISO_A4 may be used.
        order: 6
      mediaTray:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Sets MediaTray supported by the javax.print.DocFlavor API for example uppermiddle etc.
        order: 7
      mimeType:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Sets mimeTypes supported by the javax.print.DocFlavor API
        order: 8
      orientation:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        enum:
        - portrait
        - landscape
        - reverse-portrait
        - reverse-landscape
        deprecated: false
        secret: false
        defaultValue: portrait
        description: Sets the page orientation.
        order: 9
      printerPrefix:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Sets the prefix name of the printer it is useful when the printer name does not start with //hostname/printer
        order: 10
      sendToPrinter:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: etting this option to false prevents sending of the print data to the printer
        order: 11
      sides:
        kind: parameter
        group: producer
        type: string
        javaType: java.lang.String
        enum:
        - one-sided
        - duplex
        - tumble
        - two-sided-short-edge
        - two-sided-long-edge
        deprecated: false
        secret: false
        defaultValue: one-sided
        description: Sets one sided or two sided printing based on the javax.print.attribute.standard.Sides API
        order: 12
      synchronous:
        kind: parameter
        group: advanced
        label: advanced
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
        order: 13
  documentation.adoc: |
    [[Printer-PrinterComponent]]
    Printer Component
    ~~~~~~~~~~~~~~~~~

    *Available as of Camel 2.1*

    The *printer* component provides a way to direct payloads on a route to
    a printer. Obviously the payload has to be a formatted piece of payload
    in order for the component to appropriately print it. The objective is
    to be able to direct specific payloads as jobs to a line printer in a
    camel flow.

    This component only supports a camel producer endpoint.

    The functionality allows for the payload to be printed on a default
    printer, named local, remote or wirelessly linked printer using the
    javax printing API under the covers.

    Maven users will need to add the following dependency to their `pom.xml`
    for this component:

    [source,xml]
    ------------------------------------------------------------
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-printer</artifactId>
        <version>x.x.x</version>
        <!-- use the same version as your Camel core version -->
    </dependency>
    ------------------------------------------------------------

    [[Printer-URIformat]]
    URI format
    ^^^^^^^^^^

    Since the URI scheme for a printer has not been standardized (the
    nearest thing to a standard being the IETF print standard) and therefore
    not uniformly applied by vendors, we have chosen *"lpr"* as the scheme.

    [source,java]
    -----------------------------------------------
    lpr://localhost/default[?options]
    lpr://remotehost:port/path/to/printer[?options]
    -----------------------------------------------

    You can append query options to the URI in the following format,
    `?option=value&option=value&...`

    [[Printer-Options]]
    Options
    ^^^^^^^


    // component options: START
    The Printer component has no options.
    // component options: END



    // endpoint options: START
    The Printer component supports 14 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | hostname | producer |  | String | *Required* Hostname of the printer
    | port | producer |  | int | Port number of the printer
    | printername | producer |  | String | Name of the printer
    | copies | producer | 1 | int | Number of copies to print
    | docFlavor | producer |  | DocFlavor | Sets DocFlavor to use.
    | flavor | producer |  | String | Sets DocFlavor to use.
    | mediaSize | producer | na-letter | String | Sets the stationary as defined by enumeration names in the javax.print.attribute.standard.MediaSizeName API. The default setting is to use North American Letter sized stationary. The value's case is ignored e.g. values of iso_a4 and ISO_A4 may be used.
    | mediaTray | producer |  | String | Sets MediaTray supported by the javax.print.DocFlavor API for example uppermiddle etc.
    | mimeType | producer |  | String | Sets mimeTypes supported by the javax.print.DocFlavor API
    | orientation | producer | portrait | String | Sets the page orientation.
    | printerPrefix | producer |  | String | Sets the prefix name of the printer it is useful when the printer name does not start with //hostname/printer
    | sendToPrinter | producer | true | boolean | etting this option to false prevents sending of the print data to the printer
    | sides | producer | one-sided | String | Sets one sided or two sided printing based on the javax.print.attribute.standard.Sides API
    | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
    |=======================================================================
    {% endraw %}
    // endpoint options: END


    [[Printer-SendingMessagestoaPrinter]]
    Sending Messages to a Printer
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    [[Printer-PrinterProducer]]
    Printer Producer
    ++++++++++++++++

    Sending data to the printer is very straightforward and involves
    creating a producer endpoint that can be sent message exchanges on in
    route.

    [[Printer-UsageSamples]]
    Usage Samples
    ^^^^^^^^^^^^^

    [[Printer-Example1:PrintingtextbasedpayloadsonaDefaultprinterusingletterstationaryandone-sidedmode]]
    Example 1: Printing text based payloads on a Default printer using letter stationary and one-sided mode
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    [source,java]
    -----------------------------------------------
    RouteBuilder builder = new RouteBuilder() {
        public void configure() {
           from(file://inputdir/?delete=true)
           .to("lpr://localhost/default?copies=2" +
               "&flavor=DocFlavor.INPUT_STREAM&" +
               "&mimeType=AUTOSENSE" +
               "&mediaSize=NA_LETTER" +
               "&sides=one-sided")
        }};
    -----------------------------------------------

    [[Printer-Example2:PrintingGIFbasedpayloadsonaRemoteprinterusingA4stationaryandone-sidedmode]]
    Example 2: Printing GIF based payloads on a Remote printer using A4 stationary and one-sided mode
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    [source,java]
    --------------------------------------------------
    RouteBuilder builder = new RouteBuilder() {
        public void configure() {
           from(file://inputdir/?delete=true)
           .to("lpr://remotehost/sales/salesprinter" +
               "?copies=2&sides=one-sided" +
               "&mimeType=GIF&mediaSize=ISO_A4" +
               "&flavor=DocFlavor.INPUT_STREAM")
       }};
    --------------------------------------------------

    [[Printer-Example3:PrintingJPEGbasedpayloadsonaRemoteprinterusingJapanesePostcardstationaryandone-sidedmode]]
    Example 3: Printing JPEG based payloads on a Remote printer using Japanese Postcard stationary and one-sided mode
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    [source,java]
    --------------------------------------------------
    RouteBuilder builder = new RouteBuilder() {
        public void configure() {
           from(file://inputdir/?delete=true)
           .to("lpr://remotehost/sales/salesprinter" +
               "?copies=2&sides=one-sided" +
               "&mimeType=JPEG" +
               "&mediaSize=JAPANESE_POSTCARD" +
               "&flavor=DocFlavor.INPUT_STREAM")
        }};
    --------------------------------------------------
