You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/06/16 20:42:17 UTC

[1/4] git commit: Fix for CAMEL-7511 Expose the component options for Camel Quartz2

Repository: camel
Updated Branches:
  refs/heads/master 85ced0668 -> 675bd5304


Fix for CAMEL-7511 Expose the component options for Camel Quartz2


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

Branch: refs/heads/master
Commit: 3956583c7aec40f89b75cf77f4ed5c20085c3ee2
Parents: bd4f8d1
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Mon Jun 16 15:44:31 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Mon Jun 16 15:45:08 2014 +0200

----------------------------------------------------------------------
 .../component/quartz2/QuartzComponent.java      |  7 +--
 .../camel/component/quartz2/QuartzEndpoint.java | 11 ++++
 ...ponentConfigurationAndDocumentationTest.java | 55 ++++++++++++++++++++
 3 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3956583c/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
index f24046d..a6cab8f 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.StartupListener;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
  * of the code, but mostly has been re-written in attempt to be more easier to maintain, and use Quartz more
  * fully.</p>
  */
-public class QuartzComponent extends DefaultComponent implements StartupListener {
+public class QuartzComponent extends UriEndpointComponent implements StartupListener {
     private static final Logger LOG = LoggerFactory.getLogger(QuartzComponent.class);
     private SchedulerFactory schedulerFactory;
     private Scheduler scheduler;
@@ -60,10 +60,11 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
     private boolean enableJmx = true;
 
     public QuartzComponent() {
+        super(QuartzEndpoint.class);
     }
 
     public QuartzComponent(CamelContext camelContext) {
-        super(camelContext);
+        super(camelContext, QuartzEndpoint.class);
     }
 
     public int getStartDelayedSeconds() {

http://git-wip-us.apache.org/repos/asf/camel/blob/3956583c/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
index 1aeb9d0..5f42839 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
@@ -28,6 +28,8 @@ import org.apache.camel.Route;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.processor.loadbalancer.LoadBalancer;
 import org.apache.camel.processor.loadbalancer.RoundRobinLoadBalancer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.quartz.Job;
 import org.quartz.JobBuilder;
 import org.quartz.JobDataMap;
@@ -48,21 +50,30 @@ import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
  * call back into {@link #onConsumerStart(QuartzConsumer)} to add/resume or {@link #onConsumerStop(QuartzConsumer)}
  * to pause the scheduler trigger.
  */
+@UriEndpoint(scheme = "quartz2", consumerClass = QuartzComponent.class)
 public class QuartzEndpoint extends DefaultEndpoint {
     private static final Logger LOG = LoggerFactory.getLogger(QuartzEndpoint.class);
     private TriggerKey triggerKey;
+    @UriParam
     private String cron;
     private LoadBalancer consumerLoadBalancer;
     private Map<String, Object> triggerParameters;
     private Map<String, Object> jobParameters;
+    @UriParam
     private boolean stateful;
+    @UriParam
     private boolean fireNow;
+    @UriParam
     private boolean deleteJob = true;
+    @UriParam
     private boolean pauseJob;
+    @UriParam
     private boolean durableJob;
+    @UriParam
     private boolean recoverableJob;
     /** In case of scheduler has already started, we want the trigger start slightly after current time to
      * ensure endpoint is fully started before the job kicks in. */
+    @UriParam
     private long triggerStartDelay = 500; // in millis second
 
     // An internal variables to track whether a job has been in scheduler or not, and has it paused or not.

http://git-wip-us.apache.org/repos/asf/camel/blob/3956583c/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/Quartz2ComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/Quartz2ComponentConfigurationAndDocumentationTest.java b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/Quartz2ComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..93e99af
--- /dev/null
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/Quartz2ComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.quartz2;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class Quartz2ComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        QuartzComponent comp = context.getComponent("quartz2", QuartzComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("quartz2://myGroup/myTimerName?durableJob=true&recoverableJob=true&cron=0/2+*+*+*+*+?");
+
+        assertEquals("true", conf.getParameter("durableJob"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"cron\": { \"type\": \"java.lang.String\" }"));
+        assertTrue(json.contains("\"fireNow\": { \"type\": \"boolean\" }"));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("quartz2");
+        assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+    }
+
+}


[4/4] git commit: Merge branch 'CAMEL-7512' of https://github.com/kevinearls/camel

Posted by da...@apache.org.
Merge branch 'CAMEL-7512' of https://github.com/kevinearls/camel


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

Branch: refs/heads/master
Commit: 675bd5304a6e7c1ed2a35dedd5550de235e947ad
Parents: aef0e59 3f8dcdd
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jun 16 20:42:05 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 16 20:42:05 2014 +0200

----------------------------------------------------------------------
 .../camel/component/netty/NettyComponent.java   |  7 +--
 .../component/netty/NettyConfiguration.java     | 25 +++++++++
 .../camel/component/netty/NettyEndpoint.java    |  4 ++
 ...ponentConfigurationAndDocumentationTest.java | 57 ++++++++++++++++++++
 4 files changed, 90 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[2/4] git commit: Fix for CAMEL-7512 Expose the component options for Camel Netty

Posted by da...@apache.org.
Fix for CAMEL-7512 Expose the component options for Camel Netty


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

Branch: refs/heads/master
Commit: 3f8dcdde56b3012667a047f7f3b52a6f3640c12c
Parents: 9f90b02
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Mon Jun 16 17:48:09 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Mon Jun 16 17:48:09 2014 +0200

----------------------------------------------------------------------
 .../camel/component/netty/NettyComponent.java   |  7 +--
 .../component/netty/NettyConfiguration.java     | 25 +++++++++
 .../camel/component/netty/NettyEndpoint.java    |  4 ++
 ...ponentConfigurationAndDocumentationTest.java | 57 ++++++++++++++++++++
 4 files changed, 90 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3f8dcdde/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
index a570df8..62028e6 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java
@@ -24,24 +24,25 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.concurrent.CamelThreadFactory;
 import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
 import org.jboss.netty.util.HashedWheelTimer;
 import org.jboss.netty.util.Timer;
 
-public class NettyComponent extends DefaultComponent {
+public class NettyComponent extends UriEndpointComponent {
     // use a shared timer for Netty (see javadoc for HashedWheelTimer)
     private static volatile Timer timer;
     private NettyConfiguration configuration;
     private OrderedMemoryAwareThreadPoolExecutor executorService;
 
     public NettyComponent() {
+        super(NettyEndpoint.class);
     }
 
     public NettyComponent(CamelContext context) {
-        super(context);
+        super(context, NettyEndpoint.class);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/3f8dcdde/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
index 83ab62d..f61e12b 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
@@ -25,6 +25,8 @@ import java.util.Map;
 
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
@@ -36,33 +38,56 @@ import org.jboss.netty.util.CharsetUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@UriParams
 public class NettyConfiguration extends NettyServerBootstrapConfiguration implements Cloneable {
     private static final Logger LOG = LoggerFactory.getLogger(NettyConfiguration.class);
 
+    @UriParam
     private long requestTimeout;
+    @UriParam
     private boolean sync = true;
+    @UriParam
     private boolean textline;
+    @UriParam
     private TextLineDelimiter delimiter = TextLineDelimiter.LINE;
+    @UriParam
     private boolean autoAppendDelimiter = true;
+    @UriParam
     private int decoderMaxLineLength = 1024;
+    @UriParam
     private String encoding;
     private List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
     private List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
+    @UriParam
     private boolean disconnect;
+    @UriParam
     private boolean lazyChannelCreation = true;
+    @UriParam
     private boolean transferExchange;
+    @UriParam
     private boolean disconnectOnNoReply = true;
+    @UriParam
     private LoggingLevel noReplyLogLevel = LoggingLevel.WARN;
+    @UriParam
     private LoggingLevel serverExceptionCaughtLogLevel = LoggingLevel.WARN;
+    @UriParam
     private LoggingLevel serverClosedChannelExceptionCaughtLogLevel = LoggingLevel.DEBUG;
+    @UriParam
     private boolean allowDefaultCodec = true;
     private ClientPipelineFactory clientPipelineFactory;
+    @UriParam
     private int maximumPoolSize = 16;
+    @UriParam
     private boolean orderedThreadPoolExecutor = true;
+    @UriParam
     private int producerPoolMaxActive = -1;
+    @UriParam
     private int producerPoolMinIdle;
+    @UriParam
     private int producerPoolMaxIdle = 100;
+    @UriParam
     private long producerPoolMinEvictableIdle = 5 * 60 * 1000L;
+    @UriParam
     private boolean producerPoolEnabled = true;
 
     /**

http://git-wip-us.apache.org/repos/asf/camel/blob/3f8dcdde/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java
index 7b464fa..10c7aca 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java
@@ -29,13 +29,17 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.SynchronousDelegateProducer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.handler.ssl.SslHandler;
 import org.jboss.netty.util.Timer;
 
+@UriEndpoint(scheme = "netty", consumerClass = NettyConsumer.class)
 public class NettyEndpoint extends DefaultEndpoint {
+    @UriParam
     private NettyConfiguration configuration;
     private Timer timer;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/3f8dcdde/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..67b3ab0
--- /dev/null
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.netty;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class NettyComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        NettyComponent comp = context.getComponent("netty", NettyComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("netty:tcp://localhost:5150?sync=true" +
+                "&maximumPoolSize=32&ssl=true&passphrase=#password");
+
+        assertEquals("true", conf.getParameter("sync"));
+        assertEquals("32", conf.getParameter("maximumPoolSize"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"producerPoolMinEvictableIdle\": { \"type\": \"long\" }"));
+        assertTrue(json.contains("\"allowDefaultCodec\": { \"type\": \"boolean\" }"));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("netty");
+        assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+    }
+
+}


[3/4] git commit: Merge branch 'CAMEL-7511' of https://github.com/kevinearls/camel

Posted by da...@apache.org.
Merge branch 'CAMEL-7511' of https://github.com/kevinearls/camel


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

Branch: refs/heads/master
Commit: aef0e594de91f924b234e0175f1c1d31e406c874
Parents: 85ced06 3956583
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jun 16 20:41:24 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 16 20:41:24 2014 +0200

----------------------------------------------------------------------
 .../component/quartz2/QuartzComponent.java      |  7 +--
 .../camel/component/quartz2/QuartzEndpoint.java | 11 ++++
 ...ponentConfigurationAndDocumentationTest.java | 55 ++++++++++++++++++++
 3 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------