You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/11/23 17:11:03 UTC

[incubator-streampipes] branch STREAMPIPES-257 updated: [STREAMPIPES-257] finish integration of connect master API into backend

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch STREAMPIPES-257
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/STREAMPIPES-257 by this push:
     new 4f535a7  [STREAMPIPES-257] finish integration of connect master API into backend
4f535a7 is described below

commit 4f535a71bf1f386cee82cb07615a4012e2508550
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Mon Nov 23 18:09:47 2020 +0100

    [STREAMPIPES-257] finish integration of connect master API into backend
---
 .idea/runConfigurations/backend.xml                                  | 2 ++
 streampipes-backend/src/main/resources/shiro.ini                     | 2 ++
 .../connect/container/master/management/AdapterMasterManagement.java | 2 +-
 .../streampipes/connect/container/master/rest/SourcesResource.java   | 5 -----
 .../components/data-marketplace/data-marketplace.component.ts        | 2 +-
 ui/src/app/connect/services/data-marketplace.service.ts              | 2 +-
 ui/src/app/connect/services/rest.service.ts                          | 4 ++--
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/.idea/runConfigurations/backend.xml b/.idea/runConfigurations/backend.xml
index 6aff7f0..521ccca 100644
--- a/.idea/runConfigurations/backend.xml
+++ b/.idea/runConfigurations/backend.xml
@@ -7,7 +7,9 @@
       <env name="SP_COUCHDB_HOST" value="localhost" />
       <env name="SP_BACKEND_HOST" value="localhost" />
       <env name="SP_INFLUX_HOST" value="localhost" />
+      <env name="SP_KAFKA_HOST" value="localhost" />
       <env name="SP_INFLUX_PORT" value="8086" />
+      <env name="SP_KAFKA_PORT" value="9094" />
       <env name="SP_JMS_HOST" value="localhost" />
       <env name="SP_DEBUG" value="true " />
       <env name="SP_PRIORITIZED_PROTOCOL" value="kafka" />
diff --git a/streampipes-backend/src/main/resources/shiro.ini b/streampipes-backend/src/main/resources/shiro.ini
index dbd4180..f345e08 100644
--- a/streampipes-backend/src/main/resources/shiro.ini
+++ b/streampipes-backend/src/main/resources/shiro.ini
@@ -69,5 +69,7 @@ securityManager.rememberMeManager.cookie.maxAge = 1000000000
 /api/v2/users/*/labeling = anon
 /api/v2/connect/*/master/administration = anon
 /api/v2/connect/*/master/sources/* = anon
+/api/v2/connect/*/master/sources/*/streams = anon
+/api/v2/connect/*/master/sources/*/streams/* = anon
 /api/** = customFilter
 /** = customFilter
\ No newline at end of file
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java
index b1a47bd..c99f6b0 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java
+++ b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/management/AdapterMasterManagement.java
@@ -154,7 +154,7 @@ public class AdapterMasterManagement {
 
     adapterStorage.deleteAdapter(id);
 
-    String backendBaseUrl = "http://" + ConnectContainerConfig.INSTANCE.getBackendApiUrl() + "api/v2/noauth/users/" + username + "/element/delete";
+    String backendBaseUrl = ConnectContainerConfig.INSTANCE.getBackendApiUrl() + "api/v2/noauth/users/" + username + "/element/delete";
 
     String elementUrl = ad.getUri();
 
diff --git a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java
index f8f14c6..cb9ab94 100644
--- a/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java
+++ b/streampipes-connect-container-master/src/main/java/org/apache/streampipes/connect/container/master/rest/SourcesResource.java
@@ -89,8 +89,6 @@ public class SourcesResource extends AbstractContainerResource {
 
 
     @POST
-//    @JsonLdSerialized
-//    @Consumes(SpMediaType.JSONLD)
     @Consumes(MediaType.APPLICATION_JSON)
     @Path("/{streamId}/streams")
     @Produces(MediaType.APPLICATION_JSON)
@@ -100,9 +98,6 @@ public class SourcesResource extends AbstractContainerResource {
 
         String responseMessage = "Instance of data set " + dataSet.getUri() + " successfully started";
 
-//        String workerUrl = new Utils().getWorkerUrlById(dataSet.getElementId());
-//
-//        String newUrl = Utils.addUserNameToApi(workerUrl, username);
         try {
             this.sourcesManagement.addAdapter(elementId,  dataSet, username);
         } catch (AdapterException e) {
diff --git a/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts b/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts
index 8fb9b15..99b91ba 100644
--- a/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts
+++ b/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts
@@ -157,7 +157,7 @@ export class DataMarketplaceComponent implements OnInit {
         if (this.newAdapterFromDescription instanceof AdapterSetDescription) {
 
             // Create new SpDataSet and EventSchema if not already exists, e.g. in adapter template
-            if (this.newAdapterFromDescription.dataSet == undefined) {
+            if (this.newAdapterFromDescription.dataSet == undefined || this.newAdapterFromDescription.dataSet["@class"] == undefined    ) {
                 this.newAdapterFromDescription.dataSet = new SpDataSet();
                 this.newAdapterFromDescription.dataSet["@class"] = "org.apache.streampipes.model.SpDataSet";
                 this.newAdapterFromDescription.dataSet.eventSchema = new EventSchema();
diff --git a/ui/src/app/connect/services/data-marketplace.service.ts b/ui/src/app/connect/services/data-marketplace.service.ts
index 3d82b9c..96255aa 100644
--- a/ui/src/app/connect/services/data-marketplace.service.ts
+++ b/ui/src/app/connect/services/data-marketplace.service.ts
@@ -97,7 +97,7 @@ export class DataMarketplaceService {
   getAdapterCategories(): Observable<Object> {
     return this.http.get(
         this.baseUrl +
-        '/categories/adapter');
+        '/api/v2/categories/adapter');
   }
 
   private deleteRequest(adapter: AdapterDescription, url: String) {
diff --git a/ui/src/app/connect/services/rest.service.ts b/ui/src/app/connect/services/rest.service.ts
index a8bc3ba..6b2fdf6 100644
--- a/ui/src/app/connect/services/rest.service.ts
+++ b/ui/src/app/connect/services/rest.service.ts
@@ -101,7 +101,7 @@ export class RestService {
         const self = this;
         return this.http
             .get(
-                '/streampipes-connect/api/v2/connect/riemer@fzi.de/master/description/formats'
+              this.host + this.authStatusService.email + '/master/description/formats'
             )
             .pipe(map(response => {
                 return FormatDescriptionList.fromData(response as FormatDescriptionList);
@@ -118,7 +118,7 @@ export class RestService {
 
     getFittingUnits(unitDescription: UnitDescription): Observable<UnitDescription[]> {
         return this.http
-            .post<UnitDescription[]>('/streampipes-connect/api/v1/' + this.authStatusService.email + '/master/unit', unitDescription)
+            .post<UnitDescription[]>(this.host + this.authStatusService.email + '/master/unit', unitDescription)
             .pipe(map(response => {
                 const descriptions = response as UnitDescription[];
                 return descriptions.filter(entry => entry.resource != unitDescription.resource)