Skip to content

Commit

Permalink
Enable checkstyle for streampipes-messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer committed Dec 1, 2022
1 parent 1e680aa commit b11227e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 24 deletions.
24 changes: 23 additions & 1 deletion streampipes-messaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,26 @@
<version>0.71.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

<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>
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand All @@ -42,17 +42,16 @@ public List<SpProtocolDefinitionFactory<? extends TransportProtocol>> getAvailab
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();

}
}

0 comments on commit b11227e

Please sign in to comment.