This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-145 by this push:
new 82f3335 [STREAMPIPES-191] Integrate pipeline element update into
pipeline element installation view
82f3335 is described below
commit 82f33357ce05f43ae245392ec9964b8d28a99935
Author: Dominik Riemer <[email protected]>
AuthorDate: Wed Aug 5 21:05:46 2020 +0200
[STREAMPIPES-191] Integrate pipeline element update into pipeline element
installation view
---
.../master/management/SourcesManagement.java | 1 +
.../container/html/model/Description.java | 9 +++
.../html/page/WelcomePageGeneratorImpl.java | 6 +-
.../model/client/endpoint/RdfEndpointItem.java | 9 +++
.../rest/impl/OntologyPipelineElement.java | 26 ++-------
.../rest/impl/PipelineElementImport.java | 41 +++++--------
.../apache/streampipes/rest/impl/RdfEndpoint.java | 68 +++++++++++++++++++++-
.../rest/impl/SemanticEventConsumer.java | 30 +++-------
.../rest/impl/SemanticEventProcessingAgent.java | 25 ++------
.../rest/impl/SemanticEventProducer.java | 29 ++-------
.../impl/nouser/PipelineElementImportNoUser.java | 34 +++--------
.../api/IPipelineElementDescriptionStorage.java | 7 +--
.../rdf4j/impl/PipelineElementStorageRequests.java | 24 ++++----
ui/src/app/add/add.component.html | 4 +-
.../endpoint-item/endpoint-item.component.html | 9 +++
.../endpoint-item/endpoint-item.component.scss | 4 ++
.../endpoint-item/endpoint-item.component.ts | 20 +++++++
.../pipeline-overview.component.ts | 14 +++--
18 files changed, 192 insertions(+), 168 deletions(-)
diff --git
a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/SourcesManagement.java
b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/SourcesManagement.java
index 065500d..2a033e7 100644
---
a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/SourcesManagement.java
+++
b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/SourcesManagement.java
@@ -125,6 +125,7 @@ public class SourcesManagement {
DataSourceDescriptionHtml dsd = new
DataSourceDescriptionHtml("Adapter Stream",
"This stream is generated by an StreamPipes Connect
adapter. ID of adapter: " + ad.getId(), uri, streams);
dsd.setType("source");
+ dsd.setAppId(ad.getAppId());
allAdapterDescriptions.add(dsd);
}
diff --git
a/streampipes-container/src/main/java/org/apache/streampipes/container/html/model/Description.java
b/streampipes-container/src/main/java/org/apache/streampipes/container/html/model/Description.java
index 39f46e1..09af426 100644
---
a/streampipes-container/src/main/java/org/apache/streampipes/container/html/model/Description.java
+++
b/streampipes-container/src/main/java/org/apache/streampipes/container/html/model/Description.java
@@ -26,6 +26,7 @@ public class Description {
private String description;
private URI uri;
private String type;
+ private String appId;
public Description(String name, String description, URI uri)
{
@@ -69,6 +70,14 @@ public class Description {
this.type = type;
}
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git
a/streampipes-container/src/main/java/org/apache/streampipes/container/html/page/WelcomePageGeneratorImpl.java
b/streampipes-container/src/main/java/org/apache/streampipes/container/html/page/WelcomePageGeneratorImpl.java
index db513dd..25eea2d 100644
---
a/streampipes-container/src/main/java/org/apache/streampipes/container/html/page/WelcomePageGeneratorImpl.java
+++
b/streampipes-container/src/main/java/org/apache/streampipes/container/html/page/WelcomePageGeneratorImpl.java
@@ -59,6 +59,7 @@ public class WelcomePageGeneratorImpl extends
WelcomePageGenerator<Declarer> {
// TODO remove after full internationalization support has been
implemented
updateLabel(declarer.declareModel(), desc);
desc.setType(getType(declarer));
+ desc.setAppId(declarer.declareModel().getAppId());
String uri = baseUri;
if (declarer instanceof SemanticEventConsumerDeclarer) {
uri += "sec/";
@@ -80,14 +81,11 @@ public class WelcomePageGeneratorImpl extends
WelcomePageGenerator<Declarer> {
List<Description> streams = new ArrayList<>();
DataSourceDescriptionHtml desc = new DataSourceDescriptionHtml();
updateLabel(declarer.declareModel(), desc);
-// desc.setName(declarer.declareModel().getName());
-// desc.setDescription(declarer.declareModel().getDescription());
desc.setUri(URI.create(baseUri + "sep/" +
declarer.declareModel().getUri()));
desc.setType("source");
+ desc.setAppId(declarer.declareModel().getAppId());
for (DataStreamDeclarer streamDeclarer : declarer.getEventStreams()) {
Description ad = new Description();
-//
ad.setDescription(streamDeclarer.declareModel(declarer.declareModel()).getDescription());
-//
ad.setName(streamDeclarer.declareModel(declarer.declareModel()).getName());
updateLabel(streamDeclarer.declareModel(declarer.declareModel()),
ad);
ad.setUri(URI.create(baseUri +"stream/" +
streamDeclarer.declareModel(declarer.declareModel()).getUri()));
ad.setType("stream");
diff --git
a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/endpoint/RdfEndpointItem.java
b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/endpoint/RdfEndpointItem.java
index 5186c53..8fa1b50 100644
---
a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/endpoint/RdfEndpointItem.java
+++
b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/endpoint/RdfEndpointItem.java
@@ -27,6 +27,7 @@ public class RdfEndpointItem {
private String uri;
private String type;
private boolean installed;
+ private String appId;
private List<RdfEndpointItem> streams;
@@ -81,4 +82,12 @@ public class RdfEndpointItem {
public void setType(String type) {
this.type = type;
}
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
}
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java
index 9439fdb..20bd7b9 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java
@@ -21,7 +21,6 @@ package org.apache.streampipes.rest.impl;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
-import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataSinkDescription;
import org.apache.streampipes.model.graph.DataSourceDescription;
@@ -32,7 +31,6 @@ import
org.apache.streampipes.storage.management.StorageManager;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@@ -60,12 +58,8 @@ public class OntologyPipelineElement extends
AbstractRestInterface implements IO
@Produces(MediaType.APPLICATION_JSON)
public Response getSourceDetails(@PathParam("sourceId") String sepaId,
@QueryParam("keepIds") boolean keepIds) {
- try {
- DataSourceDescription sepaDescription = new
DataSourceDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataSourceById(sepaId));
- return ok(sepaDescription);
- } catch (URISyntaxException e) {
- return ok(Notifications.error("Error"));
- }
+ DataSourceDescription sepaDescription = new
DataSourceDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataSourceById(sepaId));
+ return ok(sepaDescription);
}
@Override
@@ -111,12 +105,8 @@ public class OntologyPipelineElement extends
AbstractRestInterface implements IO
@Override
public Response getSepa(@PathParam("sepaId") String sepaId,
@QueryParam("keepIds") boolean keepIds) {
- try {
- DataProcessorDescription dataProcessorDescription = new
DataProcessorDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataProcessorById(sepaId));
- return ok(dataProcessorDescription);
- } catch (URISyntaxException e) {
- return ok(Notifications.error("Error"));
- }
+ DataProcessorDescription dataProcessorDescription = new
DataProcessorDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataProcessorById(sepaId));
+ return ok(dataProcessorDescription);
}
@Path("/actions/{actionId}")
@@ -124,12 +114,8 @@ public class OntologyPipelineElement extends
AbstractRestInterface implements IO
@Produces(MediaType.APPLICATION_JSON)
@Override
public Response getAction(@PathParam("actionId") String actionId,
@QueryParam("keepIds") boolean keepIds) {
- try {
- DataSinkDescription dataSinkDescription = new
DataSinkDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataSinkById(actionId));
- return ok(dataSinkDescription);
- } catch (URISyntaxException e) {
- return ok(Notifications.error("Error"));
- }
+ DataSinkDescription dataSinkDescription = new
DataSinkDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataSinkById(actionId));
+ return ok(dataSinkDescription);
}
private JsonObject getHeader(String uri, String name) {
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementImport.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementImport.java
index 6d88613..807c030 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementImport.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementImport.java
@@ -20,8 +20,6 @@ package org.apache.streampipes.rest.impl;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.streampipes.commons.exceptions.SepaParseException;
import org.apache.streampipes.manager.assets.AssetManager;
import org.apache.streampipes.manager.endpoint.EndpointItemParser;
@@ -33,24 +31,18 @@ import
org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
import
org.apache.streampipes.storage.api.IPipelineElementDescriptionStorageCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
@Path("/v2/users/{username}/element")
public class PipelineElementImport extends AbstractRestInterface {
@@ -139,7 +131,7 @@ public class PipelineElementImport extends
AbstractRestInterface {
NotificationType.STORAGE_ERROR.description()));
}
AssetManager.deleteAsset(appId);
- } catch (URISyntaxException | IOException e) {
+ } catch (IOException e) {
return constructErrorMessage(new
Notification(NotificationType.STORAGE_ERROR.title(),
NotificationType.STORAGE_ERROR.description()));
}
@@ -152,19 +144,14 @@ public class PipelineElementImport extends
AbstractRestInterface {
public Response getActionAsJsonLd(@PathParam("id") String elementId) {
IPipelineElementDescriptionStorage requestor =
getPipelineElementRdfStorage();
elementId = decode(elementId);
- try {
- if (requestor.getDataProcessorById(elementId) != null) {
- return ok(toJsonLd(requestor.getDataProcessorById(elementId)));
- } else if (requestor.getDataSourceById(elementId) != null) {
- return ok(toJsonLd(requestor.getDataSourceById(elementId)));
- } else if (requestor.getDataSinkById(elementId) != null) {
- return ok(toJsonLd(requestor.getDataSinkById(elementId)));
- } else {
- return ok(Notifications.create(NotificationType.UNKNOWN_ERROR));
- }
- } catch (URISyntaxException e) {
- return constructErrorMessage(new
Notification(NotificationType.UNKNOWN_ERROR.title(),
- NotificationType.UNKNOWN_ERROR.description(), e.getMessage()));
+ if (requestor.getDataProcessorById(elementId) != null) {
+ return ok(toJsonLd(requestor.getDataProcessorById(elementId)));
+ } else if (requestor.getDataSourceById(elementId) != null) {
+ return ok(toJsonLd(requestor.getDataSourceById(elementId)));
+ } else if (requestor.getDataSinkById(elementId) != null) {
+ return ok(toJsonLd(requestor.getDataSinkById(elementId)));
+ } else {
+ return ok(Notifications.create(NotificationType.UNKNOWN_ERROR));
}
}
}
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RdfEndpoint.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RdfEndpoint.java
index c007477..4371298 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RdfEndpoint.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/RdfEndpoint.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.endpoint.EndpointFetcher;
import org.apache.streampipes.manager.operations.Operations;
+import org.apache.streampipes.model.base.NamedStreamPipesEntity;
import org.apache.streampipes.model.client.endpoint.RdfEndpointItem;
import org.apache.streampipes.rest.api.IRdfEndpoint;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
@@ -30,6 +31,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
@Path("/v2/users/{username}/rdfendpoints")
public class RdfEndpoint extends AbstractRestInterface implements IRdfEndpoint
{
@@ -78,6 +80,12 @@ public class RdfEndpoint extends AbstractRestInterface
implements IRdfEndpoint {
List<RdfEndpointItem> items = Operations.getEndpointUriContents(endpoints);
items.forEach(item -> item.setInstalled(isInstalled(item.getUri(),
username)));
+
+ // also add installed elements that are currently not running or available
+ items.addAll(getAllDataSourceEndpoints(username, items));
+ items.addAll(getAllDataProcessorEndpoints(username, items));
+ items.addAll(getAllDataSinkEndpoints(username, items));
+
return ok(items);
}
@@ -94,12 +102,66 @@ public class RdfEndpoint extends AbstractRestInterface
implements IRdfEndpoint {
private List<String> getAllUserElements(String username) {
List<String> elementUris = new ArrayList<>();
- elementUris.addAll(getUserService().getOwnSourceUris(username));
- elementUris.addAll(getUserService().getOwnActionUris(username));
- elementUris.addAll(getUserService().getOwnSepaUris(username));
+ elementUris.addAll(getAllDataSourceUris(username));
+ elementUris.addAll(getAllDataProcessorUris(username));
+ elementUris.addAll(getAllDataSinkUris(username));
return elementUris;
}
+ private List<RdfEndpointItem> getAllDataSourceEndpoints(String username,
List<RdfEndpointItem> existingItems) {
+ return getAllDataSourceUris(username)
+ .stream()
+ .filter(s -> existingItems.stream().noneMatch(item ->
item.getUri().equals(s)))
+ .map(s ->
getTripleStorage().getPipelineElementStorage().getDataSourceById(s))
+ .map(source -> {
+ RdfEndpointItem sourceItem = makeItem(source, "source");
+
sourceItem.setStreams(source.getSpDataStreams().stream().map(stream ->
makeItem(stream, "stream")).collect(Collectors.toList()));
+ return sourceItem;
+ })
+ .collect(Collectors.toList());
+ }
+
+ private List<RdfEndpointItem> getAllDataProcessorEndpoints(String username,
List<RdfEndpointItem> existingItems) {
+ return getAllDataProcessorUris(username)
+ .stream()
+ .filter(s -> existingItems.stream().noneMatch(item ->
item.getUri().equals(s)))
+ .map(s ->
getTripleStorage().getPipelineElementStorage().getDataProcessorById(s))
+ .map(source -> makeItem(source, "sepa"))
+ .collect(Collectors.toList());
+ }
+
+ private List<RdfEndpointItem> getAllDataSinkEndpoints(String username,
List<RdfEndpointItem> existingItems) {
+ return getAllDataSinkUris(username)
+ .stream()
+ .filter(s -> existingItems.stream().noneMatch(item ->
item.getUri().equals(s)))
+ .map(s ->
getTripleStorage().getPipelineElementStorage().getDataSinkById(s))
+ .map(source -> makeItem(source, "action"))
+ .collect(Collectors.toList());
+ }
+
+ private RdfEndpointItem makeItem(NamedStreamPipesEntity entity, String type)
{
+ RdfEndpointItem endpoint = new RdfEndpointItem();
+ endpoint.setInstalled(true);
+ endpoint.setDescription(entity.getDescription());
+ endpoint.setName(entity.getName());
+ endpoint.setAppId(entity.getAppId());
+ endpoint.setType(type);
+ endpoint.setUri(entity.getElementId());
+ return endpoint;
+ }
+
+ private List<String> getAllDataSourceUris(String username) {
+ return getUserService().getOwnSourceUris(username);
+ }
+
+ private List<String> getAllDataProcessorUris(String username) {
+ return getUserService().getOwnSepaUris(username);
+ }
+
+ private List<String> getAllDataSinkUris(String username) {
+ return getUserService().getOwnActionUris(username);
+ }
+
private IRdfEndpointStorage getRdfEndpointStorage() {
return getNoSqlStorage().getRdfEndpointStorage();
}
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
index e877903..7364e19 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
@@ -19,11 +19,10 @@
package org.apache.streampipes.rest.impl;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
-import org.apache.streampipes.model.message.Notification;
-import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.graph.DataSinkDescription;
import org.apache.streampipes.model.graph.DataSinkInvocation;
+import org.apache.streampipes.model.message.NotificationType;
+import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.rest.api.IPipelineElement;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
@@ -34,7 +33,6 @@ import org.apache.streampipes.storage.rdf4j.filter.Filter;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.stream.Collectors;
@@ -107,13 +105,9 @@ public class SemanticEventConsumer extends
AbstractRestInterface implements IPip
@GsonWithIds
@Override
public Response removeOwn(@PathParam("username") String username,
@PathParam("elementUri") String elementUri) {
- try {
- IPipelineElementDescriptionStorage requestor =
getPipelineElementRdfStorage();
- getUserService().deleteOwnAction(username, elementUri);
- requestor.deleteDataSink(requestor.getDataSinkById(elementUri));
- } catch (URISyntaxException e) {
- return constructErrorMessage(new
Notification(NotificationType.STORAGE_ERROR.title(),
NotificationType.STORAGE_ERROR.description(), e.getMessage()));
- }
+ IPipelineElementDescriptionStorage requestor =
getPipelineElementRdfStorage();
+ getUserService().deleteOwnAction(username, elementUri);
+ requestor.deleteDataSink(requestor.getDataSinkById(elementUri));
return
constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
}
@@ -122,11 +116,7 @@ public class SemanticEventConsumer extends
AbstractRestInterface implements IPip
@Produces(MediaType.TEXT_PLAIN)
@Override
public String getAsJsonLd(@PathParam("elementUri") String elementUri) {
- try {
- return
toJsonLd(getPipelineElementRdfStorage().getDataSinkById(elementUri));
- } catch (URISyntaxException e) {
- return toJson(constructErrorMessage(new
Notification(NotificationType.UNKNOWN_ERROR.title(),
NotificationType.UNKNOWN_ERROR.description(), e.getMessage())));
- }
+ return
toJsonLd(getPipelineElementRdfStorage().getDataSinkById(elementUri));
}
@Path("/{elementUri}")
@@ -135,12 +125,6 @@ public class SemanticEventConsumer extends
AbstractRestInterface implements IPip
@GsonWithIds
@Override
public Response getElement(@PathParam("username") String username,
@PathParam("elementUri") String elementUri) {
- try {
- return ok(new DataSinkInvocation(new
DataSinkInvocation(getPipelineElementRdfStorage().getDataSinkById(elementUri))));
- } catch (URISyntaxException e) {
- return statusMessage(Notifications.error(NotificationType.UNKNOWN_ERROR,
e.getMessage()));
- }
+ return ok(new DataSinkInvocation(new
DataSinkInvocation(getPipelineElementRdfStorage().getDataSinkById(elementUri))));
}
-
-
}
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
index a7231f3..109bfdb 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
@@ -19,10 +19,10 @@
package org.apache.streampipes.rest.impl;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
-import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataProcessorInvocation;
+import org.apache.streampipes.model.message.NotificationType;
+import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.rest.api.IPipelineElement;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
@@ -32,7 +32,6 @@ import org.apache.streampipes.storage.rdf4j.filter.Filter;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.stream.Collectors;
@@ -109,12 +108,8 @@ public class SemanticEventProcessingAgent extends
AbstractRestInterface implemen
@GsonWithIds
@Override
public Response removeOwn(@PathParam("username") String username,
@PathParam("elementUri") String elementUri) {
- try {
- getUserService().deleteOwnSepa(username, elementUri);
-
getPipelineElementRdfStorage().deleteDataProcessor(getPipelineElementRdfStorage().getDataProcessorById(elementUri));
- } catch (URISyntaxException e) {
- return
constructErrorMessage(Notifications.create(NotificationType.STORAGE_ERROR,
e.getMessage()));
- }
+ getUserService().deleteOwnSepa(username, elementUri);
+
getPipelineElementRdfStorage().deleteDataProcessor(getPipelineElementRdfStorage().getDataProcessorById(elementUri));
return
constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
}
@@ -123,11 +118,7 @@ public class SemanticEventProcessingAgent extends
AbstractRestInterface implemen
@Produces(MediaType.TEXT_PLAIN)
@Override
public String getAsJsonLd(@PathParam("elementUri") String elementUri) {
- try {
- return
toJsonLd(getPipelineElementRdfStorage().getDataProcessorById(elementUri));
- } catch (URISyntaxException e) {
- return
toJson(constructErrorMessage(Notifications.create(NotificationType.UNKNOWN_ERROR,
e.getMessage())));
- }
+ return
toJsonLd(getPipelineElementRdfStorage().getDataProcessorById(elementUri));
}
@Path("/{elementUri}")
@@ -137,11 +128,7 @@ public class SemanticEventProcessingAgent extends
AbstractRestInterface implemen
@Override
public Response getElement(@PathParam("username") String username,
@PathParam("elementUri") String elementUri) {
// TODO Access rights
- try {
- return ok(new DataProcessorInvocation(new
DataProcessorInvocation(getPipelineElementRdfStorage().getDataProcessorById(elementUri))));
- } catch (URISyntaxException e) {
- return
statusMessage(Notifications.error(NotificationType.UNKNOWN_ERROR,
e.getMessage()));
- }
+ return ok(new DataProcessorInvocation(new
DataProcessorInvocation(getPipelineElementRdfStorage().getDataProcessorById(elementUri))));
}
}
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
index d42648d..bd68c36 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
@@ -19,10 +19,10 @@
package org.apache.streampipes.rest.impl;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.apache.streampipes.model.graph.DataSourceDescription;
import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.message.Notifications;
-import org.apache.streampipes.model.graph.DataSourceDescription;
import org.apache.streampipes.rest.api.IPipelineElement;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
@@ -32,7 +32,6 @@ import org.apache.streampipes.storage.rdf4j.filter.Filter;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.stream.Collectors;
@@ -47,11 +46,7 @@ public class SemanticEventProducer extends
AbstractRestInterface implements IPip
{
try {
return ok(new
DataSourceDescription(getPipelineElementRdfStorage().getDataSourceById(sourceId)));
- } catch (URISyntaxException e) {
- return constructErrorMessage(new
Notification(NotificationType.URIOFFLINE.title(),
-
NotificationType.URIOFFLINE.description(), e.getMessage()));
- } catch (Exception e)
- {
+ } catch (Exception e) {
return constructErrorMessage(new
Notification(NotificationType.UNKNOWN_ERROR.title(),
NotificationType.UNKNOWN_ERROR.description(), e.getMessage()));
}
@@ -125,12 +120,8 @@ public class SemanticEventProducer extends
AbstractRestInterface implements IPip
@GsonWithIds
@Override
public Response removeOwn(@PathParam("username") String username,
@PathParam("elementUri") String elementUri) {
- try {
- getUserService().deleteOwnSource(username, elementUri);
-
getPipelineElementRdfStorage().deleteDataSink(getPipelineElementRdfStorage().getDataSinkById(elementUri));
- } catch (URISyntaxException e) {
- return constructErrorMessage(new
Notification(NotificationType.STORAGE_ERROR.title(),
NotificationType.STORAGE_ERROR.description(), e.getMessage()));
- }
+ getUserService().deleteOwnSource(username, elementUri);
+
getPipelineElementRdfStorage().deleteDataSink(getPipelineElementRdfStorage().getDataSinkById(elementUri));
return
constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
}
@@ -139,11 +130,7 @@ public class SemanticEventProducer extends
AbstractRestInterface implements IPip
@Produces(MediaType.TEXT_PLAIN)
@Override
public String getAsJsonLd(@PathParam("elementUri") String elementUri) {
- try {
- return
toJsonLd(getPipelineElementRdfStorage().getDataSinkById(elementUri));
- } catch (URISyntaxException e) {
- return
toJson(statusMessage(Notifications.error(NotificationType.UNKNOWN_ERROR)));
- }
+ return
toJsonLd(getPipelineElementRdfStorage().getDataSinkById(elementUri));
}
@@ -154,11 +141,7 @@ public class SemanticEventProducer extends
AbstractRestInterface implements IPip
@Override
public Response getElement(@PathParam("username") String username,
@PathParam("elementUri") String elementUri) {
// TODO Access rights
- try {
- return ok(new
DataSourceDescription(getPipelineElementRdfStorage().getDataSourceById(elementUri)));
- } catch (URISyntaxException e) {
- return
statusMessage(Notifications.error(NotificationType.UNKNOWN_ERROR,
e.getMessage()));
- }
+ return ok(new
DataSourceDescription(getPipelineElementRdfStorage().getDataSourceById(elementUri)));
}
}
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineElementImportNoUser.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineElementImportNoUser.java
index 644c8d9..54b23f8 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineElementImportNoUser.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineElementImportNoUser.java
@@ -18,8 +18,6 @@
package org.apache.streampipes.rest.impl.nouser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.streampipes.manager.endpoint.EndpointItemParser;
import org.apache.streampipes.manager.storage.UserService;
import org.apache.streampipes.model.message.Message;
@@ -27,14 +25,10 @@ import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.rest.impl.AbstractRestInterface;
import
org.apache.streampipes.storage.api.IPipelineElementDescriptionStorageCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import java.net.URISyntaxException;
-
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
+import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -52,10 +46,6 @@ public class PipelineElementImportNoUser extends
AbstractRestInterface {
@POST
@Produces(MediaType.APPLICATION_JSON)
public Response addElement(@PathParam("username") String username,
@FormParam("uri") String uri, @FormParam("publicElement") boolean
publicElement) {
-
-// URI myUri = uri.getBaseUri();
-// String id = myUri.toString() + "v2/adapter/all/" + elementId;
-
logger.info("User " + username + " adds element with URI: " + uri + " to
triplestore");
return ok(verifyAndAddElement(uri, username, publicElement));
@@ -70,24 +60,16 @@ public class PipelineElementImportNoUser extends
AbstractRestInterface {
@Produces(MediaType.APPLICATION_JSON)
public Response deleteElement(@PathParam("username") String username,
@FormParam("uri") String uri) {
-// URI myUri = uri.getBaseUri();
-// String id = myUri.toString() + "v2/adapter/all/" + elementId;
-
-
UserService userService = getUserService();
IPipelineElementDescriptionStorageCache requestor =
getPipelineElementRdfStorage();
logger.info("User " + username + " deletes element with URI: " + uri + "
from triplestore");
- try {
- if (requestor.getDataSourceById(uri) != null) {
- requestor.deleteDataSource(requestor.getDataSourceById(uri));
- userService.deleteOwnSource(username, uri);
- requestor.refreshDataSourceCache();
- } else {
- return constructErrorMessage(new
Notification(NotificationType.STORAGE_ERROR.title(),
NotificationType.STORAGE_ERROR.description()));
- }
- } catch (URISyntaxException e) {
+ if (requestor.getDataSourceById(uri) != null) {
+ requestor.deleteDataSource(requestor.getDataSourceById(uri));
+ userService.deleteOwnSource(username, uri);
+ requestor.refreshDataSourceCache();
+ } else {
return constructErrorMessage(new
Notification(NotificationType.STORAGE_ERROR.title(),
NotificationType.STORAGE_ERROR.description()));
}
return
constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
diff --git
a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementDescriptionStorage.java
b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementDescriptionStorage.java
index 69ca8cf..32bd0c2 100644
---
a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementDescriptionStorage.java
+++
b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineElementDescriptionStorage.java
@@ -26,7 +26,6 @@ import
org.apache.streampipes.model.graph.DataSourceDescription;
import org.apache.streampipes.model.staticproperty.StaticProperty;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.List;
public interface IPipelineElementDescriptionStorage {
@@ -45,15 +44,15 @@ public interface IPipelineElementDescriptionStorage {
DataSourceDescription getDataSourceByAppId(String appId);
- DataSourceDescription getDataSourceById(String rdfId) throws
URISyntaxException;
+ DataSourceDescription getDataSourceById(String rdfId);
- DataProcessorDescription getDataProcessorById(String rdfId) throws
URISyntaxException;
+ DataProcessorDescription getDataProcessorById(String rdfId);
DataProcessorDescription getDataProcessorById(URI rdfId);
DataProcessorDescription getDataProcessorByAppId(String appId);
- DataSinkDescription getDataSinkById(String rdfId) throws
URISyntaxException;
+ DataSinkDescription getDataSinkById(String rdfId);
DataSinkDescription getDataSinkById(URI rdfId);
diff --git
a/streampipes-storage-rdf4j/src/main/java/org/apache/streampipes/storage/rdf4j/impl/PipelineElementStorageRequests.java
b/streampipes-storage-rdf4j/src/main/java/org/apache/streampipes/storage/rdf4j/impl/PipelineElementStorageRequests.java
index bb88444..c1c4ee8 100644
---
a/streampipes-storage-rdf4j/src/main/java/org/apache/streampipes/storage/rdf4j/impl/PipelineElementStorageRequests.java
+++
b/streampipes-storage-rdf4j/src/main/java/org/apache/streampipes/storage/rdf4j/impl/PipelineElementStorageRequests.java
@@ -18,9 +18,6 @@
package org.apache.streampipes.storage.rdf4j.impl;
-import org.eclipse.rdf4j.repository.RepositoryException;
-import org.eclipse.rdf4j.rio.RDFParseException;
-import org.eclipse.rdf4j.rio.UnsupportedRDFormatException;
import io.fogsy.empire.core.empire.impl.RdfQuery;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
@@ -32,15 +29,16 @@ import
org.apache.streampipes.model.staticproperty.StaticProperty;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
import org.apache.streampipes.storage.rdf4j.sparql.QueryBuilder;
import org.apache.streampipes.storage.rdf4j.util.Transformer;
+import org.eclipse.rdf4j.repository.RepositoryException;
+import org.eclipse.rdf4j.rio.RDFParseException;
+import org.eclipse.rdf4j.rio.UnsupportedRDFormatException;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
import java.io.IOException;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
public class PipelineElementStorageRequests implements
IPipelineElementDescriptionStorage {
private EntityManager entityManager;
@@ -121,8 +119,8 @@ public class PipelineElementStorageRequests implements
IPipelineElementDescripti
}
@Override
- public DataSourceDescription getDataSourceById(String rdfId) throws
URISyntaxException {
- return getDataSourceById(new URI(rdfId));
+ public DataSourceDescription getDataSourceById(String rdfId) {
+ return getDataSourceById(URI.create(rdfId));
}
@SuppressWarnings("unchecked")
@@ -190,8 +188,8 @@ public class PipelineElementStorageRequests implements
IPipelineElementDescripti
}
@Override
- public DataProcessorDescription getDataProcessorById(String rdfId) throws
URISyntaxException {
- return getDataProcessorById(new URI(rdfId));
+ public DataProcessorDescription getDataProcessorById(String rdfId) {
+ return getDataProcessorById(URI.create(rdfId));
}
@Override
@@ -205,8 +203,8 @@ public class PipelineElementStorageRequests implements
IPipelineElementDescripti
}
@Override
- public DataSinkDescription getDataSinkById(String rdfId) throws
URISyntaxException {
- return getDataSinkById(new URI(rdfId));
+ public DataSinkDescription getDataSinkById(String rdfId) {
+ return getDataSinkById(URI.create(rdfId));
}
@Override
diff --git a/ui/src/app/add/add.component.html
b/ui/src/app/add/add.component.html
index 37983a0..ef57b48 100644
--- a/ui/src/app/add/add.component.html
+++ b/ui/src/app/add/add.component.html
@@ -36,11 +36,11 @@
<div fxFlex="100" fxLayout="column" fxLayoutAlign="start start"
class="page-container-padding-inner" *ngIf="endpointItemsLoadingComplete" >
<div fxLayoutAlign="start start" fxLayout="column">
<div fxFlex="100" fxLayout="row" style="margin-bottom:20px;">
- <button mat-button mat-raised-button (click)="selectAll(true)"
class="mr-10">
+ <button mat-button mat-flat-button color="primary"
(click)="selectAll(true)" class="mr-10">
<i class="material-icons">done</i>
Select all
</button>
- <button mat-button mat-raised-button
(click)="selectAll(false)" class="mr-10">
+ <button mat-button mat-flat-button color="primary"
(click)="selectAll(false)" class="mr-10">
<i class="material-icons">clear</i>
Select none
</button>
diff --git
a/ui/src/app/add/components/endpoint-item/endpoint-item.component.html
b/ui/src/app/add/components/endpoint-item/endpoint-item.component.html
index 902e757..5b3b5bd 100644
--- a/ui/src/app/add/components/endpoint-item/endpoint-item.component.html
+++ b/ui/src/app/add/components/endpoint-item/endpoint-item.component.html
@@ -35,6 +35,15 @@
<i class="material-icons small-icon">delete</i>
<span> Uninstall</span>
</button>
+ <div *ngIf="item.installed" style="margin-left:5px;">
+ <button class="small-button mat-basic no-min-width"
mat-raised-button mat-button [matMenuTriggerFor]="menu"><span
style="font-size:12px;">...</span></button>
+ <mat-menu #menu="matMenu">
+ <button mat-menu-item (click)="refresh(item.uri)">
+ <mat-icon>refresh</mat-icon>
+ <span> Update</span>
+ </button>
+ </mat-menu>
+ </div>
</div>
</div>
</div>
diff --git
a/ui/src/app/add/components/endpoint-item/endpoint-item.component.scss
b/ui/src/app/add/components/endpoint-item/endpoint-item.component.scss
index f723b27..fd2d4d4 100644
--- a/ui/src/app/add/components/endpoint-item/endpoint-item.component.scss
+++ b/ui/src/app/add/components/endpoint-item/endpoint-item.component.scss
@@ -30,4 +30,8 @@
.ml-5 {
margin-left:5px;
+}
+
+.no-min-width {
+ min-width: 0;
}
\ No newline at end of file
diff --git a/ui/src/app/add/components/endpoint-item/endpoint-item.component.ts
b/ui/src/app/add/components/endpoint-item/endpoint-item.component.ts
index db88d19..e43f17d 100644
--- a/ui/src/app/add/components/endpoint-item/endpoint-item.component.ts
+++ b/ui/src/app/add/components/endpoint-item/endpoint-item.component.ts
@@ -17,6 +17,8 @@
*/
import {Component, EventEmitter, Input, OnInit, Output} from "@angular/core";
+import {MatSnackBar} from "@angular/material/snack-bar";
+import {PipelineElementEndpointService} from
"../../../platform-services/apis/pipeline-element-endpoint.service";
@Component({
selector: 'endpoint-item',
@@ -37,6 +39,11 @@ export class EndpointItemComponent implements OnInit {
@Output()
triggerInstallation: EventEmitter<any> = new EventEmitter<any>();
+ constructor(private snackBar: MatSnackBar,
+ private PipelineElementEndpointService:
PipelineElementEndpointService) {
+
+ }
+
ngOnInit(): void {
this.findItemTypeTitle();
this.findItemStyle();
@@ -94,4 +101,17 @@ export class EndpointItemComponent implements OnInit {
endpointItems.push(endpointItem);
this.triggerInstallation.emit({endpointItems: endpointItems, install:
false});
}
+
+ refresh(elementUri) {
+ this.PipelineElementEndpointService.update(elementUri)
+ .subscribe(msg => {
+ console.log(msg);
+ this.snackBar.open(msg.notifications[0].title, "Ok", {
+ duration: 2000
+ });
+ })
+ .add(() => {
+ //this.loadCurrentElements(type);
+ });
+ }
}
\ No newline at end of file
diff --git
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
index 6e1b4ca..495e2e5 100644
---
a/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
+++
b/ui/src/app/pipelines/components/pipeline-overview/pipeline-overview.component.ts
@@ -45,7 +45,7 @@ export class PipelineOverviewComponent implements OnInit {
dataSource: MatTableDataSource<Pipeline>;
- @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
+ @ViewChild(MatPaginator) paginator: MatPaginator;
pageSize: number = 1;
starting: any;
@@ -81,8 +81,7 @@ export class PipelineOverviewComponent implements OnInit {
@Input()
set pipelines(pipelines: Array<Pipeline>) {
this._pipelines = pipelines;
- this.dataSource = new MatTableDataSource<Pipeline>(this.filterPipelines());
- this.dataSource.paginator = this.paginator;
+ this.addPipelinesToTable();
}
get activeCategoryId(): string {
@@ -93,10 +92,17 @@ export class PipelineOverviewComponent implements OnInit {
set activeCategoryId(activeCategoryId: string) {
this._activeCategoryId = activeCategoryId;
if (this._pipelines) {
- this.dataSource = new
MatTableDataSource<Pipeline>(this.filterPipelines());
+ this.addPipelinesToTable();
}
}
+ addPipelinesToTable() {
+ this.dataSource = new MatTableDataSource<Pipeline>(this.filterPipelines());
+ setTimeout(() => {
+ this.dataSource.paginator = this.paginator;
+ });
+ }
+
filterPipelines(): Pipeline[] {
let filteredPipelines: Pipeline[] = this._pipelines.filter(pipeline =>
!(this._activeCategoryId) || (pipeline.pipelineCategories &&
pipeline.pipelineCategories.some(pc => pc === this.activeCategoryId)));
this.filteredPipelinesAvailable = filteredPipelines.length > 0;