<?xml version="1.0" encoding="UTF-8"?>
<features name="karaf-features-fuse-droolsjbpm-${project.version}"
          xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0">

  <repository>mvn:org.kie/kie-karaf-features/${project.version}/xml/features-core</repository>

  <!--
   In order to install the below features into Fuse 7, target runtime needs to provide these features:
    - drools7-dependencies
    - jbpm7-dependencies
    - optaplanner-dependencies
    - kie7-remote-dependencies
    - db-dependencies
    - hibernate-dependencies
    - hibernate-validator-dependencies
   These features are contained in some repository not referenced explicitly with <repository> (loose coupling).
   Fuse 7 specific repository is 'mvn:org.jboss.fuse.features/brms-features/VERSION/xml/features'
  -->

  <feature name="drools-common" version="${project.version}" description="Drools Commons">
    <feature>drools7-dependencies</feature>
  </feature>

  <feature name="drools-decisiontable" description="Drools Decision Tables" version="${project.version}">
    <feature version="${project.version}">drools-module</feature>
    <feature version="${project.version}">drools-templates</feature>
    <bundle>mvn:org.drools/drools-decisiontables/${version.org.drools}</bundle>
  </feature>

  <feature name="drools-wb-guided-decisiontables" description="Drools Workbench Guided Decision Tables" version="${project.version}">
    <feature version="${project.version}">drools-module</feature>
    <bundle>mvn:org.drools/drools-workbench-models-datamodel-api/${version.org.kie}</bundle>
    <bundle>mvn:org.drools/drools-workbench-models-commons/${version.org.kie}</bundle>
    <bundle>mvn:org.drools/drools-workbench-models-guided-dtable/${version.org.kie}</bundle>
  </feature>

  <feature name="kie-dmn" description="Kie DMN" version="${project.version}">
    <feature version="${project.version}">drools-module</feature>
    <bundle>mvn:org.antlr/antlr4-runtime/${version.org.antlr4}</bundle>
    <bundle>mvn:ch.obermuhlner/big-math/${version.ch.obermuhlner}</bundle>
    <bundle>mvn:org.drools/drools-constraint-parser/${version.org.kie}</bundle>
    <bundle>mvn:org.kie/kie-dmn-model/${version.org.kie}</bundle>
    <bundle>mvn:org.kie/kie-dmn-api/${version.org.kie}</bundle>
    <bundle>mvn:org.kie/kie-dmn-backend/${version.org.kie}</bundle>
    <bundle>mvn:org.kie/kie-dmn-feel/${version.org.kie}</bundle>
    <bundle>mvn:org.kie/kie-dmn-core/${version.org.kie}</bundle>
  </feature>

  <feature name="jbpm-commons" version="${project.version}" description="jBPM Commons">
    <feature>jbpm7-dependencies</feature>
    <feature version="${project.version}">servlet-api-kie</feature>
  </feature>

  <feature name="jbpm-human-task" version="${project.version}" description="jBPM Human Task">
    <feature version="${project.version}">drools-module</feature>
    <feature version="${project.version}">drools-jpa</feature>
    <feature version="${project.version}">jbpm-commons</feature>
    <bundle>mvn:org.jbpm/jbpm-flow/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-query-jpa/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-audit/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-persistence-api/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-human-task-core/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-human-task-workitems/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-human-task-jpa/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-human-task-audit/${version.org.jbpm}</bundle>
  </feature>

  <feature name="jbpm" version="${project.version}" description="jBPM Engine">
    <feature version="${project.version}">drools-module</feature>
    <feature version="${project.version}">drools-jpa</feature>
    <feature version="${project.version}">jbpm-commons</feature>
    <feature version="${project.version}">jbpm-human-task</feature>
    <bundle>mvn:org.jbpm/jbpm-flow-builder/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-flow/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-bpmn2/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-audit/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-query-jpa/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-persistence-api/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-persistence-jpa/${version.org.jbpm}</bundle>
    <bundle>mvn:org.jbpm/jbpm-runtime-manager/${version.org.jbpm}</bundle>
  </feature>

  <feature name="optaplanner-engine" version="${project.version}" description="OptaPlanner Engine">
    <feature>optaplanner-dependencies</feature>
    <feature version="${project.version}">drools-module</feature>
    <bundle>mvn:org.optaplanner/optaplanner-core/${version.org.optaplanner}</bundle>
    <bundle>mvn:org.optaplanner/optaplanner-persistence-common/${version.org.optaplanner}</bundle>
    <bundle>mvn:org.optaplanner/optaplanner-persistence-xstream/${version.org.optaplanner}</bundle>
    <bundle>mvn:org.optaplanner/optaplanner-persistence-jaxb/${version.org.optaplanner}</bundle>
  </feature>

  <feature name="droolsjbpm-hibernate" version="${version.org.hibernate}" description="Hibernate 4.2.x JPA persistence engine support">
    <details>Enable Hibernate 5.x as persistence engine.</details>
    <feature>transaction</feature>
    <feature version="[2,3)">jpa</feature>
    <feature version="${project.version}">servlet-api-kie</feature>
    <feature>hibernate-dependencies</feature>
  </feature>

  <feature name="h2" version="${h2.version}" description="H2 database">
    <feature>db-dependencies</feature>
    <bundle>mvn:com.h2database/h2/${fuse.version.com.h2database}</bundle>
  </feature>

  <feature name="kie-server-client" version="${project.version}" description="KIE Server Client">
    <feature version="${project.version}">drools-module</feature>
    <feature version="${project.version}">optaplanner-engine</feature>
    <feature>kie7-remote-dependencies</feature>
    <bundle>mvn:org.drools/kie-pmml/${version.org.kie}</bundle>
    <bundle>mvn:org.kie.server/kie-server-api/${version.org.drools.droolsjbpm-integration}</bundle>
    <bundle>mvn:org.kie.server/kie-server-common/${version.org.drools.droolsjbpm-integration}</bundle>
    <bundle>mvn:org.kie.server/kie-server-client/${version.org.drools.droolsjbpm-integration}</bundle>
    <bundle>mvn:org.kie/kie-dmn-model/${version.org.kie}</bundle> <!-- needed as the kie-server contains DMN client, which uses the kie-dmn-api, which needs kie-dmn-model -->
    <bundle>mvn:org.kie/kie-dmn-api/${version.org.kie}</bundle>   <!-- needed as the kie-server contains DMN client, which uses the kie-dmn-api -->
    <bundle>mvn:com.fasterxml.jackson.datatype/jackson-datatype-jsr310/${version.com.fasterxml.jackson}</bundle>
  </feature>

  <feature name="servlet-api-kie" version="${project.version}">
    <feature>servlet-api-dependencies</feature>
  </feature>

  <feature name="kie-pmml" version="${project.version}">
    <feature version="${project.version}">drools-module</feature>
    <bundle start-level="100">mvn:org.drools/kie-pmml/${version.org.drools}</bundle>
  </feature>

</features>