This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch add-checkstyle-streampipes-service
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 3c04c0bb160d378fbf0c5f012cf8c842967f7e78
Author: bossenti <[email protected]>
AuthorDate: Sun Dec 4 17:02:51 2022 +0100

    add checkstyle to streampipes-service-discovery-api
---
 streampipes-service-discovery-api/pom.xml          | 25 +++++++-
 .../svcdiscovery/api/ISpServiceDiscovery.java      | 12 ++--
 .../streampipes/svcdiscovery/api/SpConfig.java     | 38 ++++++------
 .../svcdiscovery/api/model/ConfigItem.java         | 11 ++--
 .../api/model/DefaultSpServiceTags.java            |  3 +-
 .../svcdiscovery/api/model/PeConfig.java           | 72 +++++++++++-----------
 .../api/model/SpServiceRegistrationRequest.java    | 28 ++++-----
 .../svcdiscovery/api/model/SpServiceTag.java       | 11 ++--
 .../api/model/SpServiceUrlProvider.java            | 34 +++++-----
 9 files changed, 128 insertions(+), 106 deletions(-)

diff --git a/streampipes-service-discovery-api/pom.xml 
b/streampipes-service-discovery-api/pom.xml
index fd73b1de5..a2ebacb8d 100644
--- a/streampipes-service-discovery-api/pom.xml
+++ b/streampipes-service-discovery-api/pom.xml
@@ -17,7 +17,8 @@
   ~
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <parent>
         <artifactId>streampipes-parent</artifactId>
         <groupId>org.apache.streampipes</groupId>
@@ -27,5 +28,25 @@
 
     <artifactId>streampipes-service-discovery-api</artifactId>
 
