From b11227ed5b67895200b9de7d728fcf4a181118ac Mon Sep 17 00:00:00 2001 From: Dominik Riemer Date: Thu, 1 Dec 2022 19:55:25 +0100 Subject: [PATCH] Enable checkstyle for streampipes-messaging --- streampipes-messaging/pom.xml | 24 ++++++++++++++++++- .../streampipes/messaging/EventConsumer.java | 10 ++++---- .../streampipes/messaging/EventProducer.java | 10 ++++---- .../messaging/SpProtocolDefinition.java | 6 ++--- .../messaging/SpProtocolManager.java | 19 +++++++-------- 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/streampipes-messaging/pom.xml b/streampipes-messaging/pom.xml index bc9af0206a..1415a3beb9 100644 --- a/streampipes-messaging/pom.xml +++ b/streampipes-messaging/pom.xml @@ -35,4 +35,26 @@ 0.71.0-SNAPSHOT - \ No newline at end of file + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + validate + validate + + check + + + + + true + true + + + + + 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 3e276df67a..dec6f0258f 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 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException; import org.apache.streampipes.model.grounding.TransportProtocol; -public interface EventConsumer { +public interface EventConsumer { - void connect(TP protocolSettings, InternalEventProcessor eventProcessor) throws - SpRuntimeException; + void connect(T protocolSettings, InternalEventProcessor 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 9d3998bc7f..20993d932d 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 java.io.Serializable; -public interface EventProducer extends Serializable { +public interface EventProducer 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 2a1655c3bb..cd24baad59 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 @@ import org.apache.streampipes.model.grounding.TransportProtocol; -public interface SpProtocolDefinition { +public interface SpProtocolDefinition { - EventConsumer getConsumer(); + EventConsumer getConsumer(); - EventProducer getProducer(); + EventProducer 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 d15199f4e5..35e2d9b6e6 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> availableProtocols; + private final List> availableProtocols; SpProtocolManager() { this.availableProtocols = new ArrayList<>(); @@ -42,17 +42,16 @@ public List> getAvailab return availableProtocols; } - public Optional> findDefinition(T - transportProtocol) { + public Optional> 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) s) - .map(SpProtocolDefinitionFactory::createInstance) - .findFirst(); + .stream() + .filter + (adf -> adf.getTransportProtocolClass().equals(transportProtocol.getClass() + .getCanonicalName())) + .map(s -> (SpProtocolDefinitionFactory) s) + .map(SpProtocolDefinitionFactory::createInstance) + .findFirst(); } }