camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-8023: Model and component javadoc documentation
Date Sat, 07 Feb 2015 09:10:43 GMT
Repository: camel
Updated Branches:
  refs/heads/master 88f6c1e52 -> 1c7a2d749


CAMEL-8023: Model and component javadoc documentation


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

Branch: refs/heads/master
Commit: 6584c321214a82c9037bea2f5a5a6a74f9b03c92
Parents: 88f6c1e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Feb 7 09:47:51 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Feb 7 09:58:58 2015 +0100

----------------------------------------------------------------------
 .../controlbus/ControlBusEndpoint.java          | 30 ++++++++++-
 .../dataformat/DataFormatEndpoint.java          | 21 ++++++--
 .../component/dataset/DataSetEndpoint.java      |  2 +-
 .../camel/component/direct/DirectEndpoint.java  |  3 +-
 .../tools/apt/EndpointAnnotationProcessor.java  | 56 +++++++++++++-------
 .../java/org/apache/camel/spi/UriParam.java     | 10 ++++
 .../main/java/org/apache/camel/spi/UriPath.java | 10 ++++
 7 files changed, 106 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 951efed..6d1859f 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
@@ -35,12 +35,13 @@ import org.apache.camel.util.CamelLogger;
 @UriEndpoint(scheme = "controlbus", label = "core,monitoring")
 public class ControlBusEndpoint extends DefaultEndpoint {
 
-    @UriPath(description = "Command can be either route or language")
+    @UriPath(description = "Command can be either route or language", enums = "route,language")
     private String command;
+    @UriPath
     private Language language;
     @UriParam
     private String routeId;
-    @UriParam
+    @UriParam(enums = "start,stop,suspend,resume,status")
     private String action;
     @UriParam(defaultValue = "false")
     private boolean async;
@@ -77,6 +78,10 @@ public class ControlBusEndpoint extends DefaultEndpoint {
         return language;
     }
 
+    /**
+     * Allows you to specify the name of a Language to use for evaluating the message body.
+     * If there is any result from the evaluation, then the result is put in the message
body.
+     */
     public void setLanguage(Language language) {
         this.language = language;
     }
@@ -85,6 +90,9 @@ public class ControlBusEndpoint extends DefaultEndpoint {
         return routeId;
     }
 
+    /**
+     * To specify a route by its id.
+     */
     public void setRouteId(String routeId) {
         this.routeId = routeId;
     }
@@ -93,6 +101,15 @@ public class ControlBusEndpoint extends DefaultEndpoint {
         return action;
     }
 
+    /**
+     * To denote an action that can be either: start, stop, or status.
+     * <p/>
+     * To either start or stop a route, or to get the status of the route as output in the
message body.
+     * You can use suspend and resume from Camel 2.11.1 onwards to either suspend or resume
a route.
+     * And from Camel 2.11.1 onwards you can use stats to get performance statics returned
in XML format;
+     * the routeId option can be used to define which route to get the performance stats
for, if routeId is not defined,
+     * then you get statistics for the entire CamelContext.
+     */
     public void setAction(String action) {
         this.action = action;
     }
@@ -101,6 +118,12 @@ public class ControlBusEndpoint extends DefaultEndpoint {
         return async;
     }
 
+    /**
+     * Whether to execute the control bus task asynchronously.
+     * <p/>
+     * Important: If this option is enabled, then any result from the task is not set on
the Exchange.
+     * This is only possible if executing tasks synchronously.
+     */
     public void setAsync(boolean async) {
         this.async = async;
     }
@@ -109,6 +132,9 @@ public class ControlBusEndpoint extends DefaultEndpoint {
         return loggingLevel;
     }
 
+    /**
+     * Logging level used for logging when task is done, or if any exceptions occurred during
processing the task.
+     */
     public void setLoggingLevel(LoggingLevel loggingLevel) {
         this.loggingLevel = loggingLevel;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 2dbe86a..a983fda 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
@@ -37,12 +37,11 @@ public class DataFormatEndpoint extends DefaultEndpoint {
 
     private MarshalProcessor marshal;
     private UnmarshalProcessor unmarshal;
+    private DataFormat dataFormat;
 
-    @UriPath(description = "Name of data format followed by operation which must be either
marhsal or unmarshal")
+    @UriPath(description = "Name of data format")
     private String name;
-    @UriParam
-    private DataFormat dataFormat;
-    @UriParam
+    @UriPath(enums = "marshal,unmarshal")
     private String operation;
 
     public DataFormatEndpoint() {
@@ -53,6 +52,14 @@ public class DataFormatEndpoint extends DefaultEndpoint {
         this.dataFormat = dataFormat;
     }
 
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
     public DataFormat getDataFormat() {
         return dataFormat;
     }
@@ -65,6 +72,9 @@ public class DataFormatEndpoint extends DefaultEndpoint {
         return operation;
     }
 
+    /**
+     * Operation to use either marshal or unmarshal
+     */
     public void setOperation(String operation) {
         this.operation = operation;
     }
@@ -100,6 +110,9 @@ public class DataFormatEndpoint extends DefaultEndpoint {
 
     @Override
     protected void doStart() throws Exception {
+        if (dataFormat == null && name != null) {
+            dataFormat = getCamelContext().resolveDataFormat(name);
+        }
         if (operation.equals("marshal")) {
             marshal = new MarshalProcessor(dataFormat);
             marshal.setCamelContext(getCamelContext());

http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 74bc4b5..ae949e6 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
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
 public class DataSetEndpoint extends MockEndpoint implements Service {
     private final transient Logger log;
     private final AtomicInteger receivedCounter = new AtomicInteger();
-    @UriPath(name = "name", description = "name of DataSet to lookup in the registry")
+    @UriPath(name = "name", description = "Name of DataSet to lookup in the registry")
     private volatile DataSet dataSet;
     @UriParam(defaultValue = "0")
     private int minRate;

http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 55fa945..c8f9934 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
@@ -38,9 +38,10 @@ import org.apache.camel.util.ObjectHelper;
 @UriEndpoint(scheme = "direct", consumerClass = DirectConsumer.class, label = "core,endpoint")
 public class DirectEndpoint extends DefaultEndpoint {
 
+    private volatile Map<String, DirectConsumer> consumers;
+
     @UriPath(description = "Name of direct endpoint")
     private String name;
-    private volatile Map<String, DirectConsumer> consumers;
     @UriParam(defaultValue = "false")
     private boolean block;
     @UriParam(defaultValue = "30000")

http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 a431511..e409cd2 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
@@ -444,15 +444,25 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor
{
 
                     // gather enums
                     Set<String> enums = new LinkedHashSet<String>();
-                    boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind()
== ElementKind.ENUM;
-                    if (isEnum) {
-                        TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
-                        // find all the enum constants which has the possible enum value
that can be used
-                        List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
-                        for (VariableElement var : fields) {
-                            if (var.getKind() == ElementKind.ENUM_CONSTANT) {
-                                String val = var.toString();
-                                enums.add(val);
+
+                    boolean isEnum;
+                    if (!Strings.isNullOrEmpty(path.enums())) {
+                        isEnum = true;
+                        String[] values = path.enums().split(",");
+                        for (String val : values) {
+                            enums.add(val);
+                        }
+                    } else {
+                        isEnum = fieldTypeElement != null && fieldTypeElement.getKind()
== ElementKind.ENUM;
+                        if (isEnum) {
+                            TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
+                            // find all the enum constants which has the possible enum value
that can be used
+                            List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
+                            for (VariableElement var : fields) {
+                                if (var.getKind() == ElementKind.ENUM_CONSTANT) {
+                                    String val = var.toString();
+                                    enums.add(val);
+                                }
                             }
                         }
                     }
@@ -496,15 +506,25 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor
{
 
                         // gather enums
                         Set<String> enums = new LinkedHashSet<String>();
-                        boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind()
== ElementKind.ENUM;
-                        if (isEnum) {
-                            TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
-                            // find all the enum constants which has the possible enum value
that can be used
-                            List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
-                            for (VariableElement var : fields) {
-                                if (var.getKind() == ElementKind.ENUM_CONSTANT) {
-                                    String val = var.toString();
-                                    enums.add(val);
+
+                        boolean isEnum;
+                        if (!Strings.isNullOrEmpty(param.enums())) {
+                            isEnum = true;
+                            String[] values = param.enums().split(",");
+                            for (String val : values) {
+                                enums.add(val);
+                            }
+                        } else {
+                            isEnum = fieldTypeElement != null && fieldTypeElement.getKind()
== ElementKind.ENUM;
+                            if (isEnum) {
+                                TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
+                                // find all the enum constants which has the possible enum
value that can be used
+                                List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
+                                for (VariableElement var : fields) {
+                                    if (var.getKind() == ElementKind.ENUM_CONSTANT) {
+                                        String val = var.toString();
+                                        enums.add(val);
+                                    }
                                 }
                             }
                         }

http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 3e6b363..2c79b1a 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
@@ -58,4 +58,14 @@ public @interface UriParam {
      */
     String description() default "";
 
+    /**
+     * Allows to define enums this options accepts.
+     * <p/>
+     * If the type is already an enum, then this option should not be used; instead you can
use
+     * this option when the type is a String that only accept certain values.
+     * <p/>
+     * Multiple values is separated by comma.
+     */
+    String enums() default "";
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/6584c321/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 e746d3b..5fef8a6 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
@@ -46,4 +46,14 @@ public @interface UriPath {
      */
     String description() default "";
 
+    /**
+     * Allows to define enums this options accepts.
+     * <p/>
+     * If the type is already an enum, then this option should not be used; instead you can
use
+     * this option when the type is a String that only accept certain values.
+     * <p/>
+     * Multiple values is separated by comma.
+     */
+    String enums() default "";
+
 }
\ No newline at end of file


Mime
View raw message