Skip to content

Commit

Permalink
Merge pull request #6 from nimble-platform/staging
Browse files Browse the repository at this point in the history
Release 7.0.0
  • Loading branch information
AndreaMusumeciHol authored Jun 17, 2019
2 parents 7a95054 + e7f977f commit 012ffa7
Show file tree
Hide file tree
Showing 19 changed files with 1,337 additions and 229 deletions.
14 changes: 6 additions & 8 deletions data-channel-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>data-channel-service</artifactId>
<version>5.0.0</version>
<version>5.2.4</version>
<name>Nimble Data Channel Service</name>
<description>...</description>
<packaging>jar</packaging>
Expand Down Expand Up @@ -47,15 +47,15 @@
</developer>
</developers>

<repositories>
<!--repositories>
<repository>
<id>bintray-fraunhoferiosb-Maven</id>
<url>https://dl.bintray.com/fraunhoferiosb/Maven</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</repositories-->

<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -156,11 +156,11 @@
<artifactId>spring-security-jwt</artifactId>
<version>1.0.9.RELEASE</version>
</dependency>
<dependency>
<!--dependency>
<groupId>de.fraunhofer.iosb.ilt</groupId>
<artifactId>FROST-Client</artifactId>
<version>0.17</version>
</dependency>
</dependency-->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
Expand Down Expand Up @@ -204,13 +204,11 @@
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
</dependency>

<dependency>
<groupId>eu.nimble.core.common</groupId>
<artifactId>data-channel</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-json-org</artifactId>
Expand All @@ -236,7 +234,7 @@
</dependency>
</dependencies>
<build>
<finalName>app</finalName>
<finalName>data-channel-service</finalName>
<plugins>

<plugin>
Expand Down
9 changes: 5 additions & 4 deletions data-channel-service/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM nimbleplatform/nimble-base
MAINTAINER Salzburg Research <nimble-srfg@salzburgresearch.at>
FROM openjdk:8
MAINTAINER Holonix Srl <musumeci.holonix@gmail.com>
VOLUME /tmp
ARG finalName
ENV JAR '/'$finalName
ARG port
ADD $finalName $JAR
RUN touch $JAR
ENV PORT 9099

EXPOSE $PORT

ENTRYPOINT ["java", "-jar", "app.jar"]
RUN env

ENTRYPOINT ["java", "-jar", "data-channel-service.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private ApiInfo metaData() {
return new ApiInfo(
"NIMBLE Data Channel REST API",
"REST API for managing data channels on the NIMBLE platform",
"0.1",
"2.2",
null,
new Contact("Johannes Innerbichler", null, "johannes.innerbichler@salzburgresearch.at"),
"Apache License Version 2.0",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package eu.nimble.service.datachannel.dcfs;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import com.mashape.unirest.request.body.RequestBodyEntity;
import eu.nimble.service.datachannel.entity.ChannelConfiguration;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* REST Client for communications with services in the Kafka domain.
*
* @author Johannes Innerbichler
*/
@Service
public class DcfsClient {

@Value("${nimble.dcfs.service-url}")
private String DcfsUrl;

private static Logger logger = LoggerFactory.getLogger(DcfsClient.class);

public CreateFilteredChannelResponse createChannel(ChannelConfiguration channelConfig) throws UnirestException {
/*$$TBD for each Sensor
String sourceID = channelConfig.getProducerCompanyID();
String targetID = channelConfig.getConsumerCompanyIDs().stream().findFirst().get();
// create filter json
Map<String, String> map = new HashMap<>();
map.put("producerCompanyID", channelConfig.getProducerCompanyID());
JSONObject jsonFilter = new JSONObject(map);
JSONObject body = new JSONObject();
body.accumulate("source", sourceID);
body.accumulate("target", targetID);
body.accumulate("filter", jsonFilter);
// create channel in Kafka domain
HttpResponse<String> response = Unirest.post(dcfsDomainUrl + "/start-new-filtered")
.header("Content-Type", "application/json")
.body(body)
.asString();
logger.debug("{} {} {}", response.getStatus(), response.getStatusText(), response.getBody());
JSONObject jsonResponse = new JSONObject(response.getBody());
return new CreateChannelResponse(jsonResponse.getString("channelId"), jsonResponse.getString("inputTopic"),
jsonResponse.getString("outputTopic"));
*/
return new CreateFilteredChannelResponse("", true);
}

@SuppressWarnings("unused")
public static class CreateFilteredChannelResponse {

private String channelId;
private boolean hasErrors;

public CreateFilteredChannelResponse(String channelId, boolean hasErrors) {
this.channelId = channelId;
this.hasErrors = hasErrors;
}

public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}

public boolean isHasErrors() {
return hasErrors;
}

public void setHasErrors(boolean hasErrors) {
this.hasErrors = hasErrors;
}

}
}
Loading

0 comments on commit 012ffa7

Please sign in to comment.