Fixed camel-chronoicle component docs and schema

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

Branch: refs/heads/master
Commit: bb570910090c71abd4bb813214e8bde4414d519c
Parents: 52a962b
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Oct 5 12:11:32 2016 -0400
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Oct 5 12:11:32 2016 -0400

----------------------------------------------------------------------
 .../main/docs/chronicle-engine-component.adoc   | 12 +++-
 .../engine/ChronicleEngineComponent.java        |  9 ++-
 .../engine/ChronicleEngineConfiguration.java    | 63 +-------------------
 .../engine/ChronicleEngineEndpoint.java         | 42 ++++++++-----
 4 files changed, 43 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bb570910/components/camel-chronicle/src/main/docs/chronicle-engine-component.adoc
----------------------------------------------------------------------
diff --git 
a/components/camel-chronicle/src/main/docs/chronicle-engine-component.adoc 
b/components/camel-chronicle/src/main/docs/chronicle-engine-component.adoc
index 1d79ecb..3f8998b 100644
--- a/components/camel-chronicle/src/main/docs/chronicle-engine-component.adoc
+++ b/components/camel-chronicle/src/main/docs/chronicle-engine-component.adoc
@@ -6,13 +6,21 @@ The Chronicle Engine component has no options.
 
 
 // endpoint options: START
-The Chronicle Engine component supports 5 endpoint options which are listed 
below:
+The Chronicle Engine component supports 13 endpoint options which are listed 
below:
 
 {% raw %}
 [width="100%",cols="2,1,1m,1m,5",options="header"]
 |=======================================================================
 | Name | Group | Default | Java Type | Description
-| path | common |  | String | *Required* engine path
+| addresses | common |  | String | *Required* Engine addresses. Multiple 
addresses can be separated by comman.
+| path | common |  | String | *Required* Engine path
+| action | common |  | String | The default action to perform valid values 
are: - PUBLISH - PPUBLISH_AND_INDEX - PPUT - PGET_AND_PUT - PPUT_ALL - 
PPUT_IF_ABSENT - PGET - PGET_AND_REMOVE - PREMOVE - PIS_EMPTY - PSIZE
+| filteredMapEvents | common |  | String | A comma separated list of Map event 
type to filer valid values are: INSERT UPDATE REMOVE.
+| persistent | common | true | boolean | Enable/disable data persistence
+| subscribeMapEvents | common | true | boolean | Set if consumer should 
subscribe to Map events default true.
+| subscribeTopicEvents | common | false | boolean | Set if consumer should 
subscribe to TopicEventsd efault false.
+| subscribeTopologicalEvents | common | false | boolean | Set if consumer 
should subscribe to TopologicalEventsd efault false.
+| wireType | common | BINARY | String | The Wire type to use default to binary 
wire.
 | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the 
consumer to the Camel routing Error Handler which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages or the likes will now 
be processed as a message and handled by the routing Error Handler. By default 
the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions that will be logged at WARN/ERROR level and ignored.
 | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the 
consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler 
is enabled then this options is not in use. By default the consumer will deal 
with exceptions that will be logged at WARN/ERROR level and ignored.
 | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the 
exchange pattern when the consumer creates an exchange.

http://git-wip-us.apache.org/repos/asf/camel/blob/bb570910/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineComponent.java
 
b/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineComponent.java
index 06d7d7d..eb26058 100644
--- 
a/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineComponent.java
+++ 
b/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineComponent.java
@@ -39,12 +39,11 @@ public class ChronicleEngineComponent extends 
UriEndpointComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         final ChronicleEngineConfiguration configuration = new 
ChronicleEngineConfiguration();
-        configuration.setCamelContext(getCamelContext());
-        configuration.setAddresses(ObjectHelper.before(remaining, "/"));
-        configuration.setPath(ObjectHelper.after(remaining, "/"));
-
         setProperties(configuration, parameters);
 
-        return new ChronicleEngineEndpoint(uri, this, configuration);
+        ChronicleEngineEndpoint answer = new ChronicleEngineEndpoint(uri, 
this, configuration);
+        answer.setAddresses(ObjectHelper.before(remaining, "/"));
+        answer.setPath(ObjectHelper.after(remaining, "/"));
+        return answer;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/bb570910/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineConfiguration.java
 
b/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineConfiguration.java
index 8d24a17..6b76ee9 100644
--- 
a/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineConfiguration.java
+++ 
b/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineConfiguration.java
@@ -17,86 +17,27 @@
 package org.apache.camel.component.chronicle.engine;
 
 import net.openhft.chronicle.wire.WireType;
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 
 @UriParams
