Component docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f78cecfb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f78cecfb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f78cecfb Branch: refs/heads/camel-2.16.x Commit: f78cecfb20a1f93171aa7bfb105f39c87ed3f332 Parents: 68374e1 Author: Claus Ibsen <[email protected]> Authored: Wed Jan 6 10:41:16 2016 +0100 Committer: Claus Ibsen <[email protected]> Committed: Wed Jan 6 11:32:46 2016 +0100 ---------------------------------------------------------------------- .../camel/component/jbpm/JBPMConfiguration.java | 138 ++++++++++++++++--- .../camel/component/jbpm/JBPMEndpoint.java | 21 +-- .../metrics/MetricsComponentRouteTest.java | 2 +- .../component/mongodb/MongoDbEndpoint.java | 2 +- .../camel/component/mqtt/MQTTConfiguration.java | 4 +- .../component/mybatis/MyBatisConsumer.java | 11 -- .../component/mybatis/MyBatisEndpoint.java | 43 +++++- .../nagios/NagiosConfiguraitonRefTest.java | 115 ---------------- 8 files changed, 175 insertions(+), 161 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/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 index b7ce878..556001a 100644 --- 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 @@ -33,11 +33,11 @@ import org.kie.api.task.model.Task; @UriParams public class JBPMConfiguration { - /** - * Specifies the operation to perform - */ + @UriPath @Metadata(required = "true") + private URL connectionURL; @UriParam(label = "producer", defaultValue = "startProcess") private String operation; +<<<<<<< HEAD /** * Specifies the key to use */ @@ -48,48 +48,66 @@ public class JBPMConfiguration { */ @UriParam private Objects value; - private String processId; - private Map<String, Object> parameters; - /** - * Specifies the process instance to interact with - */ +======= @UriParam @Metadata(required = "true") + private String deploymentId; + @UriParam private Long processInstanceId; + @UriParam + private Object value; + @UriParam +>>>>>>> 38d72c9... Component docs + private String processId; + @UriParam private String eventType; +<<<<<<< HEAD private String event; +======= + @UriParam + private Object event; + @UriParam +>>>>>>> 38d72c9... Component docs private Integer maxNumber; + @UriParam private String identifier; + @UriParam private Long workItemId; + @UriParam private Long taskId; + @UriParam private String userId; + @UriParam private String language; + @UriParam private String targetUserId; + @UriParam private Long attachmentId; + @UriParam private Long contentId; + @UriParam private Task task; + @UriParam private List<OrganizationalEntity> entities; + @UriParam private List<Status> statuses; - - //connection + @UriParam(label = "security") private String userName; + @UriParam(label = "security") 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; + @UriParam private Integer timeout; + @UriParam(label = "advanced") + private Map<String, Object> parameters; + @UriParam(label = "advanced") private Class[] extraJaxbClasses; public String getOperation() { return operation; } + /** + * The operation to perform + */ public void setOperation(String operation) { this.operation = operation; } @@ -106,7 +124,14 @@ public class JBPMConfiguration { return value; } +<<<<<<< HEAD public void setValue(Objects value) { +======= + /** + * the value to assign to the global identifier + */ + public void setValue(Object value) { +>>>>>>> 38d72c9... Component docs this.value = value; } @@ -114,6 +139,9 @@ public class JBPMConfiguration { return processId; } + /** + * the id of the process that should be acted upon + */ public void setProcessId(String processId) { this.processId = processId; } @@ -122,6 +150,9 @@ public class JBPMConfiguration { return parameters; } + /** + * the variables that should be set for various operations + */ public void setParameters(Map<String, Object> parameters) { this.parameters = parameters; } @@ -130,6 +161,9 @@ public class JBPMConfiguration { return processInstanceId; } + /** + * the id of the process instance + */ public void setProcessInstanceId(Long processInstanceId) { this.processInstanceId = processInstanceId; } @@ -138,6 +172,9 @@ public class JBPMConfiguration { return eventType; } + /** + * the type of event to use when signalEvent operation is performed + */ public void setEventType(String eventType) { this.eventType = eventType; } @@ -146,7 +183,14 @@ public class JBPMConfiguration { return event; } +<<<<<<< HEAD public void setEvent(String event) { +======= + /** + * the data associated with this event when signalEvent operation is performed + */ + public void setEvent(Object event) { +>>>>>>> 38d72c9... Component docs this.event = event; } @@ -154,6 +198,9 @@ public class JBPMConfiguration { return maxNumber; } + /** + * the maximum number of rules that should be fired + */ public void setMaxNumber(Integer maxNumber) { this.maxNumber = maxNumber; } @@ -162,6 +209,9 @@ public class JBPMConfiguration { return identifier; } + /** + * identifier the global identifier + */ public void setIdentifier(String identifier) { this.identifier = identifier; } @@ -170,6 +220,9 @@ public class JBPMConfiguration { return workItemId; } + /** + * the id of the work item + */ public void setWorkItemId(Long workItemId) { this.workItemId = workItemId; } @@ -178,6 +231,9 @@ public class JBPMConfiguration { return taskId; } + /** + *the id of the task + */ public void setTaskId(Long taskId) { this.taskId = taskId; } @@ -186,6 +242,9 @@ public class JBPMConfiguration { return userId; } + /** + * userId to use with task operations + */ public void setUserId(String userId) { this.userId = userId; } @@ -194,6 +253,9 @@ public class JBPMConfiguration { return task; } + /** + * The task instance to use with task operations + */ public void setTask(Task task) { this.task = task; } @@ -202,6 +264,9 @@ public class JBPMConfiguration { return language; } + /** + * The language to use when filtering user tasks + */ public void setLanguage(String language) { this.language = language; } @@ -210,6 +275,9 @@ public class JBPMConfiguration { return targetUserId; } + /** + * The targetUserId used when delegating a task + */ public void setTargetUserId(String targetUserId) { this.targetUserId = targetUserId; } @@ -218,6 +286,9 @@ public class JBPMConfiguration { return attachmentId; } + /** + * attachId to use when retrieving attachments + */ public void setAttachmentId(Long attachmentId) { this.attachmentId = attachmentId; } @@ -226,6 +297,9 @@ public class JBPMConfiguration { return contentId; } + /** + * contentId to use when retrieving attachments + */ public void setContentId(Long contentId) { this.contentId = contentId; } @@ -234,6 +308,9 @@ public class JBPMConfiguration { return entities; } + /** + * The potentialOwners when nominateTask operation is performed + */ public void setEntities(List<OrganizationalEntity> entities) { this.entities = entities; } @@ -242,6 +319,9 @@ public class JBPMConfiguration { return statuses; } + /** + * The list of status to use when filtering tasks + */ public void setStatuses(List<Status> statuses) { this.statuses = statuses; } @@ -250,6 +330,9 @@ public class JBPMConfiguration { return userName; } + /** + * Username for authentication + */ public void setUserName(String userName) { this.userName = userName; } @@ -258,6 +341,9 @@ public class JBPMConfiguration { return password; } + /** + * Password for authentication + */ public void setPassword(String password) { this.password = password; } @@ -266,6 +352,9 @@ public class JBPMConfiguration { return connectionURL; } + /** + * The URL to the jBPM server. + */ public void setConnectionURL(URL connectionURL) { this.connectionURL = connectionURL; } @@ -274,6 +363,9 @@ public class JBPMConfiguration { return deploymentId; } + /** + * The id of the deployment + */ public void setDeploymentId(String deploymentId) { this.deploymentId = deploymentId; } @@ -282,6 +374,9 @@ public class JBPMConfiguration { return timeout; } + /** + * A timeout value + */ public void setTimeout(Integer timeout) { this.timeout = timeout; } @@ -290,6 +385,9 @@ public class JBPMConfiguration { return extraJaxbClasses; } + /** + * To load additional classes when working with XML + */ public void setExtraJaxbClasses(Class[] extraJaxbClasses) { this.extraJaxbClasses = extraJaxbClasses; } http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/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 index 453e66c..044aa14 100644 --- 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 @@ -31,19 +31,22 @@ 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") +/** + * The jbpm component provides integration with jBPM (Business Process Management). + */ +@UriEndpoint(scheme = "jbpm", title = "JBPM", syntax = "jbpm:connectionURL", 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; + private JBPMConfiguration configuration; public JBPMEndpoint(String uri, JBPMComponent component, JBPMConfiguration configuration) throws URISyntaxException, MalformedURLException { super(uri, component); this.configuration = configuration; - LOGGER.trace("creating endpoint: [{}]", configuration); + } + public Producer createProducer() throws Exception { RemoteRestRuntimeEngineBuilder engineBuilder = RemoteRuntimeEngineFactory.newRestBuilder(); if (configuration.getUserName() != null) { engineBuilder.addUserName(configuration.getUserName()); @@ -66,12 +69,8 @@ public class JBPMEndpoint extends DefaultEndpoint { if (configuration.getExtraJaxbClasses() != null) { engineBuilder.addExtraJaxbClasses(configuration.getExtraJaxbClasses()); } - runtimeEngine = engineBuilder.build(); - LOGGER.trace("created endpoint"); - - } + RuntimeEngine runtimeEngine = engineBuilder.build(); - public Producer createProducer() throws Exception { return new JBPMProducer(this, runtimeEngine); } @@ -83,6 +82,10 @@ public class JBPMEndpoint extends DefaultEndpoint { return true; } + public void setConfiguration(JBPMConfiguration configuration) { + this.configuration = configuration; + } + public JBPMConfiguration getConfiguration() { return configuration; } http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java index 6f71bf6..7459a19 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentRouteTest.java @@ -93,7 +93,7 @@ public class MetricsComponentRouteTest extends CamelTestSupport { public void configure() { from("direct:start-1") .to("metrics:timer:T?action=start") - .to("metrics:A") + .to("metrics:counter://A") .to("metrics:counter://B") .to("metrics:counter:C?increment=19291") .to("metrics:counter:C?decrement=19292") http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java index b3980d7..07e5d42 100644 --- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java +++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java @@ -65,7 +65,7 @@ public class MongoDbEndpoint extends DefaultEndpoint { private MongoDbOperation operation; @UriParam(defaultValue = "true") private boolean createCollection = true; - @UriParam + @UriParam(enums = "ACKNOWLEDGED,W1,W2,W3,UNACKNOWLEDGED,JOURNALED,MAJORITY,SAFE") private WriteConcern writeConcern; private WriteConcern writeConcernRef; @UriParam http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java index a0dcaf1..a346125 100644 --- a/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java +++ b/components/camel-mqtt/src/main/java/org/apache/camel/component/mqtt/MQTTConfiguration.java @@ -76,7 +76,7 @@ public class MQTTConfiguration extends MQTT { String willTopic; @UriParam String willMessage; - @UriParam(defaultValue = "AT_MOST_ONCE") + @UriParam(enums = "AtMostOnce,AtLeastOne,ExactlyOnce", defaultValue = "AtMostOnce") QoS willQos = QoS.AT_MOST_ONCE; @UriParam QoS willRetain; @@ -111,7 +111,7 @@ public class MQTTConfiguration extends MQTT { private int sendWaitInSeconds = 5; @UriParam private boolean byDefaultRetain; - @UriParam(enums = "AT_MOST_ONCE,AT_LEAST_ONCE,EXACTLY_ONCE", defaultValue = "AT_LEAST_ONCE") + @UriParam(enums = "AtMostOnce,AtLeastOne,ExactlyOnce", defaultValue = "AtLeastOnce") private String qualityOfService = QoS.AT_LEAST_ONCE.name(); private QoS qos = QoS.AT_LEAST_ONCE; http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java index 0f2fbd9..0547e29 100644 --- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java +++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java @@ -50,19 +50,8 @@ public class MyBatisConsumer extends ScheduledBatchPollingConsumer { protected volatile ShutdownRunningTask shutdownRunningTask; protected volatile int pendingExchanges; - /** - * Statement to run after data has been processed in the route - */ private String onConsume; - - /** - * Process resultset individually or as a list - */ private boolean useIterator = true; - - /** - * Whether allow empty resultset to be routed to the next hop - */ private boolean routeEmptyResultSet; public MyBatisConsumer(MyBatisEndpoint endpoint, Processor processor) { http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java index ce460c1..a22416c 100644 --- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java +++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java @@ -51,6 +51,12 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint { private String outputHeader; @UriParam(label = "consumer") private String inputHeader; + @UriParam(label = "consumer", optionalPrefix = "consumer.") + private String onConsume; + @UriParam(label = "consumer", optionalPrefix = "consumer.", defaultValue = "true") + private boolean useIterator = true; + @UriParam(label = "consumer", optionalPrefix = "consumer.") + private boolean routeEmptyResultSet; @UriParam(label = "producer", defaultValue = "SIMPLE") private ExecutorType executorType; @@ -72,6 +78,9 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint { ObjectHelper.notNull(statement, "statement", this); MyBatisConsumer consumer = new MyBatisConsumer(this, processor); consumer.setMaxMessagesPerPoll(getMaxMessagesPerPoll()); + consumer.setOnConsume(getOnConsume()); + consumer.setUseIterator(isUseIterator()); + consumer.setRouteEmptyResultSet(isRouteEmptyResultSet()); configureConsumer(consumer); return consumer; } @@ -196,6 +205,36 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint { this.inputHeader = inputHeader; } - - + public String getOnConsume() { + return onConsume; + } + + /** + * Statement to run after data has been processed in the route + */ + public void setOnConsume(String onConsume) { + this.onConsume = onConsume; + } + + public boolean isUseIterator() { + return useIterator; + } + + /** + * Process resultset individually or as a list + */ + public void setUseIterator(boolean useIterator) { + this.useIterator = useIterator; + } + + public boolean isRouteEmptyResultSet() { + return routeEmptyResultSet; + } + + /** + * Whether allow empty resultset to be routed to the next hop + */ + public void setRouteEmptyResultSet(boolean routeEmptyResultSet) { + this.routeEmptyResultSet = routeEmptyResultSet; + } } http://git-wip-us.apache.org/repos/asf/camel/blob/f78cecfb/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java ---------------------------------------------------------------------- diff --git a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java deleted file mode 100644 index 248de4b..0000000 --- a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosConfiguraitonRefTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * 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.nagios; - -import com.googlecode.jsendnsca.core.Level; -import com.googlecode.jsendnsca.core.MessagePayload; -import com.googlecode.jsendnsca.core.mocks.NagiosNscaStub; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.impl.JndiRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * @version - */ -public class NagiosConfiguraitonRefTest extends CamelTestSupport { - protected boolean canRun; - private NagiosNscaStub nagios; - - @Before - @Override - public void setUp() throws Exception { - canRun = true; - - nagios = new NagiosNscaStub(25668, "secret"); - try { - nagios.start(); - } catch (Exception e) { - log.warn("Error starting NagiosNscaStub. This exception is ignored.", e); - canRun = false; - } - - super.setUp(); - } - - @After - @Override - public void tearDown() throws Exception { - super.tearDown(); - try { - nagios.stop(); - } catch (Exception e) { - // ignore - log.warn("Error stopping NagiosNscaStub. This exception is ignored.", e); - } - } - - @Override - protected JndiRegistry createRegistry() throws Exception { - NagiosConfiguration config = new NagiosConfiguration(); - config.setPassword("secret"); - config.setHost("127.0.0.1"); - config.setPort(25668); - - JndiRegistry jndi = super.createRegistry(); - jndi.bind("nagiosConf", config); - return jndi; - } - - @Test - public void testSendToNagios() throws Exception { - if (!canRun) { - return; - } - - MockEndpoint mock = getMockEndpoint("mock:result"); - mock.expectedMessageCount(1); - mock.allMessages().body().isInstanceOf(String.class); - - template.sendBody("direct:start", "Hello Nagios"); - - assertMockEndpointsSatisfied(); - - // sleep a little to let nagios stub process the payloads - Thread.sleep(1000); - - assertEquals(1, nagios.getMessagePayloadList().size()); - - MessagePayload payload = nagios.getMessagePayloadList().get(0); - assertEquals("Hello Nagios", payload.getMessage()); - assertEquals("localhost", payload.getHostname()); - assertEquals(Level.OK.ordinal(), payload.getLevel()); - assertEquals(context.getName(), payload.getServiceName()); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - // START SNIPPET: e1 - from("direct:start").to("nagios:foo?configuration=#nagiosConf").to("mock:result"); - // END SNIPPET: e1 - } - }; - } - -} \ No newline at end of file
