You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/12/01 18:55:37 UTC

[streampipes] branch SP-820 created (now b11227ed5)

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

riemer pushed a change to branch SP-820
in repository https://gitbox.apache.org/repos/asf/streampipes.git


      at b11227ed5 Enable checkstyle for streampipes-messaging

This branch includes the following new commits:

     new b11227ed5 Enable checkstyle for streampipes-messaging

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[streampipes] 01/01: Enable checkstyle for streampipes-messaging

Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch SP-820
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit b11227ed5b67895200b9de7d728fcf4a181118ac
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Thu Dec 1 19:55:25 2022 +0100

    Enable checkstyle for streampipes-messaging
---
 streampipes-messaging/pom.xml                      | 24 +++++++++++++++++++++-
 .../streampipes/messaging/EventConsumer.java       | 10 ++++-----
 .../streampipes/messaging/EventProducer.java       | 10 ++++-----
 .../messaging/SpProtocolDefinition.java            |  6 +++---
 .../streampipes/messaging/SpProtocolManager.java   | 19 ++++++++---------
 5 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/streampipes-messaging/pom.xml b/streampipes-messaging/pom.xml
index bc9af0206..1415a3beb 100644
--- a/streampipes-messaging/pom.xml
+++ b/streampipes-messaging/pom.xml
@@ -35,4 +35,26 @@
             <version>0.71.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+
+    <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-messaging/src/main/java/org/apache/streampipes/messaging/EventConsumer.java b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventConsumer.java
index 3e276df67..dec6f0258 100644
--- a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventConsumer.java
+++ b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventConsumer.java
@@ -21,12 +21,12 @@ package org.apache.streampipes.messaging;
 import org.apache.streampipes.commons.exceptions.SpRuntimeException;
 import org.apache.streampipes.model.grounding.TransportProtocol;
 
-public interface EventConsumer<TP extends TransportProtocol> {
+public interface EventConsumer<T extends TransportProtocol> {
 
-    void connect(TP protocolSettings, InternalEventProcessor<byte[]> eventProcessor) throws
-            SpRuntimeException;
+  void connect(T protocolSettings, InternalEventProcessor<byte[]> eventProcessor) throws
+      SpRuntimeException;
 
-    void disconnect() throws SpRuntimeException;
+  void disconnect() throws SpRuntimeException;
 
-    boolean isConnected();
+  boolean isConnected();
 }
diff --git a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventProducer.java b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventProducer.java
index 9d3998bc7..20993d932 100644
--- a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventProducer.java
+++ b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventProducer.java
@@ -23,13 +23,13 @@ import org.apache.streampipes.model.grounding.TransportProtocol;
 
 import java.io.Serializable;
 
-public interface EventProducer<TP extends TransportProtocol> extends Serializable {
+public interface EventProducer<T extends TransportProtocol> extends Serializable {
 
-    void connect(TP protocolSettings) throws SpRuntimeException;
+  void connect(T protocolSettings) throws SpRuntimeException;
 
-    void publish(byte[] event);
+  void publish(byte[] event);
 
-    void disconnect() throws SpRuntimeException;
+  void disconnect() throws SpRuntimeException;
 
-    boolean isConnected();
+  boolean isConnected();
 }
diff --git a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolDefinition.java b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolDefinition.java
index 2a1655c3b..cd24baad5 100644
--- a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolDefinition.java
+++ b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolDefinition.java
@@ -20,9 +20,9 @@ package org.apache.streampipes.messaging;
 
 import org.apache.streampipes.model.grounding.TransportProtocol;
 
-public interface SpProtocolDefinition<TP extends TransportProtocol> {
+public interface SpProtocolDefinition<T extends TransportProtocol> {
 
-  EventConsumer<TP> getConsumer();
+  EventConsumer<T> getConsumer();
 
-  EventProducer<TP> getProducer();
+  EventProducer<T> getProducer();
 }
diff --git a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolManager.java b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolManager.java
index d15199f4e..35e2d9b6e 100644
--- a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolManager.java
+++ b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/SpProtocolManager.java
@@ -28,7 +28,7 @@ public enum SpProtocolManager {
 
   INSTANCE;
 
-  private List<SpProtocolDefinitionFactory<? extends TransportProtocol>> availableProtocols;
+  private final List<SpProtocolDefinitionFactory<? extends TransportProtocol>> availableProtocols;
 
   SpProtocolManager() {
     this.availableProtocols = new ArrayList<>();
@@ -42,17 +42,16 @@ public enum SpProtocolManager {
     return availableProtocols;
   }
 
-  public <T extends TransportProtocol> Optional<SpProtocolDefinition<T>> findDefinition(T
-                                                                         transportProtocol) {
+  public <T extends TransportProtocol> Optional<SpProtocolDefinition<T>> findDefinition(T transportProtocol) {
     // TODO add RDF URI for protocol in model
     return this.availableProtocols
-            .stream()
-            .filter
-                    (adf -> adf.getTransportProtocolClass().equals(transportProtocol.getClass()
-                            .getCanonicalName()))
-            .map(s -> (SpProtocolDefinitionFactory<T>) s)
-            .map(SpProtocolDefinitionFactory::createInstance)
-            .findFirst();
+        .stream()
+        .filter
+            (adf -> adf.getTransportProtocolClass().equals(transportProtocol.getClass()
+                .getCanonicalName()))
+        .map(s -> (SpProtocolDefinitionFactory<T>) s)
+        .map(SpProtocolDefinitionFactory::createInstance)
+        .findFirst();
 
   }
 }