CAMEL-10350: Add Bonita Component

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0b057b16
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0b057b16
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0b057b16

Branch: refs/heads/master
Commit: 0b057b163af12a2848ac3c4900d521269b3c2206
Parents: 23fb42a
Author: lionel-bonitasoft <lionel.pala...@bonitasoft.com>
Authored: Fri Oct 28 12:50:05 2016 -0400
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Nov 1 12:42:38 2016 +0100

----------------------------------------------------------------------
 components-starter/camel-bonita-starter/pom.xml |  55 +++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../src/main/resources/META-INF/spring.provides |  18 ++
 components-starter/pom.xml                      |   1 +
 components/camel-bonita/.gitignore              |   1 +
 components/camel-bonita/pom.xml                 | 112 ++++++++++
 .../src/main/docs/bonita-component.adoc         |  86 ++++++++
 .../camel/component/bonita/BonitaComponent.java |  47 +++++
 .../component/bonita/BonitaConfiguration.java   | 127 ++++++++++++
 .../camel/component/bonita/BonitaEndpoint.java  |  78 +++++++
 .../camel/component/bonita/api/BonitaAPI.java   |  95 +++++++++
 .../component/bonita/api/BonitaAPIBuilder.java  |  44 ++++
 .../bonita/api/filter/BonitaAuthFilter.java     |  81 ++++++++
 .../bonita/api/filter/JsonClientFilter.java     |  21 ++
 .../bonita/api/model/CaseCreationResponse.java  |  36 ++++
 .../component/bonita/api/model/FileInput.java   |  29 +++
 .../api/model/ProcessDefinitionResponse.java    | 160 +++++++++++++++
 .../bonita/api/model/UploadFileResponse.java    |  32 +++
 .../bonita/api/util/BonitaAPIConfig.java        |  71 +++++++
 .../bonita/api/util/BonitaAPIUtil.java          | 121 +++++++++++
 .../bonita/consumer/BonitaConsumer.java         |  43 ++++
 .../bonita/exception/BonitaException.java       |  31 +++
 .../bonita/producer/BonitaProducer.java         |  39 ++++
 .../bonita/producer/BonitaStartProducer.java    |  50 +++++
 .../component/bonita/util/BonitaOperation.java  |  32 +++
 .../services/org/apache/camel/component/bonita  |  17 ++
 .../bonita/BonitaConfigurationTest.java         |  56 +++++
 .../bonita/api/BonitaAPIBuilderTest.java        |  12 ++
 .../component/bonita/api/BonitaAPITest.java     |  51 +++++
 .../BonitaAuthFilterAlreadyConnectedTest.java   |  58 ++++++
 .../api/BonitaAuthFilterConnectionTest.java     |  72 +++++++
 .../bonita/api/BonitaAuthFilterTest.java        |  49 +++++
 .../bonita/api/util/BonitaAPIConfigTest.java    |  32 +++
 .../util/BonitaAPIUtilPrepareInputsTest.java    | 115 +++++++++++
 .../src/test/resources/log4j.properties         |  29 +++
 components/pom.xml                              |   1 +
 37 files changed, 2116 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components-starter/camel-bonita-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/camel-bonita-starter/pom.xml 
