Repository: camel Updated Branches: refs/heads/master 6009fad97 -> 98d2ea6c3
New component created for integration with jBPM Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/98d2ea6c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/98d2ea6c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/98d2ea6c Branch: refs/heads/master Commit: 98d2ea6c3d3eed28543772121f056fd787fbb3a8 Parents: 6009fad Author: Bilgin Ibryam <[email protected]> Authored: Thu Aug 20 08:04:40 2015 +0100 Committer: Bilgin Ibryam <[email protected]> Committed: Thu Aug 20 08:04:40 2015 +0100 ---------------------------------------------------------------------- apache-camel/pom.xml | 4 + .../src/main/descriptors/common-bin.xml | 1 + components/camel-jbpm/pom.xml | 97 ++++ .../camel/component/jbpm/JBPMComponent.java | 33 ++ .../camel/component/jbpm/JBPMConfiguration.java | 296 ++++++++++++ .../camel/component/jbpm/JBPMConstants.java | 39 ++ .../camel/component/jbpm/JBPMEndpoint.java | 89 ++++ .../camel/component/jbpm/JBPMProducer.java | 472 +++++++++++++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 ++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../services/org/apache/camel/component/jbpm | 18 + .../jbpm/JBPMComponentIntegrationTest.java | 49 ++ .../src/test/resources/log4j.properties | 34 ++ components/pom.xml | 1 + parent/pom.xml | 8 +- .../features/src/main/resources/features.xml | 28 +- 16 files changed, 1377 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/apache-camel/pom.xml ---------------------------------------------------------------------- diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index 8b1aff6..0fbf4e9 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -365,6 +365,10 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-jbpm</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-jclouds</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/apache-camel/src/main/descriptors/common-bin.xml ---------------------------------------------------------------------- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 6c311d7..87a8fd4 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -104,6 +104,7 @@ <include>org.apache.camel:camel-jasypt</include> <include>org.apache.camel:camel-javaspace</include> <include>org.apache.camel:camel-jaxb</include> + <include>org.apache.camel:camel-jbpm</include> <include>org.apache.camel:camel-jcr</include> <include>org.apache.camel:camel-jclouds</include> <include>org.apache.camel:camel-jdbc</include> http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/pom.xml b/components/camel-jbpm/pom.xml new file mode 100644 index 0000000..03d0a7d --- /dev/null +++ b/components/camel-jbpm/pom.xml @@ -0,0 +1,97 @@ +<?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/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>2.16-SNAPSHOT</version> + </parent> + + <artifactId>camel-jbpm</artifactId> + <packaging>bundle</packaging> + <name>Camel :: JBPM</name> + <description>Camel JBPM support</description> + + <properties> + <camel.osgi.import.before.defaults> + org.apache.camel;version="[2.15,3)", + org.apache.camel.impl;version="[2.15,3)", + org.apache.camel.spi;version="[2.15,3)", + org.apache.camel.util;version="[2.15,3)", + * + </camel.osgi.import.before.defaults> + <camel.osgi.export.pkg>org.apache.camel.component.jbpm.*</camel.osgi.export.pkg> + <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=jbpm</camel.osgi.export.service> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> + <dependency> + <groupId>org.kie.remote</groupId> + <artifactId>kie-remote-client</artifactId> + <version>${jbpm-version}</version> + <exclusions> + <exclusion> + <groupId>org.hornetq</groupId> + <artifactId>hornetq-core-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.hornetq</groupId> + <artifactId>hornetq-jms-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.jboss.spec.javax.jms</groupId> + <artifactId>jboss-jms-api_1.1_spec</artifactId> + </exclusion> + <exclusion> + <groupId>org.jboss.spec.javax.xml.ws</groupId> + <artifactId>jboss-jaxws-api_2.2_spec</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jms_1.1_spec</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.servicemix.specs</groupId> + <artifactId>org.apache.servicemix.specs.jaxws-api-2.2</artifactId> + <version>${servicemix-specs-version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMComponent.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMComponent.java new file mode 100644 index 0000000..f562234 --- /dev/null +++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMComponent.java @@ -0,0 +1,33 @@ +/** + * 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; + +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.impl.DefaultComponent; + +public class JBPMComponent extends DefaultComponent { + + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + JBPMConfiguration configuration = new JBPMConfiguration(); + configuration.setConnectionURL(new URL(remaining)); + setProperties(configuration, parameters); + return new JBPMEndpoint(uri, this, configuration); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java new file mode 100644 index 0000000..b7ce878 --- /dev/null +++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConfiguration.java @@ -0,0 +1,296 @@ +/** + * 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; + +import java.net.URL; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.naming.InitialContext; + +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; +import org.kie.api.task.model.OrganizationalEntity; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; + +@UriParams +public class JBPMConfiguration { + + /** + * Specifies the operation to perform + */ + @UriParam(label = "producer", defaultValue = "startProcess") + private String operation; + /** + * Specifies the key to use + */ + @UriParam + private String key; + /** + * Specifies the value to use + */ + @UriParam + private Objects value; + private String processId; + private Map<String, Object> parameters; + /** + * Specifies the process instance to interact with + */ + @UriParam @Metadata(required = "true") + private Long processInstanceId; + private String eventType; + private String event; + private Integer maxNumber; + private String identifier; + private Long workItemId; + private Long taskId; + private String userId; + private String language; + private String targetUserId; + private Long attachmentId; + private Long contentId; + private Task task; + private List<OrganizationalEntity> entities; + private List<Status> statuses; + + //connection + private String userName; + private String password; + /** + * Specifies the connection url to the jBPM system + */ + @UriPath @Metadata(required = "true") + private URL connectionURL; + /** + * Specifies the deploymentId to use + */ + @UriParam @Metadata(required = "true") + private String deploymentId; + private Integer timeout; + private Class[] extraJaxbClasses; + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Objects getValue() { + return value; + } + + public void setValue(Objects value) { + this.value = value; + } + + public String getProcessId() { + return processId; + } + + public void setProcessId(String processId) { + this.processId = processId; + } + + public Map<String, Object> getParameters() { + return parameters; + } + + public void setParameters(Map<String, Object> parameters) { + this.parameters = parameters; + } + + public Long getProcessInstanceId() { + return processInstanceId; + } + + public void setProcessInstanceId(Long processInstanceId) { + this.processInstanceId = processInstanceId; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getEvent() { + return event; + } + + public void setEvent(String event) { + this.event = event; + } + + public Integer getMaxNumber() { + return maxNumber; + } + + public void setMaxNumber(Integer maxNumber) { + this.maxNumber = maxNumber; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public Long getWorkItemId() { + return workItemId; + } + + public void setWorkItemId(Long workItemId) { + this.workItemId = workItemId; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Task getTask() { + return task; + } + + public void setTask(Task task) { + this.task = task; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getTargetUserId() { + return targetUserId; + } + + public void setTargetUserId(String targetUserId) { + this.targetUserId = targetUserId; + } + + public Long getAttachmentId() { + return attachmentId; + } + + public void setAttachmentId(Long attachmentId) { + this.attachmentId = attachmentId; + } + + public Long getContentId() { + return contentId; + } + + public void setContentId(Long contentId) { + this.contentId = contentId; + } + + public List<OrganizationalEntity> getEntities() { + return entities; + } + + public void setEntities(List<OrganizationalEntity> entities) { + this.entities = entities; + } + + public List<Status> getStatuses() { + return statuses; + } + + public void setStatuses(List<Status> statuses) { + this.statuses = statuses; + } + + 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; + } + + public URL getConnectionURL() { + return connectionURL; + } + + public void setConnectionURL(URL connectionURL) { + this.connectionURL = connectionURL; + } + + public String getDeploymentId() { + return deploymentId; + } + + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + public Integer getTimeout() { + return timeout; + } + + public void setTimeout(Integer timeout) { + this.timeout = timeout; + } + + public Class[] getExtraJaxbClasses() { + return extraJaxbClasses; + } + + public void setExtraJaxbClasses(Class[] extraJaxbClasses) { + this.extraJaxbClasses = extraJaxbClasses; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.java new file mode 100644 index 0000000..6b00d02 --- /dev/null +++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMConstants.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.jbpm; + +public interface JBPMConstants { + String VALUE = "CamelJBPMValue"; + String OPERATION = "CamelJBPMOperation"; + String PROCESS_ID = "CamelJBPMProcessId"; + String PROCESS_INSTANCE_ID = "CamelJBPMProcessInstanceId"; + String PARAMETERS = "CamelJBPMParameters"; + String EVENT_TYPE = "CamelJBPMEventType"; + String EVENT = "CamelJBPMEvent"; + String MAX_NUMBER = "CamelJBPMMaxNumber"; + String IDENTIFIER = "CamelJBPMIdentifier"; + String WORK_ITEM_ID = "CamelJBPMWorkItemId"; + String TASK_ID = "CamelJBPMTaskId"; + String TASK = "CamelJBPMTask"; + String USER_ID = "CamelJBPMUserId"; + String TARGET_USER_ID = "CamelJBPMTargetUserId"; + String LANGUAGE = "CamelJBPMLanguage"; + String ATTACHMENT_ID = "CamelJBPMAttachmentId"; + String CONTENT_ID = "CamelJBPMContentId"; + String ENTITY_LIST = "CamelJBPMEntityList"; + String STATUS_LIST = "CamelJBPMStatusList"; +} http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java new file mode 100644 index 0000000..453e66c --- /dev/null +++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMEndpoint.java @@ -0,0 +1,89 @@ +/** + * 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; + +import java.net.MalformedURLException; +import java.net.URISyntaxException; + +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.impl.DefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.remote.client.api.RemoteRestRuntimeEngineBuilder; +import org.kie.services.client.api.RemoteRuntimeEngineFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@UriEndpoint(scheme = "jbpm", title = "JBPM", syntax = "jbpm:host", producerOnly = true, label = "process") +public class JBPMEndpoint extends DefaultEndpoint { + private static final transient Logger LOGGER = LoggerFactory.getLogger(JBPMEndpoint.class); + + @UriParam + private final JBPMConfiguration configuration; + private RuntimeEngine runtimeEngine; + + public JBPMEndpoint(String uri, JBPMComponent component, JBPMConfiguration configuration) throws URISyntaxException, MalformedURLException { + super(uri, component); + this.configuration = configuration; + LOGGER.trace("creating endpoint: [{}]", configuration); + + RemoteRestRuntimeEngineBuilder engineBuilder = RemoteRuntimeEngineFactory.newRestBuilder(); + if (configuration.getUserName() != null) { + engineBuilder.addUserName(configuration.getUserName()); + } + if (configuration.getPassword() != null) { + engineBuilder.addPassword(configuration.getPassword()); + } + if (configuration.getDeploymentId() != null) { + engineBuilder.addDeploymentId(configuration.getDeploymentId()); + } + if (configuration.getConnectionURL() != null) { + engineBuilder.addUrl(configuration.getConnectionURL()); + } + if (configuration.getProcessInstanceId() != null) { + engineBuilder.addProcessInstanceId(configuration.getProcessInstanceId()); + } + if (configuration.getTimeout() != null) { + engineBuilder.addTimeout(configuration.getTimeout()); + } + if (configuration.getExtraJaxbClasses() != null) { + engineBuilder.addExtraJaxbClasses(configuration.getExtraJaxbClasses()); + } + runtimeEngine = engineBuilder.build(); + LOGGER.trace("created endpoint"); + + } + + public Producer createProducer() throws Exception { + return new JBPMProducer(this, runtimeEngine); + } + + public Consumer createConsumer(Processor processor) throws Exception { + throw new UnsupportedOperationException("Consumer not supported for " + getClass().getSimpleName() + " endpoint"); + } + + public boolean isSingleton() { + return true; + } + + public JBPMConfiguration getConfiguration() { + return configuration; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java new file mode 100644 index 0000000..efccd67 --- /dev/null +++ b/components/camel-jbpm/src/main/java/org/apache/camel/component/jbpm/JBPMProducer.java @@ -0,0 +1,472 @@ +/** + * 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; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.apache.camel.Exchange; +import org.apache.camel.Message; +import org.apache.camel.impl.DefaultProducer; +import org.apache.camel.util.ExchangeHelper; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.task.TaskService; +import org.kie.api.task.model.Attachment; +import org.kie.api.task.model.Content; +import org.kie.api.task.model.OrganizationalEntity; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskSummary; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class JBPMProducer extends DefaultProducer { + private static final transient Logger LOGGER = LoggerFactory.getLogger(JBPMProducer.class); + private KieSession kieSession; + private TaskService taskService; + private JBPMConfiguration configuration; + private RuntimeEngine runtimeEngine; + + public JBPMProducer(JBPMEndpoint endpoint, RuntimeEngine runtimeEngine) { + super(endpoint); + this.configuration = endpoint.getConfiguration(); + this.runtimeEngine = runtimeEngine; + } + + @Override + protected void doStart() throws Exception { + LOGGER.trace("starting producer"); + kieSession = runtimeEngine.getKieSession(); + taskService = runtimeEngine.getTaskService(); + super.doStart(); + LOGGER.trace("started producer"); + } + + @Override + protected void doStop() throws Exception { + super.doStop(); + if (kieSession != null) { + kieSession = null; + } + + if (taskService != null) { + taskService = null; + } + } + + public void process(Exchange exchange) throws Exception { + getOperation(exchange).execute(kieSession, taskService, configuration, exchange); + } + + Operation getOperation(Exchange exchange) { + String operation = exchange.getIn().getHeader(JBPMConstants.OPERATION, String.class); + if (operation == null && configuration.getOperation() != null) { + operation = JBPMConstants.OPERATION + configuration.getOperation(); + } + if (operation == null) { + operation = JBPMConstants.OPERATION + Operation.startProcess; + } + LOGGER.trace("Operation: [{}]", operation); + return Operation.valueOf(operation.substring(JBPMConstants.OPERATION.length())); + } + + enum Operation { + + //PROCESS OPERATIONS + startProcess { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + ProcessInstance processInstance = kieSession.startProcess(getProcessId(configuration, exchange), getParameters(configuration, exchange)); + setResult(exchange, processInstance); + } + }, abortProcessInstance { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + kieSession.abortProcessInstance(safe(getProcessInstanceId(configuration, exchange))); + } + }, signalEvent { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Long processInstanceId = getProcessInstanceId(configuration, exchange); + if (processInstanceId != null) { + kieSession.signalEvent(getEventType(configuration, exchange), getEvent(configuration, exchange), processInstanceId); + } else { + kieSession.signalEvent(getEventType(configuration, exchange), getEvent(configuration, exchange)); + } + } + }, getProcessInstance { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + ProcessInstance processInstance = kieSession.getProcessInstance(safe(getProcessInstanceId(configuration, exchange))); + setResult(exchange, processInstance); + } + }, getProcessInstances { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Collection<ProcessInstance> processInstances = kieSession.getProcessInstances(); + setResult(exchange, processInstances); + } + }, + + //RULE OPERATIONS + fireAllRules { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Integer max = getMaxNumber(configuration, exchange); + int rulesFired; + if (max != null) { + rulesFired = kieSession.fireAllRules(max); + } else { + rulesFired = kieSession.fireAllRules(); + } + setResult(exchange, rulesFired); + } + }, getFactCount { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + long factCount = kieSession.getFactCount(); + setResult(exchange, factCount); + } + }, getGlobal { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Object global = kieSession.getGlobal(getIdentifier(configuration, exchange)); + setResult(exchange, global); + } + }, setGlobal { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + kieSession.setGlobal(getIdentifier(configuration, exchange), getValue(configuration, exchange)); + } + }, + + //WORK ITEM OPERATIONS + abortWorkItem { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + kieSession.getWorkItemManager().abortWorkItem(safe(getWorkItemId(configuration, exchange))); + } + }, completeWorkItem { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + kieSession.getWorkItemManager().completeWorkItem(safe(getWorkItemId(configuration, exchange)), getParameters(configuration, exchange)); + } + }, + + //TASK OPERATIONS + activateTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.activate(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, addTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + long taskId = taskService.addTask(getTask(configuration, exchange), getParameters(configuration, exchange)); + setResult(exchange, taskId); + } + }, claimNextAvailableTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.claimNextAvailable(getUserId(configuration, exchange), getLanguage(configuration, exchange)); + } + }, claimTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.claim(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, completeTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.complete(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getParameters(configuration, exchange)); + } + }, delegateTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.delegate(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getTargetUserId(configuration, exchange)); + } + }, exitTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.exit(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, failTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.fail(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getParameters(configuration, exchange)); + } + }, getAttachment { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Attachment attachment = taskService.getAttachmentById(safe(getAttachmentId(configuration, exchange))); + setResult(exchange, attachment); + } + }, getContent { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Content content = taskService.getContentById(safe(getContentId(configuration, exchange))); + setResult(exchange, content); + } + }, getTasksAssignedAsBusinessAdministrator { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + List<TaskSummary> taskSummaries = taskService.getTasksAssignedAsBusinessAdministrator(getUserId(configuration, exchange), getLanguage(configuration, exchange)); + setResult(exchange, taskSummaries); + } + }, getTasksAssignedAsPotentialOwnerByStatus { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.getTasksAssignedAsPotentialOwnerByStatus(getUserId(configuration, exchange), getStatuses(configuration, exchange), getLanguage(configuration, exchange)); + } + }, getTaskByWorkItem { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Task task = taskService.getTaskByWorkItemId(safe(getWorkItemId(configuration, exchange))); + setResult(exchange, task); + } + }, getTaskBy { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Task task = taskService.getTaskById(safe(getTaskId(configuration, exchange))); + setResult(exchange, task); + } + }, getTaskContent { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + Map<String, Object> taskContent = taskService.getTaskContent(safe(getTaskId(configuration, exchange))); + setResult(exchange, taskContent); + } + }, getTasksByProcessInstance { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + List<Long> processInstanceIds = taskService.getTasksByProcessInstanceId(safe(getProcessInstanceId(configuration, exchange))); + setResult(exchange, processInstanceIds); + } + }, getTasksByStatusByProcessInstance { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + List<TaskSummary> taskSummaryList = taskService.getTasksByStatusByProcessInstanceId( + safe(getProcessInstanceId(configuration, exchange)), getStatuses(configuration, exchange), + getLanguage(configuration, exchange)); + setResult(exchange, taskSummaryList); + } + }, getTasksOwned { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + List<TaskSummary> summaryList = taskService.getTasksOwned(getUserId(configuration, exchange), getLanguage(configuration, exchange)); + setResult(exchange, summaryList); + } + }, nominateTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.nominate(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange), getEntities(configuration, exchange)); + } + }, releaseTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.release(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, resumeTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.resume(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, skipTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.skip(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, startTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.start(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, stopTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.stop(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }, suspendTask { + @Override + void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) { + taskService.suspend(safe(getTaskId(configuration, exchange)), getUserId(configuration, exchange)); + } + }; + + List<Status> getStatuses(JBPMConfiguration configuration, Exchange exchange) { + List<Status> statusList = exchange.getIn().getHeader(JBPMConstants.STATUS_LIST, List.class); + if (statusList == null) { + statusList = configuration.getStatuses(); + } + return statusList; + } + + List<OrganizationalEntity> getEntities(JBPMConfiguration configuration, Exchange exchange) { + List<OrganizationalEntity> entityList = exchange.getIn().getHeader(JBPMConstants.ENTITY_LIST, List.class); + if (entityList == null) { + entityList = configuration.getEntities(); + } + return entityList; + } + + Long getAttachmentId(JBPMConfiguration configuration, Exchange exchange) { + Long attachmentId = exchange.getIn().getHeader(JBPMConstants.ATTACHMENT_ID, Long.class); + if (attachmentId == null) { + attachmentId = configuration.getAttachmentId(); + } + return attachmentId; + } + + Long getContentId(JBPMConfiguration configuration, Exchange exchange) { + Long contentId = exchange.getIn().getHeader(JBPMConstants.CONTENT_ID, Long.class); + if (contentId == null) { + contentId = configuration.getContentId(); + } + return contentId; + } + + String getTargetUserId(JBPMConfiguration configuration, Exchange exchange) { + String userId = exchange.getIn().getHeader(JBPMConstants.TARGET_USER_ID, String.class); + if (userId == null) { + userId = configuration.getTargetUserId(); + } + return userId; + } + + String getLanguage(JBPMConfiguration configuration, Exchange exchange) { + String language = exchange.getIn().getHeader(JBPMConstants.LANGUAGE, String.class); + if (language == null) { + language = configuration.getLanguage(); + } + return language; + } + + Task getTask(JBPMConfiguration configuration, Exchange exchange) { + Task task = exchange.getIn().getHeader(JBPMConstants.TASK, Task.class); + if (task == null) { + task = configuration.getTask(); + } + return task; + } + + String getUserId(JBPMConfiguration configuration, Exchange exchange) { + String userId = exchange.getIn().getHeader(JBPMConstants.USER_ID, String.class); + if (userId == null) { + userId = configuration.getUserId(); + } + return userId; + } + + Long getTaskId(JBPMConfiguration configuration, Exchange exchange) { + Long taskId = exchange.getIn().getHeader(JBPMConstants.TASK_ID, Long.class); + if (taskId == null) { + taskId = configuration.getTaskId(); + } + return taskId; + } + + Long getWorkItemId(JBPMConfiguration configuration, Exchange exchange) { + Long workItemId = exchange.getIn().getHeader(JBPMConstants.WORK_ITEM_ID, Long.class); + if (workItemId == null) { + workItemId = configuration.getWorkItemId(); + } + return workItemId; + } + + String getIdentifier(JBPMConfiguration configuration, Exchange exchange) { + String identifier = exchange.getIn().getHeader(JBPMConstants.IDENTIFIER, String.class); + if (identifier == null) { + identifier = configuration.getIdentifier(); + } + return identifier; + } + + Integer getMaxNumber(JBPMConfiguration configuration, Exchange exchange) { + Integer max = exchange.getIn().getHeader(JBPMConstants.MAX_NUMBER, Integer.class); + if (max == null) { + max = configuration.getMaxNumber(); + } + return max; + } + + Object getEvent(JBPMConfiguration configuration, Exchange exchange) { + String event = exchange.getIn().getHeader(JBPMConstants.EVENT, String.class); + if (event == null) { + event = configuration.getEvent(); + } + return event; + } + + String getEventType(JBPMConfiguration configuration, Exchange exchange) { + String eventType = exchange.getIn().getHeader(JBPMConstants.EVENT_TYPE, String.class); + if (eventType == null) { + eventType = configuration.getEventType(); + } + return eventType; + } + + String getProcessId(JBPMConfiguration configuration, Exchange exchange) { + String processId = exchange.getIn().getHeader(JBPMConstants.PROCESS_ID, String.class); + if (processId == null) { + processId = configuration.getProcessId(); + } + return processId; + } + + Long getProcessInstanceId(JBPMConfiguration configuration, Exchange exchange) { + Long processInstanceId = exchange.getIn().getHeader(JBPMConstants.PROCESS_INSTANCE_ID, Long.class); + if (processInstanceId == null) { + processInstanceId = configuration.getProcessInstanceId(); + } + return processInstanceId; + } + + Map<String, Object> getParameters(JBPMConfiguration configuration, Exchange exchange) { + Map<String, Object> parameters = exchange.getIn().getHeader(JBPMConstants.PARAMETERS, Map.class); + if (parameters == null) { + parameters = configuration.getParameters(); + } + return parameters; + } + + Object getValue(JBPMConfiguration configuration, Exchange exchange) { + Object value = exchange.getIn().getHeader(JBPMConstants.VALUE); + if (value == null) { + value = configuration.getValue(); + } + return value; + } + + Message getResultMessage(Exchange exchange) { + return ExchangeHelper.isOutCapable(exchange) ? exchange.getOut() : exchange.getIn(); + } + + long safe(Long aLong) { + return aLong != null ? aLong : 0; + } + + void setResult(Exchange exchange, Object result) { + getResultMessage(exchange).setBody(result); + } + + abstract void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange); + } +} + http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/main/resources/META-INF/LICENSE.txt ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/resources/META-INF/LICENSE.txt b/components/camel-jbpm/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/components/camel-jbpm/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/98d2ea6c/components/camel-jbpm/src/main/resources/META-INF/NOTICE.txt ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/resources/META-INF/NOTICE.txt b/components/camel-jbpm/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 0000000..2e215bf --- /dev/null +++ b/components/camel-jbpm/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/98d2ea6c/components/camel-jbpm/src/main/resources/META-INF/services/org/apache/camel/component/jbpm ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/main/resources/META-INF/services/org/apache/camel/component/jbpm b/components/camel-jbpm/src/main/resources/META-INF/services/org/apache/camel/component/jbpm new file mode 100644 index 0000000..a574bbf --- /dev/null +++ b/components/camel-jbpm/src/main/resources/META-INF/services/org/apache/camel/component/jbpm @@ -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. +# + +class=org.apache.camel.component.jbpm.JBPMComponent http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java new file mode 100644 index 0000000..cdb7b50 --- /dev/null +++ b/components/camel-jbpm/src/test/java/org/apache/camel/component/jbpm/JBPMComponentIntegrationTest.java @@ -0,0 +1,49 @@ +/** + * 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; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Ignore; +import org.junit.Test; + +@Ignore("This is an integration test that needs BPMS running on the local machine") +public class JBPMComponentIntegrationTest extends CamelTestSupport { + + @Test + public void interactsOverRest() throws Exception { + getMockEndpoint("mock:result").expectedMessageCount(1); + template.sendBodyAndHeader("direct:rest", null, JBPMConstants.PROCESS_ID, "project1.integration-test"); + assertMockEndpointsSatisfied(); + + assertNotNull(getMockEndpoint("mock:result").getExchanges().get(0).getIn().getBody()); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() { + from("direct:rest") + .to("jbpm:http://localhost:8080/business-central?userName=bpmsAdmin&password=pa$word1" + + "&deploymentId=org.kie.example:project1:1.0.0-SNAPSHOT") + .to("mock:result"); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/camel-jbpm/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/components/camel-jbpm/src/test/resources/log4j.properties b/components/camel-jbpm/src/test/resources/log4j.properties new file mode 100644 index 0000000..de8b802 --- /dev/null +++ b/components/camel-jbpm/src/test/resources/log4j.properties @@ -0,0 +1,34 @@ +## ------------------------------------------------------------------------ +## 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. +## ------------------------------------------------------------------------ + +# +# The logging properties used for eclipse testing, We want to see debug output on the console. +# +log4j.rootLogger=INFO, file + +# CONSOLE appender not used by default +log4j.appender.out=org.apache.log4j.ConsoleAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n +#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + +# File appender +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +log4j.appender.file.file=target/camel-jbpm-test.log +log4j.appender.file.append=true http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/components/pom.xml ---------------------------------------------------------------------- diff --git a/components/pom.xml b/components/pom.xml index f79d07d..cd89967 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -130,6 +130,7 @@ <module>camel-javaspace</module> <module>camel-jaxb</module> <module>camel-jasypt</module> + <module>camel-jbpm</module> <module>camel-jclouds</module> <module>camel-jcr</module> <module>camel-jdbc</module> http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 1db336a..445e924 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -252,6 +252,7 @@ <javax-mail-version>1.4.7</javax-mail-version> <jaxb-bundle-version>2.2.6_1</jaxb-bundle-version> <jaxen-version>1.1.6</jaxen-version> + <jbpm-version>6.2.0.Final</jbpm-version> <jboss-javaee-6-version>1.0.0.Final</jboss-javaee-6-version> <jboss-logging-version>3.3.0.Final</jboss-logging-version> <jboss-marshalling-version>1.4.10.Final</jboss-marshalling-version> @@ -461,7 +462,7 @@ <spring-version-range>[3.2,5)</spring-version-range> <!-- However, spring-dm does not support spring 4.x so import-range must be 3.x for the --> <!-- Karaf features file. --> - <spring-version-range-karaf>[3.2,4)</spring-version-range-karaf> + <spring-version-range-karaf>[3.0,4)</spring-version-range-karaf> <spring-version>${spring4-version}</spring-version> <spring32-version>3.2.13.RELEASE</spring32-version> <spring40-version>4.0.9.RELEASE</spring40-version> @@ -1012,6 +1013,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-jbpm</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-jclouds</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/camel/blob/98d2ea6c/platforms/karaf/features/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index 45323e4..f177366 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -783,6 +783,24 @@ <feature version='${project.version}'>camel-core</feature> <bundle>mvn:org.apache.camel/camel-jaxb/${project.version}</bundle> </feature> + <feature name='camel-jbpm' version='${project.version}' resolver='(obr)' start-level='50'> + <bundle dependency='true'>mvn:org.openengsb.wrapped/com.google.protobuf/2.4.1.w1</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/${javax-inject-bundle-version}</bundle> + <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-jaxrs/${jackson-version}</bundle> + <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-core-asl/${jackson-version}</bundle> + <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson-version}</bundle> + <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-xc/${jackson-version}</bundle> + <bundle dependency='true'>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${geronimo-jms-spec-version}</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.2/${servicemix-specs-version}</bundle> + <bundle dependency='true'>mvn:org.drools/drools-core/${jbpm-version}</bundle> + <bundle dependency='true'>mvn:org.drools/drools-compiler/${jbpm-version}</bundle> + <bundle dependency='true'>wrap:mvn:org.kie/kie-internal/${jbpm-version}</bundle> + <bundle dependency='true'>wrap:mvn:org.kie/kie-api/${jbpm-version}</bundle> + <bundle dependency='true'>wrap:mvn:org.kie.remote/kie-remote-common/${jbpm-version}</bundle> + <bundle dependency='true'>wrap:mvn:org.kie.remote/kie-remote-jaxb/${jbpm-version}</bundle> + <bundle dependency='true'>wrap:mvn:org.kie.remote/kie-remote-client/${jbpm-version}</bundle> + <bundle>mvn:org.apache.camel/camel-jbpm/${project.version}</bundle> + </feature> <feature name='camel-jclouds' version='${project.version}' resolver='(obr)' start-level='50'> <feature version='${jclouds-version}'>jclouds</feature> <feature version='${jclouds-version}'>jclouds-blobstore</feature> @@ -1132,11 +1150,11 @@ <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/${javax-inject-bundle-version}</bundle> <bundle>mvn:org.apache.camel/camel-optaplanner/${project.version}</bundle> </feature> - <feature name='camel-paho' version='${project.version}' resolver='(obr)' start-level='50'> - <feature version='${project.version}'>camel-core</feature> - <bundle>mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/${paho-version}</bundle> - <bundle>mvn:org.apache.camel/camel-paho/${project.version}</bundle> - </feature> + <!--<feature name='camel-paho' version='${project.version}' resolver='(obr)' start-level='50'>--> + <!--<feature version='${project.version}'>camel-core</feature>--> + <!--<bundle>mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/${paho-version}</bundle>--> + <!--<bundle>mvn:org.apache.camel/camel-paho/${project.version}</bundle>--> + <!--</feature>--> <feature name='camel-paxlogging' version='${project.version}' resolver='(obr)' start-level='50'> <feature version='${project.version}'>camel-core</feature> <bundle>mvn:org.apache.camel/camel-paxlogging/${project.version}</bundle>
