---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: jcr
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: jcr
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: jcr
        spec:
          containers:
          - image: funktion/connector-jcr:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: jcr
      syntax: jcr:host/base
      alternativeSyntax: jcr:username:password@host/base
      title: JCR
      description: The jcr component allows you to add/read nodes to/from a JCR compliant content repository.
      label: cms,database
      deprecated: false
      async: false
      javaType: org.apache.camel.component.jcr.JcrComponent
      groupId: org.apache.camel
      artifactId: camel-jcr
      version: 2.18.3
    componentProperties: {}
    properties:
      host:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Name of the javax.jcr.Repository to lookup from the Camel registry to be used.
        order: 0
      base:
        kind: path
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Get the base node when accessing the repository
        order: 1
      deep:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: When isDeep is true events whose associated parent node is at absPath or within its subgraph are received.
        order: 2
      eventTypes:
        kind: parameter
        group: common
        type: integer
        javaType: int
        deprecated: false
        secret: false
        description: eventTypes (a combination of one or more event types encoded as a bit mask value such as javax.jcr.observation.Event.NODE_ADDED javax.jcr.observation.Event.NODE_REMOVED etc.).
        order: 3
      nodeTypeNames:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: When a comma separated nodeTypeName list string is set only events whose associated parent node has one of the node types (or a subtype of one of the node types) in this list will be received.
        order: 4
      noLocal:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: If noLocal is true then events generated by the session through which the listener was registered are ignored. Otherwise they are not ignored.
        order: 5
      password:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Password for login
        order: 6
      sessionLiveCheckInterval:
        kind: parameter
        group: common
        type: integer
        javaType: long
        deprecated: false
        secret: false
        defaultValue: "60000"
        description: Interval in milliseconds to wait before each session live checking The default value is 60000 ms.
        order: 7
      sessionLiveCheckIntervalOnStart:
        kind: parameter
        group: common
        type: integer
        javaType: long
        deprecated: false
        secret: false
        defaultValue: "3000"
        description: Interval in milliseconds to wait before the first session live checking. The default value is 3000 ms.
        order: 8
      username:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Username for login
        order: 9
      uuids:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: When a comma separated uuid list string is set only events whose associated parent node has one of the identifiers in the comma separated uuid list will be received.
        order: 10
      workspaceName:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The workspace to access. If it's not specified then the default one will be used
        order: 11
      bridgeErrorHandler:
        kind: parameter
        group: consumer
        label: consumer
        type: boolean
        javaType: boolean
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        defaultValue: false
        description: Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
        order: 12
      exceptionHandler:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: object
        javaType: org.apache.camel.spi.ExceptionHandler
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
        order: 13
      exchangePattern:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: string
        javaType: org.apache.camel.ExchangePattern
        enum:
        - InOnly
        - RobustInOnly
        - InOut
        - InOptionalOut
        - OutOnly
        - RobustOutOnly
        - OutIn
        - OutOptionalIn
        deprecated: false
        secret: false
        description: Sets the exchange pattern when the consumer creates an exchange.
        order: 14
      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: 15
  documentation.adoc: |+
    [[JCR-JCRComponent]]
    JCR Component
    ~~~~~~~~~~~~~

    The *`jcr`* component allows you to add/read nodes to/from a JCR
    compliant content repository (for example,
    http://jackrabbit.apache.org/[Apache Jackrabbit]) with its producer, or
    register an EventListener with the consumer.

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

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

    [[JCR-URIformat]]
    URI format
    ^^^^^^^^^^

    [source,java]
    -------------------------------------------
    jcr://user:password@repository/path/to/node
    -------------------------------------------

    *Consumer added*

    From *Camel 2.10* onwards you can use consumer as an EventListener in
    JCR or a producer to read a node by identifier.

    [[JCR-Usage]]
    Usage
    ^^^^^

    The `repository` element of the URI is used to look up the JCR
    `Repository` object in the Camel context registry.

    [[JCR-Options]]
    JCR Options
    +++++++++++


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




    // endpoint options: START
    The JCR component supports 16 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | host | common |  | String | *Required* Name of the javax.jcr.Repository to lookup from the Camel registry to be used.
    | base | common |  | String | Get the base node when accessing the repository
    | deep | common | false | boolean | When isDeep is true events whose associated parent node is at absPath or within its subgraph are received.
    | eventTypes | common |  | int | eventTypes (a combination of one or more event types encoded as a bit mask value such as javax.jcr.observation.Event.NODE_ADDED javax.jcr.observation.Event.NODE_REMOVED etc.).
    | nodeTypeNames | common |  | String | When a comma separated nodeTypeName list string is set only events whose associated parent node has one of the node types (or a subtype of one of the node types) in this list will be received.
    | noLocal | common | false | boolean | If noLocal is true then events generated by the session through which the listener was registered are ignored. Otherwise they are not ignored.
    | password | common |  | String | Password for login
    | sessionLiveCheckInterval | common | 60000 | long | Interval in milliseconds to wait before each session live checking The default value is 60000 ms.
    | sessionLiveCheckIntervalOnStart | common | 3000 | long | Interval in milliseconds to wait before the first session live checking. The default value is 3000 ms.
    | username | common |  | String | Username for login
    | uuids | common |  | String | When a comma separated uuid list string is set only events whose associated parent node has one of the identifiers in the comma separated uuid list will be received.
    | workspaceName | common |  | String | The workspace to access. If it's not specified then the default one will be used
    | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
    | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
    | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
    | 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




    Please note that the JCR Producer used message properties instead of
    message headers in Camel versions earlier than 2.12.3. See
    https://issues.apache.org/jira/browse/CAMEL-7067[https://issues.apache.org/jira/browse/CAMEL-7067]
    for more details.

    [[JCR-Example]]
    Example
    ^^^^^^^

    The snippet below creates a node named `node` under the `/home/test`
    node in the content repository. One additional property is added to the
    node as well: `my.contents.property` which will contain the body of the
    message being sent.

    [source,java]
    ------------------------------------------------------------------------
    from("direct:a").setHeader(JcrConstants.JCR_NODE_NAME, constant("node"))
        .setHeader("my.contents.property", body())
        .to("jcr://user:pass@repository/home/test");
    ------------------------------------------------------------------------

     

    The following code will register an EventListener under the path
    import-application/inbox for Event.NODE_ADDED and Event.NODE_REMOVED
    events (event types 1 and 2, both masked as 3) and listening deep for
    all the children.

    [source,xml]
    ---------------------------------------------------------------------------------------------
    <route>
        <from uri="jcr://user:pass@repository/import-application/inbox?eventTypes=3&deep=true" />
        <to uri="direct:execute-import-application" />
    </route>
    ---------------------------------------------------------------------------------------------

    [[JCR-SeeAlso]]
    See Also
    ^^^^^^^^

    * link:configuring-camel.html[Configuring Camel]
    * link:component.html[Component]
    * link:endpoint.html[Endpoint]
    * link:getting-started.html[Getting Started]

