[camel] 01/05: CAMEL-12964: Initial import of jBPM CamelWIH and Command.

2018-11-30 Thread dmvolod
This is an automated email from the ASF dual-hosted git repository.

dmvolod pushed a commit to branch camel-2.23.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a0fc18b3a67558073e7a7d3ff9db30b077c6695e
Author: Duncan Doyle 
AuthorDate: Wed Nov 28 13:50:22 2018 +0100

CAMEL-12964: Initial import of jBPM CamelWIH and Command.
---
 components/camel-jbpm/pom.xml  |  27 
 .../component/jbpm/workitem/CamelCommand.java  | 121 ++
 .../jbpm/workitem/CamelWorkItemHandler.java| 137 +
 .../component/jbpm/workitem/CamelCommandTest.java  | 134 
 .../jbpm/workitem/CamelWorkItemHandlerTest.java| 137 +
 5 files changed, 556 insertions(+)

diff --git a/components/camel-jbpm/pom.xml b/components/camel-jbpm/pom.xml
index ecbb6e9..c6c4dc9 100644
--- a/components/camel-jbpm/pom.xml
+++ b/components/camel-jbpm/pom.xml
@@ -92,6 +92,15 @@
 true
 
 
+
+
+   org.jbpm
+   jbpm-workitems-core
+   ${jbpm-version}
+   provided
+   true
+
+
 
 org.jboss.logging
 jboss-logging
@@ -128,6 +137,24 @@
 camel-test
 test
 
+
+   org.mockito
+   mockito-core
+   test
+
+
+org.jbpm
+jbpm-workitems-core
+${jbpm-version}
+test-jar
+test
+
+   
+   xml-apis
+   xml-apis
+   
+
+
 
 
 
diff --git 
a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
 
b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
new file mode 100644
index 000..80c767e
--- /dev/null
+++ 
b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.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.jbpm.workitem;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.executor.Command;
+import org.kie.api.executor.CommandContext;
+import org.kie.api.executor.ExecutionResults;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.internal.runtime.Cacheable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Camel jBPM {@link Command} which allows to call Camel routes with a 
direct endpoint.
+ * 
+ * The command passes the {@WorkItem} retrieved from the {@link 
CommandContext} to the route that has a consumer on the endpoint-id 
+ * that can be passed with the camel-endpoint-id {@link WorkItem} 
parameter. E.g. when a the value "myCamelEndpoint" is passed to the 
+ * {link WorkItem} via the camel-endpoint-id parameter, this 
{@link Command} will send the {@link WorkItem} to 
+ * the Camel URI direct://myCamelEndpoint.  
+ * 
+ * The body of the result {@link Message} of the invocation is returned via 
the response parameter. Access to the raw response 
+ * {@link Message} is provided via the message parameter. This 
gives the user access to more advanced fields like message headers 
+ * and attachments.  
+ * 
+ * This {@link Command} can be constructed in 2 ways. When using the default 
constructor, the {link Command} will try to find 
+ * the global KIE {@link CamelContext} from the jBPM {@link 
ServiceRegistry}. 
+ * When the {@link RuntimeManager} is passed to the constructor, the {@link 
Command} will retrieve and use the {@link CamelContext} bound 
+ * to the {@link RuntimeManage} from the {@link ServiceRegistry}
+ * 
+ */
+public class CamelCommand implements Command,
+  Cacheable {
+
+   private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = 
"GlobalCamelService

[camel] 01/05: CAMEL-12964: Initial import of jBPM CamelWIH and Command.

2018-11-30 Thread dmvolod
This is an automated email from the ASF dual-hosted git repository.

dmvolod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 128f84189a366db43a47461353c2ccaa8d8f658c
Author: Duncan Doyle 
AuthorDate: Wed Nov 28 13:50:22 2018 +0100

CAMEL-12964: Initial import of jBPM CamelWIH and Command.
---
 components/camel-jbpm/pom.xml  |  27 
 .../component/jbpm/workitem/CamelCommand.java  | 121 ++
 .../jbpm/workitem/CamelWorkItemHandler.java| 137 +
 .../component/jbpm/workitem/CamelCommandTest.java  | 134 
 .../jbpm/workitem/CamelWorkItemHandlerTest.java| 137 +
 5 files changed, 556 insertions(+)

diff --git a/components/camel-jbpm/pom.xml b/components/camel-jbpm/pom.xml
index a0536f0a..7927c7c 100644
--- a/components/camel-jbpm/pom.xml
+++ b/components/camel-jbpm/pom.xml
@@ -92,6 +92,15 @@
 true
 
 
+
+
+   org.jbpm
+   jbpm-workitems-core
+   ${jbpm-version}
+   provided
+   true
+
+
 
 org.jboss.logging
 jboss-logging
@@ -128,6 +137,24 @@
 camel-test
 test
 
+
+   org.mockito
+   mockito-core
+   test
+
+
+org.jbpm
+jbpm-workitems-core
+${jbpm-version}
+test-jar
+test
+
+   
+   xml-apis
+   xml-apis
+   
+
+
 
 
 
diff --git 
a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
 
b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.java
new file mode 100644
index 000..80c767e
--- /dev/null
+++ 
b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/workitem/CamelCommand.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.jbpm.workitem;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.ExchangeBuilder;
+import org.jbpm.services.api.service.ServiceRegistry;
+import org.kie.api.executor.Command;
+import org.kie.api.executor.CommandContext;
+import org.kie.api.executor.ExecutionResults;
+import org.kie.api.runtime.manager.RuntimeManager;
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.internal.runtime.Cacheable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Camel jBPM {@link Command} which allows to call Camel routes with a 
direct endpoint.
+ * 
+ * The command passes the {@WorkItem} retrieved from the {@link 
CommandContext} to the route that has a consumer on the endpoint-id 
+ * that can be passed with the camel-endpoint-id {@link WorkItem} 
parameter. E.g. when a the value "myCamelEndpoint" is passed to the 
+ * {link WorkItem} via the camel-endpoint-id parameter, this 
{@link Command} will send the {@link WorkItem} to 
+ * the Camel URI direct://myCamelEndpoint.  
+ * 
+ * The body of the result {@link Message} of the invocation is returned via 
the response parameter. Access to the raw response 
+ * {@link Message} is provided via the message parameter. This 
gives the user access to more advanced fields like message headers 
+ * and attachments.  
+ * 
+ * This {@link Command} can be constructed in 2 ways. When using the default 
constructor, the {link Command} will try to find 
+ * the global KIE {@link CamelContext} from the jBPM {@link 
ServiceRegistry}. 
+ * When the {@link RuntimeManager} is passed to the constructor, the {@link 
Command} will retrieve and use the {@link CamelContext} bound 
+ * to the {@link RuntimeManage} from the {@link ServiceRegistry}
+ * 
+ */
+public class CamelCommand implements Command,
+  Cacheable {
+
+   private static final String GLOBAL_CAMEL_CONTEXT_SERVICE_KEY = 
"GlobalCamelService";
+