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 2015/02/13 12:48:11 UTC

[1/8] camel git commit: CAMEL-7999: Scheduled poll endpoints should include all its consumer related options as well in component documentation.

Repository: camel
Updated Branches:
  refs/heads/master 64efcea1f -> 85ab834f2


CAMEL-7999: Scheduled poll endpoints should include all its consumer related options as well in component documentation.


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

Branch: refs/heads/master
Commit: 82eaad58a1d97417f9d7af166d2a01e8685ae15c
Parents: 6290057
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 08:50:12 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:32 2015 +0100

----------------------------------------------------------------------
 .../camel/impl/ScheduledPollConsumer.java       |  58 +--
 .../camel/impl/ScheduledPollEndpoint.java       | 418 +++++++++++++++----
 .../FileConsumerPollStrategyNotBeginTest.java   |   2 +-
 ...eConsumerPollStrategyPolledMessagesTest.java |   2 +-
 ...rPollStrategyRollbackThrowExceptionTest.java |   2 +-
 ...eConsumerPollStrategyStopOnRollbackTest.java |   2 +-
 .../file/FileConsumerPollStrategyTest.java      |   2 +-
 7 files changed, 333 insertions(+), 153 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
index e300d49..a786214 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
@@ -30,7 +30,6 @@ import org.apache.camel.Processor;
 import org.apache.camel.SuspendableService;
 import org.apache.camel.spi.PollingConsumerPollStrategy;
 import org.apache.camel.spi.ScheduledPollConsumerScheduler;
-import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ServiceHelper;
@@ -46,30 +45,18 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
     private ScheduledPollConsumerScheduler scheduler;
     private ScheduledExecutorService scheduledExecutorService;
 
-    // if adding more options then align with ScheduledPollEndpoint#configureScheduledPollConsumerProperties
-    @UriParam
+    // if adding more options then align with org.apache.camel.impl.ScheduledPollEndpoint
     private boolean startScheduler = true;
-    @UriParam
     private long initialDelay = 1000;
-    @UriParam
     private long delay = 500;
-    @UriParam
     private TimeUnit timeUnit = TimeUnit.MILLISECONDS;
-    @UriParam
     private boolean useFixedDelay = true;
-    @UriParam
     private PollingConsumerPollStrategy pollStrategy = new DefaultPollingConsumerPollStrategy();
-    @UriParam
     private LoggingLevel runLoggingLevel = LoggingLevel.TRACE;
-    @UriParam
     private boolean sendEmptyMessageWhenIdle;
-    @UriParam
     private boolean greedy;
-    @UriParam
     private int backoffMultiplier;
-    @UriParam
     private int backoffIdleThreshold;
-    @UriParam
     private int backoffErrorThreshold;
     private Map<String, Object> schedulerProperties;
 
@@ -280,11 +267,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
         return scheduler;
     }
 
-    /**
-     * Sets a custom scheduler to use for scheduling running this task (poll).
-     *
-     * @param scheduler the custom scheduler
-     */
     public void setScheduler(ScheduledPollConsumerScheduler scheduler) {
         this.scheduler = scheduler;
     }
@@ -293,9 +275,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
         return schedulerProperties;
     }
 
-    /**
-     * Additional properties to configure on the custom scheduler.
-     */
     public void setSchedulerProperties(Map<String, Object> schedulerProperties) {
         this.schedulerProperties = schedulerProperties;
     }
@@ -320,15 +299,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
         return timeUnit;
     }
 
-    /**
-     * Sets the time unit to use.
-     * <p/>
-     * Notice that both {@link #getDelay()} and {@link #getInitialDelay()} are using
-     * the same time unit. So if you change this value, then take into account that the
-     * default value of {@link #getInitialDelay()} is 1000. So you may to adjust this value accordingly.
-     *
-     * @param timeUnit the time unit.
-     */
     public void setTimeUnit(TimeUnit timeUnit) {
         this.timeUnit = timeUnit;
     }
@@ -361,13 +331,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
         return startScheduler;
     }
 
-    /**
-     * Sets whether the scheduler should be started when this consumer starts.
-     * <p/>
-     * This option is default true.
-     *
-     * @param startScheduler whether to start scheduler
-     */
     public void setStartScheduler(boolean startScheduler) {
         this.startScheduler = startScheduler;
     }
@@ -384,9 +347,6 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
         return greedy;
     }
 
-    /**
-     * If greedy then a poll is executed immediate after a previous poll that polled 1 or more messages.
-     */
     public void setGreedy(boolean greedy) {
         this.greedy = greedy;
     }
@@ -423,26 +383,10 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
         return scheduledExecutorService;
     }
 
-    /**
-     * Whether the scheduler has been started.
-     * <p/>
-     * The scheduler can be started with the {@link #startScheduler()} method.
-     *
-     * @return <tt>true</tt> if started, <tt>false</tt> if not.
-     */
     public boolean isSchedulerStarted() {
         return scheduler.isSchedulerStarted();
     }
 
-    /**
-     * Sets a custom shared {@link ScheduledExecutorService} to use as thread pool
-     * <p/>
-     * <b>Notice: </b> When using a custom thread pool, then the lifecycle of this thread
-     * pool is not controlled by this consumer (eg this consumer will not start/stop the thread pool
-     * when the consumer is started/stopped etc.)
-     *
-     * @param scheduledExecutorService the custom thread pool to use
-     */
     public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
         this.scheduledExecutorService = scheduledExecutorService;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
index 57595b1..182a683 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
@@ -18,11 +18,18 @@ package org.apache.camel.impl;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
+import org.apache.camel.LoggingLevel;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.spi.PollingConsumerPollStrategy;
+import org.apache.camel.spi.ScheduledPollConsumerScheduler;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.IntrospectionSupport;
 
@@ -36,6 +43,41 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
     private static final String SPRING_SCHEDULER = "org.apache.camel.spring.pollingconsumer.SpringScheduledPollConsumerScheduler";
     private static final String QUARTZ_2_SCHEDULER = "org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerScheduler";
 
+    private boolean consumerPropertiesInUse;
+    private String schedulerName;
+
+    // if adding more options then align with org.apache.camel.impl.ScheduledPollConsumer
+    @UriParam(defaultValue = "true", label = "consumer")
+    private boolean startScheduler = true;
+    @UriParam(defaultValue = "1000", label = "consumer")
+    private long initialDelay = 1000;
+    @UriParam(defaultValue = "500", label = "consumer")
+    private long delay = 500;
+    @UriParam(defaultValue = "MILLISECONDS", label = "consumer")
+    private TimeUnit timeUnit = TimeUnit.MILLISECONDS;
+    @UriParam(defaultValue = "true", label = "consumer")
+    private boolean useFixedDelay = true;
+    @UriParam(label = "consumer")
+    private PollingConsumerPollStrategy pollStrategy = new DefaultPollingConsumerPollStrategy();
+    @UriParam(defaultValue = "TRACE", label = "consumer")
+    private LoggingLevel runLoggingLevel = LoggingLevel.TRACE;
+    @UriParam(label = "consumer")
+    private boolean sendEmptyMessageWhenIdle;
+    @UriParam(label = "consumer")
+    private boolean greedy;
+    @UriParam(enums = "spring,quartz2", label = "consumer")
+    private ScheduledPollConsumerScheduler scheduler;
+    @UriParam(label = "consumer")
+    private Map<String, Object> schedulerProperties;
+    @UriParam(label = "consumer")
+    private ScheduledExecutorService scheduledExecutorService;
+    @UriParam(label = "consumer")
+    private int backoffMultiplier;
+    @UriParam(label = "consumer")
+    private int backoffIdleThreshold;
+    @UriParam(label = "consumer")
+    private int backoffErrorThreshold;
+
     protected ScheduledPollEndpoint(String endpointUri, Component component) {
         super(endpointUri, component);
     }
@@ -62,98 +104,28 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
         // special for scheduled poll consumers as we want to allow end users to configure its options
         // from the URI parameters without the consumer. prefix
         Map<String, Object> schedulerProperties = IntrospectionSupport.extractProperties(options, "scheduler.");
