---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: schematron
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: schematron
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: schematron
        spec:
          containers:
          - image: funktion/connector-schematron:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: schematron
      syntax: schematron:path
      title: Schematron
      description: Validates the payload of a message using the Schematron Library.
      label: validation
      deprecated: false
      async: false
      producerOnly: true
      javaType: org.apache.camel.component.schematron.SchematronComponent
      groupId: org.apache.camel
      artifactId: camel-schematron
      version: 2.18.3
    componentProperties: {}
    properties:
      path:
        kind: path
        group: producer
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The path to the schematron rules file. Can either be in class path or location in the file system.
        order: 0
      abort:
        kind: parameter
        group: producer
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Flag to abort the route and throw a schematron validation exception.
        order: 1
      rules:
        kind: parameter
        group: producer
        type: object
        javaType: javax.xml.transform.Templates
        deprecated: false
        secret: false
        description: To use the given schematron rules instead of loading from the path
        order: 2
      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: 3
      uriResolver:
        kind: parameter
        group: advanced
        label: advanced
        type: object
        javaType: javax.xml.transform.URIResolver
        deprecated: false
        secret: false
        description: Set the URIResolver to be used for resolving schematron includes in the rules file.
        order: 4
  documentation.adoc: "[[Schematron-SchematronComponent]]\nSchematron Component\n\
    ~~~~~~~~~~~~~~~~~~~~\n\n*Available as of Camel 2.14*\n\nhttp://www.schematron.com/index.html[Schematron]\_\
    is an XML-based\nlanguage for validating XML instance documents. It is used to\
    \ make\nassertions about data in an XML document and it is also used to express\n\
    operational and business rules. Schematron is\nan\_http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html[ISO\n\
    Standard]. The schematron component uses the leading\nhttp://www.schematron.com/implementation.html[implementation]\
    \ of ISO\nschematron. It is an XSLT based implementation. The schematron rules\
    \ is\nrun through http://www.schematron.com/implementation.html[four XSLT\npipelines],\
    \ which generates a final XSLT which will be used as the basis\nfor running the\
    \ assertion against the XML document. The component is\nwritten in a way that\
    \ Schematron rules are loaded at the start of the\nendpoint (only once) this is\
    \ to minimise the overhead of instantiating a\nJava Templates object representing\
    \ the rules.\n\n[[Schematron-URIformat]]\nURI format\n^^^^^^^^^^\n\n[source,java]\n\
    ---------------------------\nschematron://path?[options]\n---------------------------\n\
    \n[[Schematron-URIoptions]]\nURI options\n^^^^^^^^^^^\n\n\n// component options:\
    \ START\nThe Schematron component has no options.\n// component options: END\n\
    \n\n\n\n\n// endpoint options: START\nThe Schematron component supports 5 endpoint\
    \ options which are listed below:\n\n{% raw %}\n[width=\"100%\",cols=\"2,1,1m,1m,5\"\
    ,options=\"header\"]\n|=======================================================================\n\
    | Name | Group | Default | Java Type | Description\n| path | producer |  | String\
    \ | *Required* The path to the schematron rules file. Can either be in class path\
    \ or location in the file system.\n| abort | producer | false | boolean | Flag\
    \ to abort the route and throw a schematron validation exception.\n| rules | producer\
    \ |  | Templates | To use the given schematron rules instead of loading from the\
    \ path\n| synchronous | advanced | false | boolean | Sets whether synchronous\
    \ processing should be strictly used or Camel is allowed to use asynchronous processing\
    \ (if supported).\n| uriResolver | advanced |  | URIResolver | Set the URIResolver\
    \ to be used for resolving schematron includes in the rules file.\n|=======================================================================\n\
    {% endraw %}\n// endpoint options: END\n\n\n\n\n[[Schematron-Headers]]\nHeaders\n\
    ^^^^^^^\n\n[width=\"100%\",cols=\"10%,10%,10%,70%\",options=\"header\",]\n|=======================================================================\n\
    |Name |Description |Type |In/Out\n\n|CamelSchematronValidationStatus |The schematron\
    \ validation status: SUCCESS / FAILED |String |IN\n\n|CamelSchematronValidationReport\
    \ |The schematrion report body in XML format. See an example below |String |IN\n\
    |=======================================================================\n\n[[Schematron-URIandpathsyntax]]\n\
    URI and path syntax\n^^^^^^^^^^^^^^^^^^^\n\nThe following example shows how to\
    \ invoke the schematron processor in\nJava DSL. The schematron rules file is sourced\
    \ from the class path:\n\n[source,java]\n----------------------------------------------------------------------------\n\
    from(\"direct:start\").to(\"schematron://sch/schematron.sch\").to(\"mock:result\"\
    )\n----------------------------------------------------------------------------\n\
    \n\_\n\nThe following example shows how to invoke the schematron processor in\n\
    XML DSL. The schematrion rules file is sourced from the file system:\n\n[source,xml]\n\
    -----------------------------------------------------------------------------------------------\n\
    <route>\n   <from uri=\"direct:start\" />\n   <to uri=\"schematron:///usr/local/sch/schematron.sch\"\
    \ />\n   <log message=\"Schematron validation status: ${in.header.CamelSchematronValidationStatus}\"\
    \ />\n   <choice>\n      <when>\n         <simple>${in.header.CamelSchematronValidationStatus}\
    \ == 'SUCCESS'</simple>\n         <to uri=\"mock:success\" />\n      </when>\n\
    \      <otherwise>\n         <log message=\"Failed schematron validation\" />\n\
    \         <setBody>\n            <header>CamelSchematronValidationReport</header>\n\
    \         </setBody>\n         <to uri=\"mock:failure\" />\n      </otherwise>\n\
    \   </choice>\n</route>\n-----------------------------------------------------------------------------------------------\n\
    \nTIP: *Where to store schematron rules?*\nSchematron rules can change with business\
    \ requirement, as such it is\nrecommended to store these rules somewhere in file\
    \ system. When the\nschematron component endpoint is started, the rules are compiled\
    \ into\nXSLT as a \_Java Templates Object. This is done only once to minimise\
    \ the\noverhead of instantiating Java Templates object, which can be an\nexpensive\
    \ operation for large set of rules and given that the process\ngoes through four\
    \ pipelines\nof\_http://www.schematron.com/implementation.html[XSLT transformations].\n\
    So if you happen to store the rules in the file system, in the event of\nan update,\
    \ all you need is to restart the route or the component. No\nharm in storing these\
    \ rules in the class path though, but you will have\nto build and deploy the component\
    \ to pick up the changes.\n\n[[Schematron-Schematronrulesandreportsamples]]\n\
    Schematron rules and report samples\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nHere\
    \ is an example of schematron rules\n\n[source,xml]\n--------------------------------------------------------------------\n\
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<schema xmlns=\"http://purl.oclc.org/dsdl/schematron\"\
    >\n   <title>Check Sections 12/07</title>\n   <pattern id=\"section-check\">\n\
    \      <rule context=\"section\">\n         <assert test=\"title\">This section\
    \ has no title</assert>\n         <assert test=\"para\">This section has no paragraphs</assert>\n\
    \      </rule>\n   </pattern>\n</schema>\n--------------------------------------------------------------------\n\
    \nHere is an example of schematron report:\n\n[source,xml]\n------------------------------------------------------------------------\n\
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svrl:schematron-output xmlns:svrl=\"\
    http://purl.oclc.org/dsdl/svrl\"\n xmlns:iso=\"http://purl.oclc.org/dsdl/schematron\"\
    \n xmlns:saxon=\"http://saxon.sf.net/\"\n xmlns:schold=\"http://www.ascc.net/xml/schematron\"\
    \n xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\
    \n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" schemaVersion=\"\" title=\"\"\
    >\n   \n   <svrl:active-pattern document=\"\" />\n   <svrl:fired-rule context=\"\
    chapter\" />\n   <svrl:failed-assert test=\"title\" location=\"/doc[1]/chapter[1]\"\
    >\n      <svrl:text>A chapter should have a title</svrl:text>\n   </svrl:failed-assert>\n\
    \   <svrl:fired-rule context=\"chapter\" />\n   <svrl:failed-assert test=\"title\"\
    \ location=\"/doc[1]/chapter[2]\">\n      <svrl:text>A chapter should have a title</svrl:text>\n\
    \   </svrl:failed-assert>\n   <svrl:fired-rule context=\"chapter\" />\n</svrl:schematron-output>\n\
    ------------------------------------------------------------------------\n\nTIP:\
    \ *Useful Links and resources*\n* http://www.mulberrytech.com/papers/schematron-Philly.pdf[Introduction\n\
    to Schematron]\_by Mulleberry technologies. An excellent document in PDF\nto get\
    \ you started on Schematron.\n* http://www.schematron.com[Schematron official\
    \ site]. This contains\nlinks to other resources\n\n"
