This is an automated email from the ASF dual-hosted git repository.
yasithdev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/master by this push:
new b2175d20f6 Remove residual dead code: orphaned ServerSettings config +
migration CLI (#681)
b2175d20f6 is described below
commit b2175d20f6a289c786410b96560285dd1a706fa6
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Sat Jun 13 11:45:50 2026 -0400
Remove residual dead code: orphaned ServerSettings config + migration CLI
(#681)
- Drop the six ServerSettings accessors orphaned when the Helix-era classes
were
removed (getReSchedulerPolicyClass, getDataAnalyzingEnabledGateways,
getDataAnalyzerTimeStep, getDataAnalyzerScanningInterval,
getDataAnalyzerNoOfScanningParallelJobs,
getMetaschedulerReschedulingThreshold)
and their six now-unused config-key constants (data.analyzer.*, the
rescheduler
policy class, and the metascheduler reschedule threshold). All verified
zero-caller; getReSchedulerPolicyClass even defaulted to a since-deleted
class.
- Delete MigrateCredentialEncryption, a standalone main() CLI for the spent
one-time CBC->GCM credential re-encryption (no callers, no build wiring).
---
.../repository/MigrateCredentialEncryption.java | 103 ---------------------
.../org/apache/airavata/config/ServerSettings.java | 33 -------
2 files changed, 136 deletions(-)
diff --git
a/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/repository/MigrateCredentialEncryption.java
b/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/repository/MigrateCredentialEncryption.java
deleted file mode 100644
index b51bf3825d..0000000000
---
a/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/repository/MigrateCredentialEncryption.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
-*
-* 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.airavata.credential.repository;
-
-import java.security.Key;
-import java.sql.*;
-import org.apache.airavata.server.KeyStorePasswordCallback;
-import org.apache.airavata.util.SecurityUtil;
-
-/**
- * One-time migration: re-encrypts all CREDENTIALS rows from legacy AES/CBC
- * (static zero IV) to AES/GCM (random IV). Run before deploying the GCM-only
code.
- *
- * Usage: java MigrateCredentialEncryption <jdbcUrl> <dbUser> <dbPass>
<keystorePath> <keyAlias> <keystorePass>
- */
-public class MigrateCredentialEncryption {
-
- public static void main(String[] args) throws Exception {
- if (args.length != 6) {
- System.err.println(
- "Usage: MigrateCredentialEncryption <jdbcUrl> <dbUser>
<dbPass> <keystorePath> <keyAlias> <keystorePass>");
- System.exit(1);
- }
-
- String jdbcUrl = args[0], dbUser = args[1], dbPass = args[2];
- String keystorePath = args[3], keyAlias = args[4];
- char[] keystorePass = args[5].toCharArray();
-
- KeyStorePasswordCallback cb = new KeyStorePasswordCallback() {
- public char[] getStorePassword() {
- return keystorePass;
- }
-
- public char[] getSecretKeyPassPhrase(String alias) {
- return keystorePass;
- }
- };
-
- Key key = SecurityUtil.getSymmetricKey(keystorePath, keyAlias, cb);
-
- try (Connection conn = DriverManager.getConnection(jdbcUrl, dbUser,
dbPass)) {
- conn.setAutoCommit(false);
-
- int migrated = 0, skipped = 0;
-
- try (PreparedStatement select =
- conn.prepareStatement("SELECT GATEWAY_ID,
TOKEN_ID, CREDENTIAL FROM CREDENTIALS");
- PreparedStatement update = conn.prepareStatement(
- "UPDATE CREDENTIALS SET CREDENTIAL = ? WHERE
GATEWAY_ID = ? AND TOKEN_ID = ?")) {
-
- ResultSet rs = select.executeQuery();
- while (rs.next()) {
- String gatewayId = rs.getString("GATEWAY_ID");
- String tokenId = rs.getString("TOKEN_ID");
- byte[] blob = rs.getBytes("CREDENTIAL");
-
- // Try GCM first — if it works, already migrated
- try {
- SecurityUtil.decrypt(blob, key);
- skipped++;
- continue;
- } catch (Exception ignored) {
- // Not GCM, proceed with migration
- }
-
- // Decrypt with legacy CBC, re-encrypt with GCM
- byte[] plaintext = SecurityUtil.decryptLegacy(blob, key);
- byte[] gcmEncrypted = SecurityUtil.encrypt(plaintext, key);
-
- update.setBytes(1, gcmEncrypted);
- update.setString(2, gatewayId);
- update.setString(3, tokenId);
- update.addBatch();
- migrated++;
- }
-
- if (migrated > 0) {
- update.executeBatch();
- }
- }
-
- conn.commit();
- System.out.printf("Migration complete: %d migrated, %d already
GCM%n", migrated, skipped);
- }
- }
-}
diff --git
a/airavata-api/src/main/java/org/apache/airavata/config/ServerSettings.java
b/airavata-api/src/main/java/org/apache/airavata/config/ServerSettings.java
index 35bfbacabb..e60b00553b 100644
--- a/airavata-api/src/main/java/org/apache/airavata/config/ServerSettings.java
+++ b/airavata-api/src/main/java/org/apache/airavata/config/ServerSettings.java
@@ -70,13 +70,6 @@ public class ServerSettings extends ApplicationSettings {
public static final String METASCHEDULER_CLUSTER_SCANNING_INTERVAL =
"cluster.scanning.interval";
public static final String METASCHEDULER_JOB_SCANNING_INTERVAL =
"job.scanning.interval";
public static final String METASCHEDULER_NO_OF_SCANNING_PARALLEL_JOBS =
"cluster.scanning.parallel.jobs";
- public static final String COMPUTE_RESOURCE_RESCHEDULER_CLASS =
"compute.resource.rescheduler.policy.class";
- public static final String METASCHEDULER_MAXIMUM_RESCHEDULED_THRESHOLD =
- "metascheduler.maximum.rescheduler.threshold";
- public static final String DATA_ANALYZER_SCANNING_INTERVAL =
"data.analyzer.scanning.interval";
- public static final String DATA_ANALYZER_NO_OF_SCANNING_PARALLEL_JOBS =
"data.analyzer.scanning.parallel.jobs";
- public static final String DATA_ANALYZER_ENABLED_GATEWAYS =
"data.analyzer.enabled.gateways";
- public static final String DATA_ANALYZER_TIME_STEP_IN_SECONDS =
"data.analyzer.time.step.seconds";
public static String getDefaultUser() throws ApplicationSettingsException {
return getSetting(DEFAULT_USER);
@@ -228,12 +221,6 @@ public class ServerSettings extends ApplicationSettings {
"org.apache.airavata.orchestration.task.MultipleComputeResourcePolicy");
}
- public static String getReSchedulerPolicyClass() throws
ApplicationSettingsException {
- return getSetting(
- COMPUTE_RESOURCE_RESCHEDULER_CLASS,
-
"org.apache.airavata.orchestration.task.ExponentialBackOffReScheduler");
- }
-
public static String getMetaschedulerGateway() throws
ApplicationSettingsException {
return getSetting(METASCHEDULER_GATEWAY, "");
}
@@ -246,14 +233,6 @@ public class ServerSettings extends ApplicationSettings {
return getSetting(METASCHEDULER_USERNAME, "");
}
- public static String getDataAnalyzingEnabledGateways() throws
ApplicationSettingsException {
- return getSetting(DATA_ANALYZER_ENABLED_GATEWAYS, "");
- }
-
- public static int getDataAnalyzerTimeStep() throws
ApplicationSettingsException {
- return Integer.parseInt(getSetting(DATA_ANALYZER_TIME_STEP_IN_SECONDS,
"1"));
- }
-
public static double getMetaschedulerClusterScanningInterval() throws
ApplicationSettingsException {
return
Double.parseDouble(getSetting(METASCHEDULER_CLUSTER_SCANNING_INTERVAL,
"1800000"));
}
@@ -265,16 +244,4 @@ public class ServerSettings extends ApplicationSettings {
public static int getMetaschedulerNoOfScanningParallelJobs() throws
ApplicationSettingsException {
return
Integer.parseInt(getSetting(METASCHEDULER_NO_OF_SCANNING_PARALLEL_JOBS, "1"));
}
-
- public static double getDataAnalyzerScanningInterval() throws
ApplicationSettingsException {
- return Double.parseDouble(getSetting(DATA_ANALYZER_SCANNING_INTERVAL,
"1800000"));
- }
-
- public static int getDataAnalyzerNoOfScanningParallelJobs() throws
ApplicationSettingsException {
- return
Integer.parseInt(getSetting(DATA_ANALYZER_NO_OF_SCANNING_PARALLEL_JOBS, "1"));
- }
-
- public static int getMetaschedulerReschedulingThreshold() throws
ApplicationSettingsException {
- return
Integer.parseInt(getSetting(METASCHEDULER_MAXIMUM_RESCHEDULED_THRESHOLD, "5"));
- }
}