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

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1133a5a8ed Migration for missing Export Provider Type "FOLDER" (#3875)
1133a5a8ed is described below

commit 1133a5a8ed3226c18c3d6b3e7a39fb83c0dfda8e
Author: Jacqueline Höllig <[email protected]>
AuthorDate: Mon Oct 27 08:51:53 2025 +0100

    Migration for missing Export Provider Type "FOLDER" (#3875)
---
 .../core/migrations/AvailableMigrations.java       |  4 +-
 .../v0980/AddDefaultExportProviderMigration.java   | 62 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git 
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/AvailableMigrations.java
 
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/AvailableMigrations.java
index b547059f59..fcacf4433b 100644
--- 
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/AvailableMigrations.java
+++ 
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/AvailableMigrations.java
@@ -27,6 +27,7 @@ import 
org.apache.streampipes.service.core.migrations.v093.AdapterMigration;
 import 
org.apache.streampipes.service.core.migrations.v093.StoreEmailTemplatesMigration;
 import 
org.apache.streampipes.service.core.migrations.v095.MergeFilenamesAndRenameDuplicatesMigration;
 import 
org.apache.streampipes.service.core.migrations.v0980.AddDataLakeMeasureViewMigration;
+import 
org.apache.streampipes.service.core.migrations.v0980.AddDefaultExportProviderMigration;
 import 
org.apache.streampipes.service.core.migrations.v0980.ModifyAssetLinkTypesMigration;
 import 
org.apache.streampipes.service.core.migrations.v0980.ModifyAssetLinksMigration;
 import 
org.apache.streampipes.service.core.migrations.v970.AddDataLakePipelineTemplateMigration;
@@ -58,7 +59,8 @@ public class AvailableMigrations {
         new AddDataLakePipelineTemplateMigration(),
         new ModifyAssetLinksMigration(),
         new ModifyAssetLinkTypesMigration(),
-        new AddDataLakeMeasureViewMigration()
+        new AddDataLakeMeasureViewMigration(),
+        new AddDefaultExportProviderMigration()
     );
   }
 }
diff --git 
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v0980/AddDefaultExportProviderMigration.java
 
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v0980/AddDefaultExportProviderMigration.java
new file mode 100644
index 0000000000..c35342fe17
--- /dev/null
+++ 
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v0980/AddDefaultExportProviderMigration.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.service.core.migrations.v0980;
+
+import org.apache.streampipes.model.configuration.DefaultExportProviderConfig;
+import org.apache.streampipes.service.core.migrations.Migration;
+import org.apache.streampipes.storage.api.ISpCoreConfigurationStorage;
+import org.apache.streampipes.storage.management.StorageDispatcher;
+
+import java.io.IOException;
+
+public class AddDefaultExportProviderMigration implements Migration {
+
+  private final ISpCoreConfigurationStorage storage = 
StorageDispatcher.INSTANCE.getNoSqlStore()
+      .getSpCoreConfigurationStorage();
+
+  @Override
+  public boolean shouldExecute() {
+
+    try {
+
+      boolean shouldExecute = storage.get().getExportProviderSettings() == 
null  || storage.get().getExportProviderSettings().isEmpty();
+
+      return shouldExecute;
+    } catch (Exception e) {
+      return true;
+    }
+
+  }
+
+  @Override
+  public void executeMigration() throws IOException {
+
+    var coreCfg = storage.get();
+
+    coreCfg.setExportProviderSettings(new 
DefaultExportProviderConfig().make());
+
+    storage.updateElement(coreCfg);
+
+  }
+
+  @Override
+  public String getDescription() {
+    return "Migrating SPCoreConfiguration to include the default folder.";
+  }
+}

Reply via email to