-        Object startScheduler = options.remove("startScheduler");
-        Object initialDelay = options.remove("initialDelay");
-        Object delay = options.remove("delay");
-        Object timeUnit = options.remove("timeUnit");
-        Object useFixedDelay = options.remove("useFixedDelay");
-        Object pollStrategy = options.remove("pollStrategy");
-        Object runLoggingLevel = options.remove("runLoggingLevel");
-        Object sendEmptyMessageWhenIdle = options.remove("sendEmptyMessageWhenIdle");
-        Object greedy = options.remove("greedy");
-        Object scheduledExecutorService  = options.remove("scheduledExecutorService");
-        Object scheduler  = options.remove("scheduler");
-        Object backoffMultiplier  = options.remove("backoffMultiplier");
-        Object backoffIdleThreshold  = options.remove("backoffIdleThreshold");
-        Object backoffErrorThreshold  = options.remove("backoffErrorThreshold");
-        boolean setConsumerProperties = false;
-
-        // the following is split into two if statements to satisfy the checkstyle max complexity constraint
-        if (initialDelay != null || delay != null || timeUnit != null || useFixedDelay != null || pollStrategy != null) {
-            setConsumerProperties = true;
-        }
-        if (runLoggingLevel != null || startScheduler != null || sendEmptyMessageWhenIdle != null || greedy != null || scheduledExecutorService != null) {
-            setConsumerProperties = true;
-        }
-        if (scheduler != null || !schedulerProperties.isEmpty() || backoffMultiplier != null || backoffIdleThreshold != null || backoffErrorThreshold != null) {
-            setConsumerProperties = true;
-        }
-
-        if (setConsumerProperties) {
-
-            if (consumerProperties == null) {
-                consumerProperties = new HashMap<String, Object>();
-            }
-            if (initialDelay != null) {
-                consumerProperties.put("initialDelay", initialDelay);
-            }
-            if (startScheduler != null) {
-                consumerProperties.put("startScheduler", startScheduler);
-            }
-            if (delay != null) {
-                consumerProperties.put("delay", delay);
-            }
-            if (timeUnit != null) {
-                consumerProperties.put("timeUnit", timeUnit);
-            }
-            if (useFixedDelay != null) {
-                consumerProperties.put("useFixedDelay", useFixedDelay);
-            }
-            if (pollStrategy != null) {
-                consumerProperties.put("pollStrategy", pollStrategy);
-            }
-            if (runLoggingLevel != null) {
-                consumerProperties.put("runLoggingLevel", runLoggingLevel);
-            }
-            if (sendEmptyMessageWhenIdle != null) {
-                consumerProperties.put("sendEmptyMessageWhenIdle", sendEmptyMessageWhenIdle);
-            }
-            if (greedy != null) {
-                consumerProperties.put("greedy", greedy);
-            }
-            if (scheduledExecutorService != null) {
-                consumerProperties.put("scheduledExecutorService", scheduledExecutorService);
-            }
-            if (scheduler != null) {
-                // special for scheduler if its "spring"
-                if ("spring".equals(scheduler)) {
-                    try {
-                        Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(SPRING_SCHEDULER);
-                        scheduler = getCamelContext().getInjector().newInstance(clazz);
-                    } catch (ClassNotFoundException e) {
-                        throw new IllegalArgumentException("Cannot load " + SPRING_SCHEDULER + " from classpath. Make sure camel-spring.jar is on the classpath.", e);
-                    }
-                } else if ("quartz2".equals(scheduler)) {
-                    try {
-                        Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(QUARTZ_2_SCHEDULER);
-                        scheduler = getCamelContext().getInjector().newInstance(clazz);
-                    } catch (ClassNotFoundException e) {
-                        throw new IllegalArgumentException("Cannot load " + QUARTZ_2_SCHEDULER + " from classpath. Make sure camel-quarz2.jar is on the classpath.", e);
-                    }
+        if (schedulerProperties != null && !schedulerProperties.isEmpty()) {
+            setSchedulerProperties(schedulerProperties);
+        }
+
+        if (scheduler == null && schedulerName != null) {
+            // special for scheduler if its "spring"
+            if ("spring".equals(schedulerName)) {
+                try {
+                    Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(SPRING_SCHEDULER, ScheduledPollConsumerScheduler.class);
+                    setScheduler(getCamelContext().getInjector().newInstance(clazz));
+                } catch (ClassNotFoundException e) {
+                    throw new IllegalArgumentException("Cannot load " + SPRING_SCHEDULER + " from classpath. Make sure camel-spring.jar is on the classpath.", e);
                 }
-                consumerProperties.put("scheduler", scheduler);
-            }
-            if (!schedulerProperties.isEmpty()) {
-                consumerProperties.put("schedulerProperties", schedulerProperties);
-            }
-            if (backoffMultiplier != null) {
-                consumerProperties.put("backoffMultiplier", backoffMultiplier);
-            }
-            if (backoffIdleThreshold != null) {
-                consumerProperties.put("backoffIdleThreshold", backoffIdleThreshold);
-            }
-            if (backoffErrorThreshold != null) {
-                consumerProperties.put("backoffErrorThreshold", backoffErrorThreshold);
+            } else if ("quartz2".equals(schedulerName)) {
+                try {
+                    Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(QUARTZ_2_SCHEDULER, ScheduledPollConsumerScheduler.class);
+                    setScheduler(getCamelContext().getInjector().newInstance(clazz));
+                } catch (ClassNotFoundException e) {
+                    throw new IllegalArgumentException("Cannot load " + QUARTZ_2_SCHEDULER + " from classpath. Make sure camel-quarz2.jar is on the classpath.", e);
+                }
+            } else {
+                setScheduler(CamelContextHelper.mandatoryLookup(getCamelContext(), schedulerName, ScheduledPollConsumerScheduler.class));
             }
         }
     }
@@ -179,4 +151,268 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
         }
     }
 
