camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-7999: Add support for @UriPath in apt compiler plugin. Also fixed the camel-core components to have a @UriPath
Date Tue, 11 Nov 2014 14:42:06 GMT
Repository: camel
Updated Branches:
  refs/heads/master 337f247f5 -> 12f85a77c


CAMEL-7999: Add support for @UriPath in apt compiler plugin. Also fixed the camel-core components
to have a @UriPath


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

Branch: refs/heads/master
Commit: 12f85a77c8437d1b3342311d53022814e964b5a3
Parents: 337f247
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Nov 11 15:41:54 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Nov 11 15:41:54 2014 +0100

----------------------------------------------------------------------
 .../camel/component/bean/BeanEndpoint.java      |   5 +-
 .../camel/component/browse/BrowseComponent.java |   5 +-
 .../camel/component/browse/BrowseEndpoint.java  |  13 ++
 .../controlbus/ControlBusComponent.java         |   6 +-
 .../controlbus/ControlBusEndpoint.java          |   3 +
 .../dataformat/DataFormatEndpoint.java          |   4 +
 .../component/dataset/DataSetEndpoint.java      |   2 +
 .../camel/component/direct/DirectEndpoint.java  |   3 +
 .../component/directvm/DirectVmEndpoint.java    |   3 +
 .../camel/component/file/FileEndpoint.java      |   5 +-
 .../component/language/LanguageEndpoint.java    |   3 +-
 .../apache/camel/component/log/LogEndpoint.java |   8 +-
 .../camel/component/mock/MockComponent.java     |   2 +-
 .../camel/component/mock/MockEndpoint.java      |  41 ++++--
 .../apache/camel/component/ref/RefEndpoint.java |   6 +-
 .../camel/component/seda/SedaEndpoint.java      |   3 +
 .../camel/component/test/TestComponent.java     |   3 +-
 .../camel/component/test/TestEndpoint.java      |   6 +
 .../camel/component/timer/TimerEndpoint.java    |   3 +-
 .../component/validator/ValidatorEndpoint.java  |   6 +-
 .../camel/component/xslt/XsltEndpoint.java      |   3 +-
 .../tools/apt/EndpointAnnotationProcessor.java  | 125 ++++++++++++++++---
 .../main/java/org/apache/camel/spi/UriPath.java |  17 +++
 23 files changed, 228 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
