-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from nimble-platform/staging
Release 7.0.0
- Loading branch information
Showing
19 changed files
with
1,337 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
329 changes: 308 additions & 21 deletions
329
data-channel-service/src/main/java/eu/nimble/service/datachannel/controller/ChannelAPI.java
Large diffs are not rendered by default.
Oops, something went wrong.
539 changes: 479 additions & 60 deletions
539
...nel-service/src/main/java/eu/nimble/service/datachannel/controller/ChannelController.java
Large diffs are not rendered by default.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
data-channel-service/src/main/java/eu/nimble/service/datachannel/dcfs/DcfsClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.