You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/09/24 13:26:15 UTC
[incubator-streampipes] 01/12: [STREAMPIPES-427] Add
streampipes-rest-core-base module,
extract AuthGuardedResource to separate module, refactor pipeline API
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit a453b87803cf23b48cbf54f96e16a13c9f390d36
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Sep 24 13:41:03 2021 +0200
[STREAMPIPES-427] Add streampipes-rest-core-base module, extract AuthGuardedResource to separate module, refactor pipeline API
---
pom.xml | 1 +
.../backend/StreamPipesResourceConfig.java | 2 +-
.../streampipes/model/pipeline/Pipeline.java | 1 +
.../apache/streampipes/ps/DataLakeResourceV3.java | 2 +-
.../apache/streampipes/ps/DataLakeResourceV4.java | 2 +-
.../ps/PipelineElementTemplateResource.java | 2 +-
streampipes-rest-core-base/pom.xml | 55 ++++
.../impl/AbstractAuthGuardedRestResource.java | 7 +-
.../rest/core/base}/impl/AbstractRestResource.java | 2 +-
streampipes-rest/pom.xml | 5 +
.../apache/streampipes/rest}/ResetManagement.java | 2 +-
.../streampipes/rest/impl/AssetDashboard.java | 3 +-
.../streampipes/rest/impl/Authentication.java | 1 +
.../apache/streampipes/rest/impl/AutoComplete.java | 1 +
.../streampipes/rest/impl/CategoryResource.java | 1 +
.../apache/streampipes/rest/impl/ConsulConfig.java | 1 +
.../rest/impl/ContainerProvidedOptions.java | 1 +
.../org/apache/streampipes/rest/impl/Couchdb.java | 1 +
.../apache/streampipes/rest/impl/DataStream.java | 1 +
.../apache/streampipes/rest/impl/Deployment.java | 1 +
.../impl/ExtensionsServiceEndpointResource.java | 1 +
.../rest/impl/InternalPipelineTemplates.java | 1 +
.../streampipes/rest/impl/LabelResource.java | 1 +
.../rest/impl/MeasurementUnitResource.java | 1 +
.../apache/streampipes/rest/impl/Notification.java | 1 +
.../rest/impl/OntologyMeasurementUnit.java | 1 +
.../rest/impl/OntologyPipelineElement.java | 1 +
.../streampipes/rest/impl/PipelineCache.java | 1 +
.../rest/impl/PipelineCanvasMetadataCache.java | 1 +
.../rest/impl/PipelineCanvasMetadataResource.java | 1 +
.../streampipes/rest/impl/PipelineCategory.java | 9 +-
.../rest/impl/PipelineElementAsset.java | 1 +
.../rest/impl/PipelineElementCategory.java | 1 +
.../streampipes/rest/impl/PipelineElementFile.java | 1 +
.../rest/impl/PipelineElementImport.java | 1 +
.../rest/impl/PipelineElementPreview.java | 1 +
.../rest/impl/PipelineElementRuntimeInfo.java | 1 +
.../streampipes/rest/impl/PipelineMonitoring.java | 1 +
.../streampipes/rest/impl/PipelineResource.java | 58 ++--
.../streampipes/rest/impl/PipelineTemplate.java | 1 +
.../streampipes/rest/impl/ResetResource.java | 3 +-
.../rest/impl/SemanticEventConsumer.java | 1 +
.../rest/impl/SemanticEventProcessingAgent.java | 1 +
.../rest/impl/SemanticEventProducer.java | 1 +
.../org/apache/streampipes/rest/impl/Setup.java | 1 +
.../org/apache/streampipes/rest/impl/User.java | 1 +
.../org/apache/streampipes/rest/impl/Version.java | 1 +
.../streampipes/rest/impl/VirtualSensor.java | 1 +
.../streampipes/rest/impl/Visualization.java | 2 +
.../impl/connect}/AbstractAdapterResource.java | 2 +-
.../rest/impl/connect}/AdapterResource.java | 2 +-
.../impl/connect}/AdapterTemplateResource.java | 2 +-
.../rest/impl/connect}/DescriptionResource.java | 2 +-
.../rest/impl/connect}/GuessResource.java | 2 +-
.../impl/connect}/RuntimeResolvableResource.java | 2 +-
.../rest/impl/connect}/SourcesResource.java | 2 +-
.../rest/impl/connect}/UnitResource.java | 2 +-
.../rest/impl/connect}/WelcomePageMaster.java | 2 +-
.../connect}/WorkerAdministrationResource.java | 2 +-
.../impl/dashboard/AbstractDashboardResource.java | 2 +-
.../AbstractPipelineExtractionResource.java | 2 +-
.../rest/impl/dashboard/DashboardWidget.java | 2 +-
.../impl/datalake/DataLakeNoUserResourceV3.java | 2 +-
.../rest/impl/datalake/DataLakeWidgetResource.java | 2 +-
.../rest/impl/nouser/FileServingResource.java | 2 +-
.../impl/nouser/PipelineElementImportNoUser.java | 2 +-
.../rest/impl/nouser/PipelineNoUserResource.java | 2 +-
.../rest/management/PipelineManagement.java | 2 +-
.../app-asset-monitoring/services/rest.service.ts | 94 +++---
ui/src/app/home/components/status.component.html | 4 +-
ui/src/app/home/components/status.component.ts | 40 ++-
ui/src/app/home/home.component.ts | 14 +-
.../pipeline-overview.component.ts | 26 +-
ui/src/app/pipelines/pipelines.component.html | 2 +-
ui/src/app/pipelines/pipelines.component.ts | 335 ++++++++++-----------
.../app/platform-services/apis/commons.service.ts | 4 +
.../app/platform-services/apis/pipeline.service.ts | 71 +++--
77 files changed, 441 insertions(+), 376 deletions(-)
diff --git a/pom.xml b/pom.xml
index 36ecdb4..f571c6e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -855,6 +855,7 @@
<module>streampipes-service-discovery-api</module>
<module>streampipes-connect-api</module>
<module>streampipes-service-extensions-base</module>
+ <module>streampipes-rest-core-base</module>
</modules>
<profiles>
diff --git a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
index a429102..e140797 100644
--- a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
+++ b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
@@ -19,11 +19,11 @@
package org.apache.streampipes.backend;
import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
-import org.apache.streampipes.connect.container.master.rest.*;
import org.apache.streampipes.ps.DataLakeResourceV3;
import org.apache.streampipes.ps.DataLakeResourceV4;
import org.apache.streampipes.ps.PipelineElementTemplateResource;
import org.apache.streampipes.rest.impl.*;
+import org.apache.streampipes.rest.impl.connect.*;
import org.apache.streampipes.rest.impl.dashboard.Dashboard;
import org.apache.streampipes.rest.impl.dashboard.DashboardWidget;
import org.apache.streampipes.rest.impl.dashboard.VisualizablePipelineResource;
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java
index 3249a65..fa2aca2 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/Pipeline.java
@@ -58,6 +58,7 @@ public class Pipeline extends ElementComposition {
super();
this.actions = new ArrayList<>();
this.pipelineNotifications = new ArrayList<>();
+ this.pipelineCategories = new ArrayList<>();
}
public List<DataSinkInvocation> getActions() {
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
index d8d814c..0f8bfff 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
@@ -25,7 +25,7 @@ import org.apache.streampipes.model.datalake.DataResult;
import org.apache.streampipes.model.datalake.GroupedDataResult;
import org.apache.streampipes.model.datalake.PageResult;
import org.apache.streampipes.model.message.Notification;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
index 1589b4f..e2efc0b 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
@@ -30,7 +30,7 @@ import org.apache.streampipes.dataexplorer.v4.ProvidedQueryParams;
import org.apache.streampipes.model.datalake.DataLakeConfiguration;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
import org.apache.streampipes.model.datalake.DataResult;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java
index d405b5b..5f6faf1 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/PipelineElementTemplateResource.java
@@ -29,7 +29,7 @@ import org.apache.streampipes.manager.template.DataSinkTemplateHandler;
import org.apache.streampipes.model.graph.DataProcessorInvocation;
import org.apache.streampipes.model.graph.DataSinkInvocation;
import org.apache.streampipes.model.template.PipelineElementTemplate;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.*;
diff --git a/streampipes-rest-core-base/pom.xml b/streampipes-rest-core-base/pom.xml
new file mode 100644
index 0000000..91e1596
--- /dev/null
+++ b/streampipes-rest-core-base/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>streampipes-parent</artifactId>
+ <groupId>org.apache.streampipes</groupId>
+ <version>0.69.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>streampipes-rest-core-base</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-rest-shared</artifactId>
+ <version>0.69.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-user-management</artifactId>
+ <version>0.69.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-storage-management</artifactId>
+ <version>0.69.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-pipeline-management</artifactId>
+ <version>0.69.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AbstractAuthGuardedRestResource.java b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java
similarity index 85%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AbstractAuthGuardedRestResource.java
rename to streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java
index c1d73c0..c42e0a4 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AbstractAuthGuardedRestResource.java
+++ b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java
@@ -15,9 +15,7 @@
* limitations under the License.
*
*/
-package org.apache.streampipes.rest.impl;
-
-import org.apache.streampipes.model.client.user.User;
+package org.apache.streampipes.rest.core.base.impl;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.SecurityContext;
@@ -35,7 +33,4 @@ public class AbstractAuthGuardedRestResource extends AbstractRestResource {
return this.securityContext.getUserPrincipal().getName();
}
- protected User getAuthenticatedUser() {
- return getUserStorage().getUser(getAuthenticatedUsername());
- }
}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AbstractRestResource.java b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java
similarity index 99%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AbstractRestResource.java
rename to streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java
index 71d3112..1ae36f9 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AbstractRestResource.java
+++ b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractRestResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.rest.impl;
+package org.apache.streampipes.rest.core.base.impl;
import org.apache.http.client.ClientProtocolException;
import org.apache.shiro.SecurityUtils;
diff --git a/streampipes-rest/pom.xml b/streampipes-rest/pom.xml
index 0b2bb05..0d0bd26 100644
--- a/streampipes-rest/pom.xml
+++ b/streampipes-rest/pom.xml
@@ -92,6 +92,11 @@
</dependency>
<dependency>
<groupId>org.apache.streampipes</groupId>
+ <artifactId>streampipes-rest-core-base</artifactId>
+ <version>0.69.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streampipes</groupId>
<artifactId>streampipes-connect-container-master</artifactId>
<version>0.69.0-SNAPSHOT</version>
</dependency>
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/general/ResetManagement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java
similarity index 98%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/general/ResetManagement.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java
index fb33d62..d0b77ed 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/general/ResetManagement.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/ResetManagement.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.general;
+package org.apache.streampipes.rest;
import org.apache.streampipes.connect.api.exception.AdapterException;
import org.apache.streampipes.connect.container.master.management.AdapterMasterManagement;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java
index 5cdabe0..6114d20 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.commons.io.FileUtils;
import org.apache.streampipes.model.client.assetdashboard.AssetDashboardConfig;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
@@ -33,7 +34,7 @@ import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Paths;
-@Path("/v2/users/{username}/asset-dashboards")
+@Path("/v2/asset-dashboards")
public class AssetDashboard extends AbstractRestResource {
private static final String APP_ID = "org.apache.streampipes.apps.assetdashboard";
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
index 5af79b7..aa9f0b4 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
@@ -29,6 +29,7 @@ import org.apache.streampipes.model.message.ErrorMessage;
import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.message.SuccessMessage;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import javax.servlet.http.HttpServletRequest;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
index 7253fd6..b18c4a3 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.rest.impl;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.vocabulary.SemanticTypeRegistry;
import javax.ws.rs.GET;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/CategoryResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/CategoryResource.java
index 9ea8ac6..25c6df6 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/CategoryResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/CategoryResource.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.labeling.Category;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
index d3c7c6d..fe4167d 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
@@ -22,6 +22,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.streampipes.config.backend.BackendConfig;
import org.apache.streampipes.config.backend.MessagingSettings;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.svcdiscovery.consul.ConsulSpConfig;
import org.apache.streampipes.svcdiscovery.api.model.ConfigItem;
import org.apache.streampipes.svcdiscovery.api.model.PeConfig;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ContainerProvidedOptions.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ContainerProvidedOptions.java
index 4eca9d4..aabea60 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ContainerProvidedOptions.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ContainerProvidedOptions.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.operations.Operations;
import org.apache.streampipes.model.runtime.RuntimeOptionsRequest;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.Consumes;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Couchdb.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Couchdb.java
index 524b650..9191c9b 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Couchdb.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Couchdb.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.rest.impl;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.storage.couchdb.utils.Utils;
import org.lightcouch.CouchDbClient;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
index db9f7fc..747da3b 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.operations.Operations;
import org.apache.streampipes.model.SpDataStream;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import javax.ws.rs.POST;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
index 7de0f80..f6d9c93 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
@@ -26,6 +26,7 @@ import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataSinkDescription;
import org.apache.streampipes.model.graph.DataSourceDescription;
import org.apache.streampipes.model.message.Notifications;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.serializers.json.GsonSerializer;
import org.apache.streampipes.storage.management.StorageManager;
import org.glassfish.jersey.media.multipart.FormDataParam;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java
index f056477..11403a8 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java
@@ -25,6 +25,7 @@ import org.apache.streampipes.model.SpDataSet;
import org.apache.streampipes.model.base.NamedStreamPipesEntity;
import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpoint;
import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpointItem;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.sdk.utils.Assets;
import org.apache.streampipes.storage.api.IExtensionsServiceEndpointStorage;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java
index 5cbc743..e9cdbf4 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java
@@ -25,6 +25,7 @@ import org.apache.streampipes.model.graph.DataSinkDescription;
import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
import org.apache.streampipes.model.template.PipelineTemplateDescription;
import org.apache.streampipes.model.template.PipelineTemplateInvocation;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.sdk.builder.BoundPipelineElementBuilder;
import org.apache.streampipes.sdk.builder.PipelineTemplateBuilder;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/LabelResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/LabelResource.java
index d0b5a40..81332c5 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/LabelResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/LabelResource.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.labeling.Category;
import org.apache.streampipes.model.labeling.Label;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java
index 630fbf7..9b0814f 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java
@@ -16,6 +16,7 @@
*/
package org.apache.streampipes.rest.impl;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.units.UnitProvider;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Notification.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Notification.java
index 6a03bfd..ff1d413 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Notification.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Notification.java
@@ -19,6 +19,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.message.Notifications;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import javax.ws.rs.*;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyMeasurementUnit.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyMeasurementUnit.java
index 0bcbd81..a6056e6 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyMeasurementUnit.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyMeasurementUnit.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.rest.impl;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.units.UnitProvider;
import javax.ws.rs.GET;
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 ea9bf2d..b30062b 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
@@ -24,6 +24,7 @@ import com.google.gson.JsonPrimitive;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataSinkDescription;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.storage.management.StorageManager;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java
index ddafe60..53c3dbd 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCache.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.pipeline.PipelineCacheManager;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java
index 022d5e2..e0f3754 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataCache.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.pipeline.PipelineCanvasMetadataCacheManager;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataResource.java
index 0aaaa00..4754060 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCanvasMetadataResource.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.canvas.PipelineCanvasMetadata;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.api.IPipelineCanvasMetadataStorage;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java
index c55fcf0..9ef53d9 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineCategory.java
@@ -19,6 +19,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.message.Notifications;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.api.IPipelineCategoryStorage;
@@ -26,13 +27,13 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-@Path("/v2/users/{username}/pipelinecategories")
+@Path("/v2/pipelinecategories")
public class PipelineCategory extends AbstractRestResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
@JacksonSerialized
- public Response getCategories(@PathParam("username") String username) {
+ public Response getCategories() {
return ok(getPipelineCategoryStorage()
.getPipelineCategories());
}
@@ -41,7 +42,7 @@ public class PipelineCategory extends AbstractRestResource {
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
- public Response addCategory(@PathParam("username") String username, org.apache.streampipes.model.pipeline.PipelineCategory pipelineCategory) {
+ public Response addCategory(org.apache.streampipes.model.pipeline.PipelineCategory pipelineCategory) {
boolean success = getPipelineCategoryStorage()
.addPipelineCategory(pipelineCategory);
if (success) return ok(Notifications.success("Category successfully stored. "));
@@ -52,7 +53,7 @@ public class PipelineCategory extends AbstractRestResource {
@Path("/{categoryId}")
@Produces(MediaType.APPLICATION_JSON)
@JacksonSerialized
- public Response removeCategory(@PathParam("username") String username, @PathParam("categoryId") String categoryId) {
+ public Response removeCategory(@PathParam("categoryId") String categoryId) {
boolean success = getPipelineCategoryStorage()
.deletePipelineCategory(categoryId);
if (success) return ok(Notifications.success("Category successfully deleted. "));
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
index dff9b4a..68e1432 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
@@ -18,6 +18,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.assets.AssetManager;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementCategory.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementCategory.java
index c83e341..715c843 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementCategory.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementCategory.java
@@ -23,6 +23,7 @@ import org.apache.streampipes.model.DataProcessorType;
import org.apache.streampipes.model.DataSinkType;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.client.Category;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.management.StorageManager;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
index 4a30550..e57a26d 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.file.FileManager;
import org.apache.streampipes.model.client.file.FileMetadata;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
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 9673cf0..0b2184b 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
@@ -32,6 +32,7 @@ import org.apache.streampipes.model.message.Message;
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.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorageCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementPreview.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementPreview.java
index 1b21aa2..c5187ae 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementPreview.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementPreview.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.preview.PipelinePreview;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.model.preview.PipelinePreviewModel;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.*;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementRuntimeInfo.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementRuntimeInfo.java
index 76f7e81..d654f70 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementRuntimeInfo.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementRuntimeInfo.java
@@ -21,6 +21,7 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException;
import org.apache.streampipes.manager.operations.Operations;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.message.Notifications;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.Consumes;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineMonitoring.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineMonitoring.java
index e25f35e..336068d 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineMonitoring.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineMonitoring.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.monitoring.pipeline.PipelineExecutionStatusCollector;
import org.apache.streampipes.rest.api.IPipelineMonitoring;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.GET;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
index 2a9b702..737757f 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
@@ -37,6 +37,7 @@ import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.message.SuccessMessage;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
+import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,21 +46,11 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-@Path("/v2/users/{username}/pipelines")
+@Path("/v2/pipelines")
public class PipelineResource extends AbstractAuthGuardedRestResource {
private static final Logger logger = LoggerFactory.getLogger(PipelineResource.class);
- public Response getAvailable(String username) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Response getFavorites(String username) {
- // TODO Auto-generated method stub
- return null;
- }
-
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/own")
@@ -72,8 +63,8 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
mediaType = "application/json",
array = @ArraySchema(schema = @Schema(implementation = Pipeline.class)))
})})
- public Response getOwn(@PathParam("username") String username) {
- return ok(PipelineManager.getOwnPipelines(username));
+ public Response getOwn() {
+ return ok(PipelineManager.getOwnPipelines(getAuthenticatedUsername()));
}
@GET
@@ -86,23 +77,13 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
return ok(getPipelineStorage().getSystemPipelines());
}
- public Response addFavorite(String username, String elementUri) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Response removeFavorite(String username, String elementUri) {
- // TODO Auto-generated method stub
- return null;
- }
-
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{pipelineId}/status")
@JacksonSerialized
@Operation(summary = "Get the pipeline status of a given pipeline",
tags = {"Pipeline"})
- public Response getPipelineStatus(@PathParam("username") String username, @PathParam("pipelineId") String pipelineId) {
+ public Response getPipelineStatus(@PathParam("pipelineId") String pipelineId) {
return ok(PipelineStatusManager.getPipelineStatus(pipelineId, 5));
}
@@ -112,7 +93,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@JacksonSerialized
@Operation(summary = "Delete a pipeline with a given id",
tags = {"Pipeline"})
- public Response removeOwn(@PathParam("username") String username, @PathParam("pipelineId") String pipelineId) {
+ public Response removeOwn(@PathParam("pipelineId") String pipelineId) {
PipelineManager.deletePipeline(pipelineId);
return statusMessage(Notifications.success("Pipeline deleted"));
}
@@ -123,7 +104,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@JacksonSerialized
@Operation(summary = "Get a specific pipeline with the given id",
tags = {"Pipeline"})
- public Response getElement(@PathParam("username") String username, @PathParam("pipelineId") String pipelineId) {
+ public Response getElement(@PathParam("pipelineId") String pipelineId) {
return ok(PipelineManager.getPipeline(pipelineId));
}
@@ -133,7 +114,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@JacksonSerialized
@Operation(summary = "Start the pipeline with the given id",
tags = {"Pipeline"})
- public Response start(@PathParam("username") String username, @PathParam("pipelineId") String pipelineId) {
+ public Response start(@PathParam("pipelineId") String pipelineId) {
try {
PipelineOperationStatus status = PipelineManager.startPipeline(pipelineId);
@@ -150,11 +131,8 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@JacksonSerialized
@Operation(summary = "Stop the pipeline with the given id",
tags = {"Pipeline"})
- public Response stop(@PathParam("username") String username,
- @PathParam("pipelineId") String pipelineId,
+ public Response stop(@PathParam("pipelineId") String pipelineId,
@QueryParam("forceStop") @DefaultValue("false") boolean forceStop) {
- logger.info("User: " + username + " stopped pipeline: " + pipelineId);
-
try {
PipelineOperationStatus status = PipelineManager.stopPipeline(pipelineId, forceStop);
return ok(status);
@@ -170,9 +148,9 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@JacksonSerialized
@Operation(summary = "Store a new pipeline",
tags = {"Pipeline"})
- public Response addPipeline(@PathParam("username") String username, Pipeline pipeline) {
+ public Response addPipeline(Pipeline pipeline) {
- String pipelineId = PipelineManager.addPipeline(username, pipeline);
+ String pipelineId = PipelineManager.addPipeline(getAuthenticatedUsername(), pipeline);
SuccessMessage message = Notifications.success("Pipeline stored");
message.addNotification(new Notification("id", pipelineId));
return ok(message);
@@ -183,9 +161,9 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@Produces(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Hidden
- public Response recommend(@PathParam("username") String email, Pipeline pipeline) {
+ public Response recommend(Pipeline pipeline) {
try {
- return ok(Operations.findRecommendedElements(email, pipeline));
+ return ok(Operations.findRecommendedElements(getAuthenticatedUsername(), pipeline));
} catch (JsonSyntaxException e) {
return constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR,
e.getMessage()));
@@ -205,8 +183,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Hidden
- public Response updateDataSet(SpDataSet spDataSet, @PathParam("username")
- String username) {
+ public Response updateDataSet(SpDataSet spDataSet) {
return ok(Operations.updateDataSet(spDataSet));
}
@@ -216,9 +193,9 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@Consumes(MediaType.APPLICATION_JSON)
@JacksonSerialized
@Hidden
- public Response update(Pipeline pipeline, @PathParam("username") String username) {
+ public Response update(Pipeline pipeline) {
try {
- return ok(Operations.validatePipeline(pipeline, true, username));
+ return ok(Operations.validatePipeline(pipeline, true));
} catch (JsonSyntaxException e) {
return badRequest(new Notification(NotificationType.UNKNOWN_ERROR,
e.getMessage()));
@@ -249,8 +226,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@JacksonSerialized
@Operation(summary = "Update an existing pipeline",
tags = {"Pipeline"})
- public Response overwritePipeline(@PathParam("username") String username,
- @PathParam("pipelineId") String pipelineId,
+ public Response overwritePipeline(@PathParam("pipelineId") String pipelineId,
Pipeline pipeline) {
Pipeline storedPipeline = getPipelineStorage().getPipeline(pipelineId);
if (!storedPipeline.isRunning()) {
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineTemplate.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineTemplate.java
index 9d6caa7..8e7f6b8 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineTemplate.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineTemplate.java
@@ -25,6 +25,7 @@ import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
import org.apache.streampipes.model.template.PipelineTemplateDescription;
import org.apache.streampipes.model.template.PipelineTemplateDescriptionContainer;
import org.apache.streampipes.model.template.PipelineTemplateInvocation;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.util.SpMediaType;
import javax.ws.rs.*;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ResetResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ResetResource.java
index cfd629c..4024c39 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ResetResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ResetResource.java
@@ -19,9 +19,10 @@
package org.apache.streampipes.rest.impl;
import io.swagger.v3.oas.annotations.Operation;
-import org.apache.streampipes.connect.container.master.general.ResetManagement;
+import org.apache.streampipes.rest.ResetManagement;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.message.SuccessMessage;
+import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 8709483..f3fccd6 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
@@ -24,6 +24,7 @@ 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.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.rest.shared.util.SpMediaType;
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 372ac4f..82b429c 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
@@ -24,6 +24,7 @@ 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.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.rest.shared.util.SpMediaType;
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 e737a4c..1599b9a 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
@@ -24,6 +24,7 @@ import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.util.Cloner;
import org.apache.streampipes.rest.api.IPipelineElement;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.rest.shared.util.SpMediaType;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java
index e7c45a9..8f028b6 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java
@@ -24,6 +24,7 @@ import org.apache.streampipes.manager.setup.Installer;
import org.apache.streampipes.model.client.setup.InitialSettings;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.message.SetupStatusMessage;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.notifications.NotificationListener;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/User.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/User.java
index 8350f46..80879e9 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/User.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/User.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.client.user.RawUserApiToken;
import org.apache.streampipes.model.message.Notifications;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.user.management.service.TokenService;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Version.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Version.java
index 1bacd77..733b434 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Version.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Version.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.info.SystemInfoProvider;
import org.apache.streampipes.manager.info.VersionInfoProvider;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/VirtualSensor.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/VirtualSensor.java
index 07a70d3..2b094f2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/VirtualSensor.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/VirtualSensor.java
@@ -19,6 +19,7 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.model.message.NotificationType;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.serializers.json.Utils;
import javax.ws.rs.*;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Visualization.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Visualization.java
index 1bd075e..f4570cb 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Visualization.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Visualization.java
@@ -18,6 +18,8 @@
package org.apache.streampipes.rest.impl;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
+
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AbstractAdapterResource.java
similarity index 94%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AbstractAdapterResource.java
index f9a1045..06d6323 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AbstractAdapterResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AbstractAdapterResource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.rest.shared.impl.AbstractSharedRestInterface;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AdapterResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java
similarity index 98%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AdapterResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java
index b887d98..4b4363c 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AdapterResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.commons.exceptions.NoServiceEndpointsAvailableException;
import org.apache.streampipes.connect.api.exception.AdapterException;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AdapterTemplateResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterTemplateResource.java
similarity index 98%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AdapterTemplateResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterTemplateResource.java
index 3b2d0bd..ea20e6e 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/AdapterTemplateResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterTemplateResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.connect.api.exception.AdapterException;
import org.apache.streampipes.connect.container.master.management.AdapterTemplateMasterManagement;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/DescriptionResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/DescriptionResource.java
similarity index 99%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/DescriptionResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/DescriptionResource.java
index a247193..d848cc3 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/DescriptionResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/DescriptionResource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.commons.exceptions.NoServiceEndpointsAvailableException;
import org.apache.streampipes.connect.api.exception.AdapterException;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/GuessResource.java
similarity index 97%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/GuessResource.java
index 340a7b3..b5724cd 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/GuessResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/GuessResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.connect.api.exception.ParseException;
import org.apache.streampipes.connect.api.exception.WorkerAdapterException;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/RuntimeResolvableResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/RuntimeResolvableResource.java
similarity index 97%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/RuntimeResolvableResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/RuntimeResolvableResource.java
index 0294dcb..eff352f 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/RuntimeResolvableResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/RuntimeResolvableResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.commons.exceptions.NoServiceEndpointsAvailableException;
import org.apache.streampipes.connect.api.exception.AdapterException;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/SourcesResource.java
similarity index 98%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/SourcesResource.java
index 3d6a67a..f9a4414 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/SourcesResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.commons.exceptions.NoServiceEndpointsAvailableException;
import org.apache.streampipes.connect.api.exception.AdapterException;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/UnitResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/UnitResource.java
similarity index 97%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/UnitResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/UnitResource.java
index 888803d..5a0433f 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/UnitResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/UnitResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.connect.api.exception.AdapterException;
import org.apache.streampipes.connect.container.master.management.UnitMasterManagement;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WelcomePageMaster.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/WelcomePageMaster.java
similarity index 97%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WelcomePageMaster.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/WelcomePageMaster.java
index 7fa69da..1dd5b12 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WelcomePageMaster.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/WelcomePageMaster.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.connect.adapter.GroundingService;
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/WorkerAdministrationResource.java
similarity index 97%
rename from streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/WorkerAdministrationResource.java
index b601d60..866146f 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/WorkerAdministrationResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/WorkerAdministrationResource.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.streampipes.connect.container.master.rest;
+package org.apache.streampipes.rest.impl.connect;
import org.apache.streampipes.connect.container.master.management.WorkerAdministrationManagement;
import org.apache.streampipes.model.connect.worker.ConnectWorkerContainer;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractDashboardResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractDashboardResource.java
index e8df60e..6279f82 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractDashboardResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractDashboardResource.java
@@ -19,7 +19,7 @@
package org.apache.streampipes.rest.impl.dashboard;
import org.apache.streampipes.model.dashboard.DashboardModel;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.storage.api.IDashboardStorage;
import javax.ws.rs.*;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractPipelineExtractionResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractPipelineExtractionResource.java
index b1f8db6..21ea073 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractPipelineExtractionResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/AbstractPipelineExtractionResource.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.rest.impl.dashboard;
import org.apache.streampipes.model.graph.DataSinkInvocation;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java
index d3809ed..e4ac40b 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DashboardWidget.java
@@ -19,7 +19,7 @@
package org.apache.streampipes.rest.impl.dashboard;
import org.apache.streampipes.model.dashboard.DashboardWidgetModel;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.api.IDashboardWidgetStorage;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserResourceV3.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserResourceV3.java
index 0736e99..bc8220e 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserResourceV3.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserResourceV3.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.rest.impl.datalake;
import org.apache.streampipes.dataexplorer.DataLakeNoUserManagementV3;
import org.apache.streampipes.model.schema.EventSchema;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.*;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
index e8a2525..5ddefd2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeWidgetResource.java
@@ -19,7 +19,7 @@
package org.apache.streampipes.rest.impl.datalake;
import org.apache.streampipes.model.datalake.DataExplorerWidgetModel;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.storage.api.IDataExplorerWidgetStorage;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/FileServingResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/FileServingResource.java
index 5467889..3e7c332 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/FileServingResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/FileServingResource.java
@@ -18,7 +18,7 @@
package org.apache.streampipes.rest.impl.nouser;
import org.apache.streampipes.manager.file.FileManager;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
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 8644811..fd67989 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
@@ -23,7 +23,7 @@ import org.apache.streampipes.manager.storage.UserService;
import org.apache.streampipes.model.message.Message;
import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorageCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java
index 8a31a1c..b1228dc 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.rest.impl.nouser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import org.apache.streampipes.rest.management.PipelineManagement;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.NoAuthenticationRequired;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java
index f90fd89..f3619f5 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java
@@ -23,7 +23,7 @@ import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
-import org.apache.streampipes.rest.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
import javax.ws.rs.core.Response;
diff --git a/ui/src/app/app-asset-monitoring/services/rest.service.ts b/ui/src/app/app-asset-monitoring/services/rest.service.ts
index 59e161e..2797cc5 100644
--- a/ui/src/app/app-asset-monitoring/services/rest.service.ts
+++ b/ui/src/app/app-asset-monitoring/services/rest.service.ts
@@ -16,65 +16,63 @@
*
*/
-import {HttpClient} from "@angular/common/http";
-import {Injectable} from "@angular/core";
-import {map} from "rxjs/operators";
-import {Observable} from "rxjs";
-import {AuthStatusService} from "../../services/auth-status.service";
-import {DashboardConfiguration} from "../model/dashboard-configuration.model";
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { map } from 'rxjs/operators';
+import { Observable } from 'rxjs';
+import { AuthStatusService } from '../../services/auth-status.service';
+import { DashboardConfiguration } from '../model/dashboard-configuration.model';
+import { PlatformServicesCommons } from '../../platform-services/apis/commons.service';
@Injectable()
export class RestService {
+ constructor(private http: HttpClient,
+ private authStatusService: AuthStatusService,
+ private platformServicesCommons: PlatformServicesCommons) {
+ }
- constructor(private http: HttpClient, private authStatusService: AuthStatusService) {
- }
+ getVisualizablePipelines(): Observable<any> {
+ return this.http.get('/visualizablepipeline/_all_docs?include_docs=true');
+ }
- getVisualizablePipelines(): Observable<any> {
- return this.http.get('/visualizablepipeline/_all_docs?include_docs=true');
- }
+ getPipeline(pipelineId): Observable<any> {
+ return this.http.get('/pipeline/' + pipelineId);
+ }
- getPipeline(pipelineId): Observable<any> {
- return this.http.get('/pipeline/' + pipelineId);
- }
-
- storeImage(file: File): Observable<any> {
- const data: FormData = new FormData();
- data.append('file_upload', file, file.name);
- return this.http.post(this.imagePath, data)
- .pipe(map(res => {
- return res;
- }));
- }
-
- deleteDashboard(dashboardId: string) {
- return this.http.delete(this.url + "/" +dashboardId);
- }
+ storeImage(file: File): Observable<any> {
+ const data: FormData = new FormData();
+ data.append('file_upload', file, file.name);
+ return this.http.post(this.imagePath, data)
+ .pipe(map(res => {
+ return res;
+ }));
+ }
- storeDashboard(dashboardConfig: DashboardConfiguration) {
- return this.http.post(this.url, dashboardConfig);
- }
+ deleteDashboard(dashboardId: string) {
+ return this.http.delete(`${this.url}/${dashboardId}`);
+ }
- getDashboards(): Observable<DashboardConfiguration[]> {
- return this.http.get(this.url).pipe(map(response => {
- return response as DashboardConfiguration[];
- }));
- }
+ storeDashboard(dashboardConfig: DashboardConfiguration) {
+ return this.http.post(this.url, dashboardConfig);
+ }
- getImageUrl(imageName: string): string {
- return this.imagePath + "/" + imageName;
- }
+ getDashboards(): Observable<DashboardConfiguration[]> {
+ return this.http.get(this.url).pipe(map(response => {
+ return response as DashboardConfiguration[];
+ }));
+ }
- private get baseUrl() {
- return '/streampipes-backend';
- }
+ getImageUrl(imageName: string): string {
+ return `${this.imagePath}/${imageName}`;
+ }
- private get url() {
- return this.baseUrl + '/api/v2/users/' + this.authStatusService.email + '/asset-dashboards'
- }
+ private get url() {
+ return `${this.platformServicesCommons.apiBasePath()}/asset-dashboards`;
+ }
- private get imagePath() {
- return this.url + "/images";
- }
+ private get imagePath() {
+ return `${this.url}/images`;
+ }
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/home/components/status.component.html b/ui/src/app/home/components/status.component.html
index 1eef874..1441e63 100644
--- a/ui/src/app/home/components/status.component.html
+++ b/ui/src/app/home/components/status.component.html
@@ -31,7 +31,7 @@
</div>
<div fxFlex="25" class="status-container notifications mr-20" (click)="navigate('notifications')">
<div fxFill="100" fxLayout="column" fxLayoutAlign="center center">
- <div class="status-container-number" fxLayoutAlign="start center">{{NotificationCountService.unreadNotificationCount}}</div>
+ <div class="status-container-number" fxLayoutAlign="start center">{{notificationCountService.unreadNotificationCount}}</div>
<div class="status-container-text">unread notifications</div>
</div>
</div>
@@ -41,4 +41,4 @@
<div class="status-container-text">installed pipeline elements</div>
</div>
</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/ui/src/app/home/components/status.component.ts b/ui/src/app/home/components/status.component.ts
index c10ee51..ee636cb 100644
--- a/ui/src/app/home/components/status.component.ts
+++ b/ui/src/app/home/components/status.component.ts
@@ -16,29 +16,27 @@
*
*/
-import {Component} from "@angular/core";
-import {RestApi} from "../../services/rest-api.service";
-import {Router} from "@angular/router";
-import {NotificationCountService} from "../../services/notification-count-service";
-import {PipelineElementService} from "../../platform-services/apis/pipeline-element.service";
+import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { NotificationCountService } from '../../services/notification-count-service';
+import { PipelineElementService } from '../../platform-services/apis/pipeline-element.service';
+import { PipelineService } from '../../platform-services/apis/pipeline.service';
@Component({
selector: 'status',
templateUrl: './status.component.html',
styleUrls: ['./status.component.css']
})
-export class StatusComponent {
+export class StatusComponent implements OnInit {
- pipelines: number = 0;
- runningPipelines: number = 0;
- installedPipelineElements: number = 0;
+ pipelines = 0;
+ runningPipelines = 0;
+ installedPipelineElements = 0;
constructor(private pipelineElementService: PipelineElementService,
- private RestApi: RestApi,
- private Router: Router,
- public NotificationCountService: NotificationCountService) {
-
- }
+ private router: Router,
+ public notificationCountService: NotificationCountService,
+ private pipelineService: PipelineService) { }
ngOnInit() {
this.getPipelines();
@@ -48,7 +46,7 @@ export class StatusComponent {
}
getPipelines() {
- this.RestApi.getOwnPipelines().subscribe(pipelines => {
+ this.pipelineService.getOwnPipelines().subscribe(pipelines => {
this.pipelines = pipelines.length;
this.runningPipelines = pipelines.filter(p => p.running).length;
});
@@ -58,27 +56,27 @@ export class StatusComponent {
this.pipelineElementService.getDataStreams().subscribe(streams => {
this.addPipelineElementList(streams);
});
- };
+ }
getProcessors() {
- this.RestApi.getOwnSepas()
+ this.pipelineElementService.getDataProcessors()
.subscribe(msg => {
this.addPipelineElementList(msg);
});
- };
+ }
getSinks() {
- this.RestApi.getOwnActions()
+ this.pipelineElementService.getDataSinks()
.subscribe(msg => {
this.addPipelineElementList(msg);
});
- };
+ }
addPipelineElementList(msg) {
this.installedPipelineElements += msg.length;
}
navigate(url: string) {
- this.Router.navigate([url]);
+ this.router.navigate([url]);
}
}
diff --git a/ui/src/app/home/home.component.ts b/ui/src/app/home/home.component.ts
index f1b7c35..a00a516 100644
--- a/ui/src/app/home/home.component.ts
+++ b/ui/src/app/home/home.component.ts
@@ -16,11 +16,11 @@
*
*/
-import {Component} from '@angular/core';
-import {DomSanitizer} from '@angular/platform-browser';
-import {HomeService} from './home.service';
-import {Router} from "@angular/router";
-import {AppConstants} from "../services/app.constants";
+import { Component } from '@angular/core';
+import { DomSanitizer } from '@angular/platform-browser';
+import { HomeService } from './home.service';
+import { Router } from '@angular/router';
+import { AppConstants } from '../services/app.constants';
@Component({
templateUrl: './home.component.html',
@@ -32,7 +32,7 @@ export class HomeComponent {
constructor(private homeService: HomeService,
private sanitizer: DomSanitizer,
- private Router: Router,
+ private router: Router,
public appConstants: AppConstants) {
this.serviceLinks = this.homeService.getServiceLinks();
}
@@ -45,7 +45,7 @@ export class HomeComponent {
if (link.link.newWindow) {
window.open(link.link.value);
} else {
- this.Router.navigate([link.link.value]);
+ this.router.navigate([link.link.value]);
}
}
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 f11fe1e..a63da8f 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
@@ -16,12 +16,12 @@
*
*/
-import {Pipeline} from "../../../core-model/gen/streampipes-model";
-import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from "@angular/core";
-import {PipelineOperationsService} from "../../services/pipeline-operations.service";
-import {MatTableDataSource} from "@angular/material/table";
-import {MatPaginator} from "@angular/material/paginator";
-import {MatSort} from "@angular/material/sort";
+import { Pipeline } from '../../../core-model/gen/streampipes-model';
+import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
+import { PipelineOperationsService } from '../../services/pipeline-operations.service';
+import { MatTableDataSource } from '@angular/material/table';
+import { MatPaginator } from '@angular/material/paginator';
+import { MatSort } from '@angular/material/sort';
@Component({
@@ -31,10 +31,10 @@ import {MatSort} from "@angular/material/sort";
})
export class PipelineOverviewComponent implements OnInit {
- _pipelines: Array<Pipeline>;
+ _pipelines: Pipeline[];
_activeCategoryId: string;
- filteredPipelinesAvailable: boolean = false;
+ filteredPipelinesAvailable = false;
@Input()
pipelineToStart: Pipeline;
@@ -47,7 +47,7 @@ export class PipelineOverviewComponent implements OnInit {
dataSource: MatTableDataSource<Pipeline>;
@ViewChild(MatPaginator) paginator: MatPaginator;
- pageSize: number = 1;
+ pageSize = 1;
@ViewChild(MatSort) sort: MatSort;
@@ -79,7 +79,7 @@ export class PipelineOverviewComponent implements OnInit {
openPipelineNotificationsDialog(pipeline: Pipeline) {
this.pipelineOperationsService.showPipelineNotificationsDialog(pipeline,
- this.refreshPipelinesEmitter)
+ this.refreshPipelinesEmitter);
}
get pipelines() {
@@ -87,7 +87,7 @@ export class PipelineOverviewComponent implements OnInit {
}
@Input()
- set pipelines(pipelines: Array<Pipeline>) {
+ set pipelines(pipelines: Pipeline[]) {
this._pipelines = pipelines;
this.addPipelinesToTable();
}
@@ -113,7 +113,9 @@ export class PipelineOverviewComponent implements OnInit {
}
filterPipelines(): Pipeline[] {
- let filteredPipelines: Pipeline[] = this._pipelines.filter(pipeline => !(this._activeCategoryId) || (pipeline.pipelineCategories && pipeline.pipelineCategories.some(pc => pc === this.activeCategoryId)));
+ const filteredPipelines: Pipeline[] = this._pipelines
+ .filter(pipeline => !(this._activeCategoryId) ||
+ (pipeline.pipelineCategories && pipeline.pipelineCategories.some(pc => pc === this.activeCategoryId)));
this.filteredPipelinesAvailable = filteredPipelines.length > 0;
return filteredPipelines.sort((a, b) => a.name.localeCompare(b.name));
}
diff --git a/ui/src/app/pipelines/pipelines.component.html b/ui/src/app/pipelines/pipelines.component.html
index b5f48ad..5e0796f 100644
--- a/ui/src/app/pipelines/pipelines.component.html
+++ b/ui/src/app/pipelines/pipelines.component.html
@@ -17,7 +17,7 @@
-->
<div fxLayout="column" class="page-container">
- <div fxLayout="row" class="border sp-tab-bg" style="padding:0px;">
+ <div fxLayout="row" class="border sp-tab-bg" style="padding:0;">
<div fxFlex="100" class="page-container-nav">
<div fxFlex="100" fxLayout="row">
<button mat-button mat-flat-button color="accent" (click)="showPipelineCategoriesDialog()">Manage Categories</button>
diff --git a/ui/src/app/pipelines/pipelines.component.ts b/ui/src/app/pipelines/pipelines.component.ts
index 777a713..aeb3962 100644
--- a/ui/src/app/pipelines/pipelines.component.ts
+++ b/ui/src/app/pipelines/pipelines.component.ts
@@ -17,180 +17,175 @@
*/
import * as FileSaver from 'file-saver';
-import {Component, OnInit} from "@angular/core";
-import {PipelineService} from "../platform-services/apis/pipeline.service";
-import {Pipeline, PipelineCategory} from '../core-model/gen/streampipes-model';
-import {DialogService} from "../core-ui/dialog/base-dialog/base-dialog.service";
-import {PanelType} from "../core-ui/dialog/base-dialog/base-dialog.model";
-import {ImportPipelineDialogComponent} from "./dialog/import-pipeline/import-pipeline-dialog.component";
-import {DialogRef} from "../core-ui/dialog/base-dialog/dialog-ref";
-import {StartAllPipelinesDialogComponent} from "./dialog/start-all-pipelines/start-all-pipelines-dialog.component";
-import {PipelineCategoriesDialogComponent} from "./dialog/pipeline-categories/pipeline-categories-dialog.component";
-import {zip} from "rxjs";
-import {ActivatedRoute} from "@angular/router";
+import { Component, OnInit } from '@angular/core';
+import { PipelineService } from '../platform-services/apis/pipeline.service';
+import { Pipeline, PipelineCategory } from '../core-model/gen/streampipes-model';
+import { DialogService } from '../core-ui/dialog/base-dialog/base-dialog.service';
+import { PanelType } from '../core-ui/dialog/base-dialog/base-dialog.model';
+import { ImportPipelineDialogComponent } from './dialog/import-pipeline/import-pipeline-dialog.component';
+import { DialogRef } from '../core-ui/dialog/base-dialog/dialog-ref';
+import { StartAllPipelinesDialogComponent } from './dialog/start-all-pipelines/start-all-pipelines-dialog.component';
+import { PipelineCategoriesDialogComponent } from './dialog/pipeline-categories/pipeline-categories-dialog.component';
+import { zip } from 'rxjs';
+import { ActivatedRoute } from '@angular/router';
@Component({
- selector: 'pipelines',
- templateUrl: './pipelines.component.html',
- styleUrls: ['./pipelines.component.scss']
+ selector: 'pipelines',
+ templateUrl: './pipelines.component.html',
+ styleUrls: ['./pipelines.component.scss']
})
export class PipelinesComponent implements OnInit {
- pipeline: Pipeline;
- pipelines: Array<Pipeline> = [];
- systemPipelines: Array<Pipeline> = [];
- starting: boolean;
- stopping: boolean;
- pipelineCategories: Array<PipelineCategory>;
- activeCategoryId: string;
-
- pipelineIdToStart: string;
-
- pipelineToStart: Pipeline;
- systemPipelineToStart: Pipeline;
-
- pipelinesReady: boolean = false;
-
- selectedCategoryIndex: number = 0;
-
- constructor(private pipelineService: PipelineService,
- private DialogService: DialogService,
- private ActivatedRoute: ActivatedRoute) {
- this.pipelineCategories = [];
- this.starting = false;
- this.stopping = false;
- }
-
- ngOnInit() {
- this.ActivatedRoute.queryParams.subscribe(params => {
- if (params['pipeline']) {
- this.pipelineIdToStart = params['pipeline'];
- }
- this.getPipelineCategories();
- this.getPipelines();
- });
- }
-
- setSelectedTab(index) {
- if (index == 0) {
- this.activeCategoryId = undefined;
- } else {
- this.activeCategoryId = this.pipelineCategories[index - 1]._id;
+ pipeline: Pipeline;
+ pipelines: Pipeline[] = [];
+ systemPipelines: Pipeline[] = [];
+ starting: boolean;
+ stopping: boolean;
+ pipelineCategories: PipelineCategory[];
+ activeCategoryId: string;
+
+ pipelineIdToStart: string;
+
+ pipelineToStart: Pipeline;
+ systemPipelineToStart: Pipeline;
+
+ pipelinesReady = false;
+
+ selectedCategoryIndex = 0;
+
+ constructor(private pipelineService: PipelineService,
+ private dialogService: DialogService,
+ private activatedRoute: ActivatedRoute) {
+ this.pipelineCategories = [];
+ this.starting = false;
+ this.stopping = false;
+ }
+
+ ngOnInit() {
+ this.activatedRoute.queryParams.subscribe(params => {
+ if (params['pipeline']) {
+ this.pipelineIdToStart = params['pipeline'];
+ }
+ this.getPipelineCategories();
+ this.getPipelines();
+ });
+ }
+
+ setSelectedTab(index) {
+ this.activeCategoryId = index === 0 ? undefined : this.pipelineCategories[index - 1]._id;
+ }
+
+ exportPipelines() {
+ const blob = new Blob([JSON.stringify(this.pipelines)], {type: 'application/json'});
+ FileSaver.saveAs(blob, 'pipelines.json');
+ }
+
+ getPipelines() {
+ this.pipelines = [];
+ zip(this.pipelineService.getOwnPipelines(), this.pipelineService.getSystemPipelines()).subscribe(allPipelines => {
+ this.pipelines = allPipelines[0];
+ this.systemPipelines = allPipelines[1];
+ this.checkForImmediateStart(allPipelines);
+ this.pipelinesReady = true;
+ });
+ }
+
+ checkForImmediateStart(allPipelines: Pipeline[][]) {
+ this.pipelineToStart = undefined;
+ allPipelines.forEach((pipelines, index) => {
+ pipelines.forEach(pipeline => {
+ if (pipeline._id === this.pipelineIdToStart) {
+ if (index === 0) {
+ this.pipelineToStart = pipeline;
+ } else {
+ this.systemPipelineToStart = pipeline;
+ }
}
- }
-
- exportPipelines() {
- let blob = new Blob([JSON.stringify(this.pipelines)], {type: "application/json"})
- FileSaver.saveAs(blob, "pipelines.json");
- }
-
-
- getPipelines() {
- this.pipelines = [];
- zip(this.pipelineService.getOwnPipelines(), this.pipelineService.getSystemPipelines()).subscribe(allPipelines => {
- this.pipelines = allPipelines[0];
- this.systemPipelines = allPipelines[1];
- this.checkForImmediateStart(allPipelines);
- this.pipelinesReady = true;
- });
- };
-
- checkForImmediateStart(allPipelines: Pipeline[][]) {
- this.pipelineToStart = undefined;
- allPipelines.forEach((pipelines , index) => {
- pipelines.forEach(pipeline => {
- if (pipeline._id == this.pipelineIdToStart) {
- if (index == 0) {
- this.pipelineToStart = pipeline;
- } else {
- this.systemPipelineToStart = pipeline;
- }
- }
- })
- });
- this.pipelineIdToStart = undefined;
- }
-
- getPipelineCategories() {
- this.pipelineService.getPipelineCategories()
- .subscribe(pipelineCategories => {
- this.pipelineCategories = pipelineCategories;
- });
- };
-
- activeClass(pipeline) {
- return 'active-pipeline';
- }
-
- checkCurrentSelectionStatus(status) {
- var active = true;
- this.pipelines.forEach(pipeline => {
- if (!this.activeCategoryId || pipeline.pipelineCategories.some(pc => pc === this.activeCategoryId)) {
- if (pipeline.running == status) {
- active = false;
- }
- }
- });
- return active;
- }
-
- openImportPipelinesDialog() {
- let dialogRef: DialogRef<ImportPipelineDialogComponent> = this.DialogService.open(ImportPipelineDialogComponent, {
- panelType: PanelType.STANDARD_PANEL,
- title: "Import Pipeline",
- width: "70vw",
- data: {
- "pipelines": this.pipelines
- }
- });
- dialogRef.afterClosed().subscribe(data => {
- if (data) {
- this.refreshPipelines();
- }
- })
- }
-
- startAllPipelines(action) {
- let dialogRef: DialogRef<StartAllPipelinesDialogComponent> = this.DialogService.open(StartAllPipelinesDialogComponent, {
- panelType: PanelType.STANDARD_PANEL,
- title: (action ? "Start" : "Stop") + " all pipelines",
- width: "70vw",
- data: {
- "pipelines": this.pipelines,
- "action": action,
- "activeCategoryId": this.activeCategoryId
- }
+ });
+ });
+ this.pipelineIdToStart = undefined;
+ }
+
+ getPipelineCategories() {
+ this.pipelineService.getPipelineCategories()
+ .subscribe(pipelineCategories => {
+ this.pipelineCategories = pipelineCategories;
});
-
- dialogRef.afterClosed().subscribe(data => {
- if (data) {
- this.refreshPipelines();
- }
- });
- }
-
- showPipelineCategoriesDialog() {
- let dialogRef: DialogRef<PipelineCategoriesDialogComponent> = this.DialogService.open(PipelineCategoriesDialogComponent, {
- panelType: PanelType.STANDARD_PANEL,
- title: "Pipeline Categories",
- width: "70vw",
- data: {
- "pipelines": this.pipelines,
- "systemPipelines": this.systemPipelines
- }
- });
-
- dialogRef.afterClosed().subscribe(data => {
- this.getPipelineCategories();
- this.refreshPipelines();
- });
- };
-
- refreshPipelines() {
- this.getPipelines();
- }
-
- showPipeline(pipeline) {
- pipeline.display = !pipeline.display;
- }
-}
\ No newline at end of file
+ }
+
+ activeClass(pipeline) {
+ return 'active-pipeline';
+ }
+
+ checkCurrentSelectionStatus(status) {
+ let active = true;
+ this.pipelines.forEach(pipeline => {
+ if (!this.activeCategoryId || pipeline.pipelineCategories.some(pc => pc === this.activeCategoryId)) {
+ if (pipeline.running === status) {
+ active = false;
+ }
+ }
+ });
+ return active;
+ }
+
+ openImportPipelinesDialog() {
+ const dialogRef: DialogRef<ImportPipelineDialogComponent> = this.dialogService.open(ImportPipelineDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: 'Import Pipeline',
+ width: '70vw',
+ data: {
+ 'pipelines': this.pipelines
+ }
+ });
+ dialogRef.afterClosed().subscribe(data => {
+ if (data) {
+ this.refreshPipelines();
+ }
+ });
+ }
+
+ startAllPipelines(action) {
+ const dialogRef: DialogRef<StartAllPipelinesDialogComponent> = this.dialogService.open(StartAllPipelinesDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: (action ? 'Start' : 'Stop') + ' all pipelines',
+ width: '70vw',
+ data: {
+ 'pipelines': this.pipelines,
+ 'action': action,
+ 'activeCategoryId': this.activeCategoryId
+ }
+ });
+
+ dialogRef.afterClosed().subscribe(data => {
+ if (data) {
+ this.refreshPipelines();
+ }
+ });
+ }
+
+ showPipelineCategoriesDialog() {
+ const dialogRef: DialogRef<PipelineCategoriesDialogComponent> = this.dialogService.open(PipelineCategoriesDialogComponent, {
+ panelType: PanelType.STANDARD_PANEL,
+ title: 'Pipeline Categories',
+ width: '70vw',
+ data: {
+ 'pipelines': this.pipelines,
+ 'systemPipelines': this.systemPipelines
+ }
+ });
+
+ dialogRef.afterClosed().subscribe(data => {
+ this.getPipelineCategories();
+ this.refreshPipelines();
+ });
+ }
+
+ refreshPipelines() {
+ this.getPipelines();
+ }
+
+ showPipeline(pipeline) {
+ pipeline.display = !pipeline.display;
+ }
+}
diff --git a/ui/src/app/platform-services/apis/commons.service.ts b/ui/src/app/platform-services/apis/commons.service.ts
index c4781ba..dbf307a 100644
--- a/ui/src/app/platform-services/apis/commons.service.ts
+++ b/ui/src/app/platform-services/apis/commons.service.ts
@@ -30,6 +30,10 @@ export class PlatformServicesCommons {
return '/streampipes-backend';
}
+ apiBasePath() {
+ return this.basePath + '/api/v2';
+ }
+
authUserBasePath() {
return this.basePath + '/api/v2/users/' + this.authStatusService.email;
}
diff --git a/ui/src/app/platform-services/apis/pipeline.service.ts b/ui/src/app/platform-services/apis/pipeline.service.ts
index 060c911..3796bbc 100644
--- a/ui/src/app/platform-services/apis/pipeline.service.ts
+++ b/ui/src/app/platform-services/apis/pipeline.service.ts
@@ -16,99 +16,96 @@
*
*/
-import {Injectable} from "@angular/core";
-import {HttpClient} from "@angular/common/http";
-import {PlatformServicesCommons} from "./commons.service";
-import {Observable} from "rxjs";
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { PlatformServicesCommons } from './commons.service';
+import { Observable } from 'rxjs';
import {
Message,
Pipeline,
- PipelineCategory, PipelineElementStatus,
- PipelineOperationStatus, PipelineStatusMessage
-} from "../../core-model/gen/streampipes-model";
-import {map} from "rxjs/operators";
-import {query} from "@angular/animations";
+ PipelineCategory,
+ PipelineOperationStatus,
+ PipelineStatusMessage
+} from '../../core-model/gen/streampipes-model';
+import { map } from 'rxjs/operators';
@Injectable()
export class PipelineService {
constructor(private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons) {
-
- }
+ private platformServicesCommons: PlatformServicesCommons) { }
getPipelineCategories(): Observable<PipelineCategory[]> {
- return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipelinecategories")
+ return this.http.get(`${this.apiBasePath}/pipelinecategories`)
.pipe(map(response => {
return (response as any[]).map(p => PipelineCategory.fromData(p));
}));
- };
+ }
storePipelineCategory(pipelineCategory: PipelineCategory) {
- return this.http.post(this.platformServicesCommons.authUserBasePath() + "/pipelinecategories", pipelineCategory);
- };
+ return this.http.post(`${this.apiBasePath}/pipelinecategories`, pipelineCategory);
+ }
deletePipelineCategory(categoryId: string) {
- return this.http.delete(this.platformServicesCommons.authUserBasePath() + "/pipelinecategories/" + categoryId);
+ return this.http.delete(`${this.apiBasePath}/pipelinecategories/${categoryId}`);
}
startPipeline(pipelineId): Observable<PipelineOperationStatus> {
- return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipelines/" + pipelineId + "/start")
+ return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}/start`)
.pipe(map(result => PipelineOperationStatus.fromData(result as PipelineOperationStatus)));
}
stopPipeline(pipelineId: string, forceStop?: boolean): Observable<PipelineOperationStatus> {
- let queryAppendix = "";
- if (forceStop) {
- queryAppendix = "?forceStop=" + forceStop;
- }
- return this.http.get(this.platformServicesCommons.authUserBasePath()
- + "/pipelines/" + pipelineId
- + "/stop" + queryAppendix)
+ const queryAppendix = forceStop ? '?forceStop=' + forceStop : '';
+ return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}/stop${queryAppendix}`)
.pipe(map(result => PipelineOperationStatus.fromData(result as PipelineOperationStatus)));
}
- getPipelineById(pipelineId): Observable<Pipeline> {
- return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipelines/" + pipelineId)
+ getPipelineById(pipelineId: string): Observable<Pipeline> {
+ return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}`)
.pipe(map(response => Pipeline.fromData(response as Pipeline)));
}
storePipeline(pipeline: Pipeline): Observable<Message> {
- return this.http.post(this.platformServicesCommons.authUserBasePath() + "/pipelines", pipeline)
+ return this.http.post(`${this.apiBasePath}/pipelines`, pipeline)
.pipe(map(response => {
return Message.fromData(response as Message);
}));
}
updatePipeline(pipeline: Pipeline): Observable<Message> {
- var pipelineId = pipeline._id;
- return this.http.put(this.platformServicesCommons.authUserBasePath() + "/pipelines/" + pipelineId, pipeline)
+ const pipelineId = pipeline._id;
+ return this.http.put(`${this.apiBasePath}/pipelines/${pipelineId}`, pipeline)
.pipe(map(response => {
return Message.fromData(response as Message);
}));
}
getOwnPipelines(): Observable<Pipeline[]> {
- return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipelines/own").pipe(map(response => {
+ return this.http.get(`${this.apiBasePath}/pipelines/own`).pipe(map(response => {
return (response as any[]).map(p => Pipeline.fromData(p));
}));
- };
+ }
deleteOwnPipeline(pipelineId): Observable<any> {
- return this.http.delete(this.platformServicesCommons.authUserBasePath() + "/pipelines/" + pipelineId);
+ return this.http.delete(`${this.apiBasePath}/pipelines/${pipelineId}`);
}
getSystemPipelines(): Observable<Pipeline[]> {
- return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipelines/system").pipe(map(response => {
+ return this.http.get(`${this.apiBasePath}/pipelines/system`).pipe(map(response => {
return (response as any[]).map(p => Pipeline.fromData(p));
- }))
- };
+ }));
+ }
getPipelineStatusById(pipelineId): Observable<PipelineStatusMessage[]> {
- return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipelines/" + pipelineId + "/status")
+ return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}/status`)
.pipe(map(response => {
return (response as any[]).map(r => PipelineStatusMessage.fromData(r));
}));
}
+ get apiBasePath() {
+ return this.platformServicesCommons.apiBasePath();
+ }
+
}