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/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new c78f3c7236 refactor: Extract migration selection to method (#4182)
c78f3c7236 is described below
commit c78f3c72361a9677abb296473f40d8869e2c0df8
Author: Dominik Riemer <[email protected]>
AuthorDate: Tue Feb 17 18:21:38 2026 +0100
refactor: Extract migration selection to method (#4182)
---
.../streampipes/service/core/StreamPipesCoreApplication.java | 8 +++++++-
.../streampipes/service/core/migrations/MigrationsHandler.java | 7 +++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
index 95316cdda4..a893025c12 100644
---
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
+++
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
@@ -48,6 +48,8 @@ import
org.apache.streampipes.resource.management.SpResourceManager;
import org.apache.streampipes.service.base.BaseNetworkingConfig;
import org.apache.streampipes.service.base.StreamPipesPrometheusConfig;
import org.apache.streampipes.service.base.StreamPipesServiceBase;
+import org.apache.streampipes.service.core.migrations.AvailableMigrations;
+import org.apache.streampipes.service.core.migrations.Migration;
import org.apache.streampipes.service.core.migrations.MigrationsHandler;
import org.apache.streampipes.storage.api.pipeline.IPipelineStorage;
import org.apache.streampipes.storage.api.system.ISpCoreConfigurationStorage;
@@ -142,7 +144,7 @@ public class StreamPipesCoreApplication extends
StreamPipesServiceBase {
if (coreConfigStorage.exists()) {
coreStatusManager.updateCoreStatus(SpCoreConfigurationStatus.MIGRATING);
}
- new MigrationsHandler().performMigrations();
+ new MigrationsHandler().performMigrations(getMigrations());
}
new ApplyDefaultRolesAndPrivilegesTask().execute();
@@ -185,6 +187,10 @@ public class StreamPipesCoreApplication extends
StreamPipesServiceBase {
});
}
+ protected List<Migration> getMigrations() {
+ return new AvailableMigrations().getAvailableMigrations();
+ }
+
private boolean isConfigured() {
return new UserStorage().existsDatabase();
}
diff --git
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java
index e8f63eeb92..a3f9b7c0b2 100644
---
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java
+++
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java
@@ -23,15 +23,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.List;
public class MigrationsHandler {
private static final Logger LOG =
LoggerFactory.getLogger(MigrationsHandler.class);
- public void performMigrations() {
- LOG.info("Checking for required migrations...");
- var availableMigrations = new
AvailableMigrations().getAvailableMigrations();
-
+ public void performMigrations(List<Migration> availableMigrations) {
+ LOG.info("Running required migrations...");
availableMigrations.forEach(migration -> {
if (migration.shouldExecute()) {
LOG.info("Performing migration: {}", migration.getDescription());