Repository: camel Updated Branches: refs/heads/master e85782704 -> 5ab310241
CAMEL-9586: Reworked a bit to include component docs. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e88b5a0c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e88b5a0c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e88b5a0c Branch: refs/heads/master Commit: e88b5a0cdebd5657ed63710cd803b7c09701b87a Parents: e857827 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Feb 23 08:09:54 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Feb 23 08:09:54 2016 +0100 ---------------------------------------------------------------------- components/camel-etcd/src/main/docs/etcd.adoc | 14 +++- .../component/etcd/AbstractEtcdConsumer.java | 13 +-- .../component/etcd/AbstractEtcdEndpoint.java | 30 +++++-- .../etcd/AbstractEtcdPollingConsumer.java | 2 +- .../component/etcd/AbstractEtcdProducer.java | 2 +- .../camel/component/etcd/EtcdComponent.java | 6 +- .../camel/component/etcd/EtcdConfiguration.java | 88 +++++++++++++++++--- .../camel/component/etcd/EtcdConstants.java | 1 + .../component/etcd/EtcdKeysConfiguration.java | 82 ------------------ .../camel/component/etcd/EtcdKeysEndpoint.java | 7 +- .../camel/component/etcd/EtcdKeysProducer.java | 15 ++-- .../camel/component/etcd/EtcdNamespace.java | 3 +- .../component/etcd/EtcdStatsConfiguration.java | 23 ----- .../camel/component/etcd/EtcdStatsConsumer.java | 4 +- .../camel/component/etcd/EtcdStatsEndpoint.java | 8 +- .../camel/component/etcd/EtcdStatsProducer.java | 4 +- .../component/etcd/EtcdWatchConfiguration.java | 36 -------- .../camel/component/etcd/EtcdWatchConsumer.java | 8 +- .../camel/component/etcd/EtcdWatchEndpoint.java | 6 +- 19 files changed, 145 insertions(+), 207 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/docs/etcd.adoc ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/docs/etcd.adoc b/components/camel-etcd/src/main/docs/etcd.adoc index 499b706..d416460 100644 --- a/components/camel-etcd/src/main/docs/etcd.adoc +++ b/components/camel-etcd/src/main/docs/etcd.adoc @@ -3,23 +3,35 @@ + // endpoint options: START -The etcd component supports 5 endpoint options which are listed below: +The etcd component supports 15 endpoint options which are listed below: [width="100%",cols="2s,1,1m,1m,5",options="header"] |======================================================================= | Name | Group | Default | Java Type | Description | namespace | common | | EtcdNamespace | *Required* The namespace +| path | common | | String | The path +| path | common | | String | TODO: document me +| recursive | common | false | boolean | TODO: document me +| sendEmptyExchangeOnTimeout | common | false | boolean | TODO: document me +| timeout | common | | Long | TODO: document me +| uris | common | | String | TODO: document me | 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. +| timeToLive | producer | | Integer | TODO: document me | exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). +| password | security | | String | TODO: document me +| sslContextParameters | security | | SSLContextParameters | TODO: document me +| userName | security | | String | TODO: document me |======================================================================= // endpoint options: END + // component options: START The etcd component has no options. http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdConsumer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdConsumer.java index e75909a..0d70397 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdConsumer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdConsumer.java @@ -23,7 +23,7 @@ import org.apache.camel.impl.DefaultConsumer; /** * The etcd consumer. */ -abstract class AbstractEtcdConsumer extends DefaultConsumer { +public abstract class AbstractEtcdConsumer extends DefaultConsumer { private final EtcdConfiguration configuration; private final EtcdNamespace namespace; private final String path; @@ -56,15 +56,4 @@ abstract class AbstractEtcdConsumer extends DefaultConsumer { return client; } - protected EtcdConfiguration getConfiguration() { - return configuration; - } - - protected EtcdNamespace getActionNamespace() { - return namespace; - } - - protected String getPath() { - return this.path; - } } http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java index 8cf18ca..5c7bd34 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java @@ -17,28 +17,32 @@ package org.apache.camel.component.etcd; import java.net.URI; +import javax.net.ssl.SSLContext; import mousio.etcd4j.EtcdClient; import mousio.etcd4j.EtcdSecurityContext; 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; /** * Represents a etcd endpoint. */ -@UriEndpoint(scheme = "etcd", title = "etcd", syntax = "etcd:namespace", consumerClass = AbstractEtcdConsumer.class, label = "etcd") -abstract class AbstractEtcdEndpoint<C extends EtcdConfiguration> extends DefaultEndpoint { +@UriEndpoint(scheme = "etcd", title = "etcd", syntax = "etcd:namespace/path", consumerClass = AbstractEtcdConsumer.class, label = "etcd") +public abstract class AbstractEtcdEndpoint extends DefaultEndpoint { - @UriPath(description = "The namespace") + @UriPath(description = "The namespace") // TODO: document me @Metadata(required = "true") private final EtcdNamespace namespace; - private final C configuration; + @UriPath(description = "The path") // TODO: document me private final String path; + @UriParam + private final EtcdConfiguration configuration; - protected AbstractEtcdEndpoint(String uri, EtcdComponent component, C configuration, EtcdNamespace namespace, String path) { + protected AbstractEtcdEndpoint(String uri, EtcdComponent component, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(uri, component); this.configuration = configuration; @@ -51,18 +55,18 @@ abstract class AbstractEtcdEndpoint<C extends EtcdConfiguration> extends Default return true; } - public C getConfiguration() { + public EtcdConfiguration getConfiguration() { return this.configuration; } - public EtcdNamespace getActionNamespace() { + public EtcdNamespace getNamespace() { return this.namespace; } public EtcdClient createClient() throws Exception { String[] uris = EtcdConstants.ETCD_DEFAULT_URIS; - if (configuration.hasUris()) { + if (configuration.getUris() != null) { uris = configuration.getUris().split(","); } @@ -75,7 +79,7 @@ abstract class AbstractEtcdEndpoint<C extends EtcdConfiguration> extends Default return new EtcdClient( new EtcdSecurityContext( - configuration.createSslContext(), + createSslContext(configuration), configuration.getUserName(), configuration.getPassword()), etcdUriList @@ -94,4 +98,12 @@ abstract class AbstractEtcdEndpoint<C extends EtcdConfiguration> extends Default return path; } + + private SSLContext createSslContext(EtcdConfiguration configuration) throws Exception { + if (configuration.getSslContextParameters() != null) { + return configuration.getSslContextParameters().createSSLContext(); + } + return null; + } + } http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java index d9d65df..542250c 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdPollingConsumer.java @@ -23,7 +23,7 @@ import org.apache.camel.impl.ScheduledPollConsumer; /** * The etcd consumer. */ -abstract class AbstractEtcdPollingConsumer extends ScheduledPollConsumer { +public abstract class AbstractEtcdPollingConsumer extends ScheduledPollConsumer { private final EtcdConfiguration configuration; private final EtcdNamespace namespace; private final String path; http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java index 214c9a0..3c56240 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdProducer.java @@ -22,7 +22,7 @@ import org.apache.camel.impl.DefaultProducer; /** * The etcd producer. */ -abstract class AbstractEtcdProducer extends DefaultProducer { +public abstract class AbstractEtcdProducer extends DefaultProducer { private final EtcdConfiguration configuration; private final EtcdNamespace namespace; private final String path; http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java index 8aa20c8f..fca9136 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java @@ -47,7 +47,7 @@ public class EtcdComponent extends UriEndpointComponent { return new EtcdStatsEndpoint( uri, this, - loadConfiguration(new EtcdStatsConfiguration(), parameters), + loadConfiguration(new EtcdConfiguration(), parameters), namespace, remaining ); @@ -55,7 +55,7 @@ public class EtcdComponent extends UriEndpointComponent { return new EtcdWatchEndpoint( uri, this, - loadConfiguration(new EtcdWatchConfiguration(), parameters), + loadConfiguration(new EtcdConfiguration(), parameters), namespace, remaining ); @@ -63,7 +63,7 @@ public class EtcdComponent extends UriEndpointComponent { return new EtcdKeysEndpoint( uri, this, - loadConfiguration(new EtcdKeysConfiguration(), parameters), + loadConfiguration(new EtcdConfiguration(), parameters), namespace, remaining ); http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConfiguration.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConfiguration.java index 38c85a1..fcaa50f 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConfiguration.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConfiguration.java @@ -23,29 +23,34 @@ import org.apache.camel.spi.UriParams; import org.apache.camel.util.jsse.SSLContextParameters; @UriParams -class EtcdConfiguration { +public class EtcdConfiguration { @UriParam(multiValue = true) private String uris; - @UriParam(label = "security") private SSLContextParameters sslContextParameters; - @UriParam(label = "security") private String userName; - @UriParam(label = "security") private String password; - + @UriParam + boolean sendEmptyExchangeOnTimeout; + @UriParam + private String path; + @UriParam + private boolean recursive; + @UriParam(label = "producer") + private Integer timeToLive; + @UriParam + private Long timeout; public String getUris() { return uris; } - public boolean hasUris() { - return uris != null; - } - + /** + * TODO: document me + */ public void setUris(String uris) { this.uris = uris; } @@ -54,6 +59,9 @@ class EtcdConfiguration { return sslContextParameters; } + /** + * TODO: document me + */ public void setSslContextParameters(SSLContextParameters sslContextParameters) { this.sslContextParameters = sslContextParameters; } @@ -62,6 +70,9 @@ class EtcdConfiguration { return userName; } + /** + * TODO: document me + */ public void setUserName(String userName) { this.userName = userName; } @@ -70,11 +81,66 @@ class EtcdConfiguration { return password; } + /** + * TODO: document me + */ public void setPassword(String password) { this.password = password; } - SSLContext createSslContext() throws Exception { - return sslContextParameters != null ? sslContextParameters.createSSLContext() : null; + public boolean isSendEmptyExchangeOnTimeout() { + return sendEmptyExchangeOnTimeout; } + + /** + * TODO: document me + */ + public void setSendEmptyExchangeOnTimeout(boolean sendEmptyExchangeOnTimeout) { + this.sendEmptyExchangeOnTimeout = sendEmptyExchangeOnTimeout; + } + + public String getPath() { + return path; + } + + /** + * TODO: document me + */ + public void setPath(String path) { + this.path = path; + } + + public boolean isRecursive() { + return recursive; + } + + /** + * TODO: document me + */ + public void setRecursive(boolean recursive) { + this.recursive = recursive; + } + + public Integer getTimeToLive() { + return timeToLive; + } + + /** + * TODO: document me + */ + public void setTimeToLive(Integer timeToLive) { + this.timeToLive = timeToLive; + } + + public Long getTimeout() { + return timeout; + } + + /** + * TODO: document me + */ + public void setTimeout(Long timeout) { + this.timeout = timeout; + } + } http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConstants.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConstants.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConstants.java index 88bc6ea..0b102c3 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConstants.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdConstants.java @@ -17,6 +17,7 @@ package org.apache.camel.component.etcd; public interface EtcdConstants { + String[] ETCD_DEFAULT_URIS = new String [] { "http://localhost:2379", "http://localhost:4001" http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysConfiguration.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysConfiguration.java deleted file mode 100644 index ac46330..0000000 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysConfiguration.java +++ /dev/null @@ -1,82 +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.etcd; - -import org.apache.camel.spi.UriParam; -import org.apache.camel.spi.UriParams; -import org.apache.camel.util.ObjectHelper; - -@UriParams -class EtcdKeysConfiguration extends EtcdConfiguration { - @UriParam - private String path; - - @UriParam - private boolean recursive; - - @UriParam(label = "producer") - private Integer timeToLive; - - @UriParam(label = "producer,consumer") - private Long timeout; - - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public boolean hasPath() { - return ObjectHelper.isNotEmpty(path); - } - - public boolean isRecursive() { - return recursive; - } - - public void setRecursive(boolean recursive) { - this.recursive = recursive; - } - - - public Integer getTimeToLive() { - return timeToLive; - } - - public void setTimeToLive(Integer timeToLive) { - this.timeToLive = timeToLive; - } - - public boolean hasTimeToLive() { - return timeToLive != null && timeToLive > 0; - } - - public Long getTimeout() { - return timeout; - } - - public void setTimeout(Long timeout) { - this.timeout = timeout; - } - - public boolean hasTimeout() { - return timeout != null && timeout > 0; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysEndpoint.java index e16f71d..03deafc 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysEndpoint.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysEndpoint.java @@ -20,15 +20,16 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -class EtcdKeysEndpoint extends AbstractEtcdEndpoint<EtcdKeysConfiguration> { +public class EtcdKeysEndpoint extends AbstractEtcdEndpoint { + public EtcdKeysEndpoint( - String uri, EtcdComponent component, EtcdKeysConfiguration configuration, EtcdNamespace namespace, String path) { + String uri, EtcdComponent component, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(uri, component, configuration, namespace, path); } @Override public Producer createProducer() throws Exception { - return new EtcdKeysProducer(this, getConfiguration(), getActionNamespace(), getPath()); + return new EtcdKeysProducer(this, getConfiguration(), getNamespace(), getPath()); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysProducer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysProducer.java index fc6395e..167129e 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysProducer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdKeysProducer.java @@ -27,12 +27,11 @@ import org.apache.camel.Exchange; import org.apache.camel.ExchangeTimedOutException; import org.apache.camel.util.ObjectHelper; - -class EtcdKeysProducer extends AbstractEtcdProducer { - private final EtcdKeysConfiguration configuration; +public class EtcdKeysProducer extends AbstractEtcdProducer { + private final EtcdConfiguration configuration; private final String defaultPath; - EtcdKeysProducer(EtcdKeysEndpoint endpoint, EtcdKeysConfiguration configuration, EtcdNamespace namespace, String path) { + public EtcdKeysProducer(EtcdKeysEndpoint endpoint, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(endpoint, configuration, namespace, path); this.configuration = configuration; @@ -74,10 +73,10 @@ class EtcdKeysProducer extends AbstractEtcdProducer { private void processSet(EtcdClient client, String path, Exchange exchange) throws Exception { EtcdKeyPutRequest request = client.put(path, exchange.getIn().getBody(String.class)); - if (configuration.hasTimeToLive()) { + if (configuration.getTimeToLive() != null) { request.ttl(configuration.getTimeToLive()); } - if (configuration.hasTimeout()) { + if (configuration.getTimeout() != null) { request.timeout(configuration.getTimeout(), TimeUnit.MILLISECONDS); } @@ -90,7 +89,7 @@ class EtcdKeysProducer extends AbstractEtcdProducer { private void processGet(EtcdClient client, String path, Exchange exchange) throws Exception { EtcdKeyGetRequest request = client.get(path); - if (configuration.hasTimeout()) { + if (configuration.getTimeout() != null) { request.timeout(configuration.getTimeout(), TimeUnit.MILLISECONDS); } if (configuration.isRecursive()) { @@ -106,7 +105,7 @@ class EtcdKeysProducer extends AbstractEtcdProducer { private void processDel(EtcdClient client, String path, boolean dir, Exchange exchange) throws Exception { EtcdKeyDeleteRequest request = client.delete(path); - if (configuration.hasTimeout()) { + if (configuration.getTimeout() != null) { request.timeout(configuration.getTimeout(), TimeUnit.MILLISECONDS); } if (configuration.isRecursive()) { http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdNamespace.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdNamespace.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdNamespace.java index 9d370d8..9517c67 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdNamespace.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdNamespace.java @@ -18,7 +18,7 @@ package org.apache.camel.component.etcd; import org.apache.camel.util.ObjectHelper; -enum EtcdNamespace { +public enum EtcdNamespace { STATS(EtcdConstants.ETCD_PATH_STATS), WATCH(EtcdConstants.ETCD_PATH_WATCH), KEYS(EtcdConstants.ETCD_PATH_KEYS); @@ -35,7 +35,6 @@ enum EtcdNamespace { return path; } - static EtcdNamespace fromPath(String name) { if (ObjectHelper.isNotEmpty(name)) { for (int i = VALUES.length - 1; i >= 0; --i) { http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConfiguration.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConfiguration.java deleted file mode 100644 index 024b212..0000000 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConfiguration.java +++ /dev/null @@ -1,23 +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.etcd; - -import org.apache.camel.spi.UriParams; - -@UriParams -class EtcdStatsConfiguration extends EtcdConfiguration { -} http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConsumer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConsumer.java index f9a8648..adda1f3 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConsumer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsConsumer.java @@ -19,9 +19,9 @@ package org.apache.camel.component.etcd; import org.apache.camel.Exchange; import org.apache.camel.Processor; -class EtcdStatsConsumer extends AbstractEtcdPollingConsumer { +public class EtcdStatsConsumer extends AbstractEtcdPollingConsumer { - EtcdStatsConsumer(EtcdStatsEndpoint endpoint, Processor processor, EtcdStatsConfiguration configuration, EtcdNamespace namespace, String path) { + public EtcdStatsConsumer(EtcdStatsEndpoint endpoint, Processor processor, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(endpoint, processor, configuration, namespace, path); } http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java index e29e45d..e3386bc 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsEndpoint.java @@ -21,21 +21,21 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +public class EtcdStatsEndpoint extends AbstractEtcdEndpoint { -class EtcdStatsEndpoint extends AbstractEtcdEndpoint<EtcdStatsConfiguration> { public EtcdStatsEndpoint( - String uri, EtcdComponent component, EtcdStatsConfiguration configuration, EtcdNamespace namespace, String path) { + String uri, EtcdComponent component, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(uri, component, configuration, namespace, path); } @Override public Producer createProducer() throws Exception { - return new EtcdStatsProducer(this, getConfiguration(), getActionNamespace(), getPath()); + return new EtcdStatsProducer(this, getConfiguration(), getNamespace(), getPath()); } @Override public Consumer createConsumer(Processor processor) throws Exception { - return new EtcdStatsConsumer(this, processor, getConfiguration(), getActionNamespace(), getPath()); + return new EtcdStatsConsumer(this, processor, getConfiguration(), getNamespace(), getPath()); } Object getStats(EtcdClient client) { http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsProducer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsProducer.java index fbefe68..9b8ba8b 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsProducer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdStatsProducer.java @@ -18,9 +18,9 @@ package org.apache.camel.component.etcd; import org.apache.camel.Exchange; +public class EtcdStatsProducer extends AbstractEtcdProducer { -class EtcdStatsProducer extends AbstractEtcdProducer { - EtcdStatsProducer(EtcdStatsEndpoint endpoint, EtcdStatsConfiguration configuration, EtcdNamespace namespace, String path) { + public EtcdStatsProducer(EtcdStatsEndpoint endpoint, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(endpoint, configuration, namespace, path); } http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConfiguration.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConfiguration.java deleted file mode 100644 index d5d1f9e..0000000 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConfiguration.java +++ /dev/null @@ -1,36 +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.etcd; - -import org.apache.camel.spi.UriParam; -import org.apache.camel.spi.UriParams; - -@UriParams -class EtcdWatchConfiguration extends EtcdKeysConfiguration { - - - @UriParam(defaultValue = "false") - boolean sendEmptyExchangeOnTimeout; - - public boolean isSendEmptyExchangeOnTimeout() { - return sendEmptyExchangeOnTimeout; - } - - public void setSendEmptyExchangeOnTimeout(boolean sendEmptyExchangeOnTimeout) { - this.sendEmptyExchangeOnTimeout = sendEmptyExchangeOnTimeout; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConsumer.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConsumer.java index 23bb560..43b2c91 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConsumer.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchConsumer.java @@ -28,14 +28,14 @@ import org.apache.camel.Processor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -class EtcdWatchConsumer extends AbstractEtcdConsumer implements ResponsePromise.IsSimplePromiseResponseHandler<EtcdKeysResponse> { +public class EtcdWatchConsumer extends AbstractEtcdConsumer implements ResponsePromise.IsSimplePromiseResponseHandler<EtcdKeysResponse> { private static final Logger LOGGER = LoggerFactory.getLogger(EtcdWatchConsumer.class); private final EtcdWatchEndpoint endpoint; - private final EtcdWatchConfiguration configuration; + private final EtcdConfiguration configuration; private final String defaultPath; - EtcdWatchConsumer(EtcdWatchEndpoint endpoint, Processor processor, EtcdWatchConfiguration configuration, EtcdNamespace namespace, String path) { + public EtcdWatchConsumer(EtcdWatchEndpoint endpoint, Processor processor, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(endpoint, processor, configuration, namespace, path); this.endpoint = endpoint; @@ -100,7 +100,7 @@ class EtcdWatchConsumer extends AbstractEtcdConsumer implements ResponsePromise. if (configuration.isRecursive()) { request.recursive(); } - if (configuration.hasTimeout()) { + if (configuration.getTimeout() != null) { request.timeout(configuration.getTimeout(), TimeUnit.MILLISECONDS); } http://git-wip-us.apache.org/repos/asf/camel/blob/e88b5a0c/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchEndpoint.java index 3791dc0..3dbfc33 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchEndpoint.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdWatchEndpoint.java @@ -20,10 +20,10 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +public class EtcdWatchEndpoint extends AbstractEtcdEndpoint { -class EtcdWatchEndpoint extends AbstractEtcdEndpoint<EtcdWatchConfiguration> { public EtcdWatchEndpoint( - String uri, EtcdComponent component, EtcdWatchConfiguration configuration, EtcdNamespace namespace, String path) { + String uri, EtcdComponent component, EtcdConfiguration configuration, EtcdNamespace namespace, String path) { super(uri, component, configuration, namespace, path); } @@ -34,6 +34,6 @@ class EtcdWatchEndpoint extends AbstractEtcdEndpoint<EtcdWatchConfiguration> { @Override public Consumer createConsumer(Processor processor) throws Exception { - return new EtcdWatchConsumer(this, processor, getConfiguration(), getActionNamespace(), getPath()); + return new EtcdWatchConsumer(this, processor, getConfiguration(), getNamespace(), getPath()); } }