index cdb770f..c7b6de5 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanEndpoint.java
@@ -22,6 +22,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.impl.ProcessorEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 
 /**
  * Endpoint for the bean component.
@@ -31,13 +32,13 @@ import org.apache.camel.spi.UriParam;
 @UriEndpoint(scheme = "bean")
 public class BeanEndpoint extends ProcessorEndpoint {
     private BeanHolder beanHolder;
+    @UriPath
+    private String beanName;
     @UriParam(defaultValue = "false")
     private boolean cache;
     @UriParam(defaultValue = "false")
     private boolean multiParameterArray;
     @UriParam
-    private String beanName;
-    @UriParam
     private String method;
 
     public BeanEndpoint() {

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/browse/BrowseComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/browse/BrowseComponent.java
b/camel-core/src/main/java/org/apache/camel/component/browse/BrowseComponent.java
index ca08cf6..80559a5 100644
--- a/camel-core/src/main/java/org/apache/camel/component/browse/BrowseComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/browse/BrowseComponent.java
@@ -33,6 +33,9 @@ public class BrowseComponent extends UriEndpointComponent {
     }
 
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object>
parameters) throws Exception {
-        return new BrowseEndpoint(uri, this);
+        BrowseEndpoint endpoint = new BrowseEndpoint(uri, this);
+        endpoint.setName(remaining);
+        setProperties(endpoint, parameters);
+        return endpoint;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java
index 20293ef..73c4b6b 100644
--- a/camel-core/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/browse/BrowseEndpoint.java
@@ -31,6 +31,7 @@ import org.apache.camel.processor.loadbalancer.LoadBalancerConsumer;
 import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
 import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriPath;
 
 /**
  * An endpoint which maintains a {@link List} of {@link Exchange} instances
@@ -40,6 +41,10 @@ import org.apache.camel.spi.UriEndpoint;
  */
 @UriEndpoint(scheme = "browse")
 public class BrowseEndpoint extends DefaultEndpoint implements BrowsableEndpoint {
+
+    @UriPath(description = "A name which can be any string to uniquely identify the endpoint")
+    private String name;
+
     private List<Exchange> exchanges;
     private final LoadBalancer loadBalancer = new TopicLoadBalancer();
 
@@ -75,6 +80,14 @@ public class BrowseEndpoint extends DefaultEndpoint implements BrowsableEndpoint
         return answer;
     }
 
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
     protected List<Exchange> createExchangeList() {
         return new CopyOnWriteArrayList<Exchange>();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusComponent.java
b/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusComponent.java
index 91df308..f2ca975 100644
--- a/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusComponent.java
@@ -40,11 +40,7 @@ public class ControlBusComponent extends UriEndpointComponent {
         // does the control bus use a language
         if (remaining != null && remaining.startsWith("language:")) {
             String lan = remaining.substring(9);
-            if (lan != null) {
-                answer.setLanguage(getCamelContext().resolveLanguage(lan));
-            } else {
-                throw new IllegalArgumentException("Language must be configured in endpoint
uri: " + uri);
-            }
+            answer.setLanguage(getCamelContext().resolveLanguage(lan));
         }
 
         setProperties(answer, parameters);

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusEndpoint.java
index f1fd3df..467affd 100644
--- a/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusEndpoint.java
@@ -26,6 +26,7 @@ import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.CamelLogger;
 
 /**
@@ -34,6 +35,8 @@ import org.apache.camel.util.CamelLogger;
 @UriEndpoint(scheme = "controlbus")
 public class ControlBusEndpoint extends DefaultEndpoint {
 
+    @UriPath(description = "Command can be either route or language")
+    private String command;
     private Language language;
     @UriParam
     private String routeId;

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
index d1ba5ca..14599d2 100644
--- a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
@@ -29,6 +29,7 @@ import org.apache.camel.processor.UnmarshalProcessor;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.ServiceHelper;
 
 @UriEndpoint(scheme = "dataformat")
@@ -36,6 +37,9 @@ public class DataFormatEndpoint extends DefaultEndpoint {
 
     private MarshalProcessor marshal;
     private UnmarshalProcessor unmarshal;
+
+    @UriPath(description = "Name of data format followed by operation which must be either
marhsal or unmarshal")
+    private String name;
     @UriParam
     private DataFormat dataFormat;
     @UriParam

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java
index 57f30fe..c64d6df 100644
--- a/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java
@@ -28,6 +28,7 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.processor.ThroughputLogger;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.CamelLogger;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -43,6 +44,7 @@ import org.slf4j.LoggerFactory;
 @UriEndpoint(scheme = "dataset", consumerClass = DataSetConsumer.class)
 public class DataSetEndpoint extends MockEndpoint implements Service {
     private final transient Logger log;
+    @UriPath(name = "name", description = "name of DataSet to lookup in the registry")
     private volatile DataSet dataSet;
     private final AtomicInteger receivedCounter = new AtomicInteger();
     @UriParam(defaultValue = "0")

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/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 fa59de6..b6986d8 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
@@ -26,6 +26,7 @@ import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -37,6 +38,8 @@ import org.apache.camel.util.ObjectHelper;
 @UriEndpoint(scheme = "direct", consumerClass = DirectConsumer.class)
 public class DirectEndpoint extends DefaultEndpoint {
 
+    @UriPath(description = "Name of direct endpoint")
+    private String name;
     private volatile Map<String, DirectConsumer> consumers;
     @UriParam(defaultValue = "false")
     private boolean block;

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/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 e8af675..c5c3af4 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
@@ -23,6 +23,7 @@ import org.apache.camel.component.direct.DirectConsumer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 
 /**
  * The direct-vm endpoint.
@@ -30,6 +31,8 @@ import org.apache.camel.spi.UriParam;
 @UriEndpoint(scheme = "direct-vm", consumerClass = DirectConsumer.class)
 public class DirectVmEndpoint extends DefaultEndpoint {
 
+    @UriPath(description = "Name of direct-vm endpoint")
+    private String name;
     @UriParam(defaultValue = "false")
     private boolean block;
     @UriParam(defaultValue = "30000")

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/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 4177f5d..645d733 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
@@ -36,7 +36,7 @@ import org.apache.camel.util.ObjectHelper;
 public class FileEndpoint extends GenericFileEndpoint<File> {
 
     private final FileOperations operations = new FileOperations(this);
-    @UriPath
+    @UriPath(name = "directoryName")
     private File file;
     @UriParam(defaultValue = "false")
     private boolean copyAndDeleteOnRenameFail = true;
@@ -141,6 +141,9 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
         return file;
     }
 
+    /**
+     * The starting directory
+     */
     public void setFile(File file) {
         this.file = file;
         // update configuration as well

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
index 3701149..b025b05 100644
--- a/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java
@@ -31,6 +31,7 @@ import org.apache.camel.component.ResourceEndpoint;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ResourceHelper;
@@ -44,7 +45,7 @@ import org.apache.camel.util.ResourceHelper;
 public class LanguageEndpoint extends ResourceEndpoint {
     private Language language;
     private Expression expression;
-    @UriParam
+    @UriPath
     private String languageName;
     @UriParam
     private String script;

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/log/LogEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/log/LogEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/log/LogEndpoint.java
index 7aeac00..ca3c21e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/log/LogEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/log/LogEndpoint.java
@@ -26,6 +26,7 @@ import org.apache.camel.processor.ThroughputLogger;
 import org.apache.camel.spi.ExchangeFormatter;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.CamelLogger;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
@@ -37,6 +38,8 @@ import org.slf4j.Logger;
 public class LogEndpoint extends ProcessorEndpoint {
 
     private volatile Processor logger;
+    @UriPath(description = "Name of the logging category to use")
+    private String loggerName;
     @UriParam(defaultValue = "INFO")
     private String level;
     @UriParam
@@ -49,10 +52,9 @@ public class LogEndpoint extends ProcessorEndpoint {
     private Boolean groupActiveOnly;
     @UriParam
     private Long groupDelay;
-    
-    private ExchangeFormatter localFormatter;
+    @UriParam
     private Logger providedLogger;
-    private String loggerName;
+    private ExchangeFormatter localFormatter;
 
     public LogEndpoint() {
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java
index 8977918..b0b264c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java
@@ -25,7 +25,7 @@ import org.apache.camel.processor.ThroughputLogger;
 import org.apache.camel.util.CamelLogger;
 
 /**
- * A factory of {@link MockEndpoint} instances
+ * Component for testing with mock endpoints.
  *
  * @version 
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
index 03d20a2..4cb60e9 100644
--- a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
@@ -51,6 +51,7 @@ import org.apache.camel.impl.InterceptSendToEndpoint;
 import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.CaseInsensitiveMap;
 import org.apache.camel.util.ExchangeHelper;
@@ -92,16 +93,27 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint
{
     // must be volatile so changes is visible between the thread which performs the assertions
     // and the threads which process the exchanges when routing messages in Camel
     protected volatile Processor reporter;
-    protected boolean copyOnExchange = true;
-    @UriParam
-    private volatile int expectedCount;
-    private volatile int counter;
+
     private volatile Processor defaultProcessor;
     private volatile Map<Integer, Processor> processors;
     private volatile List<Exchange> receivedExchanges;
     private volatile List<Throwable> failures;
     private volatile List<Runnable> tests;
     private volatile CountDownLatch latch;
+    private volatile int expectedMinimumCount;
+    private volatile List<?> expectedBodyValues;
+    private volatile List<Object> actualBodyValues;
+    private volatile Map<String, Object> expectedHeaderValues;
+    private volatile Map<String, Object> actualHeaderValues;
+    private volatile Map<String, Object> expectedPropertyValues;
+    private volatile Map<String, Object> actualPropertyValues;
+
+    @UriPath(description = "Name of mock endpoint")
+    private String name;
+    @UriParam(defaultValue = "true")
+    protected boolean copyOnExchange = true;
+    @UriParam
+    private volatile int expectedCount;
     @UriParam
     private volatile long sleepForEmptyTest;
     @UriParam
@@ -111,13 +123,7 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint
{
     @UriParam
     private volatile long assertPeriod;
     @UriParam
-    private volatile int expectedMinimumCount;
-    private volatile List<?> expectedBodyValues;
-    private volatile List<Object> actualBodyValues;
-    private volatile Map<String, Object> expectedHeaderValues;
-    private volatile Map<String, Object> actualHeaderValues;
-    private volatile Map<String, Object> expectedPropertyValues;
-    private volatile Map<String, Object> actualPropertyValues;
+    private volatile int counter;
     @UriParam
     private volatile int retainFirst;
     @UriParam
@@ -1147,6 +1153,19 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint
{
         this.retainLast = retainLast;
     }
 
+    public boolean isCopyOnExchange() {
+        return copyOnExchange;
+    }
+
+    /**
+     * Sets whether to make a deep copy of the incoming {@link Exchange} when received at
this mock endpoint.
+     * <p/>
+     * Is by default <tt>true</tt>.
+     */
+    public void setCopyOnExchange(boolean copyOnExchange) {
+        this.copyOnExchange = copyOnExchange;
+    }
+
     // Implementation methods
     // -------------------------------------------------------------------------
     private void init() {

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
index 2e1ef40..e9cc74e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/ref/RefEndpoint.java
@@ -24,7 +24,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
-import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.CamelContextHelper;
 
 @UriEndpoint(scheme = "ref")
@@ -32,7 +32,7 @@ public class RefEndpoint extends DefaultEndpoint implements DelegateEndpoint
{
 
     private volatile Endpoint endpoint;
 
-    @UriParam
+    @UriPath
     private String name;
 
     public RefEndpoint(String endpointUri, Component component) {
@@ -44,7 +44,7 @@ public class RefEndpoint extends DefaultEndpoint implements DelegateEndpoint
{
     }
 
     /**
-     * Name of endpoint to lookup
+     * Name of endpoint to lookup in the registry.
      */
     public void setName(String name) {
         this.name = name;

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/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 86a5321..36ed65a 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
@@ -41,6 +41,7 @@ import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.MessageHelper;
 import org.apache.camel.util.ServiceHelper;
@@ -63,6 +64,8 @@ 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")

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/test/TestComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/test/TestComponent.java b/camel-core/src/main/java/org/apache/camel/component/test/TestComponent.java
index 626529f..2e7d665 100644
--- a/camel-core/src/main/java/org/apache/camel/component/test/TestComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/test/TestComponent.java
@@ -27,7 +27,8 @@ import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.UnsafeUriCharactersEncoder;
 
 /**
- * Test Component.
+ * Component for testing by polling test messages from another endpoint on startup as the
expected message bodies to
+ * receive during testing.
  *
  * @version 
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
index ce3c50d..7f2b53a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
@@ -26,6 +26,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.EndpointHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,6 +42,8 @@ import org.slf4j.LoggerFactory;
 public class TestEndpoint extends MockEndpoint {
     private static final Logger LOG = LoggerFactory.getLogger(TestEndpoint.class);
     private final Endpoint expectedMessageEndpoint;
+    @UriPath(description = "Name of endpoint to lookup in the registry to use for polling
messages used for testing")
+    private String name;
     @UriParam(defaultValue = "2000")
     private long timeout = 2000L;
 
@@ -77,6 +80,9 @@ public class TestEndpoint extends MockEndpoint {
         return timeout;
     }
 
+    /**
+     * The timeout to use when polling for message bodies from the URI
+     */
     public void setTimeout(long timeout) {
         this.timeout = timeout;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
index d2d6bb8..8b2621c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
@@ -30,6 +30,7 @@ import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 
 /**
  * Represents a timer endpoint that can generate periodic inbound exchanges triggered by
a timer.
@@ -39,7 +40,7 @@ import org.apache.camel.spi.UriParam;
 @ManagedResource(description = "Managed TimerEndpoint")
 @UriEndpoint(scheme = "timer", consumerClass = TimerConsumer.class)
 public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersSupport {
-    @UriParam
+    @UriPath
     private String timerName;
     @UriParam
     private Date time;

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
index 4628732..89a6f73 100644
--- a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
@@ -20,6 +20,7 @@ import java.io.InputStream;
 import javax.xml.XMLConstants;
 import javax.xml.validation.SchemaFactory;
 
+import org.apache.camel.spi.UriPath;
 import org.w3c.dom.ls.LSResourceResolver;
 
 import org.apache.camel.Component;
@@ -43,7 +44,7 @@ public class ValidatorEndpoint extends DefaultEndpoint {
 
     private static final Logger LOG = LoggerFactory.getLogger(ValidatorEndpoint.class);
 
-    @UriParam
+    @UriPath
     private String resourceUri;
     @UriParam
     private String schemaLanguage = XMLConstants.W3C_XML_SCHEMA_NS_URI;
@@ -126,6 +127,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
         return resourceUri;
     }
 
+    /**
+     * URL to a local resource on the classpath or a full URL to a remote resource or resource
on the file system which contains the XSD to validate against.
+     */
     public void setResourceUri(String resourceUri) {
         this.resourceUri = resourceUri;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
index 003f2b6..a7075ee 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
@@ -29,6 +29,7 @@ import org.apache.camel.builder.xml.XsltBuilder;
 import org.apache.camel.impl.ProcessorEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,7 +42,7 @@ public class XsltEndpoint extends ProcessorEndpoint {
 
     private volatile boolean cacheCleared;
     private XsltBuilder xslt;
-    @UriParam
+    @UriPath
     private String resourceUri;
     @UriParam(defaultValue = "false")
     private boolean cacheStylesheet;

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/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 e3c1ef7..362da84 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
@@ -51,6 +51,7 @@ import javax.tools.StandardLocation;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
 
 import static org.apache.camel.tools.apt.IOHelper.loadText;
 import static org.apache.camel.tools.apt.JsonSchemaHelper.sanitizeDescription;
@@ -153,31 +154,48 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
         String scheme = uriEndpoint.scheme();
         ComponentModel componentModel = findComponentProperties(roundEnv, scheme);
 
+        // get endpoint information which is divided into paths and options (though there
should really only be one path)
+        Set<EndpointPath> endpointPaths = new LinkedHashSet<>();
         Set<EndpointOption> endpointOptions = new LinkedHashSet<>();
-        findClassProperties(roundEnv, endpointOptions, classElement, "");
-        String json = createParameterJsonSchema(componentModel, endpointOptions);
+        findClassProperties(roundEnv, endpointPaths, endpointOptions, classElement, "");
+
+        String json = createParameterJsonSchema(componentModel, endpointPaths, endpointOptions);
         writer.println(json);
     }
 
-    public String createParameterJsonSchema(ComponentModel componentModel, Set<EndpointOption>
options) {
+    public String createParameterJsonSchema(ComponentModel componentModel, Set<EndpointPath>
paths, Set<EndpointOption> options) {
         StringBuilder buffer = new StringBuilder("{");
         // component model
         buffer.append("\n \"component\": {");
-        buffer.append("\n    \"scheme\": \"" + componentModel.getScheme() + "\",");
-        buffer.append("\n    \"description\": \"" + componentModel.getDescription() + "\",");
-        buffer.append("\n    \"javaType\": \"" + componentModel.getJavaType() + "\",");
-        buffer.append("\n    \"groupId\": \"" + componentModel.getGroupId() + "\",");
-        buffer.append("\n    \"artifactId\": \"" + componentModel.getArtifactId() + "\",");
-        buffer.append("\n    \"version\": \"" + componentModel.getVersionId() + "\"");
+        buffer.append("\n    \"scheme\": \"").append(componentModel.getScheme()).append("\",");
+        buffer.append("\n    \"description\": \"").append(componentModel.getDescription()).append("\",");
+        buffer.append("\n    \"javaType\": \"").append(componentModel.getJavaType()).append("\",");
+        buffer.append("\n    \"groupId\": \"").append(componentModel.getGroupId()).append("\",");
+        buffer.append("\n    \"artifactId\": \"").append(componentModel.getArtifactId()).append("\",");
+        buffer.append("\n    \"version\": \"").append(componentModel.getVersionId()).append("\"");
         buffer.append("\n  },");
 
         // and empty component properties as placeholder for future improvement
         buffer.append("\n  \"componentProperties\": {");
         buffer.append("\n  },");
 
+        // endpoint paths
+        buffer.append("\n  \"endpointPaths\": {");
+        boolean first = true;
+        for (EndpointPath path : paths) {
+            if (first) {
+                first = false;
+            } else {
+                buffer.append(",");
+            }
+            buffer.append("\n    ");
+            buffer.append(JsonSchemaHelper.toJson(path.getName(), path.getType(), "", path.getDocumentation(),
false, null));
+        }
+        buffer.append("\n  }");
+
         // endpoint properties was named properties at first, and hence we stick with that
naming to be compatible
         buffer.append("\n  \"properties\": {");
-        boolean first = true;
+        first = true;
         for (EndpointOption entry : options) {
             if (first) {
                 first = false;
@@ -202,9 +220,10 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
             writer.println("<p>" + classDoc + "</p>");
         }
 
+        Set<EndpointPath> endpointPaths = new LinkedHashSet<>();
         Set<EndpointOption> endpointOptions = new LinkedHashSet<>();
-        findClassProperties(roundEnv, endpointOptions, classElement, prefix);
-        if (!endpointOptions.isEmpty()) {
+        findClassProperties(roundEnv, endpointPaths, endpointOptions, classElement, prefix);
+        if (!endpointOptions.isEmpty() || !endpointPaths.isEmpty()) {
             writer.println("<table class='table'>");
             writer.println("  <tr>");
             writer.println("    <th>Name</th>");
@@ -213,6 +232,15 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
             writer.println("    <th>Enum Values</th>");
             writer.println("    <th>Description</th>");
             writer.println("  </tr>");
+            for (EndpointPath path : endpointPaths) {
+                writer.println("  <tr>");
+                writer.println("    <td>" + path.getName() + " (<i>endpoint path</i>)
" + "</td>");
+                writer.println("    <td>" + path.getType() + "</td>");
+                writer.println("    <td>" + "</td>");
+                writer.println("    <td>" + "</td>");
+                writer.println("    <td>" + path.getDocumentation() + "</td>");
+                writer.println("  </tr>");
+            }
             for (EndpointOption option : endpointOptions) {
                 writer.println("  <tr>");
                 writer.println("    <td>" + option.getName() + "</td>");
@@ -283,13 +311,52 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
         return model;
     }
 
-    protected void findClassProperties(RoundEnvironment roundEnv, Set<EndpointOption>
endpointOptions, TypeElement classElement, String prefix) {
+    protected void findClassProperties(RoundEnvironment roundEnv, Set<EndpointPath>
endpointPaths, Set<EndpointOption> endpointOptions, TypeElement classElement, String
prefix) {
         Elements elementUtils = processingEnv.getElementUtils();
         while (true) {
             List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
             for (VariableElement fieldElement : fieldElements) {
-                UriParam param = fieldElement.getAnnotation(UriParam.class);
+
+                UriPath path = fieldElement.getAnnotation(UriPath.class);
                 String fieldName = fieldElement.getSimpleName().toString();
+                if (path != null) {
+                    String name = path.name();
+                    if (isNullOrEmpty(name)) {
+                        name = fieldName;
+                    }
+                    name = prefix + name;
+                    TypeMirror fieldType = fieldElement.asType();
+                    String fieldTypeName = fieldType.toString();
+
+                    String docComment = elementUtils.getDocComment(fieldElement);
+                    if (isNullOrEmpty(docComment)) {
+                        String setter = "set" + fieldName.substring(0, 1).toUpperCase();
+                        if (fieldName.length() > 1) {
+                            setter += fieldName.substring(1);
+                        }
+                        //  lets find the setter
+                        List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());
+                        for (ExecutableElement method : methods) {
+                            String methodName = method.getSimpleName().toString();
+                            if (setter.equals(methodName) && method.getParameters().size()
== 1) {
+                                String doc = elementUtils.getDocComment(method);
+                                if (!isNullOrEmpty(doc)) {
+                                    docComment = doc;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    if (isNullOrEmpty(docComment)) {
+                        docComment = path.description();
+                    }
+
+                    EndpointPath ep = new EndpointPath(name, fieldTypeName, docComment);
+                    endpointPaths.add(ep);
+                }
+
+                UriParam param = fieldElement.getAnnotation(UriParam.class);
+                fieldName = fieldElement.getSimpleName().toString();
                 if (param != null) {
                     String name = param.name();
                     if (isNullOrEmpty(name)) {
@@ -314,7 +381,7 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
                         if (!isNullOrEmpty(extraPrefix)) {
                             nestedPrefix += extraPrefix;
                         }
-                        findClassProperties(roundEnv, endpointOptions, fieldTypeElement,
nestedPrefix);
+                        findClassProperties(roundEnv, endpointPaths, endpointOptions, fieldTypeElement,
nestedPrefix);
                     } else {
                         String docComment = elementUtils.getDocComment(fieldElement);
                         if (isNullOrEmpty(docComment)) {
@@ -359,6 +426,8 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
                     }
                 }
             }
+
+            // check super classes which may also have @UriParam fields
             TypeElement baseTypeElement = null;
             TypeMirror superclass = classElement.getSuperclass();
             if (superclass != null) {
@@ -635,4 +704,30 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
             return name.hashCode();
         }
     }
+
+    private static final class EndpointPath {
+
+        private String name;
+        private String type;
+        private String documentation;
+
+        private EndpointPath(String name, String type, String documentation) {
+            this.name = name;
+            this.type = type;
+            this.documentation = documentation;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getType() {
+            return type;
+        }
+
+        public String getDocumentation() {
+            return documentation;
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/12f85a77/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 87761c7..e746d3b 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
@@ -29,4 +29,21 @@ import java.lang.annotation.Target;
 @Documented
 @Target({ElementType.FIELD })
 public @interface UriPath {
+
+    /**
+     * Returns the name of the uri path.
+     * <p/>
+     * This can be used to name the uri path something meaningful, such as a <tt>directory</tt>,
<tt>queueName</tt> etc.
+     * <p/>
+     * If this is not specified then the name of the field or property which has this annotation
is used.
+     */
+    String name() default "";
+
+    /**
+     * Returns a description of this uri path
+     * <p/>
+     * This is used for documentation and tooling only.
+     */
+    String description() default "";
+
 }
\ No newline at end of file


Mime
View raw message