b/components-starter/camel-bonita-starter/pom.xml
new file mode 100644
index 0000000..cf2dae1
--- /dev/null
+++ b/components-starter/camel-bonita-starter/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-bonita-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: Bonita</name>
+  <description>Spring-Boot Starter for Camel Bonita support</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-bonita</artifactId>
+      <version>${project.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components-starter/camel-bonita-starter/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git 
a/components-starter/camel-bonita-starter/src/main/resources/META-INF/LICENSE.txt
 
b/components-starter/camel-bonita-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ 
b/components-starter/camel-bonita-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components-starter/camel-bonita-starter/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git 
a/components-starter/camel-bonita-starter/src/main/resources/META-INF/NOTICE.txt
 
b/components-starter/camel-bonita-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ 
b/components-starter/camel-bonita-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components-starter/camel-bonita-starter/src/main/resources/META-INF/spring.provides
----------------------------------------------------------------------
diff --git 
a/components-starter/camel-bonita-starter/src/main/resources/META-INF/spring.provides
 
b/components-starter/camel-bonita-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..2ec712f
--- /dev/null
+++ 
b/components-starter/camel-bonita-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+provides: camel-bonita
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/pom.xml b/components-starter/pom.xml
index 7d3219c..daafb5c 100644
--- a/components-starter/pom.xml
+++ b/components-starter/pom.xml
@@ -96,6 +96,7 @@
     <module>camel-beanio-starter</module>
     <module>camel-beanstalk-starter</module>
     <module>camel-bindy-starter</module>
+    <module>camel-bonita-starter</module>
     <module>camel-boon-starter</module>
     <module>camel-box-starter</module>
     <module>camel-braintree-starter</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/.gitignore
----------------------------------------------------------------------
diff --git a/components/camel-bonita/.gitignore 
b/components/camel-bonita/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/components/camel-bonita/.gitignore
@@ -0,0 +1 @@
+/target/

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-bonita/pom.xml b/components/camel-bonita/pom.xml
new file mode 100644
index 0000000..86c5874
--- /dev/null
+++ b/components/camel-bonita/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+       license agreements. See the NOTICE file distributed with this work for 
additional
+       information regarding copyright ownership. The ASF licenses this file to
+       You under the Apache License, Version 2.0 (the "License"); you may not 
use
+       this file except in compliance with the License. You may obtain a copy 
of
+       the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
required
+       by applicable law or agreed to in writing, software distributed under 
the
+       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS
+       OF ANY KIND, either express or implied. See the License for the specific
+       language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.apache.camel</groupId>
+               <artifactId>components</artifactId>
+               <version>2.19.0-SNAPSHOT</version>
+       </parent>
+
+       <artifactId>camel-bonita</artifactId>
+       <packaging>jar</packaging>
+       <name>Camel :: Bonita</name>
+       <description>Camel Bonita support</description>
+
+       <properties>
+               
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+               
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+               <jersey.version>2.23.2</jersey.version>
+               <wiremock.version>2.1.12</wiremock.version>
+       </properties>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.apache.camel</groupId>
+                       <artifactId>camel-core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.jaxrs</groupId>
+                       <artifactId>jackson-jaxrs-json-provider</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.glassfish.jersey.core</groupId>
+                       <artifactId>jersey-client</artifactId>
+                       <version>${jersey.version}</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.glassfish.jersey.connectors</groupId>
+                       <artifactId>jersey-apache-connector</artifactId>
+                       <version>${jersey.version}</version>
+               </dependency>
+
+<!--           <dependency> -->
+<!--                   <groupId>org.glassfish.jersey.core</groupId> -->
+<!--                   <artifactId>jersey-client</artifactId> -->
+<!--                   <version>${jersey.version}</version> -->
+<!--           </dependency> -->
+
+               <dependency>
+                       <groupId>org.glassfish.jersey.media</groupId>
+                       <artifactId>jersey-media-json-jackson</artifactId>
+                       <version>${jersey.version}</version>
+                       <exclusions>
+                               <exclusion>
+                                       
<groupId>com.fasterxml.jackson.core</groupId>
+                                       
<artifactId>jackson-annotations</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.glassfish.jersey.media</groupId>
+                       <artifactId>jersey-media-multipart</artifactId>
+                       <version>${jersey.version}</version>
+                       <exclusions>
+                               <exclusion>
+                                       
<groupId>com.fasterxml.jackson.core</groupId>
+                                       
<artifactId>jackson-annotations</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <!-- testing -->
+               <dependency>
+                       <groupId>org.apache.camel</groupId>
+                       <artifactId>camel-test</artifactId>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.powermock</groupId>
+                       <artifactId>powermock-module-junit4</artifactId>
+                       <version>${powermock-version}</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.powermock</groupId>
+                       <artifactId>powermock-api-mockito</artifactId>
+                       <version>${powermock-version}</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>com.github.tomakehurst</groupId>
+                       <artifactId>wiremock-standalone</artifactId>
+                       <version>${wiremock.version}</version>
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/docs/bonita-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-bonita/src/main/docs/bonita-component.adoc 
b/components/camel-bonita/src/main/docs/bonita-component.adoc
new file mode 100644
index 0000000..4518c1d
--- /dev/null
+++ b/components/camel-bonita/src/main/docs/bonita-component.adoc
@@ -0,0 +1,86 @@
+[[Bonita-CamelComponent]]
+Camel Bonita component
+~~~~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.19*
+
+This Camel component allow you to communicate with a remote Bonita engine.
+
+[[Bonita-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+------------------------------
+bonita://[operation]?[options]
+------------------------------
+
+Where *operation* is the specific action to perform on Bonita.
+
+[[Bonita-Options]]
+General Options
+^^^^^^^^^^^^^^^
+
+// component options: START
+The bonita component has no options.
+// component options: END
+
+
+// endpoint options: START
+The bonita component supports 10 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| operation | common |  | BonitaOperation | *Required* Operation to use
+| hostname | common | localhost | String | Hostname where Bonita engine runs
+| port | common | 8080 | String | Port of the server hosting Bonita engine
+| processName | common |  | String | Name of the process involved in the 
operation
+| 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).
+| password | security |  | String | Password to authenticate to Bonita engine.
+| username | security |  | String | Username to authenticate to Bonita engine.
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+[[Bonita-BodyMessage]]
+Body content
+^^^^^^^^^^^^
+
+For the startCase operation, the input variables are retrieved from the body 
message. This one has to contains a Map<String,Serializable>.
+
+
+[[Bonita-Examples]]
+Examples
+^^^^^^^^
+
+The following example start a new case in Bonita:
+
+[source,java]
+----------------------------------------------------------------------
+from("direct:start).to("bonita:startCase?hostname=localhost&amp;port=8080&amp;processName=TestProcess&amp;username=install&amp;password=install")
+----------------------------------------------------------------------
+
+[[Bonita-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use Bonita in your Camel routes you need to add a dependency on
+*camel-bonita*, which implements the component.
+
+If you use Maven you can just add the following to your pom.xml,
+substituting the version number for the latest and greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,java]
+-------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-bonita</artifactId>
+  <version>x.x.x</version>
+</dependency>
+-------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaComponent.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaComponent.java
new file mode 100644
index 0000000..ccff314
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaComponent.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.bonita.util.BonitaOperation;
+import org.apache.camel.impl.UriEndpointComponent;
+
+/**
+ * Represents the component that manages {@link BonitaEndpoint}.
+ */
+public class BonitaComponent extends UriEndpointComponent {
+    
+    public BonitaComponent() {
+        super(BonitaEndpoint.class);
+    }
+
+    public BonitaComponent(CamelContext context) {
+        super(context, BonitaEndpoint.class);
+    }
+
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        BonitaConfiguration configuration = new BonitaConfiguration();
+//        configuration.setParameters(parameters);
+        setProperties(configuration, parameters);
+        configuration.setOperation(BonitaOperation.valueOf(remaining));
+        Endpoint endpoint = new BonitaEndpoint(uri, this, configuration);
+        return endpoint;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaConfiguration.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaConfiguration.java
new file mode 100644
index 0000000..fe77d2d
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaConfiguration.java
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita;
+
+import java.util.Map;
+
+import org.apache.camel.component.bonita.util.BonitaOperation;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+
+@UriParams
+public class BonitaConfiguration implements Cloneable {
+       
+       
+    @UriPath(enums = "startCase") @Metadata(required = "true")
+    private BonitaOperation operation;
+    
+    @UriParam(defaultValue = "localhost")
+    private String hostname = "localhost";
+    
+    @UriParam(defaultValue = "8080")
+       private String port = "8080";
+    
+    @UriParam
+    private String processName;
+    
+    @UriParam(label = "security")
+    private String username;
+    
+    @UriParam(label = "security")
+    private String password;
+    
+    
+    public String getHostname() {
+               return hostname;
+       }
+
+    /** 
+     * Hostname where Bonita engine runs
+     */
+       public void setHostname(String hostname) {
+               this.hostname = hostname;
+       }
+
+       public String getPort() {
+               return port;
+       }
+
+       /**
+        * Port of the server hosting Bonita engine
+        */
+       public void setPort(String port) {
+               this.port = port;
+       }
+
+       public String getProcessName() {
+               return processName;
+       }
+
+       /**
+        * Name of the process involved in the operation
+        */
+       public void setProcessName(String processName) {
+               this.processName = processName;
+       }
+
+
+    public BonitaOperation getOperation() {
+        return operation;
+    }
+
+    
+    /**
+     * Operation to use
+     */
+    public void setOperation(BonitaOperation operation) {
+        this.operation = operation;
+    }
+
+
+
+       public void setParameters(Map<String, Object> parameters) {
+               if (parameters.get("hostname") != null) this.hostname = 
(String) parameters.get("hostname");
+               if (parameters.get("port") != null) this.port = (String) 
parameters.get("port");
+               if (parameters.get("processName") != null) this.processName = 
(String) parameters.get("processName");
+
+       }
+
+       public String getUsername() {
+               return username;
+       }
+
+        /**
+     * Username to authenticate to Bonita engine.
+     */
+       public void setUsername(String username) {
+               this.username = username;
+       }
+
+       public String getPassword() {
+               return password;
+       }
+
+        /**
+     * Password to authenticate to Bonita engine.
+     */
+       public void setPassword(String password) {
+               this.password = password;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java
new file mode 100644
index 0000000..62c3603
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/BonitaEndpoint.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.bonita.consumer.BonitaConsumer;
+import org.apache.camel.component.bonita.exception.BonitaException;
+import org.apache.camel.component.bonita.producer.BonitaStartProducer;
+import org.apache.camel.component.bonita.util.BonitaOperation;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents a bonita endpoint.
+ */
+@UriEndpoint(scheme = "bonita", title = "bonita", syntax="bonita:operation", 
consumerClass = BonitaConsumer.class, label = "bonita")
+public class BonitaEndpoint extends DefaultEndpoint {
+
+    private static final transient Logger LOG = 
LoggerFactory.getLogger(BonitaEndpoint.class);
+       
+ 
+    @UriParam
+    private BonitaConfiguration configuration;
+
+    public BonitaEndpoint() {
+    }
+    
+    public BonitaEndpoint(String uri, BonitaComponent component, 
BonitaConfiguration configuration) {
+        super(uri, component);
+        this.configuration = configuration;
+    }
+
+    public BonitaEndpoint(String endpointUri) {
+        super(endpointUri);
+    }
+
+    public Producer createProducer() throws Exception {
+        if (configuration.getOperation() == BonitaOperation.startCase) {
+               return new BonitaStartProducer(this, configuration);
+        } else {
+               throw new BonitaException("Operation specified is not 
supported.");
+        }
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        return new BonitaConsumer(this, processor);
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+    
+    public BonitaConfiguration getConfiguration() {
+       return configuration;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPI.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPI.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPI.java
new file mode 100644
index 0000000..fce5ac8
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPI.java
@@ -0,0 +1,95 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api;
+
+import static javax.ws.rs.client.Entity.entity;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.component.bonita.api.model.CaseCreationResponse;
+import org.apache.camel.component.bonita.api.model.FileInput;
+import org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse;
+import org.apache.camel.component.bonita.api.util.BonitaAPIConfig;
+import org.apache.camel.component.bonita.api.util.BonitaAPIUtil;
+import org.apache.camel.util.ObjectHelper;
+
+public class BonitaAPI {
+
+       private BonitaAPIConfig bonitaApiConfig;
+       private WebTarget webTarget;
+
+       protected BonitaAPI(BonitaAPIConfig bonitaApiConfig, WebTarget 
webTarget) {
+               super();
+               this.bonitaApiConfig = bonitaApiConfig;
+               this.webTarget = webTarget;
+               
+       }
+
+       private WebTarget getBaseResource() {
+               return webTarget;
+       }
+
+       public ProcessDefinitionResponse getProcessDefinition(String 
processName) {
+               if (ObjectHelper.isEmpty(processName)) {
+                       throw new IllegalArgumentException("processName is 
empty.");
+               }
+               WebTarget resource = 
getBaseResource().path("process").queryParam("s", processName);
+               List<ProcessDefinitionResponse> listProcess = 
resource.request().accept(MediaType.APPLICATION_JSON)
+                               .get(new 
GenericType<List<ProcessDefinitionResponse>>() {
+                               });
+               if (listProcess.size() > 0) {
+                       return listProcess.get(0);
+               } else {
+                       throw new RuntimeException("The process with name " + 
processName + " has not been retrieved");
+               }
+       }
+
+       public CaseCreationResponse startCase(ProcessDefinitionResponse 
processDefinition, Map<String, Serializable> rawInputs) {
+               if (processDefinition == null) {
+                       throw new IllegalArgumentException("ProcessDefinition 
is null");
+               }
+               if (rawInputs == null) {
+                       throw new IllegalArgumentException("The contract input 
is null");
+               }
+               Map<String, Serializable> inputs = 
BonitaAPIUtil.getInstance(bonitaApiConfig).prepareInputs(processDefinition, 
rawInputs);
+               WebTarget resource = 
getBaseResource().path("process/{processId}/instantiation").resolveTemplate("processId",
+                               processDefinition.getId());
+               return 
resource.request().accept(MediaType.APPLICATION_JSON).post(entity(inputs, 
MediaType.APPLICATION_JSON),
+                               CaseCreationResponse.class);
+       }
+
+       public BonitaAPIConfig getBonitaApiConfig() {
+               return bonitaApiConfig;
+       }
+
+       public void setBonitaApiConfig(BonitaAPIConfig bonitaApiConfig) {
+               this.bonitaApiConfig = bonitaApiConfig;
+       }
+       
+       
+       
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPIBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPIBuilder.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPIBuilder.java
new file mode 100644
index 0000000..6b70297
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/BonitaAPIBuilder.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+
+import org.apache.camel.component.bonita.api.filter.BonitaAuthFilter;
+import org.apache.camel.component.bonita.api.util.BonitaAPIConfig;
+import org.glassfish.jersey.client.ClientConfig;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+public class BonitaAPIBuilder {
+       
+       public static BonitaAPI build(BonitaAPIConfig bonitaAPIConfig) {
+               if (bonitaAPIConfig == null) { throw new 
IllegalArgumentException("bonitaApiConfig is null"); }
+               ClientConfig clientConfig = new ClientConfig();
+        clientConfig.register(JacksonJsonProvider.class);
+        ClientBuilder clientBuilder = 
ClientBuilder.newBuilder().withConfig(clientConfig);
+        Client client = clientBuilder.build();
+        client.register(new BonitaAuthFilter(bonitaAPIConfig));
+        WebTarget webTarget = 
client.target(bonitaAPIConfig.getBaseBonitaURI()).path("/API/bpm");
+               return new BonitaAPI(bonitaAPIConfig, webTarget); 
+       }
+       
+       
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/BonitaAuthFilter.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/BonitaAuthFilter.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/BonitaAuthFilter.java
new file mode 100644
index 0000000..3edf1ee
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/BonitaAuthFilter.java
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api.filter;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.NewCookie;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.component.bonita.api.util.BonitaAPIConfig;
+import org.apache.camel.util.ObjectHelper;
+
+public class BonitaAuthFilter implements ClientRequestFilter { 
+       
+       private BonitaAPIConfig bonitaApiConfig;        
+       
+       public BonitaAuthFilter(BonitaAPIConfig bonitaApiConfig) {
+               this.bonitaApiConfig = bonitaApiConfig;
+       }
+       
+       @Override
+    public void filter(ClientRequestContext requestContext) throws IOException 
{
+        if (requestContext.getCookies().get("JSESSIONID") == null) {
+               String username = bonitaApiConfig.getUsername();
+               String password = bonitaApiConfig.getPassword();
+               if (ObjectHelper.isEmpty(username)) {
+                       throw new IllegalArgumentException("Username provided 
is null or empty.");
+               }
+               if (ObjectHelper.isEmpty(password)) {
+                       throw new IllegalArgumentException("Password provided 
is null or empty.");
+               }
+            ClientBuilder clientBuilder = ClientBuilder.newBuilder();
+            Client client = clientBuilder.build();
+            WebTarget webTarget = 
client.target(bonitaApiConfig.getBaseBonitaURI()).path("loginservice");
+            MultivaluedMap<String, String> form = new 
MultivaluedHashMap<String, String>();
+            form.add("username", username);
+            form.add("password", password);
+            form.add("redirect", "false");
+            Response response = 
webTarget.request().accept(MediaType.APPLICATION_FORM_URLENCODED).post(Entity.form(form));
+            Map<String, NewCookie> cr = response.getCookies();
+            ArrayList<Object> cookies = new ArrayList<>();
+            for (NewCookie cookie : cr.values()) {
+               cookies.add(cookie.toCookie());
+            }
+            requestContext.getHeaders().put("Cookie", cookies);
+        }
+    }
+
+       public BonitaAPIConfig getBonitaApiConfig() {
+               return bonitaApiConfig;
+       }
+
+       public void setBonitaApiConfig(BonitaAPIConfig bonitaApiConfig) {
+               this.bonitaApiConfig = bonitaApiConfig;
+       }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/JsonClientFilter.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/JsonClientFilter.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/JsonClientFilter.java
new file mode 100644
index 0000000..1a1baed
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/filter/JsonClientFilter.java
@@ -0,0 +1,21 @@
+package org.apache.camel.component.bonita.api.filter;
+
+import java.io.IOException;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+
+public class JsonClientFilter implements ClientResponseFilter {
+ 
+       
+       @Override
+       public void filter(ClientRequestContext request, ClientResponseContext 
response) throws IOException {
+                String contentType = 
response.getHeaders().getFirst("Content-Type");
+               if (contentType.startsWith("text/plain")) {
+                    String newContentType = "application/json" + 
contentType.substring(10);
+                    response.getHeaders().putSingle("Content-Type", 
newContentType);
+               }
+       }
+ 
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/CaseCreationResponse.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/CaseCreationResponse.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/CaseCreationResponse.java
new file mode 100644
index 0000000..c7c7326
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/CaseCreationResponse.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class CaseCreationResponse {
+       
+       @JsonProperty("caseId")
+       private String caseId;
+
+       public String getCaseId() {
+               return caseId;
+       }
+
+       public void setCaseId(String caseId) {
+               this.caseId = caseId;
+       }
+       
+       
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/FileInput.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/FileInput.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/FileInput.java
new file mode 100644
index 0000000..84cd648
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/FileInput.java
@@ -0,0 +1,29 @@
+package org.apache.camel.component.bonita.api.model;
+
+import java.io.Serializable;
+
+public class FileInput implements Serializable {
+       
+       private String filename;
+       private byte[] content;
+       public String getFilename() {
+               return filename;
+       }
+       public void setFilename(String filename) {
+               this.filename = filename;
+       }
+       public byte[] getContent() {
+               return content;
+       }
+       public void setContent(byte[] content) {
+               this.content = content;
+       }
+       public FileInput(String filename, byte[] content) {
+               super();
+               this.filename = filename;
+               this.content = content;
+       } 
+       
+       
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/ProcessDefinitionResponse.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/ProcessDefinitionResponse.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/ProcessDefinitionResponse.java
new file mode 100644
index 0000000..9169c4a
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/ProcessDefinitionResponse.java
@@ -0,0 +1,160 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ProcessDefinitionResponse {
+
+       @JsonProperty("id")
+       private String id;
+       
+       @JsonProperty("displayDescription")
+       private String displayDescription;
+       
+       @JsonProperty("deploymentDate")
+       private String deploymentDate;
+       
+       @JsonProperty("description")
+       private String description;
+       
+       @JsonProperty("activationState")
+       private String activationState;
+       
+       @JsonProperty("name")
+       private String name;
+       
+       @JsonProperty("deployedBy")
+       private String deployedBy;
+       
+       @JsonProperty("displayName")
+       private String displayName;
+       
+       @JsonProperty("actorinitiatorid")
+       private String actorInitiatorId;
+       
+       @JsonProperty("last_update_date")
+       private String lastUpdateDate;
+       
+       @JsonProperty("configurationState")
+       private String configurationState;
+       
+       @JsonProperty("version")
+       private String version;
+       
+       public ProcessDefinitionResponse() {
+               super();
+       }
+
+       public String getId() {
+               return id;
+       }
+
+       public void setId(String id) {
+               this.id = id;
+       }
+
+       public String getDisplayDescription() {
+               return displayDescription;
+       }
+
+       public void setDisplayDescription(String displayDescription) {
+               this.displayDescription = displayDescription;
+       }
+
+       public String getDeploymentDate() {
+               return deploymentDate;
+       }
+
+       public void setDeploymentDate(String deploymentDate) {
+               this.deploymentDate = deploymentDate;
+       }
+
+       public String getDescription() {
+               return description;
+       }
+
+       public void setDescription(String description) {
+               this.description = description;
+       }
+
+       public String getActivationState() {
+               return activationState;
+       }
+
+       public void setActivationState(String activationState) {
+               this.activationState = activationState;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       public String getDeployedBy() {
+               return deployedBy;
+       }
+
+       public void setDeployedBy(String deployedBy) {
+               this.deployedBy = deployedBy;
+       }
+
+       public String getDisplayName() {
+               return displayName;
+       }
+
+       public void setDisplayName(String displayName) {
+               this.displayName = displayName;
+       }
+
+       public String getActorInitiatorId() {
+               return actorInitiatorId;
+       }
+
+       public void setActorInitiatorId(String actorInitiatorId) {
+               this.actorInitiatorId = actorInitiatorId;
+       }
+
+       public String getLastUpdateDate() {
+               return lastUpdateDate;
+       }
+
+       public void setLastUpdateDate(String lastUpdateDate) {
+               this.lastUpdateDate = lastUpdateDate;
+       }
+
+       public String getConfigurationState() {
+               return configurationState;
+       }
+
+       public void setConfigurationState(String configurationState) {
+               this.configurationState = configurationState;
+       }
+
+       public String getVersion() {
+               return version;
+       }
+
+       public void setVersion(String version) {
+               this.version = version;
+       }
+       
+       
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/UploadFileResponse.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/UploadFileResponse.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/UploadFileResponse.java
new file mode 100644
index 0000000..9acae81
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/model/UploadFileResponse.java
@@ -0,0 +1,32 @@
+package org.apache.camel.component.bonita.api.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class UploadFileResponse {
+       
+       @JsonProperty("filename")
+       private String filename;
+       @JsonProperty("tempPath")
+       private String tempPath;
+       @JsonProperty("contentType")
+       private String contentType;
+       public String getFilename() {
+               return filename;
+       }
+       public void setFilename(String filename) {
+               this.filename = filename;
+       }
+       public String getTempPath() {
+               return tempPath;
+       }
+       public void setTempPath(String tempPath) {
+               this.tempPath = tempPath;
+       }
+       public String getContentType() {
+               return contentType;
+       }
+       public void setContentType(String contentType) {
+               this.contentType = contentType;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIConfig.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIConfig.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIConfig.java
new file mode 100644
index 0000000..0ce81b7
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIConfig.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api.util;
+
+public class BonitaAPIConfig {
+       
+       private String hostname;
+       private String port;
+       private String username;
+       private String password;
+       
+       
+       public BonitaAPIConfig(String hostname, String port, String username, 
String password) {
+               super();
+               this.hostname = hostname;
+               this.port = port;
+               this.username = username;
+               this.password = password;
+       }
+       
+       public String getBaseBonitaURI() {
+               return "http://"; + hostname + ":" + port + "/bonita";
+       }
+       
+       
+       public String getProcessFileUploadBaseURI(String processName, String 
processVersion) {
+               return getBaseBonitaURI() + "portal/resource/process/"+ 
processName + "/" +processVersion + "/API/formFileUpload";
+       }
+       
+       public String getHostname() {
+               return hostname;
+       }
+       public void setHostname(String hostname) {
+               this.hostname = hostname;
+       }
+       public String getPort() {
+               return port;
+       }
+       public void setPort(String port) {
+               this.port = port;
+       }
+       public String getUsername() {
+               return username;
+       }
+       public void setUsername(String username) {
+               this.username = username;
+       }
+       public String getPassword() {
+               return password;
+       }
+       public void setPassword(String password) {
+               this.password = password;
+       }
+       
+       
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
new file mode 100644
index 0000000..ab8f15c
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api.util;
+
+import static javax.ws.rs.client.Entity.entity;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Feature;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.component.bonita.api.filter.BonitaAuthFilter;
+import org.apache.camel.component.bonita.api.filter.JsonClientFilter;
+import org.apache.camel.component.bonita.api.model.FileInput;
+import org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse;
+import org.apache.camel.component.bonita.api.model.UploadFileResponse;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.logging.LoggingFeature;
+import org.glassfish.jersey.media.multipart.FormDataMultiPart;
+import org.glassfish.jersey.media.multipart.MultiPart;
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
+import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+public class BonitaAPIUtil {
+
+       private static BonitaAPIUtil instance;
+       private WebTarget webTarget;
+       
+       public static BonitaAPIUtil getInstance(BonitaAPIConfig 
bonitaAPIConfig) {
+               if (instance == null) {
+                       instance = new BonitaAPIUtil();
+                       ClientConfig clientConfig = new ClientConfig();
+               clientConfig.register(MultiPartFeature.class);
+               clientConfig.register(JacksonJsonProvider.class);
+               Logger logger = 
Logger.getLogger("org.bonitasoft.camel.bonita.api.util.BonitaAPIUtil");
+
+               Feature feature = new LoggingFeature(logger, Level.INFO, null, 
null);
+               clientConfig.register(feature);
+               ClientBuilder clientBuilder = 
ClientBuilder.newBuilder().withConfig(clientConfig);
+               Client client = clientBuilder.build();
+               client.register(new JsonClientFilter());
+               client.register(new BonitaAuthFilter(bonitaAPIConfig));
+               
instance.setWebTarget(client.target(bonitaAPIConfig.getBaseBonitaURI()));
+               }
+               return instance;
+       }
+       
+       
+       public UploadFileResponse uploadFile(ProcessDefinitionResponse 
processDefinition, FileInput file) {
+               WebTarget resource = 
webTarget.path("portal/resource/process/{processName}/{processVersion}/API/formFileUpload").resolveTemplate("processName",
+                               
processDefinition.getName()).resolveTemplate("processVersion", 
processDefinition.getVersion());
+               try {
+                       File tempFile = File.createTempFile("tempFile",".tmp");
+                       FileOutputStream fos = new FileOutputStream(tempFile);
+                       fos.write(file.getContent());
+                       fos.close();
+                       final FileDataBodyPart filePart = new 
FileDataBodyPart("file", tempFile, MediaType.APPLICATION_OCTET_STREAM_TYPE);
+                       final MultiPart multipart = new 
FormDataMultiPart().bodyPart(filePart);
+//                     resource.request().header("ContentType", 
"application/json");
+                       return 
resource.request().accept(MediaType.APPLICATION_JSON).post(entity(multipart, 
MediaType.MULTIPART_FORM_DATA),
+                                       UploadFileResponse.class);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+               return null;
+               
+               
+       }
+
+
+       public Map<String, Serializable> 
prepareInputs(ProcessDefinitionResponse processDefinition, 
Map<String,Serializable> inputs) {
+               for (Entry<String, Serializable> entry : inputs.entrySet()) {
+                       if (entry.getValue() instanceof FileInput) {
+                               FileInput file = (FileInput) entry.getValue();
+                               String tmpFile = uploadFile(processDefinition, 
file).getTempPath();
+                               HashMap<String,Serializable> fileInput = new 
HashMap<String,Serializable>();
+                               fileInput.put("filename", file.getFilename());
+                               fileInput.put("tempPath", tmpFile);
+                               entry.setValue(fileInput);
+                       }
+               }
+               return inputs;
+       }
+
+
+       public WebTarget getWebTarget() {
+               return webTarget;
+       }
+
+
+       public void setWebTarget(WebTarget webTarget) {
+               this.webTarget = webTarget;
+       }
+       
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/consumer/BonitaConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/consumer/BonitaConsumer.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/consumer/BonitaConsumer.java
new file mode 100644
index 0000000..e9c216c
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/consumer/BonitaConsumer.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.consumer;
+
+import org.apache.camel.Processor;
+import org.apache.camel.component.bonita.BonitaEndpoint;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The bonita consumer.
+ */
+public class BonitaConsumer extends ScheduledPollConsumer {
+
+       protected static final transient Logger LOG = 
LoggerFactory.getLogger(BonitaConsumer.class);
+
+       protected BonitaEndpoint endpoint;
+
+       public BonitaConsumer(BonitaEndpoint endpoint, Processor processor) {
+               super(endpoint, processor);
+               this.endpoint = endpoint;
+       }
+
+       @Override
+       protected int poll() throws Exception {
+               return 0;
+       }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/exception/BonitaException.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/exception/BonitaException.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/exception/BonitaException.java
new file mode 100644
index 0000000..d21e70e
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/exception/BonitaException.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.exception;
+
+public class BonitaException extends Exception {
+       
+        private static final long serialVersionUID = 1L;
+
+           public BonitaException(String message) {
+               super(message);
+           }
+
+           public BonitaException(Throwable throwable) {
+               super(throwable);
+           }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaProducer.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaProducer.java
new file mode 100644
index 0000000..c80f786
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaProducer.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.producer;
+
+import org.apache.camel.component.bonita.BonitaConfiguration;
+import org.apache.camel.component.bonita.BonitaEndpoint;
+import org.apache.camel.impl.DefaultProducer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The bonita producer.
+ */
+public abstract class BonitaProducer extends DefaultProducer {
+    private static final Logger LOG = 
LoggerFactory.getLogger(BonitaProducer.class);
+
+    protected BonitaEndpoint endpoint;
+    protected BonitaConfiguration configuration;
+
+    public BonitaProducer(BonitaEndpoint endpoint, BonitaConfiguration 
configuration) {
+        super(endpoint);
+        this.endpoint = endpoint;
+        this.configuration = configuration;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaStartProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaStartProducer.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaStartProducer.java
new file mode 100644
index 0000000..8bf39b7
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/producer/BonitaStartProducer.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.producer;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.bonita.BonitaConfiguration;
+import org.apache.camel.component.bonita.BonitaEndpoint;
+import org.apache.camel.component.bonita.api.BonitaAPI;
+import org.apache.camel.component.bonita.api.BonitaAPIBuilder;
+import org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse;
+import org.apache.camel.component.bonita.api.util.BonitaAPIConfig;
+import org.apache.camel.model.ProcessDefinition;
+
+public class BonitaStartProducer extends BonitaProducer {
+
+       public BonitaStartProducer(BonitaEndpoint endpoint, BonitaConfiguration 
configuration) {
+               super(endpoint, configuration);
+       }
+
+       public void process(Exchange exchange) throws Exception {
+               // Setup access type (HTTP on local host)
+               String hostname = this.configuration.getHostname();
+               String port = this.configuration.getPort();
+               String processName = this.configuration.getProcessName();
+               String username = this.configuration.getUsername();
+               String password = this.configuration.getPassword();
+               BonitaAPIConfig bonitaAPIConfig = new BonitaAPIConfig(hostname, 
port, username, password);
+               BonitaAPI bonitaApi = BonitaAPIBuilder.build(bonitaAPIConfig);
+               ProcessDefinitionResponse processDefinition = 
bonitaApi.getProcessDefinition(processName);
+               bonitaApi.startCase(processDefinition, 
exchange.getIn().getBody(Map.class));
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/util/BonitaOperation.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/util/BonitaOperation.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/util/BonitaOperation.java
new file mode 100644
index 0000000..e28f8d0
--- /dev/null
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/util/BonitaOperation.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.util;
+
+public enum BonitaOperation {
+        startCase("startCase");
+
+    private final String text;
+
+    BonitaOperation(final String text) {
+        this.text = text;
+    }
+
+    @Override
+    public String toString() {
+        return text;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/main/resources/META-INF/services/org/apache/camel/component/bonita
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/main/resources/META-INF/services/org/apache/camel/component/bonita
 
b/components/camel-bonita/src/main/resources/META-INF/services/org/apache/camel/component/bonita
new file mode 100644
index 0000000..0017801
--- /dev/null
+++ 
b/components/camel-bonita/src/main/resources/META-INF/services/org/apache/camel/component/bonita
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class=org.apache.camel.component.bonita.BonitaComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/BonitaConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/BonitaConfigurationTest.java
 
b/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/BonitaConfigurationTest.java
new file mode 100644
index 0000000..dea6575
--- /dev/null
+++ 
b/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/BonitaConfigurationTest.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita;
+
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.component.bonita.BonitaConfiguration;
+import org.apache.camel.component.bonita.BonitaEndpoint;
+import org.apache.camel.component.bonita.util.BonitaOperation;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class BonitaConfigurationTest extends CamelTestSupport {
+       
+       @Test
+       public void testBonitaConfigurationDefaults() {
+               BonitaEndpoint bonitaEndpoint = 
context.getEndpoint("bonita:startCase", BonitaEndpoint.class);
+               BonitaConfiguration configuration = 
bonitaEndpoint.getConfiguration();
+               
+               assertEquals("localhost", configuration.getHostname());
+               assertEquals("8080", configuration.getPort());
+       }
+       
+       @Test
+       public void testBonitaConfigurationCustom() {
+               BonitaEndpoint bonitaEndpoint = 
context.getEndpoint("bonita:startCase?hostname=host&port=port&processName=processName&username=username&password=password",
 BonitaEndpoint.class);
+               BonitaConfiguration configuration = 
bonitaEndpoint.getConfiguration();
+               
+               
+               assertEquals("host", configuration.getHostname());
+               assertEquals("port", configuration.getPort());
+               assertEquals("processName", configuration.getProcessName());
+               assertEquals("username", configuration.getUsername());
+               assertEquals("password", configuration.getPassword());
+               
assertEquals(0,configuration.getOperation().compareTo(BonitaOperation.startCase));
+       }
+       
+       @Test(expected=ResolveEndpointFailedException.class)
+       public void testBonitaConfigurationWrongOperation() {
+               BonitaEndpoint bonitaEndpoint = 
context.getEndpoint("bonita:wrongOperation", BonitaEndpoint.class);
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPIBuilderTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPIBuilderTest.java
 
b/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPIBuilderTest.java
new file mode 100644
index 0000000..690e6c5
--- /dev/null
+++ 
b/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPIBuilderTest.java
@@ -0,0 +1,12 @@
+package org.apache.camel.component.bonita.api;
+
+import org.apache.camel.component.bonita.api.BonitaAPIBuilder;
+import org.junit.Test;
+
+public class BonitaAPIBuilderTest {
+
+       @Test(expected=IllegalArgumentException.class)
+       public void testNullBuilderInput() {
+               BonitaAPIBuilder.build(null);
+       }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0b057b16/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPITest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPITest.java
 
b/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPITest.java
new file mode 100644
index 0000000..cfbe2a5
--- /dev/null
+++ 
b/components/camel-bonita/src/test/java/org/apache/camel/component/bonita/api/BonitaAPITest.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bonita.api;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.component.bonita.api.BonitaAPI;
+import org.apache.camel.component.bonita.api.BonitaAPIBuilder;
+import org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse;
+import org.apache.camel.component.bonita.api.util.BonitaAPIConfig;
+import org.junit.Test;
+
+public class BonitaAPITest {
+       @Test(expected=IllegalArgumentException.class)
+       public void testGetProcessDefinitionEmptyInput() {
+               BonitaAPI bonitaApi = BonitaAPIBuilder.build(new 
BonitaAPIConfig("hostname","port","username","password"));
+               bonitaApi.getProcessDefinition("");
+       }
+       
+       @Test(expected=IllegalArgumentException.class)
+       public void testStartCaseEmptyProcessDefinitionId() {
+               BonitaAPI bonitaApi = BonitaAPIBuilder.build(new 
BonitaAPIConfig("hostname","port","username","password"));
+               bonitaApi.startCase(null, new HashMap<String,Serializable>());
+       }
+       
+       @Test(expected=IllegalArgumentException.class)
+       public void testStartCaseNUllContractInput() {
+               BonitaAPI bonitaApi = BonitaAPIBuilder.build(new 
BonitaAPIConfig("hostname","port","username","password"));
+               ProcessDefinitionResponse processDefinition = new 
ProcessDefinitionResponse();
+               bonitaApi.startCase(processDefinition, null);
+       }
+       
+       
+
+}

Reply via email to