This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch STREAMPIPES-426 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 209e3c4490837770de9a3ed12158fc59a9281aa0 Merge: c81b92d d3a8840 Author: Dominik Riemer <[email protected]> AuthorDate: Wed Oct 13 10:17:34 2021 +0200 Merge branch 'dev' into STREAMPIPES-426 .idea/runConfigurations/backend.xml | 1 + .idea/runConfigurations/connect_adapters.xml | 1 + .idea/runConfigurations/connect_adapters_iiot.xml | 15 + .../backend/StreamPipesResourceConfig.java | 1 - .../master/health/AdapterHealthCheck.java | 129 +++++++ .../master/management/AdapterMasterManagement.java | 207 +++++++----- .../AdapterTemplateMasterManagement.java | 106 ------ .../master/management/DescriptionManagement.java | 56 +--- .../master/management/SourcesManagement.java | 159 +++------ .../master/management/UnitMasterManagement.java | 7 +- .../management/WorkerAdministrationManagement.java | 73 ++-- .../master/management/WorkerRestClient.java | 78 +++-- .../master/management/WorkerUrlProvider.java | 61 +--- .../master/util/AdapterEncryptionService.java | 7 +- .../connect/container/master/util/WorkerPaths.java | 36 +- .../master/health/AdapterHealthCheckTest.java | 87 +++++ .../management/AdapterMasterManagementTest.java | 16 +- .../AdapterTemplateMasterManagementTest.java | 58 ---- .../management/DescriptionManagementTest.java | 10 +- .../master/management/SourcesManagementTest.java | 78 +---- .../master/management/WorkerRestClientTest.java | 10 +- .../init/AdapterServiceResourceProvider.java | 7 +- .../worker/init/AdapterWorkerContainer.java | 64 ---- .../init/ConnectWorkerDescriptionProvider.java | 75 ++++- .../init/ConnectWorkerRegistrationService.java | 7 +- .../worker/management/AdapterWorkerManagement.java | 78 +---- .../worker/management/GuessManagement.java | 8 - .../management/HttpServerAdapterManagement.java | 3 +- .../worker/management/MasterRestClient.java | 8 +- ...pterResource.java => AdapterAssetResource.java} | 28 +- ...kerResource.java => AdapterWorkerResource.java} | 30 +- .../container/worker/rest/GuessResource.java | 5 +- .../container/worker/rest/ProtocolResource.java | 75 ----- .../container/worker/rest/WelcomePageWorker.java | 108 ------ .../container/worker/utils/AdapterUtils.java | 28 +- .../management/AdapterWorkerManagementTest.java | 26 +- .../container/worker/utils/AdapterUtilsTest.java | 60 ---- .../connect/container/worker/utils/Utils.java | 6 +- .../connect/RunningAdapterInstances.java | 21 +- .../adapter/guess/PropertyGuessResults.java | 40 --- .../connect/adapter/guess/PropertyGuesses.java | 54 --- .../connect/adapter/guess/SchemaGuesser.java | 101 +----- .../model/generic/GenericDataSetAdapter.java | 4 +- .../model/generic/GenericDataStreamAdapter.java | 4 +- .../connect/adapter/guess/SchemaGuesserTest.java | 132 -------- .../extensions/ExtensionsModelSubmitter.java | 2 +- .../standalone/init/StandaloneModelSubmitter.java | 1 + .../container/util/ServiceDefinitionUtil.java | 2 +- .../assetdashboard/AssetDashboardConfig.java | 7 +- .../client/assetdashboard/CanvasAttributes.java | 28 ++ .../model/client/assetdashboard/CanvasElement.java | 7 +- .../org/apache/streampipes/model/SpDataSet.java | 1 + .../org/apache/streampipes/model/SpDataStream.java | 1 + .../model/connect/adapter/AdapterDescription.java | 38 +-- .../connect/adapter/AdapterDescriptionList.java | 49 --- .../connect/adapter/AdapterSetDescription.java | 11 +- .../connect/adapter/AdapterStreamDescription.java | 7 +- .../adapter/GenericAdapterSetDescription.java | 1 - .../adapter/GenericAdapterStreamDescription.java | 1 - .../model/connect/grounding/FormatDescription.java | 46 --- .../connect/grounding/FormatDescriptionList.java | 63 ---- .../connect/grounding/ProtocolDescription.java | 2 - .../connect/grounding/ProtocolDescriptionList.java | 58 ---- .../connect/guess/DomainPropertyProbability.java | 53 --- .../guess/DomainPropertyProbabilityList.java | 56 ---- .../model/connect/guess/GuessSchema.java | 30 +- .../connect/worker/ConnectWorkerContainer.java | 95 ------ streampipes-pipeline-management/pom.xml | 2 +- .../manager/execution/http/GraphSubmitter.java | 2 +- .../manager/execution/http/PipelineExecutor.java | 6 +- .../manager/setup/CouchDbInstallationStep.java | 8 +- .../apache/streampipes/rest/ResetManagement.java | 6 +- .../streampipes/rest/impl/AssetDashboard.java | 17 + .../streampipes/rest/impl/PipelineTemplate.java | 2 +- .../rest/impl/connect/AdapterResource.java | 31 +- .../rest/impl/connect/AdapterTemplateResource.java | 88 ----- .../rest/impl/connect/DescriptionResource.java | 50 +-- .../rest/impl/connect/GuessResource.java | 3 +- .../impl/connect/RuntimeResolvableResource.java | 4 +- .../rest/impl/connect/SourcesResource.java | 54 +-- .../rest/impl/connect/WelcomePageMaster.java | 4 +- .../impl/connect/WorkerAdministrationResource.java | 11 +- .../builder/adapter/AdapterDescriptionBuilder.java | 9 +- .../sdk/builder/adapter/GuessSchemaBuilder.java | 10 - .../serializers/json/AdapterSerializer.java | 4 +- .../svcdiscovery/api/model/SpServiceTagPrefix.java | 1 - .../api/model/SpServiceUrlProvider.java | 3 +- .../storage/api/IAdapterTemplateStorage.java | 36 -- .../storage/api/IAssetDashboardStorage.java | 2 + .../api/IConnectWorkerContainerStorage.java | 35 -- .../streampipes/storage/api/INoSqlStorage.java | 4 +- .../storage/couchdb/CouchDbStorageManager.java | 9 +- ...mpl.java => AdapterDescriptionStorageImpl.java} | 14 +- ...geImpl.java => AdapterInstanceStorageImpl.java} | 10 +- .../couchdb/impl/AdapterTemplateStorageImpl.java | 70 ---- .../couchdb/impl/AssetDashboardStorageImpl.java | 5 + .../impl/ConnectionWorkerContainerStorageImpl.java | 71 ---- .../streampipes/storage/couchdb/utils/Utils.java | 8 +- .../support/builder/GenericAdapterBuilder.ts | 87 ++--- ui/cypress/support/builder/PipelineBuilder.ts | 1 + ui/cypress/support/utils/AdapterUtils.ts | 4 + ui/cypress/support/utils/StaticPropertyUtils.ts | 30 +- ui/cypress/tests/adapter/InfluxDbAdapter.ts | 74 ++++ ui/cypress/tests/adapter/KafkaAdapter.ts | 72 ++++ .../{persistInDataLake.ts => MqttAdapter.ts} | 39 ++- .../{persistInDataLake.ts => MySQLDbAdapter.ts} | 37 +- ui/cypress/tests/adapter/machineDataSimulator.ts | 1 + ui/cypress/tests/adapter/persistInDataLake.ts | 18 +- .../tests/pipelineElement/AllPipelineElements.ts | 32 +- ui/nginx_config/default.conf | 11 + ui/package.json | 2 +- .../app-asset-monitoring.component.html | 6 +- .../app-asset-monitoring.component.ts | 11 +- .../app-asset-monitoring.module.ts | 4 +- .../create-asset/create-asset.component.css | 5 +- .../create-asset/create-asset.component.html | 46 ++- .../create-asset/create-asset.component.ts | 252 +++++++++----- .../dashboard-overview.component.html | 8 +- .../dashboard-overview.component.ts | 15 +- .../components/view-asset/view-asset.component.css | 7 +- .../view-asset/view-asset.component.html | 5 +- .../components/view-asset/view-asset.component.ts | 50 ++- .../dialog/add-link/add-link-dialog.component.html | 54 +++ .../dialog/add-link/add-link-dialog.component.scss | 9 +- .../dialog/add-link/add-link-dialog.component.ts | 58 ++++ .../add-pipeline-dialog.component.html | 91 +++-- ...nent.css => add-pipeline-dialog.component.scss} | 45 ++- .../add-pipeline/add-pipeline-dialog.component.ts | 90 +++-- .../save-dashboard-dialog.component.css | 55 --- .../save-dashboard-dialog.component.html | 59 ++-- .../save-dashboard-dialog.component.scss | 17 +- .../save-dashboard-dialog.component.ts | 73 ++-- .../model/dashboard-configuration.model.ts | 9 +- .../app-asset-monitoring/model/image-info.model.ts | 4 +- .../model/selected-visualization-data.model.ts | 9 +- .../app-asset-monitoring/services/rest.service.ts | 4 + .../app-asset-monitoring/services/shape.service.ts | 91 +++-- .../app/app-overview/app-overview.component.html | 4 +- .../adapter-description.component.html | 16 +- .../adapter-description.component.ts | 78 ++--- .../data-marketplace.component.html | 10 +- .../data-marketplace/data-marketplace.component.ts | 373 +++++++++------------ .../format-configuration.component.ts | 5 +- .../start-adapter-configuration.component.html | 9 +- .../start-adapter-configuration.component.ts | 15 +- .../adapter-started-dialog.component.html | 14 +- .../adapter-started-dialog.component.ts | 106 +++--- .../adapter-upload-dialog.component.ts | 60 ++-- .../connect/services/data-marketplace.service.ts | 135 ++------ ui/src/app/connect/services/rest.service.ts | 79 ++--- ui/src/app/core-model/gen/streampipes-model.ts | 57 +--- .../static-alternatives.component.html | 12 +- ...c-runtime-resolvable-oneof-input.component.html | 8 +- .../static-secret-input.component.html | 27 +- ui/src/app/dashboard/dashboard.component.html | 2 +- .../app/data-explorer/data-explorer.component.html | 2 +- ui/src/app/editor/editor.component.html | 2 +- .../pipeline-status-dialog.component.html | 44 +-- ui/src/scss/sp/main.scss | 4 + 159 files changed, 2236 insertions(+), 3617 deletions(-) diff --cc streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java index 3b6b803,444d54f..7143075 --- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java +++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/CouchDbInstallationStep.java @@@ -25,203 -27,192 +25,199 @@@ import org.lightcouch.DesignDocument import org.lightcouch.DesignDocument.MapReduce; import org.lightcouch.Response; - import java.util.Collections; - import java.util.HashMap; - import java.util.List; - import java.util.Map; + import java.util.*; -public class CouchDbInstallationStep implements InstallationStep { - - private static List<String> initRdfEndpointPorts = new ArrayList<>(); - private static final String initRdfEndpointHost = "http://localhost:"; - - private static final String PREPARING_NOTIFICATIONS_TEXT = "Preparing database " + - "'notifications'..."; - private static final String PREPARING_USERS_TEXT = "Preparing database 'users'..."; - - public CouchDbInstallationStep() { - - } - - @Override - public List<Message> install() { - List<Message> msgs = new ArrayList<>(); - msgs.addAll(createDatabases()); - msgs.addAll(createViews()); - msgs.add(addRdfEndpoints()); - return msgs; - } - - @Override - public String getTitle() { - return "Creating databases..."; - } - - private List<Message> createDatabases() { - try { - // Set up couchdb internal databases - Utils.getCouchDbInternalUsersClient(); - Utils.getCouchDbReplicatorClient(); - Utils.getCouchDbGlobalChangesClient(); - - // Set up streampipes internal databases - Utils.getCouchDbUserClient(); - Utils.getCouchDbMonitoringClient(); - Utils.getCouchDbPipelineClient(); - Utils.getCouchDbConnectionClient(); - Utils.getCouchDbNotificationClient(); - Utils.getCouchDbPipelineCategoriesClient(); - Utils.getCouchDbVisualizationClient(); - Utils.getCouchDbRdfEndpointClient(); - Utils.getCouchDbDashboardClient(); - Utils.getCouchDbDashboardWidgetClient(); - Utils.getCouchDbLabelClient(); - Utils.getCouchDbCategoryClient(); - - return Collections.singletonList(Notifications.success(getTitle())); - } catch (Exception e) { - return Collections.singletonList(Notifications.error(getTitle())); - } +public class CouchDbInstallationStep extends InstallationStep { + + private static final String initRdfEndpointHost = "http://localhost:"; + private static final String PREPARING_NOTIFICATIONS_TEXT = "Preparing database " + + "'notifications'..."; + private static final String PREPARING_USERS_TEXT = "Preparing database 'users'..."; - private static List<String> initRdfEndpointPorts = - Collections.singletonList("8099/api/v1/master/sources/"); ++ private static List<String> initRdfEndpointPorts = new ArrayList<>(); + + public CouchDbInstallationStep() { + + } + + @Override + public void install() { + createDatabases(); + createViews(); + addRdfEndpoints(); + } + + @Override + public String getTitle() { + return "Creating databases..."; + } + + private void createDatabases() { + try { + // Set up couchdb internal databases + Utils.getCouchDbInternalUsersClient(); + Utils.getCouchDbReplicatorClient(); + Utils.getCouchDbGlobalChangesClient(); + + // Set up streampipes internal databases + Utils.getCouchDbUserClient(); + Utils.getCouchDbMonitoringClient(); + Utils.getCouchDbPipelineClient(); + Utils.getCouchDbConnectionClient(); + Utils.getCouchDbNotificationClient(); + Utils.getCouchDbPipelineCategoriesClient(); + Utils.getCouchDbVisualizationClient(); + Utils.getCouchDbRdfEndpointClient(); + Utils.getCouchDbDashboardClient(); + Utils.getCouchDbDashboardWidgetClient(); + Utils.getCouchDbLabelClient(); + Utils.getCouchDbCategoryClient(); + + logSuccess(getTitle()); + } catch (Exception e) { + logFailure(getTitle(), e); } - - private List<Message> createViews() { - List<Message> result = new ArrayList<>(); - result.add(addUserView()); - result.add(addConnectionView()); - result.add(addNotificationView()); - result.add(addLabelView()); - return result; + } + + private void createViews() { + addUserView(); + addConnectionView(); + addNotificationView(); + addLabelView(); + } + + private void addRdfEndpoints() { + ExtensionsServiceEndpointStorageImpl rdfEndpointStorage = new ExtensionsServiceEndpointStorageImpl(); + initRdfEndpointPorts + .forEach(p -> rdfEndpointStorage + .addExtensionsServiceEndpoint(new ExtensionsServiceEndpoint(initRdfEndpointHost + p))); + + logSuccess("Discovering pipeline element endpoints..."); + } + + private void addNotificationView() { + try { + DesignDocument userDocument = prepareDocument("_design/notificationtypes"); + DesignDocument notificationCountDocument = prepareDocument("_design/unread"); + + Map<String, MapReduce> notificationTypeViews = new HashMap<>(); + MapReduce notificationTypeFunction = new MapReduce(); + notificationTypeFunction.setMap("function (doc) { var vizName = doc.title.replace(/\\s/g, '-'); var indexName = doc.correspondingPipelineId + '-' + vizName; emit([indexName, doc.createdAtTimestamp], doc);}"); + notificationTypeViews.put("notificationtypes", notificationTypeFunction); + userDocument.setViews(notificationTypeViews); + Response resp = Utils.getCouchDbNotificationClient().design().synchronizeWithDb(userDocument); + + Map<String, MapReduce> notificationCountTypeViews = new HashMap<>(); + MapReduce countFunction = new MapReduce(); + countFunction.setMap("function (doc) {\n" + + " var user = doc.targetedAt; \n" + + " if (!doc.read) {\n" + + " emit(user, 1);\n" + + " }\n" + + "}"); + countFunction.setReduce("function (keys, values, rereduce) {\n" + + " if (rereduce) {\n" + + " return sum(values);\n" + + " } else {\n" + + " return values.length;\n" + + " }\n" + + "}"); + notificationCountTypeViews.put("unread", countFunction); + notificationCountDocument.setViews(notificationCountTypeViews); + Response countResp = + Utils.getCouchDbNotificationClient().design().synchronizeWithDb(notificationCountDocument); + + if (resp.getError() != null && countResp != null) { + logFailure(PREPARING_NOTIFICATIONS_TEXT); + } else { + logSuccess(PREPARING_NOTIFICATIONS_TEXT); + } + } catch (Exception e) { + logFailure(PREPARING_NOTIFICATIONS_TEXT, e); } + } - private Message addRdfEndpoints() { - ExtensionsServiceEndpointStorageImpl rdfEndpointStorage = new ExtensionsServiceEndpointStorageImpl(); - initRdfEndpointPorts - .forEach(p -> rdfEndpointStorage - .addExtensionsServiceEndpoint(new ExtensionsServiceEndpoint(initRdfEndpointHost + p))); + private void addUserView() { + try { + DesignDocument userDocument = prepareDocument("_design/users"); + Map<String, MapReduce> views = new HashMap<>(); - return Notifications.success("Discovering pipeline element endpoints..."); - } - - private Message addNotificationView() { - try { - DesignDocument userDocument = prepareDocument("_design/notificationtypes"); - DesignDocument notificationCountDocument = prepareDocument("_design/unread"); - - Map<String, MapReduce> notificationTypeViews = new HashMap<>(); - MapReduce notificationTypeFunction = new MapReduce(); - notificationTypeFunction.setMap("function (doc) { var vizName = doc.title.replace(/\\s/g, '-'); var indexName = doc.correspondingPipelineId + '-' + vizName; emit([indexName, doc.createdAtTimestamp], doc);}"); - notificationTypeViews.put("notificationtypes", notificationTypeFunction); - userDocument.setViews(notificationTypeViews); - Response resp = Utils.getCouchDbNotificationClient().design().synchronizeWithDb(userDocument); - - Map<String, MapReduce> notificationCountTypeViews = new HashMap<>(); - MapReduce countFunction = new MapReduce(); - countFunction.setMap("function (doc) {\n" + - " var user = doc.targetedAt; \n" + - " if (!doc.read) {\n" + - " emit(user, 1);\n" + - " }\n" + - "}"); - countFunction.setReduce("function (keys, values, rereduce) {\n" + - " if (rereduce) {\n" + - " return sum(values);\n" + - " } else {\n" + - " return values.length;\n" + - " }\n" + - "}"); - notificationCountTypeViews.put("unread", countFunction); - notificationCountDocument.setViews(notificationCountTypeViews); - Response countResp = - Utils.getCouchDbNotificationClient().design().synchronizeWithDb(notificationCountDocument); - - if (resp.getError() != null && countResp != null) return Notifications.error(PREPARING_NOTIFICATIONS_TEXT); - else return Notifications.success(PREPARING_NOTIFICATIONS_TEXT); - } catch (Exception e) { - return Notifications.error(PREPARING_NOTIFICATIONS_TEXT); - } - } + MapReduce passwordFunction = new MapReduce(); + passwordFunction.setMap("function(doc) { if(doc.username && doc.principalType === 'USER_ACCOUNT' && doc.password) { emit(doc.username, doc.password); } }"); - private Message addUserView() { - try { - DesignDocument userDocument = prepareDocument("_design/users"); - Map<String, MapReduce> views = new HashMap<>(); + MapReduce usernameFunction = new MapReduce(); + usernameFunction.setMap("function(doc) { if(doc.username) { emit(doc.username, doc); } }"); - MapReduce passwordFunction = new MapReduce(); - passwordFunction.setMap("function(doc) { if(doc.email&& doc.password) { emit(doc.email, doc.password); } }"); + MapReduce tokenFunction = new MapReduce(); + tokenFunction.setMap("function(doc) { if (doc.userApiTokens) { doc.userApiTokens.forEach(function(token) { emit(token.hashedToken, doc.email); });}}"); - MapReduce usernameFunction = new MapReduce(); - usernameFunction.setMap("function(doc) { if(doc.email) { emit(doc.email, doc); } }"); + views.put("password", passwordFunction); + views.put("username", usernameFunction); + views.put("token", tokenFunction); - MapReduce tokenFunction = new MapReduce(); - tokenFunction.setMap("function(doc) { if (doc.userApiTokens) { doc.userApiTokens.forEach(function(token) { emit(token.hashedToken, doc.email); });}}"); + userDocument.setViews(views); + Response resp = Utils.getCouchDbUserClient().design().synchronizeWithDb(userDocument); - views.put("password", passwordFunction); - views.put("username", usernameFunction); - views.put("token", tokenFunction); - - userDocument.setViews(views); - Response resp = Utils.getCouchDbUserClient().design().synchronizeWithDb(userDocument); - - if (resp.getError() != null) return Notifications.error(PREPARING_USERS_TEXT); - else return Notifications.success(PREPARING_USERS_TEXT); - } catch (Exception e) { - return Notifications.error(PREPARING_USERS_TEXT); - } + if (resp.getError() != null) { + logFailure(PREPARING_USERS_TEXT); + } else { + logSuccess(PREPARING_USERS_TEXT); + } + } catch (Exception e) { + logFailure(PREPARING_USERS_TEXT, e); } + } - private Message addLabelView() { - try { - DesignDocument labelDocument = prepareDocument("_design/categoryId"); - Map<String, MapReduce> views = new HashMap<>(); + private void addLabelView() { + try { + DesignDocument labelDocument = prepareDocument("_design/categoryId"); + Map<String, MapReduce> views = new HashMap<>(); - MapReduce categoryIdFunction = new MapReduce(); - categoryIdFunction.setMap("function(doc) { if(doc.categoryId) { emit(doc.categoryId, doc); } }"); + MapReduce categoryIdFunction = new MapReduce(); + categoryIdFunction.setMap("function(doc) { if(doc.categoryId) { emit(doc.categoryId, doc); } }"); - views.put("categoryId", categoryIdFunction); + views.put("categoryId", categoryIdFunction); - labelDocument.setViews(views); - Response resp = Utils.getCouchDbLabelClient().design().synchronizeWithDb(labelDocument); + labelDocument.setViews(views); + Response resp = Utils.getCouchDbLabelClient().design().synchronizeWithDb(labelDocument); - if (resp.getError() != null) return Notifications.error(PREPARING_USERS_TEXT); - else return Notifications.success(PREPARING_USERS_TEXT); - } catch (Exception e) { - return Notifications.error(PREPARING_USERS_TEXT); - } + if (resp.getError() != null) { + logFailure(PREPARING_USERS_TEXT); + } else { + logSuccess(PREPARING_USERS_TEXT); + } + } catch (Exception e) { + logFailure(PREPARING_USERS_TEXT, e); } + } - private Message addConnectionView() { - try { - DesignDocument connectionDocument = prepareDocument("_design/connection"); - Map<String, MapReduce> views = new HashMap<>(); + private void addConnectionView() { + try { + DesignDocument connectionDocument = prepareDocument("_design/connection"); + Map<String, MapReduce> views = new HashMap<>(); - MapReduce frequentFunction = new MapReduce(); - frequentFunction.setMap("function(doc) { if(doc.from && doc.to) { emit([doc.from, doc.to] , 1 ); } }"); - frequentFunction.setReduce("function (key, values) { return sum(values); }"); + MapReduce frequentFunction = new MapReduce(); + frequentFunction.setMap("function(doc) { if(doc.from && doc.to) { emit([doc.from, doc.to] , 1 ); } }"); + frequentFunction.setReduce("function (key, values) { return sum(values); }"); - views.put("frequent", frequentFunction); + views.put("frequent", frequentFunction); - connectionDocument.setViews(views); - Response resp = Utils.getCouchDbConnectionClient().design().synchronizeWithDb(connectionDocument); - - if (resp.getError() != null) return Notifications.error("Preparing database 'connection'..."); - else return Notifications.success("Preparing database 'connection'..."); - } catch (Exception e) { - return Notifications.error("Preparing database 'connection'..."); - } - } + connectionDocument.setViews(views); + Response resp = Utils.getCouchDbConnectionClient().design().synchronizeWithDb(connectionDocument); - private DesignDocument prepareDocument(String id) { - DesignDocument doc = new DesignDocument(); - doc.setLanguage("javascript"); - doc.setId(id); - return doc; + if (resp.getError() != null) { + logFailure("Preparing database 'connection'..."); + } else { + logSuccess("Preparing database 'connection'..."); + } + } catch (Exception e) { + logFailure("Preparing database 'connection'...", e); } + } + + private DesignDocument prepareDocument(String id) { + DesignDocument doc = new DesignDocument(); + doc.setLanguage("javascript"); + doc.setId(id); + return doc; + } } diff --cc ui/src/app/connect/services/data-marketplace.service.ts index de185c0,afc9bda..588f91b --- a/ui/src/app/connect/services/data-marketplace.service.ts +++ b/ui/src/app/connect/services/data-marketplace.service.ts @@@ -48,7 -44,7 +42,7 @@@ export class DataMarketplaceService } get connectPath() { - return this.platformServicesCommons.apiBasePath + '/connect'; - return `${this.platformServicesCommons.apiBasePath()}/connect`; ++ return `${this.platformServicesCommons.apiBasePath}/connect`; } getAdapterDescriptions(): Observable<AdapterDescriptionUnion[]> { diff --cc ui/src/app/connect/services/rest.service.ts index b10b2d9,c2e12a8..d4d31a3 --- a/ui/src/app/connect/services/rest.service.ts +++ b/ui/src/app/connect/services/rest.service.ts @@@ -23,16 -23,9 +23,9 @@@ import { HttpClient } from '@angular/co import { from, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { UnitDescription } from '../model/UnitDescription'; - import { - AdapterDescription, - FormatDescriptionList, - GuessSchema, - Message, - ProtocolDescriptionList, - SpDataStream - } from '../../core-model/gen/streampipes-model'; + import { AdapterDescription, FormatDescription, GuessSchema, Message, SpDataStream } from '../../core-model/gen/streampipes-model'; import { PlatformServicesCommons } from '../../platform-services/apis/commons.service'; -import { AuthStatusService } from '../../services/auth-status.service'; +import { AuthService } from '../../services/auth.service'; @Injectable() export class RestService { @@@ -51,23 -44,19 +44,19 @@@ return this.addAdapterDescription(adapter, '/master/adapters'); } - addAdapterTemplate(adapter: AdapterDescription): Observable<Message> { - return this.addAdapterDescription(adapter, '/master/adapters/template'); - } - addAdapterDescription(adapter: AdapterDescription, url: string): Observable<Message> { - adapter.userName = this.authStatusService.email; + adapter.userName = this.authService.getCurrentUser().email; const promise = new Promise<Message>((resolve, reject) => { this.http - .post( - this.connectPath + url, - adapter, - ) - .pipe(map(response => { - const statusMessage = response as Message; - resolve(statusMessage); - })) - .subscribe(); + .post( + this.connectPath + url, + adapter + ) + .pipe(map(response => { + const statusMessage = response as Message; + resolve(statusMessage); + })) + .subscribe(); }); return from(promise); } @@@ -83,14 -72,14 +72,14 @@@ getSourceDetails(sourceElementId): Observable<SpDataStream> { return this.http - .get(this.platformServicesCommons.apiBasePath + '/streams/' + encodeURIComponent(sourceElementId)).pipe(map(response => { - return SpDataStream.fromData(response as SpDataStream); - })); - .get(`${this.platformServicesCommons.apiBasePath()}/streams/${encodeURIComponent(sourceElementId)}`).pipe(map(response => { ++ .get(`${this.platformServicesCommons.apiBasePath}/streams/${encodeURIComponent(sourceElementId)}`).pipe(map(response => { + return SpDataStream.fromData(response as SpDataStream); + })); } getRuntimeInfo(sourceDescription): Observable<any> { - return this.http.post(this.platformServicesCommons.apiBasePath + '/pipeline-element/runtime', sourceDescription, { - headers: {ignoreLoadingBar: ''} - return this.http.post(`${this.platformServicesCommons.apiBasePath()}/pipeline-element/runtime`, sourceDescription, { ++ return this.http.post(`${this.platformServicesCommons.apiBasePath}/pipeline-element/runtime`, sourceDescription, { + headers: { ignoreLoadingBar: '' } }); }