-public class ChronicleEngineConfiguration implements CamelContextAware {
+public class ChronicleEngineConfiguration {
 
     @UriParam(defaultValue = "BINARY", javaType = "java.lang.String")
     private WireType wireType = WireType.BINARY;
-
     @UriParam(defaultValue = "true")
     private boolean subscribeMapEvents = true;
-
     @UriParam(javaType = "java.lang.String")
     private String[] filteredMapEvents;
-
     @UriParam
     private boolean subscribeTopologicalEvents;
-
     @UriParam
     private boolean subscribeTopicEvents;
-
-    @UriParam
+    @UriParam(enums = 
"PUBLISH,PUBLISH_AND_INDEX,PPUT,PGET_AND_PUT,PPUT_ALL,PPUT_IF_ABSENT,PGET,PGET_AND_REMOVE,PREMOVE,PIS_EMPTY,PSIZE")
     private String action;
-
     @UriParam(defaultValue = "true")
     private boolean persistent = true;
 
-    private CamelContext camelContext;
-    private String[] addresses;
-    private String path;
-
-    // ****************************
-    //
-    // ****************************
-
-    @Override
-    public CamelContext getCamelContext() {
-        return camelContext;
-    }
-
-    @Override
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
-    }
-
-    public String[] getAddresses() {
-        return addresses;
-    }
-
-    /**
-     * Description
-     */
-    public void setAddresses(String addresses) {
-        setAddresses(addresses.split(","));
-    }
-
-    /**
-     * Description
-     */
-    public void setAddresses(String[] addresses) {
-        this.addresses = addresses;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    /**
-     * Description
-     */
-    public void setPath(String path) {
-        this.path = path;
-
-        if (!this.path.startsWith("/")) {
-            this.path = "/" + this.path;
-        }
-    }
-
     // ****************************
     // CLIENT OPTIONS
     // ****************************

http://git-wip-us.apache.org/repos/asf/camel/blob/bb570910/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineEndpoint.java
 
b/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineEndpoint.java
index 8939a3c..8387474 100644
--- 
a/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineEndpoint.java
+++ 
b/components/camel-chronicle/src/main/java/org/apache/camel/component/chronicle/engine/ChronicleEngineEndpoint.java
@@ -24,28 +24,24 @@ import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
-import org.apache.camel.util.ObjectHelper;
-
 
 @UriEndpoint(scheme = "chronicle-engine", title = "Chronicle Engine", syntax = 
"chronicle-engine:addresses/path", consumerClass = 
ChronicleEngineConsumer.class, label = "Chronicle")
 public class ChronicleEngineEndpoint extends DefaultEndpoint {
-    private final ChronicleEngineConfiguration configuration;
 
-    @UriPath(description = "engine path")
+    @UriPath(description = "Engine addresses. Multiple addresses can be 
separated by comman.")
+    @Metadata(required = "true")
+    private String addresses;
+    @UriPath(description = "Engine path")
     @Metadata(required = "true")
-    private final String path;
+    private String path;
+    @UriParam
+    private ChronicleEngineConfiguration configuration;
 
     public ChronicleEngineEndpoint(String uri, ChronicleEngineComponent 
component, ChronicleEngineConfiguration configuration) throws Exception {
         super(uri, component);
-
-        ObjectHelper.notNull(configuration.getCamelContext(), "camelContext");
-        ObjectHelper.notNull(configuration.getAddresses(), "addresses");
-        ObjectHelper.notNull(configuration.getPath(), "path");
-        ObjectHelper.notNull(configuration.getWireType(), "wireType");
-
         this.configuration = configuration;
-        this.path = configuration.getPath();
     }
 
     @Override
@@ -65,12 +61,27 @@ public class ChronicleEngineEndpoint extends 
DefaultEndpoint {
 
     @Override
     protected void doStart() throws Exception {
+        if (!this.path.startsWith("/")) {
+            this.path = "/" + this.path;
+        }
     }
 
     @Override
     protected void doStop() throws Exception {
     }
 
+    public void setAddresses(String addresses) {
+        this.addresses = addresses;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public void setConfiguration(ChronicleEngineConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
     // ****************************
     // Helpers
     // ****************************
@@ -85,12 +96,13 @@ public class ChronicleEngineEndpoint extends 
DefaultEndpoint {
 
     protected String getUri() {
         return configuration.isPersistent()
-            ? configuration.getPath()
-            : configuration.getPath() + "?dontPersist=true";
+            ? path
+            : path + "?dontPersist=true";
     }
 
     protected AssetTree createRemoteAssetTree() {
+        String[] urls = addresses.split(",");
         return new VanillaAssetTree()
-            .forRemoteAccess(configuration.getAddresses(), 
configuration.getWireType());
+            .forRemoteAccess(urls, configuration.getWireType());
     }
 }

Reply via email to