camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [16/18] camel git commit: Fix a bunch of other checkstyle violations
Date Wed, 12 Apr 2017 08:56:02 GMT
Fix a bunch of other checkstyle violations


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

Branch: refs/heads/master
Commit: 839453f85b8aefb24195eb7d9881b9f15b2b5410
Parents: 942f160
Author: Jens Reimann <jreimann@redhat.com>
Authored: Wed Apr 12 09:59:16 2017 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Wed Apr 12 10:55:27 2017 +0200

----------------------------------------------------------------------
 .../milo/client/MiloClientConnection.java       |  2 +-
 .../milo/client/MiloClientEndpoint.java         |  4 +-
 .../client/MiloClientItemConfiguration.java     |  6 +-
 .../client/internal/SubscriptionManager.java    | 80 ++++++++++----------
 .../milo/server/MiloServerComponent.java        | 39 +++++-----
 .../milo/server/MiloServerConsumer.java         |  2 +-
 .../milo/server/MiloServerEndpoint.java         |  2 +-
 .../milo/server/MiloServerProducer.java         |  2 +-
 .../component/milo/testing/Application.java     |  6 +-
 .../milo/testing/Application2Client.java        |  6 +-
 .../milo/testing/Application2Server.java        |  5 +-
 11 files changed, 82 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