+    @Override
+    protected void doStart() throws Exception {
+        // if any of the consumer properties was configured then we need to initialize the options before starting
+        if (consumerPropertiesInUse) {
+            initConsumerProperties();
+        }
+
+        super.doStart();
+    }
+
+    protected void initConsumerProperties() {
+        // must setup consumer properties before we are ready to start
+        Map<String, Object> options = getConsumerProperties();
+        if (!options.containsKey("startScheduler")) {
+            options.put("startScheduler", isStartScheduler());
+        }
+        if (!options.containsKey("initialDelay")) {
+            options.put("initialDelay", getInitialDelay());
+        }
+        if (!options.containsKey("delay")) {
+            options.put("delay", getDelay());
+        }
+        if (!options.containsKey("timeUnit")) {
+            options.put("timeUnit", getTimeUnit());
+        }
+        if (!options.containsKey("useFixedDelay")) {
+            options.put("useFixedDelay", isUseFixedDelay());
+        }
+        if (!options.containsKey("pollStrategy")) {
+            options.put("pollStrategy", getPollStrategy());
+        }
+        if (!options.containsKey("runLoggingLevel")) {
+            options.put("runLoggingLevel", getRunLoggingLevel());
+        }
+        if (!options.containsKey("sendEmptyMessageWhenIdle")) {
+            options.put("sendEmptyMessageWhenIdle", isSendEmptyMessageWhenIdle());
+        }
+        if (!options.containsKey("greedy")) {
+            options.put("greedy", isGreedy());
+        }
+        if (!options.containsKey("scheduler")) {
+            options.put("scheduler", getScheduler());
+        }
+        if (!options.containsKey("schedulerProperties")) {
+            options.put("schedulerProperties", getSchedulerProperties());
+        }
+        if (!options.containsKey("scheduledExecutorService")) {
+            options.put("scheduledExecutorService", getScheduledExecutorService());
+        }
+        if (!options.containsKey("backoffMultiplier")) {
+            options.put("backoffMultiplier", getBackoffMultiplier());
+        }
+        if (!options.containsKey("backoffIdleThreshold")) {
+            options.put("backoffIdleThreshold", getBackoffIdleThreshold());
+        }
+        if (!options.containsKey("backoffErrorThreshold")) {
+            options.put("backoffErrorThreshold", getBackoffErrorThreshold());
+        }
+    }
+
+    public boolean isStartScheduler() {
+        return startScheduler;
+    }
+
+    /**
+     * Whether the scheduler should be auto started.
+     */
+    public void setStartScheduler(boolean startScheduler) {
+        this.startScheduler = startScheduler;
+        consumerPropertiesInUse = true;
+    }
+
+    public long getInitialDelay() {
+        return initialDelay;
+    }
+
+    /**
+     * Milliseconds before the first poll starts.
+     */
+    public void setInitialDelay(long initialDelay) {
+        this.initialDelay = initialDelay;
+        consumerPropertiesInUse = true;
+    }
+
+    public long getDelay() {
+        return delay;
+    }
+
+    /**
+     * Milliseconds before the next poll.
+     */
+    public void setDelay(long delay) {
+        this.delay = delay;
+        consumerPropertiesInUse = true;
+    }
+
+    public TimeUnit getTimeUnit() {
+        return timeUnit;
+    }
+
+    /**
+     * Time unit for initialDelay and delay options.
+     */
+    public void setTimeUnit(TimeUnit timeUnit) {
+        this.timeUnit = timeUnit;
+        consumerPropertiesInUse = true;
+    }
+
+    public boolean isUseFixedDelay() {
+        return useFixedDelay;
+    }
+
+    /**
+     * Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.
+     */
+    public void setUseFixedDelay(boolean useFixedDelay) {
+        this.useFixedDelay = useFixedDelay;
+        consumerPropertiesInUse = true;
+    }
+
+    public PollingConsumerPollStrategy getPollStrategy() {
+        return pollStrategy;
+    }
+
+    /**
+     * A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation
+     * to control error handling usually occurred during the poll operation before an Exchange have been created
+     * and being routed in Camel. In other words the error occurred while the polling was gathering information,
+     * for instance access to a file network failed so Camel cannot access it to scan for files.
+     * The default implementation will log the caused exception at WARN level and ignore it.
+     */
+    public void setPollStrategy(PollingConsumerPollStrategy pollStrategy) {
+        this.pollStrategy = pollStrategy;
+        consumerPropertiesInUse = true;
+    }
+
+    public LoggingLevel getRunLoggingLevel() {
+        return runLoggingLevel;
+    }
+
+    /**
+     * The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.
+     */
+    public void setRunLoggingLevel(LoggingLevel runLoggingLevel) {
+        this.runLoggingLevel = runLoggingLevel;
+        consumerPropertiesInUse = true;
+    }
+
+    public boolean isSendEmptyMessageWhenIdle() {
+        return sendEmptyMessageWhenIdle;
+    }
+
+    /**
+     * If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead.
+     */
+    public void setSendEmptyMessageWhenIdle(boolean sendEmptyMessageWhenIdle) {
+        this.sendEmptyMessageWhenIdle = sendEmptyMessageWhenIdle;
+        consumerPropertiesInUse = true;
+    }
+
+    public boolean isGreedy() {
+        return greedy;
+    }
+
+    /**
+     * If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.
+     */
+    public void setGreedy(boolean greedy) {
+        this.greedy = greedy;
+        consumerPropertiesInUse = true;
+    }
+
+    public ScheduledPollConsumerScheduler getScheduler() {
+        return scheduler;
+    }
+
+    /**
+     * Allow to plugin a custom org.apache.camel.spi.ScheduledPollConsumerScheduler to use as the scheduler for
+     * firing when the polling consumer runs. The default implementation uses the ScheduledExecutorService and
+     * there is a Quartz2, and Spring based which supports CRON expressions.
+     *
+     * Notice: If using a custom scheduler then the options for initialDelay, useFixedDelay, timeUnit,
+     * and scheduledExecutorService may not be in use. Use the text quartz2 to refer to use the Quartz2 scheduler;
+     * and use the text spring to use the Spring based; and use the text #myScheduler to refer to a custom scheduler
+     * by its id in the Registry. See Quartz2 page for an example.
+     */
+    public void setScheduler(ScheduledPollConsumerScheduler scheduler) {
+        this.scheduler = scheduler;
+        consumerPropertiesInUse = true;
+    }
+
+    /**
+     * Allow to plugin a custom org.apache.camel.spi.ScheduledPollConsumerScheduler to use as the scheduler for
+     * firing when the polling consumer runs. This option is used for referring to one of the built-in schedulers
+     * either <tt>spring</tt>, or <tt>quartz2</tt>.
+     */
+    public void setScheduler(String schedulerName) {
+        this.schedulerName = schedulerName;
+        consumerPropertiesInUse = true;
+    }
+
+    public Map<String, Object> getSchedulerProperties() {
+        return schedulerProperties;
+    }
+
+    /**
+     * To configure additional properties when using a custom scheduler or any of the Quartz2, Spring based scheduler.
+     */
+    public void setSchedulerProperties(Map<String, Object> schedulerProperties) {
+        this.schedulerProperties = schedulerProperties;
+        consumerPropertiesInUse = true;
+    }
+
+    public ScheduledExecutorService getScheduledExecutorService() {
+        return scheduledExecutorService;
+    }
+
+    /**
+     * Allows for configuring a custom/shared thread pool to use for the consumer.
+     * By default each consumer has its own single threaded thread pool.
+     * This option allows you to share a thread pool among multiple consumers.
+     */
+    public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
+        this.scheduledExecutorService = scheduledExecutorService;
+        consumerPropertiesInUse = true;
+    }
+
+    public int getBackoffMultiplier() {
+        return backoffMultiplier;
+    }
+
+    /**
+     * To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row.
+     * The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again.
+     * When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
+     */
+    public void setBackoffMultiplier(int backoffMultiplier) {
+        this.backoffMultiplier = backoffMultiplier;
+        consumerPropertiesInUse = true;
+    }
+
+    public int getBackoffIdleThreshold() {
+        return backoffIdleThreshold;
+    }
+
+    /**
+     * The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
+     */
+    public void setBackoffIdleThreshold(int backoffIdleThreshold) {
+        this.backoffIdleThreshold = backoffIdleThreshold;
+        consumerPropertiesInUse = true;
+    }
+
+    public int getBackoffErrorThreshold() {
+        return backoffErrorThreshold;
+    }
+
+    /**
+     * The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.
+     */
+    public void setBackoffErrorThreshold(int backoffErrorThreshold) {
+        this.backoffErrorThreshold = backoffErrorThreshold;
+        consumerPropertiesInUse = true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyNotBeginTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyNotBeginTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyNotBeginTest.java
index 6fb087a..a019d2c 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyNotBeginTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyNotBeginTest.java
@@ -44,8 +44,8 @@ public class FileConsumerPollStrategyNotBeginTest extends ContextTestSupport {
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
         deleteDirectory("target/pollstrategy");
+        super.setUp();
         template.sendBodyAndHeader("file:target/pollstrategy/", "Hello World", Exchange.FILE_NAME, "hello.txt");
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
index 2714fc2..f88198c 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
@@ -47,8 +47,8 @@ public class FileConsumerPollStrategyPolledMessagesTest extends ContextTestSuppo
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
         deleteDirectory("target/pollstrategy");
+        super.setUp();
     }
 
     public void testPolledMessages() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyRollbackThrowExceptionTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyRollbackThrowExceptionTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyRollbackThrowExceptionTest.java
index 0894f33..25ffa9c 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyRollbackThrowExceptionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyRollbackThrowExceptionTest.java
@@ -42,8 +42,8 @@ public class FileConsumerPollStrategyRollbackThrowExceptionTest extends ContextT
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
         deleteDirectory("target/pollstrategy");
+        super.setUp();
         template.sendBodyAndHeader("file:target/pollstrategy/", "Hello World", Exchange.FILE_NAME, "hello.txt");
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
index 68d788f..0408ae3 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
@@ -45,8 +45,8 @@ public class FileConsumerPollStrategyStopOnRollbackTest extends ContextTestSuppo
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
         deleteDirectory("target/pollstrategy");
+        super.setUp();
         template.sendBodyAndHeader("file:target/pollstrategy/", "Hello World", Exchange.FILE_NAME, "hello.txt");
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/82eaad58/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyTest.java
index 714965b..2769bae 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyTest.java
@@ -44,8 +44,8 @@ public class FileConsumerPollStrategyTest extends ContextTestSupport {
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
         deleteDirectory("target/pollstrategy");
+        super.setUp();
         template.sendBodyAndHeader("file:target/pollstrategy/", "Hello World", Exchange.FILE_NAME, "hello.txt");
     }
 


[8/8] camel git commit: CAMEL-7999: apt plugin supports labels per component and endpoint options

Posted by da...@apache.org.
CAMEL-7999: apt plugin supports labels per component and endpoint options


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

Branch: refs/heads/master
Commit: 85ab834f214a432367600a16d01d63fc7a333ce6
Parents: 3fc476e
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 11:36:27 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:34 2015 +0100

----------------------------------------------------------------------
 .../DirectComponentConfigurationAndDocumentationTest.java    | 8 ++++----
 .../DirectVmComponentConfigurationAndDocumentationTest.java  | 4 ++--
 .../file/FileComponentConfigurationAndDocumentationTest.java | 5 +++--
 .../seda/SedaComponentConfigurationAndDocumentationTest.java | 5 +++--
 4 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/85ab834f/camel-core/src/test/java/org/apache/camel/component/direct/DirectComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/direct/DirectComponentConfigurationAndDocumentationTest.java b/camel-core/src/test/java/org/apache/camel/component/direct/DirectComponentConfigurationAndDocumentationTest.java
index d588823..43823e9 100644
--- a/camel-core/src/test/java/org/apache/camel/component/direct/DirectComponentConfigurationAndDocumentationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/direct/DirectComponentConfigurationAndDocumentationTest.java
@@ -41,8 +41,8 @@ public class DirectComponentConfigurationAndDocumentationTest extends ContextTes
         String json = compConf.createParameterJsonSchema();
         assertNotNull(json);
 
-        assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"type\": \"integer\""));
-        assertTrue(json.contains("\"block\": { \"kind\": \"parameter\", \"type\": \"boolean\""));
+        assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"integer\""));
+        assertTrue(json.contains("\"block\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"boolean\""));
     }
 
     @Test
@@ -60,8 +60,8 @@ public class DirectComponentConfigurationAndDocumentationTest extends ContextTes
         log.info(json);
 
         // should include javadoc