-
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>validate</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <logViolationsToConsole>true</logViolationsToConsole>
+                    <failOnViolation>true</failOnViolation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/ISpServiceDiscovery.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/ISpServiceDiscovery.java
index c9159bd9f..729739229 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/ISpServiceDiscovery.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/ISpServiceDiscovery.java
@@ -27,7 +27,7 @@ public interface ISpServiceDiscovery {
   /**
    * Register service.
    *
-   * @param serviceRegistrationRequest  the service registration request
+   * @param serviceRegistrationRequest the service registration request
    */
   void registerService(SpServiceRegistrationRequest 
serviceRegistrationRequest);
 
@@ -48,10 +48,10 @@ public interface ISpServiceDiscovery {
   /**
    * Get service endpoints
    *
-   * @param svcGroup            service group for registered service
-   * @param restrictToHealthy   retrieve healthy or all registered services 
for a service group
-   * @param filterByTags        filter param to filter list of registered 
services
-   * @return                    list of services
+   * @param svcGroup          service group for registered service
+   * @param restrictToHealthy retrieve healthy or all registered services for 
a service group
+   * @param filterByTags      filter param to filter list of registered 
services
+   * @return list of services
    */
   List<String> getServiceEndpoints(String svcGroup,
                                    boolean restrictToHealthy,
@@ -67,7 +67,7 @@ public interface ISpServiceDiscovery {
   /**
    * Deregister registered service endpoint in Consul
    *
-   * @param svcId     service id of endpoint to be deregistered
+   * @param svcId service id of endpoint to be deregistered
    */
   void deregisterService(String svcId);
 
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/SpConfig.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/SpConfig.java
index 892302fd2..caab3e6ff 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/SpConfig.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/SpConfig.java
@@ -23,42 +23,42 @@ import 
org.apache.streampipes.svcdiscovery.api.model.ConfigurationScope;
 
 public interface SpConfig {
 
-    <T> void register(String key, T defaultValue, String description, 
ConfigurationScope configurationScope);
+  <T> void register(String key, T defaultValue, String description, 
ConfigurationScope configurationScope);
 
-    void register(String key, boolean defaultValue, String description);
+  void register(String key, boolean defaultValue, String description);
 
-    void register(String key, int defaultValue, String description);
+  void register(String key, int defaultValue, String description);
 
-    void register(String key, double defaultValue, String description);
+  void register(String key, double defaultValue, String description);
 
-    void register(String key, String defaultValue, String description);
+  void register(String key, String defaultValue, String description);
 
-    void register(ConfigItem configItem);
+  void register(ConfigItem configItem);
 
-    void registerObject(String key, Object defaultValue, String description);
+  void registerObject(String key, Object defaultValue, String description);
 
-    void registerPassword(String key, String defaultValue, String description);
+  void registerPassword(String key, String defaultValue, String description);
 
-    boolean getBoolean(String key);
+  boolean getBoolean(String key);
 
-    int getInteger(String key);
+  int getInteger(String key);
 
-    double getDouble(String key);
+  double getDouble(String key);
 
-    String getString(String key);
+  String getString(String key);
 
-    <T> T getObject(String key, Class<T> clazz, T defaultValue);
+  <T> T getObject(String key, Class<T> clazz, T defaultValue);
 
-    ConfigItem getConfigItem(String key);
+  ConfigItem getConfigItem(String key);
 
-    void setBoolean(String key, Boolean value);
+  void setBoolean(String key, Boolean value);
 
-    void setInteger(String key, int value);
+  void setInteger(String key, int value);
 
-    void setDouble(String key, double value);
+  void setDouble(String key, double value);
 
-    void setString(String key, String value);
+  void setString(String key, String value);
 
-    void setObject(String key, Object value);
+  void setObject(String key, Object value);
 
 }
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/ConfigItem.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/ConfigItem.java
index b44bb9025..c3dcc0415 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/ConfigItem.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/ConfigItem.java
@@ -27,6 +27,10 @@ public class ConfigItem {
   private ConfigurationScope configurationScope;
   private boolean isPassword;
 
+  public ConfigItem() {
+    setPassword(false);
+  }
+
   public static <T> ConfigItem from(String key,
                                     T defaultValue,
                                     String description) {
@@ -45,7 +49,8 @@ public class ConfigItem {
                                     String description,
                                     ConfigurationScope configurationScope,
                                     boolean isPassword) {
-    return from(key, defaultValue, description, 
ConfigItemUtils.getValueType(defaultValue), configurationScope, isPassword);
+    return from(key, defaultValue, description, 
ConfigItemUtils.getValueType(defaultValue), configurationScope,
+        isPassword);
   }
 
   public static <T> ConfigItem from(String key,
@@ -65,10 +70,6 @@ public class ConfigItem {
     return configItem;
   }
 
-  public ConfigItem() {
-    setPassword(false);
-  }
-
   public String getKey() {
     return key;
   }
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/DefaultSpServiceTags.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/DefaultSpServiceTags.java
index fc4f980f3..289211c87 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/DefaultSpServiceTags.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/DefaultSpServiceTags.java
@@ -23,5 +23,6 @@ public class DefaultSpServiceTags {
   public static final SpServiceTag PE = 
SpServiceTag.create(SpServiceTagPrefix.SYSTEM, "pe");
   public static final SpServiceTag CONNECT_MASTER = 
SpServiceTag.create(SpServiceTagPrefix.SYSTEM, "connect-master");
   public static final SpServiceTag CONNECT_WORKER = 
SpServiceTag.create(SpServiceTagPrefix.SYSTEM, "connect-worker");
-  public static final SpServiceTag STREAMPIPES_CLIENT = 
SpServiceTag.create(SpServiceTagPrefix.SYSTEM, "streampipes-client");
+  public static final SpServiceTag STREAMPIPES_CLIENT =
+      SpServiceTag.create(SpServiceTagPrefix.SYSTEM, "streampipes-client");
 }
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/PeConfig.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/PeConfig.java
index c215a1cd3..d0053e8bf 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/PeConfig.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/PeConfig.java
@@ -23,40 +23,40 @@ import java.util.Map;
 
 public class PeConfig {
 
-    String mainKey;
-    String name;
-    List<ConfigItem> configs;
-    Map<String, String> meta;
-
-    public List<ConfigItem> getConfigs() {
-        return configs;
-    }
-
-    public void setConfigs(List<ConfigItem> configs) {
-        this.configs = configs;
-    }
-
-    public Map<String, String> getMeta() {
-        return meta;
-    }
-
-    public void setMeta(Map<String, String> meta) {
-        this.meta = meta;
-    }
-
-    public String getMainKey() {
-        return mainKey;
-    }
-
-    public void setMainKey(String mainKey) {
-        this.mainKey = mainKey;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
+  String mainKey;
+  String name;
+  List<ConfigItem> configs;
+  Map<String, String> meta;
+
+  public List<ConfigItem> getConfigs() {
+    return configs;
+  }
+
+  public void setConfigs(List<ConfigItem> configs) {
+    this.configs = configs;
+  }
+
+  public Map<String, String> getMeta() {
+    return meta;
+  }
+
+  public void setMeta(Map<String, String> meta) {
+    this.meta = meta;
+  }
+
+  public String getMainKey() {
+    return mainKey;
+  }
+
+  public void setMainKey(String mainKey) {
+    this.mainKey = mainKey;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
 }
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceRegistrationRequest.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceRegistrationRequest.java
index 4926cdd99..0b0e6c0d2 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceRegistrationRequest.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceRegistrationRequest.java
@@ -28,6 +28,20 @@ public class SpServiceRegistrationRequest {
   private List<SpServiceTag> tags;
   private String healthCheckPath;
 
+  public SpServiceRegistrationRequest(String svcGroup,
+                                      String svcId,
+                                      String host,
+                                      int port,
+                                      List<SpServiceTag> tags,
+                                      String healthCheckPath) {
+    this.svcGroup = svcGroup;
+    this.svcId = svcId;
+    this.host = host;
+    this.port = port;
+    this.tags = tags;
+    this.healthCheckPath = healthCheckPath;
+  }
+
   public static SpServiceRegistrationRequest from(String svcGroup,
                                                   String svcId,
                                                   String host,
@@ -45,20 +59,6 @@ public class SpServiceRegistrationRequest {
     return new SpServiceRegistrationRequest(svcGroup, svcId, host, port, tags, 
healthCheckPath);
   }
 
-  public SpServiceRegistrationRequest(String svcGroup,
-                                      String svcId,
-                                      String host,
-                                      int port,
-                                      List<SpServiceTag> tags,
-                                      String healthCheckPath) {
-    this.svcGroup = svcGroup;
-    this.svcId = svcId;
-    this.host = host;
-    this.port = port;
-    this.tags = tags;
-    this.healthCheckPath = healthCheckPath;
-  }
-
   public String getSvcGroup() {
     return svcGroup;
   }
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceTag.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceTag.java
index e003366c7..baabf90f3 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceTag.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceTag.java
@@ -19,21 +19,20 @@ package org.apache.streampipes.svcdiscovery.api.model;
 
 public class SpServiceTag {
 
+  private static final String COLON = ":";
   private final SpServiceTagPrefix prefix;
   private final String value;
 
-  private static final String COLON = ":";
+  private SpServiceTag(SpServiceTagPrefix prefix, String value) {
+    this.prefix = prefix;
+    this.value = value;
+  }
 
   public static SpServiceTag create(SpServiceTagPrefix prefix,
                                     String value) {
     return new SpServiceTag(prefix, value);
   }
 
-  private SpServiceTag(SpServiceTagPrefix prefix, String value) {
-    this.prefix = prefix;
-    this.value = value;
-  }
-
   public String asString() {
     return prefix.asString() + COLON + value;
   }
diff --git 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceUrlProvider.java
 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceUrlProvider.java
index fb3c3d5e6..1e02adf14 100644
--- 
a/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceUrlProvider.java
+++ 
b/streampipes-service-discovery-api/src/main/java/org/apache/streampipes/svcdiscovery/api/model/SpServiceUrlProvider.java
@@ -25,8 +25,8 @@ public enum SpServiceUrlProvider {
   DATA_SET(SpServicePathPrefix.DATA_SET, SpServiceTagPrefix.DATA_SET),
   ADAPTER(SpServicePathPrefix.ADAPTER, SpServiceTagPrefix.ADAPTER);
 
-  private final String HTTP = "http://";;
-  private final String SLASH = "/";
+  private final String http = "http://";;
+  private final String slash = "/";
 
   private final String prefix;
   private final SpServiceTagPrefix serviceTagPrefix;
@@ -44,21 +44,21 @@ public enum SpServiceUrlProvider {
   public String getInvocationUrl(String host,
                                  Integer port,
                                  String appId) {
-    return HTTP
-            + host
-            + ":"
-            + port
-            + SLASH
-            + this.prefix
-            + SLASH + appId;
+    return http
+        + host
+        + ":"
+        + port
+        + slash
+        + this.prefix
+        + slash + appId;
   }
 
   public String getInvocationUrl(String baseUrl, String appId) {
     return baseUrl
-            + SLASH
-            + this.prefix
-            + SLASH
-            + appId;
+        + slash
+        + this.prefix
+        + slash
+        + appId;
   }
 
   public String getDetachUrl(String host,
@@ -66,14 +66,14 @@ public enum SpServiceUrlProvider {
                              String appId,
                              String invocationId) {
     return getInvocationUrl(host, port, appId)
-            + SLASH
-            + invocationId;
+        + slash
+        + invocationId;
   }
 
   public String getDetachUrl(String baseUrl, String appId, String 
invocationId) {
     return getInvocationUrl(baseUrl, appId)
-            + SLASH
-            + invocationId;
+        + slash
+        + invocationId;
   }
 
   public SpServiceTagPrefix getServiceTagPrefix() {

Reply via email to