index ec3d569..b521b0b 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConnection.java
@@ -74,7 +74,7 @@ public class MiloClientConnection implements AutoCloseable {
 
     @FunctionalInterface
     public interface MonitorHandle {
-        public void unregister();
+        void unregister();
     }
 
     public MonitorHandle monitorValue(final MiloClientItemConfiguration configuration, final
Consumer<DataValue> valueConsumer) {

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientEndpoint.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientEndpoint.java
index 7826389..34a4148 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientEndpoint.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientEndpoint.java
@@ -30,7 +30,7 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.eclipse.milo.opcua.stack.core.types.builtin.ExpandedNodeId;
 
-@UriEndpoint(scheme = "milo-client", syntax = "milo-client:tcp://user:password@host:port/path/to/service?itemId=item.id&namespaceUri=urn:foo:bar",
title = "Milo based OPC UA Client", consumerClass = MiloClientConsumer.class, label = "iot")
+@UriEndpoint(scheme = "milo-client", syntax = "milo-client:tcp://user:password@host:port/path/to/service",
title = "Milo based OPC UA Client", consumerClass = MiloClientConsumer.class, label = "iot")
 public class MiloClientEndpoint extends DefaultEndpoint implements MiloClientItemConfiguration
{
 
     /**
@@ -62,7 +62,7 @@ public class MiloClientEndpoint extends DefaultEndpoint implements MiloClientIte
      * Default "await" setting for writes
      */
     @UriParam
-    private boolean defaultAwaitWrites = false;
+    private boolean defaultAwaitWrites;
 
     private final MiloClientConnection connection;
     private final MiloClientComponent component;

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientItemConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientItemConfiguration.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientItemConfiguration.java
index 2468449..5e7954d 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientItemConfiguration.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientItemConfiguration.java
@@ -20,9 +20,9 @@ import org.apache.camel.component.milo.NamespaceId;
 import org.apache.camel.component.milo.PartialNodeId;
 
 public interface MiloClientItemConfiguration {
-    public NamespaceId makeNamespaceId();
+    NamespaceId makeNamespaceId();
 
-    public PartialNodeId makePartialNodeId();
+    PartialNodeId makePartialNodeId();
 
-    public Double getSamplingInterval();
+    Double getSamplingInterval();
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
index 0350987..7502164 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
@@ -68,7 +68,7 @@ import org.slf4j.LoggerFactory;
 
 public class SubscriptionManager {
 
-    private final static Logger LOG = LoggerFactory.getLogger(SubscriptionManager.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SubscriptionManager.class);
 
     private final AtomicLong clientHandleCounter = new AtomicLong(0);
 
@@ -100,7 +100,7 @@ public class SubscriptionManager {
     }
 
     public interface Worker<T> {
-        public void work(T on) throws Exception;
+        void work(T on) throws Exception;
     }
 
     private static class Subscription {
@@ -110,7 +110,7 @@ public class SubscriptionManager {
 
         private final Consumer<DataValue> valueConsumer;
 
-        public Subscription(final NamespaceId namespaceId, final PartialNodeId partialNodeId,
final Double samplingInterval, final Consumer<DataValue> valueConsumer) {
+        Subscription(final NamespaceId namespaceId, final PartialNodeId partialNodeId, final
Double samplingInterval, final Consumer<DataValue> valueConsumer) {
             this.namespaceId = namespaceId;
             this.partialNodeId = partialNodeId;
             this.samplingInterval = samplingInterval;
@@ -144,7 +144,7 @@ public class SubscriptionManager {
 
         private final Map<String, UShort> namespaceCache = new ConcurrentHashMap<>();
 
-        public Connected(final OpcUaClient client, final UaSubscription manager) {
+        Connected(final OpcUaClient client, final UaSubscription manager) {
             this.client = client;
             this.manager = manager;
         }
@@ -179,9 +179,7 @@ public class SubscriptionManager {
                 }
             }
 
-            if (!items.isEmpty())
-
-            {
+            if (!items.isEmpty()) {
 
                 // create monitors
 
@@ -364,6 +362,10 @@ public class SubscriptionManager {
             }
         }
 
+        performAndEvalConnect();
+    }
+
+    private void performAndEvalConnect() {
         try {
             final Connected connected = performConnect();
             LOG.debug("Connect call done");
@@ -398,38 +400,6 @@ public class SubscriptionManager {
         }
     }
 
-    public void dispose() {
-        Connected connected;
-
-        synchronized (this) {
-            if (this.disposed) {
-                return;
-            }
-            this.disposed = true;
-            connected = this.connected;
-        }
-
-        if (connected != null) {
-            // dispose outside of lock
-            connected.dispose();
-        }
-    }
-
-    private synchronized void triggerReconnect(final boolean immediate) {
-        LOG.info("Trigger re-connect (immediate: {})", immediate);
-
-        if (this.reconnectJob != null) {
-            LOG.info("Re-connect already scheduled");
-            return;
-        }
-
-        if (immediate) {
-            this.reconnectJob = this.executor.submit(this::connect);
-        } else {
-            this.reconnectJob = this.executor.schedule(this::connect, this.reconnectTimeout,
TimeUnit.MILLISECONDS);
-        }
-    }
-
     private Connected performConnect() throws Exception {
         final EndpointDescription endpoint = UaTcpStackClient.getEndpoints(this.configuration.getEndpointUri()).thenApply(endpoints
-> {
             if (LOG.isDebugEnabled()) {
@@ -485,6 +455,38 @@ public class SubscriptionManager {
         }
     }
 
+    public void dispose() {
+        Connected connected;
+
+        synchronized (this) {
+            if (this.disposed) {
+                return;
+            }
+            this.disposed = true;
+            connected = this.connected;
+        }
+
+        if (connected != null) {
+            // dispose outside of lock
+            connected.dispose();
+        }
+    }
+
+    private synchronized void triggerReconnect(final boolean immediate) {
+        LOG.info("Trigger re-connect (immediate: {})", immediate);
+
+        if (this.reconnectJob != null) {
+            LOG.info("Re-connect already scheduled");
+            return;
+        }
+
+        if (immediate) {
+            this.reconnectJob = this.executor.submit(this::connect);
+        } else {
+            this.reconnectJob = this.executor.schedule(this::connect, this.reconnectTimeout,
TimeUnit.MILLISECONDS);
+        }
+    }
+
     private EndpointDescription findEndpoint(final EndpointDescription[] endpoints) {
         EndpointDescription best = null;
         for (final EndpointDescription ep : endpoints) {

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
index b72c6b5..e8295f7 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
@@ -68,30 +68,10 @@ import static org.eclipse.milo.opcua.sdk.server.api.config.OpcUaServerConfig.USE
  * OPC UA Server based component
  */
 public class MiloServerComponent extends DefaultComponent {
+    public static final String DEFAULT_NAMESPACE_URI = "urn:org:apache:camel";
 
     private static final Logger LOG = LoggerFactory.getLogger(MiloClientConsumer.class);
-
-    private final static class DenyAllCertificateValidator implements CertificateValidator
{
-        public static final CertificateValidator INSTANCE = new DenyAllCertificateValidator();
-
-        private DenyAllCertificateValidator() {
-        }
-
-        @Override
-        public void validate(final X509Certificate certificate) throws UaException {
-            throw new UaException(StatusCodes.Bad_CertificateUseNotAllowed);
-        }
-
-        @Override
-        public void verifyTrustChain(final X509Certificate certificate, final List<X509Certificate>
chain) throws UaException {
-            throw new UaException(StatusCodes.Bad_CertificateUseNotAllowed);
-        }
-    }
-
     private static final String URL_CHARSET = "UTF-8";
-
-    public static final String DEFAULT_NAMESPACE_URI = "urn:org:apache:camel";
-
     private static final OpcUaServerConfig DEFAULT_SERVER_CONFIG;
 
     static {
@@ -112,6 +92,23 @@ public class MiloServerComponent extends DefaultComponent {
         DEFAULT_SERVER_CONFIG = cfg.build();
     }
 
+    private static final class DenyAllCertificateValidator implements CertificateValidator
{
+        public static final CertificateValidator INSTANCE = new DenyAllCertificateValidator();
+
+        private DenyAllCertificateValidator() {
+        }
+
+        @Override
+        public void validate(final X509Certificate certificate) throws UaException {
+            throw new UaException(StatusCodes.Bad_CertificateUseNotAllowed);
+        }
+
+        @Override
+        public void verifyTrustChain(final X509Certificate certificate, final List<X509Certificate>
chain) throws UaException {
+            throw new UaException(StatusCodes.Bad_CertificateUseNotAllowed);
+        }
+    }
+
     private String namespaceUri = DEFAULT_NAMESPACE_URI;
 
     private final OpcUaServerConfigBuilder serverConfig;

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
index 5f6e925..ca91d14 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
@@ -27,7 +27,7 @@ import org.apache.camel.impl.DefaultConsumer;
 import org.apache.camel.impl.DefaultMessage;
 import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
 
-class MiloServerConsumer extends DefaultConsumer {
+public class MiloServerConsumer extends DefaultConsumer {
 
     private final CamelServerItem item;
     private final Consumer<DataValue> writeHandler = this::performWrite;

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerEndpoint.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerEndpoint.java
index df67226..6384365 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerEndpoint.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerEndpoint.java
@@ -31,7 +31,7 @@ import org.apache.camel.spi.UriPath;
  * OPC UA Server based endpoint
  */
 @UriEndpoint(scheme = "milo-server", syntax = "milo-server:itemId", title = "OPC UA Server",
consumerClass = MiloServerConsumer.class, label = "iot")
-class MiloServerEndpoint extends DefaultEndpoint {
+public class MiloServerEndpoint extends DefaultEndpoint {
 
     @UriPath
     @Metadata(required = "true")

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerProducer.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerProducer.java
index 6f71a12..c42da2d 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerProducer.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerProducer.java
@@ -21,7 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.component.milo.server.internal.CamelServerItem;
 import org.apache.camel.impl.DefaultProducer;
 
-class MiloServerProducer extends DefaultProducer {
+public class MiloServerProducer extends DefaultProducer {
 
     private final CamelServerItem item;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application.java
index e49fea9..a78efbf 100644
--- a/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application.java
+++ b/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application.java
@@ -20,7 +20,11 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 
-public class Application {
+public final class Application {
+
+    private Application() {
+    }
+
     public static void main(final String[] args) throws Exception {
 
         // camel conext

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Client.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Client.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Client.java
index 3f03789..d613a18 100644
--- a/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Client.java
+++ b/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Client.java
@@ -20,7 +20,11 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 
-public class Application2Client {
+public final class Application2Client {
+
+    private Application2Client() {
+    }
+
     public static void main(final String[] args) throws Exception {
 
         // camel conext

http://git-wip-us.apache.org/repos/asf/camel/blob/839453f8/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Server.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Server.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Server.java
index 21d955e..ae85890 100644
--- a/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Server.java
+++ b/components/camel-milo/src/test/java/org/apache/camel/component/milo/testing/Application2Server.java
@@ -21,7 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.milo.server.MiloServerComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 
-public class Application2Server {
+public final class Application2Server {
+    private Application2Server() {
+    }
+
     public static void main(final String[] args) throws Exception {
 
         // camel conext


Mime
View raw message