-        assertTrue("Should include javadoc", json.contains("\"timeout\": { \"kind\": \"parameter\", \"type\": \"integer\", \"javaType\": \"long\","
-                + " \"deprecated\": \"false\", \"defaultValue\": \"30000\","
+        assertTrue("Should include javadoc", json.contains("\"timeout\": { \"kind\": \"parameter\", \"label\": \"producer\","
+                + " \"type\": \"integer\", \"javaType\": \"long\", \"deprecated\": \"false\", \"defaultValue\": \"30000\","
                 + " \"description\": \"The timeout value to use if block is enabled."));
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/85ab834f/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmComponentConfigurationAndDocumentationTest.java b/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmComponentConfigurationAndDocumentationTest.java
index 8cafb3e..f548ce4 100644
--- a/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmComponentConfigurationAndDocumentationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmComponentConfigurationAndDocumentationTest.java
@@ -41,8 +41,8 @@ public class DirectVmComponentConfigurationAndDocumentationTest extends ContextT
         String json = compConf.createParameterJsonSchema();
         assertNotNull(json);
 
-        assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"type\": \"integer\""));
-        assertTrue(json.contains("\"block\": { \"kind\": \"parameter\", \"type\": \"boolean\""));
+        assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"integer\""));
+        assertTrue(json.contains("\"block\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"boolean\""));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/85ab834f/camel-core/src/test/java/org/apache/camel/component/file/FileComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileComponentConfigurationAndDocumentationTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileComponentConfigurationAndDocumentationTest.java
index 7693c4b..fd2355a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileComponentConfigurationAndDocumentationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileComponentConfigurationAndDocumentationTest.java
@@ -41,8 +41,9 @@ public class FileComponentConfigurationAndDocumentationTest extends ContextTestS
         String json = compConf.createParameterJsonSchema();
         assertNotNull(json);
 
-        assertTrue(json.contains("\"exclude\": { \"kind\": \"parameter\", \"type\": \"string\""));
-        assertTrue(json.contains("\"delete\": { \"kind\": \"parameter\", \"type\": \"boolean\""));
+        assertTrue(json.contains("\"doneFileName\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"string\""));
+        assertTrue(json.contains("\"exclude\": { \"kind\": \"parameter\", \"label\": \"consumer\", \"type\": \"string\""));
+        assertTrue(json.contains("\"delete\": { \"kind\": \"parameter\", \"label\": \"consumer\", \"type\": \"boolean\""));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/85ab834f/camel-core/src/test/java/org/apache/camel/component/seda/SedaComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SedaComponentConfigurationAndDocumentationTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SedaComponentConfigurationAndDocumentationTest.java
index b3fea69..c1c2973 100644
--- a/camel-core/src/test/java/org/apache/camel/component/seda/SedaComponentConfigurationAndDocumentationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/seda/SedaComponentConfigurationAndDocumentationTest.java
@@ -41,8 +41,9 @@ public class SedaComponentConfigurationAndDocumentationTest extends ContextTestS
         String json = compConf.createParameterJsonSchema();
         assertNotNull(json);
 
-        assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"type\": \"integer\""));
-        assertTrue(json.contains("\"blockWhenFull\": { \"kind\": \"parameter\", \"type\": \"boolean\""));
+        assertTrue(json.contains("\"concurrentConsumers\": { \"kind\": \"parameter\", \"label\": \"consumer\", \"type\": \"integer\""));
+        assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"integer\""));
+        assertTrue(json.contains("\"blockWhenFull\": { \"kind\": \"parameter\", \"label\": \"producer\", \"type\": \"boolean\""));
     }
 
     @Test


[4/8] camel git commit: CAMEL-7999: apt plugin supports labels per component and endpoint options

Posted by da...@apache.org.
CAMEL-7999: apt plugin supports labels per component and endpoint options


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

Branch: refs/heads/master
Commit: 7c7f21e1829d3857339d88649ee103eae1705d97
Parents: 82eaad5
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 08:50:52 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:33 2015 +0100

----------------------------------------------------------------------
 .../tools/apt/EndpointAnnotationProcessor.java  | 44 +++++++++++++++-----
 .../camel/tools/apt/JsonSchemaHelper.java       |  2 +-
 2 files changed, 35 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7c7f21e1/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index 949b846..89caf07 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -207,6 +207,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             String doc = entry.getDocumentationWithNotes();
             doc = sanitizeDescription(doc, false);
             Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
+
             buffer.append(JsonSchemaHelper.toJson(entry.getName(), "property", required, entry.getType(), entry.getDefaultValue(), doc,
                     entry.isDeprecated(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null));
         }
@@ -214,23 +215,45 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
 
         buffer.append("\n  \"properties\": {");
         first = true;
+
         // include paths in the top
-        for (EndpointPath path : endpointPaths) {
+        for (EndpointPath entry : endpointPaths) {
+            String label = entry.getLabel();
+            if (label != null) {
+                // skip options which are either consumer or producer labels but the component does not support them
+                if (label.contains("consumer") && componentModel.isProducerOnly()) {
+                    continue;
+                } else if (label.contains("producer") && componentModel.isConsumerOnly()) {
+                    continue;
+                }
+            }
+
             if (first) {
                 first = false;
             } else {
                 buffer.append(",");
             }
             buffer.append("\n    ");
-            String doc = path.getDocumentation();
+            String doc = entry.getDocumentation();
             doc = sanitizeDescription(doc, false);
-            Boolean required = path.getRequired() != null ? Boolean.valueOf(path.getRequired()) : null;
-            buffer.append(JsonSchemaHelper.toJson(path.getName(), "path", required, path.getType(), null, doc,
-                    path.isDeprecated(), path.getLabel(), path.isEnumType(), path.getEnums(), false, null));
+            Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
+
+            buffer.append(JsonSchemaHelper.toJson(entry.getName(), "path", required, entry.getType(), null, doc,
+                    entry.isDeprecated(), label, entry.isEnumType(), entry.getEnums(), false, null));
         }
 
         // and then regular parameter options
         for (EndpointOption entry : endpointOptions) {
+            String label = entry.getLabel();
+            if (label != null) {
+                // skip options which are either consumer or producer labels but the component does not support them
+                if (label.contains("consumer") && componentModel.isProducerOnly()) {
+                    continue;
+                } else if (label.contains("producer") && componentModel.isConsumerOnly()) {
+                    continue;
+                }
+            }
+
             if (first) {
                 first = false;
             } else {
@@ -241,8 +264,9 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             String doc = entry.getDocumentationWithNotes();
             doc = sanitizeDescription(doc, false);
             Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
+
             buffer.append(JsonSchemaHelper.toJson(entry.getName(), "parameter", required, entry.getType(), entry.getDefaultValue(),
-                    doc, entry.isDeprecated(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null));
+                    doc, entry.isDeprecated(), label, entry.isEnumType(), entry.getEnums(), false, null));
         }
         buffer.append("\n  }");
 
@@ -455,7 +479,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                     }
                     name = prefix + name;
 
-                    String labels = path.label();
+                    String label = path.label();
                     String required = metadata != null ? metadata.required() : null;
 
                     TypeMirror fieldType = fieldElement.asType();
@@ -492,7 +516,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         }
                     }
 
-                    EndpointPath ep = new EndpointPath(name, fieldTypeName, required, docComment, deprecated, labels, isEnum, enums);
+                    EndpointPath ep = new EndpointPath(name, fieldTypeName, required, docComment, deprecated, label, isEnum, enums);
                     endpointPaths.add(ep);
                 }
 
@@ -508,7 +532,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                     String defaultValue = param.defaultValue();
                     String defaultValueNote = param.defaultValueNote();
                     String required =  metadata != null ? metadata.required() : null;
-                    String labels = param.label();
+                    String label = param.label();
 
                     // if the field type is a nested parameter then iterate through its fields
                     TypeMirror fieldType = fieldElement.asType();
@@ -557,7 +581,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         }
 
                         EndpointOption option = new EndpointOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
-                                docComment.trim(), deprecated, labels, isEnum, enums);
+                                docComment.trim(), deprecated, label, isEnum, enums);
                         endpointOptions.add(option);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/7c7f21e1/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
index 8aadb99..5c19aa2 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
@@ -84,7 +84,7 @@ final class JsonSchemaHelper {
             sb.append(Strings.doubleQuote(text));
         }
 
-        if (label != null) {
+        if (!Strings.isNullOrEmpty(label)) {
             sb.append(", \"label\": ");
             sb.append(Strings.doubleQuote(label));
         }


[5/8] camel git commit: CAMEL-7999: apt plugin supports labels per component and endpoint options

Posted by da...@apache.org.
CAMEL-7999: apt plugin supports labels per component and endpoint options


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

Branch: refs/heads/master
Commit: a1ee6ed385864714afdf5dd0d2ecd6daa10e496a
Parents: c4c7daf
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 10:54:13 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:33 2015 +0100

----------------------------------------------------------------------
 .../management/mbean/CamelOpenMBeanTypes.java   | 18 ++---
 .../apache/camel/impl/DefaultCamelContext.java  | 71 +++++++++++++-------
 .../management/mbean/ManagedComponent.java      |  5 +-
 .../camel/management/mbean/ManagedEndpoint.java |  5 +-
 .../management/mbean/ManagedProcessor.java      |  5 +-
 5 files changed, 63 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a1ee6ed3/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
index 5ebdb1c..2f87a3a 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
@@ -72,9 +72,9 @@ public final class CamelOpenMBeanTypes {
     }
 
     public static CompositeType explainComponentCompositeType() throws OpenDataException {
-        return new CompositeType("components", "Components", new String[]{"option", "kind", "type", "java type", "deprecated", "value", "default value", "description"},
-                new String[]{"Option", "Kind", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
-                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
+        return new CompositeType("components", "Components", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
+                new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
+                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
     }
 
     public static TabularType explainEndpointTabularType() throws OpenDataException {
@@ -83,9 +83,9 @@ public final class CamelOpenMBeanTypes {
     }
 
     public static CompositeType explainEndpointsCompositeType() throws OpenDataException {
-        return new CompositeType("endpoints", "Endpoints", new String[]{"option", "kind", "type", "java type", "deprecated", "value", "default value", "description"},
-                new String[]{"Option", "Kind", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
-                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
+        return new CompositeType("endpoints", "Endpoints", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
+                new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
+                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
     }
 
     public static TabularType explainEipTabularType() throws OpenDataException {
@@ -94,9 +94,9 @@ public final class CamelOpenMBeanTypes {
     }
 
     public static CompositeType explainEipsCompositeType() throws OpenDataException {
-        return new CompositeType("eips", "EIPs", new String[]{"option", "kind", "type", "java type", "deprecated", "value", "default value", "description"},
-                new String[]{"Option", "Kind", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
-                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
+        return new CompositeType("eips", "EIPs", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
+                new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
+                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
     }
 
     public static TabularType listComponentsTabularType() throws OpenDataException {

http://git-wip-us.apache.org/repos/asf/camel/blob/a1ee6ed3/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 68afa2f..d36b8e6 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -1394,6 +1394,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 for (Map<String, String> row : rows) {
                     String name = row.get("name");
                     String kind = row.get("kind");
+                    String label = row.get("label");
                     String required = row.get("required");
                     String value = row.get("value");
                     String defaultValue = row.get("defaultValue");
@@ -1413,7 +1414,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                     if (includeAllOptions || o != null) {
                         // add as selected row
                         if (!selected.containsKey(name)) {
-                            selected.put(name, new String[]{name, kind, required, type, javaType, deprecated, value, defaultValue, description});
+                            selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
                         }
                     }
                 }
@@ -1433,13 +1434,14 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
 
                     String name = row[0];
                     String kind = row[1];
-                    String required = row[2];
-                    String type = row[3];
-                    String javaType = row[4];
-                    String deprecated = row[5];
-                    String value = row[6];
-                    String defaultValue = row[7];
-                    String description = row[8];
+                    String label = row[2];
+                    String required = row[3];
+                    String type = row[4];
+                    String javaType = row[5];
+                    String deprecated = row[6];
+                    String value = row[7];
+                    String defaultValue = row[8];
+                    String description = row[9];
 
                     // add json of the option
                     buffer.append(doubleQuote(name)).append(": { ");
@@ -1447,6 +1449,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                     if (kind != null) {
                         csb.append("\"kind\": \"" + kind + "\"");
                     }
+                    if (label != null) {
+                        csb.append("\"label\": \"" + label + "\"");
+                    }
                     if (required != null) {
                         csb.append("\"required\": \"" + required + "\"");
                     }
@@ -1522,6 +1527,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 // find type and description from the json schema
                 String type = null;
                 String kind = null;
+                String label = null;
                 String required = null;
                 String javaType = null;
                 String deprecated = null;
@@ -1531,6 +1537,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                     if (name.equals(row.get("name"))) {
                         type = row.get("type");
                         kind = row.get("kind");
+                        label = row.get("label");
                         required = row.get("required");
                         javaType = row.get("javaType");
                         deprecated = row.get("deprecated");
@@ -1541,13 +1548,14 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 }
 
                 // add as selected row
-                selected.put(name, new String[]{name, kind, required, type, javaType, deprecated, value, defaultValue, description});
+                selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
             }
 
             // include other rows
             for (Map<String, String> row : rows) {
                 String name = row.get("name");
                 String kind = row.get("kind");
+                String label = row.get("label");
                 String required = row.get("required");
                 String value = row.get("value");
                 String defaultValue = row.get("defaultValue");
@@ -1561,7 +1569,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 if (includeAllOptions) {
                     // add as selected row
                     if (!selected.containsKey(name)) {
-                        selected.put(name, new String[]{name, kind, required, type, javaType, deprecated, value, defaultValue, description});
+                        selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
                     }
                 }
             }
@@ -1581,13 +1589,14 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
 
                 String name = row[0];
                 String kind = row[1];
-                String required = row[2];
-                String type = row[3];
-                String javaType = row[4];
-                String deprecated = row[5];
-                String value = row[6];
-                String defaultValue = row[7];
-                String description = row[8];
+                String label = row[2];
+                String required = row[3];
+                String type = row[4];
+                String javaType = row[5];
+                String deprecated = row[6];
+                String value = row[7];
+                String defaultValue = row[8];
+                String description = row[9];
 
                 // add json of the option
                 buffer.append(doubleQuote(name)).append(": { ");
@@ -1595,6 +1604,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 if (kind != null) {
                     csb.append("\"kind\": \"" + kind + "\"");
                 }
+                if (label != null) {
+                    csb.append("\"label\": \"" + label + "\"");
+                }
                 if (required != null) {
                     csb.append("\"required\": \"" + required + "\"");
                 }
@@ -1667,6 +1679,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 // find type and description from the json schema
                 String type = null;
                 String kind = null;
+                String label = null;
                 String required = null;
                 String javaType = null;
                 String deprecated = null;
@@ -1676,6 +1689,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                     if (name.equals(row.get("name"))) {
                         type = row.get("type");
                         kind = row.get("kind");
+                        label = row.get("label");
                         required = row.get("required");
                         javaType = row.get("javaType");
                         deprecated = row.get("deprecated");
@@ -1686,13 +1700,14 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 }
 
                 // add as selected row
-                selected.put(name, new String[]{name, kind, required, type, javaType, deprecated, value, defaultValue, description});
+                selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
             }
 
             // include other rows
             for (Map<String, String> row : rows) {
                 String name = row.get("name");
                 String kind = row.get("kind");
+                String label = row.get("label");
                 String required = row.get("required");
                 String value = row.get("value");
                 String defaultValue = row.get("defaultValue");
@@ -1712,7 +1727,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 if (includeAllOptions || "path".equals(kind)) {
                     // add as selected row
                     if (!selected.containsKey(name)) {
-                        selected.put(name, new String[]{name, kind, required, type, javaType, deprecated, value, defaultValue, description});
+                        selected.put(name, new String[]{name, kind, label, required, type, javaType, deprecated, value, defaultValue, description});
                     }
                 }
             }
@@ -1732,13 +1747,14 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
 
                 String name = row[0];
                 String kind = row[1];
-                String required = row[2];
-                String type = row[3];
-                String javaType = row[4];
-                String deprecated = row[5];
-                String value = row[6];
-                String defaultValue = row[7];
-                String description = row[8];
+                String label = row[2];
+                String required = row[3];
+                String type = row[4];
+                String javaType = row[5];
+                String deprecated = row[6];
+                String value = row[7];
+                String defaultValue = row[8];
+                String description = row[9];
 
                 // add json of the option
                 buffer.append(doubleQuote(name)).append(": { ");
@@ -1746,6 +1762,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
                 if (kind != null) {
                     csb.append("\"kind\": \"" + kind + "\"");
                 }
+                if (label != null) {
+                    csb.append("\"label\": \"" + label + "\"");
+                }
                 if (required != null) {
                     csb.append("\"required\": \"" + required + "\"");
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a1ee6ed3/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
index b9405af..fea76b2 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedComponent.java
@@ -112,6 +112,7 @@ public class ManagedComponent implements ManagedInstance, ManagedComponentMBean
             for (Map<String, String> row : rows) {
                 String name = row.get("name");
                 String kind = row.get("kind");
+                String label = row.get("label") != null ? row.get("label") : "";
                 String type = row.get("type");
                 String javaType = row.get("javaType");
                 String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
@@ -121,8 +122,8 @@ public class ManagedComponent implements ManagedInstance, ManagedComponentMBean
 
                 CompositeType ct = CamelOpenMBeanTypes.explainComponentCompositeType();
                 CompositeData data = new CompositeDataSupport(ct,
-                        new String[]{"option", "kind", "type", "java type", "deprecated", "value", "default value", "description"},
-                        new Object[]{name, kind, type, javaType, deprecated, value, defaultValue, description});
+                        new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
+                        new Object[]{name, kind, label, type, javaType, deprecated, value, defaultValue, description});
                 answer.put(data);
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a1ee6ed3/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
index 000794a..20c2be7 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
@@ -99,6 +99,7 @@ public class ManagedEndpoint implements ManagedInstance, ManagedEndpointMBean {
             for (Map<String, String> row : rows) {
                 String name = row.get("name");
                 String kind = row.get("kind");
+                String label = row.get("label") != null ? row.get("label") : "";
                 String type = row.get("type");
                 String javaType = row.get("javaType");
                 String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
@@ -108,8 +109,8 @@ public class ManagedEndpoint implements ManagedInstance, ManagedEndpointMBean {
 
                 CompositeType ct = CamelOpenMBeanTypes.explainEndpointsCompositeType();
                 CompositeData data = new CompositeDataSupport(ct,
-                        new String[]{"option", "kind", "type", "java type", "deprecated", "value", "default value", "description"},
-                        new Object[]{name, kind, type, javaType, deprecated, value, defaultValue, description});
+                        new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
+                        new Object[]{name, kind, label, type, javaType, deprecated, value, defaultValue, description});
                 answer.put(data);
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a1ee6ed3/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
index 7eb0cbb..39a7dc1 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
@@ -151,6 +151,7 @@ public class ManagedProcessor extends ManagedPerformanceCounter implements Manag
             for (Map<String, String> row : rows) {
                 String name = row.get("name");
                 String kind = row.get("kind");
+                String label = row.get("label") != null ? row.get("label") : "";
                 String type = row.get("type");
                 String javaType = row.get("javaType");
                 String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
@@ -160,8 +161,8 @@ public class ManagedProcessor extends ManagedPerformanceCounter implements Manag
 
                 CompositeType ct = CamelOpenMBeanTypes.explainEipsCompositeType();
                 CompositeData data = new CompositeDataSupport(ct,
-                        new String[]{"option", "kind", "type", "java type", "deprecated", "value", "default value", "description"},
-                        new Object[]{name, kind, type, javaType, deprecated, value, defaultValue, description});
+                        new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
+                        new Object[]{name, kind, label, type, javaType, deprecated, value, defaultValue, description});
                 answer.put(data);
             }
 


[6/8] camel git commit: CAMEL-7999: Scheduled poll endpoints should include all its consumer related options as well in component documentation.

Posted by da...@apache.org.
CAMEL-7999: Scheduled poll endpoints should include all its consumer related options as well in component documentation.


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

Branch: refs/heads/master
Commit: 0670b6ee7fab46f218d49e0a3a1ced2ef8982a0a
Parents: 7c7f21e
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 10:31:21 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:33 2015 +0100

----------------------------------------------------------------------
 .../camel/component/file/FileEndpoint.java      |   2 +-
 .../component/file/GenericFileEndpoint.java     | 126 ++++++++++---------
 2 files changed, 68 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0670b6ee/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
index 680779f..f02e69e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
@@ -44,7 +44,7 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
     private boolean copyAndDeleteOnRenameFail = true;
     @UriParam(defaultValue = "false")
     private boolean renameUsingCopy;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "producer", defaultValue = "true")
     private boolean forceWrites = true;
 
     public FileEndpoint() {

http://git-wip-us.apache.org/repos/asf/camel/blob/0670b6ee/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index 596edb9..3dad350 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -65,101 +65,109 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
 
     protected final Logger log = LoggerFactory.getLogger(getClass());
 
+    // common options
+
+    @UriParam(defaultValue = "true")
+    protected boolean autoCreate = true;
+    @UriParam(defaultValue = "" + FileUtil.BUFFER_SIZE)
+    protected int bufferSize = FileUtil.BUFFER_SIZE;
+    @UriParam(defaultValue = "false")
+    protected boolean flatten;
     @UriParam
-    protected GenericFileConfiguration configuration;
+    protected String charset;
     @UriParam
-    protected GenericFileProcessStrategy<T> processStrategy;
+    protected Expression fileName;
+
+    // producer options
+
+    @UriParam(label = "producer", defaultValue = "Override")
+    protected GenericFileExist fileExist = GenericFileExist.Override;
+    @UriParam(label = "producer")
+    protected String tempPrefix;
+    @UriParam(label = "producer")
+    protected Expression tempFileName;
+    @UriParam(label = "producer", defaultValue = "true")
+    protected boolean eagerDeleteTargetFile = true;
+    @UriParam(defaultValue = "false", label = "producer")
+    protected boolean keepLastModified;
+    @UriParam(label = "producer")
+    protected String doneFileName;
+    @UriParam(label = "producer", defaultValue = "false")
+    protected boolean allowNullBody;
+    @UriParam(label = "producer")
+    protected String chmod;
+
+    // consumer options
+
     @UriParam
+    protected GenericFileConfiguration configuration;
+    @UriParam(label = "consumer")
+    protected GenericFileProcessStrategy<T> processStrategy;
+    @UriParam(label = "consumer")
     protected IdempotentRepository<String> inProgressRepository = new MemoryIdempotentRepository();
-    @UriParam
+    @UriParam(label = "consumer")
     protected String localWorkDirectory;
-    @UriParam(defaultValue = "true")
-    protected boolean autoCreate = true;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "consumer", defaultValue = "false")
     protected boolean startingDirectoryMustExist;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "consumer", defaultValue = "false")
     protected boolean directoryMustExist;
-    @UriParam(defaultValue = "" + FileUtil.BUFFER_SIZE)
-    protected int bufferSize = FileUtil.BUFFER_SIZE;
-    @UriParam(defaultValue = "Override")
-    protected GenericFileExist fileExist = GenericFileExist.Override;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "consumer", defaultValue = "false")
     protected boolean noop;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "consumer", defaultValue = "false")
     protected boolean recursive;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "consumer", defaultValue = "false")
     protected boolean delete;
-    @UriParam(defaultValue = "false")
-    protected boolean flatten;
-    @UriParam
+    @UriParam(label = "consumer")
     protected int maxMessagesPerPoll;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "consumer", defaultValue = "true")
     protected boolean eagerMaxMessagesPerPoll = true;
-    @UriParam(defaultValue = "" + Integer.MAX_VALUE)
+    @UriParam(label = "consumer", defaultValue = "" + Integer.MAX_VALUE)
     protected int maxDepth = Integer.MAX_VALUE;
-    @UriParam
+    @UriParam(label = "consumer")
     protected int minDepth;
-    @UriParam
-    protected String tempPrefix;
-    @UriParam
-    protected Expression tempFileName;
-    @UriParam(defaultValue = "true")
-    protected boolean eagerDeleteTargetFile = true;
-    @UriParam
+    @UriParam(label = "consumer")
     protected String include;
-    @UriParam
+    @UriParam(label = "consumer")
     protected String exclude;
-    @UriParam
-    protected String charset;
-    @UriParam
-    protected Expression fileName;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Expression move;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Expression moveFailed;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Expression preMove;
-    @UriParam
+    @UriParam(label = "producer")
     protected Expression moveExisting;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Boolean idempotent;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Expression idempotentKey;
-    @UriParam
+    @UriParam(label = "consumer")
     protected IdempotentRepository<String> idempotentRepository;
-    @UriParam
+    @UriParam(label = "consumer")
     protected GenericFileFilter<T> filter;
     protected volatile AntPathMatcherGenericFileFilter<T> antFilter;
-    @UriParam
+    @UriParam(label = "consumer")
     protected String antInclude;
-    @UriParam
+    @UriParam(label = "consumer")
     protected String antExclude;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Comparator<GenericFile<T>> sorter;
-    @UriParam
+    @UriParam(label = "consumer")
     protected Comparator<Exchange> sortBy;
-    @UriParam(enums = "none,markerFile,fileLock,rename,changed")
+    @UriParam(label = "consumer", enums = "none,markerFile,fileLock,rename,changed")
     protected String readLock = "none";
-    @UriParam(defaultValue = "1000")
+    @UriParam(label = "consumer", defaultValue = "1000")
     protected long readLockCheckInterval = 1000;
-    @UriParam(defaultValue = "10000")
+    @UriParam(label = "consumer", defaultValue = "10000")
     protected long readLockTimeout = 10000;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "consumer", defaultValue = "true")
     protected boolean readLockMarkerFile = true;
-    @UriParam(defaultValue = "WARN")
+    @UriParam(label = "consumer", defaultValue = "WARN")
     protected LoggingLevel readLockLoggingLevel = LoggingLevel.WARN;
-    @UriParam(defaultValue = "1")
+    @UriParam(label = "consumer", defaultValue = "1")
     protected long readLockMinLength = 1;
-    @UriParam
+    @UriParam(label = "consumer")
     protected GenericFileExclusiveReadLockStrategy<T> exclusiveReadLockStrategy;
-    @UriParam(defaultValue = "false")
-    protected boolean keepLastModified;
-    @UriParam
-    protected String doneFileName;
-    @UriParam(defaultValue = "false")
-    protected boolean allowNullBody;
-    @UriParam
-    protected String chmod;
 
     public GenericFileEndpoint() {
     }


[3/8] camel git commit: CAMEL-7999: apt plugin supports labels per component and endpoint options

Posted by da...@apache.org.
CAMEL-7999: apt plugin supports labels per component and endpoint options


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

Branch: refs/heads/master
Commit: 3fc476ec458517b2848c60f827a23a8b85c83a8b
Parents: a1ee6ed
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 11:08:20 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:33 2015 +0100

----------------------------------------------------------------------
 .../camel/component/direct/DirectEndpoint.java  |  5 ++--
 .../component/directvm/DirectVmEndpoint.java    |  5 ++--
 .../camel/component/seda/SedaEndpoint.java      | 24 ++++++++--------
 .../camel/component/stub/StubConsumer.java      | 29 ++++++++++++++++++++
 .../camel/component/stub/StubEndpoint.java      |  1 -
 .../apache/camel/component/vm/StubConsumer.java | 27 ------------------
 6 files changed, 48 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3fc476ec/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
index 3661cbb..e29e01d 100644
--- a/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
@@ -42,9 +42,10 @@ public class DirectEndpoint extends DefaultEndpoint {
 
     @UriPath(description = "Name of direct endpoint")
     private String name;
-    @UriParam(defaultValue = "false")
+
+    @UriParam(label = "producer", defaultValue = "false")
     private boolean block;
-    @UriParam(defaultValue = "30000")
+    @UriParam(label = "producer", defaultValue = "30000")
     private long timeout = 30000L;
 
     public DirectEndpoint() {

http://git-wip-us.apache.org/repos/asf/camel/blob/3fc476ec/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmEndpoint.java
index 831ce6c..57733c5 100644
--- a/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmEndpoint.java
@@ -33,9 +33,10 @@ public class DirectVmEndpoint extends DefaultEndpoint {
 
     @UriPath(description = "Name of direct-vm endpoint")
     private String name;
-    @UriParam(defaultValue = "false")
+
+    @UriParam(label = "producer", defaultValue = "false")
     private boolean block;
-    @UriParam(defaultValue = "30000")
+    @UriParam(label = "producer", defaultValue = "30000")
     private long timeout = 30000L;
 
     public DirectVmEndpoint(String endpointUri, DirectVmComponent component) {

http://git-wip-us.apache.org/repos/asf/camel/blob/3fc476ec/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
index 6262bff..6f42b4f 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
@@ -64,26 +64,28 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint,
     private volatile MulticastProcessor consumerMulticastProcessor;
     private volatile boolean multicastStarted;
     private volatile ExecutorService multicastExecutor;
+
     @UriPath(description = "Name of queue")
     private String name;
     @UriParam(defaultValue = "" + Integer.MAX_VALUE)
     private int size = Integer.MAX_VALUE;
-    @UriParam(defaultValue = "1")
+
+    @UriParam(label = "consumer", defaultValue = "1")
     private int concurrentConsumers = 1;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "consumer", defaultValue = "false")
     private boolean multipleConsumers;
-    @UriParam(defaultValue = "IfReplyExpected")
+    @UriParam(label = "consumer", defaultValue = "false")
+    private boolean purgeWhenStopping;
+    @UriParam(label = "consumer", defaultValue = "1000")
+    private int pollTimeout = 1000;
+
+    @UriParam(label = "producer", defaultValue = "IfReplyExpected")
     private WaitForTaskToComplete waitForTaskToComplete = WaitForTaskToComplete.IfReplyExpected;
-    @UriParam(defaultValue = "30000")
+    @UriParam(label = "producer", defaultValue = "30000")
     private long timeout = 30000;
-    @UriParam(defaultValue = "false")
+    @UriParam(label = "producer", defaultValue = "false")
     private boolean blockWhenFull;
-    @UriParam(defaultValue = "1000")
-    private int pollTimeout = 1000;
-    @UriParam(defaultValue = "false")
-    private boolean purgeWhenStopping;
-
-    @UriParam
+    @UriParam(label = "producer")
     private boolean failIfNoConsumers;
 
     private BlockingQueueFactory<Exchange> queueFactory;

http://git-wip-us.apache.org/repos/asf/camel/blob/3fc476ec/camel-core/src/main/java/org/apache/camel/component/stub/StubConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/stub/StubConsumer.java b/camel-core/src/main/java/org/apache/camel/component/stub/StubConsumer.java
new file mode 100644
index 0000000..b78e566
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/component/stub/StubConsumer.java
@@ -0,0 +1,29 @@
+/**
+ * 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.stub;
+
+import org.apache.camel.Processor;
+import org.apache.camel.component.vm.VmConsumer;
+import org.apache.camel.component.vm.VmEndpoint;
+
+public class StubConsumer extends VmConsumer {
+
+    public StubConsumer(VmEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3fc476ec/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
index bd12cb1..db159c6 100644
--- a/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
@@ -22,7 +22,6 @@ import org.apache.camel.Component;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.component.seda.BlockingQueueFactory;
-import org.apache.camel.component.vm.StubConsumer;
 import org.apache.camel.component.vm.VmConsumer;
 import org.apache.camel.component.vm.VmEndpoint;
 import org.apache.camel.spi.UriEndpoint;

http://git-wip-us.apache.org/repos/asf/camel/blob/3fc476ec/camel-core/src/main/java/org/apache/camel/component/vm/StubConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/vm/StubConsumer.java b/camel-core/src/main/java/org/apache/camel/component/vm/StubConsumer.java
deleted file mode 100644
index 92c477f..0000000
--- a/camel-core/src/main/java/org/apache/camel/component/vm/StubConsumer.java
+++ /dev/null
@@ -1,27 +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.vm;
-
-import org.apache.camel.Processor;
-
-public class StubConsumer extends VmConsumer {
-
-    public StubConsumer(VmEndpoint endpoint, Processor processor) {
-        super(endpoint, processor);
-    }
-
-}


[2/8] camel git commit: CAMEL-7999: apt plugin supports labels per component and endpoint options

Posted by da...@apache.org.
CAMEL-7999: apt plugin supports labels per component and endpoint options


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

Branch: refs/heads/master
Commit: 6290057b91b58e03482812515c2259979bdbc829
Parents: 64efcea
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 06:50:45 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:32 2015 +0100

----------------------------------------------------------------------
 .../camel/tools/apt/EipAnnotationProcessor.java |  2 +-
 .../tools/apt/EndpointAnnotationProcessor.java  | 57 +++++++++++++-------
 .../camel/tools/apt/JsonSchemaHelper.java       |  7 ++-
 .../java/org/apache/camel/spi/UriParam.java     |  9 ++++
 .../main/java/org/apache/camel/spi/UriPath.java |  9 ++++
 5 files changed, 64 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6290057b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
index cbcbdb9..aeb014a 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
@@ -188,7 +188,7 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
             String doc = entry.getDocumentation();
             doc = sanitizeDescription(doc, false);
             buffer.append(JsonSchemaHelper.toJson(entry.getName(), entry.getKind(), entry.isRequired(), entry.getType(), entry.getDefaultValue(), doc,
-                    entry.isDeprecated(), entry.isEnumType(), entry.getEnums(), entry.isOneOf(), entry.getOneOfTypes()));
+                    entry.isDeprecated(), null, entry.isEnumType(), entry.getEnums(), entry.isOneOf(), entry.getOneOfTypes()));
         }
         buffer.append("\n  }");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6290057b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index 1db05e1..949b846 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -207,8 +207,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             String doc = entry.getDocumentationWithNotes();
             doc = sanitizeDescription(doc, false);
             Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
-            buffer.append(JsonSchemaHelper.toJson(entry.getName(), "property", required, entry.getType(), entry.getDefaultValue(), doc, entry.isDeprecated(),
-                    entry.isEnumType(), entry.getEnums(), false, null));
+            buffer.append(JsonSchemaHelper.toJson(entry.getName(), "property", required, entry.getType(), entry.getDefaultValue(), doc,
+                    entry.isDeprecated(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null));
         }
         buffer.append("\n  },");
 
@@ -225,8 +225,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             String doc = path.getDocumentation();
             doc = sanitizeDescription(doc, false);
             Boolean required = path.getRequired() != null ? Boolean.valueOf(path.getRequired()) : null;
-            buffer.append(JsonSchemaHelper.toJson(path.getName(), "path", required, path.getType(), null, doc, path.isDeprecated(),
-                    path.isEnumType(), path.getEnums(), false, null));
+            buffer.append(JsonSchemaHelper.toJson(path.getName(), "path", required, path.getType(), null, doc,
+                    path.isDeprecated(), path.getLabel(), path.isEnumType(), path.getEnums(), false, null));
         }
 
         // and then regular parameter options
@@ -241,8 +241,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             String doc = entry.getDocumentationWithNotes();
             doc = sanitizeDescription(doc, false);
             Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
-            buffer.append(JsonSchemaHelper.toJson(entry.getName(), "parameter", required, entry.getType(), entry.getDefaultValue(), doc, entry.isDeprecated(),
-                    entry.isEnumType(), entry.getEnums(), false, null));
+            buffer.append(JsonSchemaHelper.toJson(entry.getName(), "parameter", required, entry.getType(), entry.getDefaultValue(),
+                    doc, entry.isDeprecated(), entry.getLabel(), entry.isEnumType(), entry.getEnums(), false, null));
         }
         buffer.append("\n  }");
 
@@ -388,6 +388,9 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                     String fieldTypeName = fieldType.toString();
                     TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
 
+                    String required =  metadata != null ? metadata.required() : null;
+                    String label = metadata != null ? metadata.label() : null;
+
                     // we do not yet have default values / notes / as no annotation support yet
                     // String defaultValueNote = param.defaultValueNote();
                     String defaultValue = metadata != null ? metadata.defaultValue() : null;
@@ -398,8 +401,6 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         docComment = "";
                     }
 
-                    String required =  metadata != null ? metadata.required() : null;
-
                     // gather enums
                     Set<String> enums = new LinkedHashSet<String>();
                     boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind() == ElementKind.ENUM;
@@ -416,7 +417,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                     }
 
                     ComponentOption option = new ComponentOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
-                            docComment.trim(), deprecated, isEnum, enums);
+                            docComment.trim(), deprecated, label, isEnum, enums);
                     componentOptions.add(option);
                 }
             }
@@ -453,6 +454,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         name = fieldName;
                     }
                     name = prefix + name;
+
+                    String labels = path.label();
+                    String required = metadata != null ? metadata.required() : null;
+
                     TypeMirror fieldType = fieldElement.asType();
                     String fieldTypeName = fieldType.toString();
                     TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
@@ -462,8 +467,6 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         docComment = path.description();
                     }
 
-                    String required =  metadata != null ? metadata.required() : null;
-
                     // gather enums
                     Set<String> enums = new LinkedHashSet<String>();
 
@@ -489,7 +492,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         }
                     }
 
-                    EndpointPath ep = new EndpointPath(name, fieldTypeName, required, docComment, deprecated, isEnum, enums);
+                    EndpointPath ep = new EndpointPath(name, fieldTypeName, required, docComment, deprecated, labels, isEnum, enums);
                     endpointPaths.add(ep);
                 }
 
@@ -504,6 +507,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
 
                     String defaultValue = param.defaultValue();
                     String defaultValueNote = param.defaultValueNote();
+                    String required =  metadata != null ? metadata.required() : null;
+                    String labels = param.label();
 
                     // if the field type is a nested parameter then iterate through its fields
                     TypeMirror fieldType = fieldElement.asType();
@@ -526,8 +531,6 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                             docComment = param.description();
                         }
 
-                        String required =  metadata != null ? metadata.required() : null;
-
                         // gather enums
                         Set<String> enums = new LinkedHashSet<String>();
 
@@ -554,7 +557,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
                         }
 
                         EndpointOption option = new EndpointOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
-                                docComment.trim(), deprecated, isEnum, enums);
+                                docComment.trim(), deprecated, labels, isEnum, enums);
                         endpointOptions.add(option);
                     }
                 }
@@ -683,11 +686,12 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
         private String defaultValueNote;
         private String documentation;
         private boolean deprecated;
+        private String label;
         private boolean enumType;
         private Set<String> enums;
 
         private ComponentOption(String name, String type, String required, String defaultValue, String defaultValueNote,
-                               String documentation, boolean deprecated, boolean enumType, Set<String> enums) {
+                                String documentation, boolean deprecated, String label, boolean enumType, Set<String> enums) {
             this.name = name;
             this.type = type;
             this.required = required;
@@ -695,6 +699,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             this.defaultValueNote = defaultValueNote;
             this.documentation = documentation;
             this.deprecated = deprecated;
+            this.label = label;
             this.enumType = enumType;
             this.enums = enums;
         }
@@ -752,6 +757,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             return enums;
         }
 
+        public String getLabel() {
+            return label;
+        }
+
         @Override
         public boolean equals(Object o) {
             if (this == o) {
@@ -785,11 +794,12 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
         private String defaultValueNote;
         private String documentation;
         private boolean deprecated;
+        private String label;
         private boolean enumType;
         private Set<String> enums;
 
         private EndpointOption(String name, String type, String required, String defaultValue, String defaultValueNote,
-                               String documentation, boolean deprecated, boolean enumType, Set<String> enums) {
+                               String documentation, boolean deprecated, String label, boolean enumType, Set<String> enums) {
             this.name = name;
             this.type = type;
             this.required = required;
@@ -797,6 +807,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             this.defaultValueNote = defaultValueNote;
             this.documentation = documentation;
             this.deprecated = deprecated;
+            this.label = label;
             this.enumType = enumType;
             this.enums = enums;
         }
@@ -854,6 +865,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             return enums;
         }
 
+        public String getLabel() {
+            return label;
+        }
+
         @Override
         public boolean equals(Object o) {
             if (this == o) {
@@ -885,16 +900,18 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
         private String required;
         private String documentation;
         private boolean deprecated;
+        private String label;
         private boolean enumType;
         private Set<String> enums;
 
         private EndpointPath(String name, String type, String required, String documentation, boolean deprecated,
-                             boolean enumType, Set<String> enums) {
+                             String label, boolean enumType, Set<String> enums) {
             this.name = name;
             this.type = type;
             this.required = required;
             this.documentation = documentation;
             this.deprecated = deprecated;
+            this.label = label;
             this.enumType = enumType;
             this.enums = enums;
         }
@@ -937,6 +954,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
             return enums;
         }
 
+        public String getLabel() {
+            return label;
+        }
+
         @Override
         public boolean equals(Object o) {
             if (this == o) {

http://git-wip-us.apache.org/repos/asf/camel/blob/6290057b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
index ea78bae..8aadb99 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
@@ -31,7 +31,7 @@ final class JsonSchemaHelper {
     }
 
     public static String toJson(String name, String kind, Boolean required, String type, String defaultValue, String description,
-                                Boolean deprecated, boolean enumType, Set<String> enums, boolean oneOfType, Set<String> oneOffTypes) {
+                                Boolean deprecated, String label, boolean enumType, Set<String> enums, boolean oneOfType, Set<String> oneOffTypes) {
         String typeName = JsonSchemaHelper.getType(type, enumType);
 
         StringBuilder sb = new StringBuilder();
@@ -84,6 +84,11 @@ final class JsonSchemaHelper {
             sb.append(Strings.doubleQuote(text));
         }
 
+        if (label != null) {
+            sb.append(", \"label\": ");
+            sb.append(Strings.doubleQuote(label));
+        }
+
         if (!Strings.isNullOrEmpty(description)) {
             sb.append(", \"description\": ");
             String text = sanitizeDescription(description, false);

http://git-wip-us.apache.org/repos/asf/camel/blob/6290057b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
----------------------------------------------------------------------
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
index 2c79b1a..13e067d 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriParam.java
@@ -68,4 +68,13 @@ public @interface UriParam {
      */
     String enums() default "";
 
+    /**
+     * To associate this parameter with label(s).
+     * <p/>
+     * Multiple labels can be defined as a comma separated value.
+     * <p/>
+     * The labels is intended for grouping the parameters, such as <tt>consumer</tt>, <tt>producer</tt>, <tt>common</tt>, <tt>security</tt>, etc.
+     */
+    String label() default "";
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/6290057b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
----------------------------------------------------------------------
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
index 5fef8a6..44b2f1c 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriPath.java
@@ -56,4 +56,13 @@ public @interface UriPath {
      */
     String enums() default "";
 
+    /**
+     * To associate this path value with label(s).
+     * <p/>
+     * Multiple labels can be defined as a comma separated value.
+     * <p/>
+     * The labels is intended for grouping the parameters, such as <tt>consumer</tt>, <tt>producer</tt>, <tt>common</tt>, <tt>security</tt>, etc.
+     */
+    String label() default "";
+
 }
\ No newline at end of file


[7/8] camel git commit: CAMEL-7999: apt plugin supports labels per component and endpoint options

Posted by da...@apache.org.
CAMEL-7999: apt plugin supports labels per component and endpoint options


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

Branch: refs/heads/master
Commit: c4c7daf4dc74ac85de949af7d95a182b3a0b279c
Parents: 0670b6e
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Feb 13 10:40:46 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Feb 13 12:48:33 2015 +0100

----------------------------------------------------------------------
 .../org/apache/camel/tools/apt/JsonSchemaHelper.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c4c7daf4/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
index 5c19aa2..f53785b 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/JsonSchemaHelper.java
@@ -39,6 +39,12 @@ final class JsonSchemaHelper {
         sb.append(": { \"kind\": ");
         sb.append(Strings.doubleQuote(kind));
 
+        // we want label early so its easier to spot
+        if (!Strings.isNullOrEmpty(label)) {
+            sb.append(", \"label\": ");
+            sb.append(Strings.doubleQuote(label));
+        }
+
         if (required != null) {
             sb.append(", \"required\": ");
             sb.append(Strings.doubleQuote(required.toString()));
@@ -84,11 +90,6 @@ final class JsonSchemaHelper {
             sb.append(Strings.doubleQuote(text));
         }
 
-        if (!Strings.isNullOrEmpty(label)) {
-            sb.append(", \"label\": ");
-            sb.append(Strings.doubleQuote(label));
-        }
-
         if (!Strings.isNullOrEmpty(description)) {
             sb.append(", \"description\": ");
             String text = sanitizeDescription(description, false);