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 22b59bd5f6 Remove more dead code from airavata-api (#629)
22b59bd5f6 is described below

commit 22b59bd5f6cdc966f15779cfb5127955aacecd14
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Sun Jun 7 17:04:59 2026 -0400

    Remove more dead code from airavata-api (#629)
    
    * chore: remove dead URL/HTML helper methods from StringUtil
    
    getURLS, createHTMLUrlTaggedString and createHTMLUrlTaggedString2 generate 
portal-presentation markup, have no callers, and were the only users of the 
regex imports, so they and the now-unused Matcher/Pattern imports are removed.
    
    * chore: drop unused cross-domain mapper declarations from ExecutionMapper
    
    The queueStatus and gateway toModel/toEntity methods have no callers (those 
conversions live in compute's ComputeMapper and iam's GatewayEntityMapper), are 
never used as MapStruct sub-mappers, and only pulled in four cross-module 
imports, so all are removed.
    
    * chore: remove unused AgentExecution entities, repositories and empty 
AgentMapper
    
    AgentExecutionEntity/AgentExecutionStatusEntity, their repositories and the 
empty AgentMapper are never read or written, so they are removed along with 
their two now-orphaned entries in the shared test persistence unit (which still 
bootstraps cleanly).
    
    * chore: remove stubbed Utility methods and SSHUtil.main
    
    Utility.encrypt always returned null and loadKeyStore/getPassword were 
unused (credential encryption is handled by CredentialEncryptionUtil), and 
SSHUtil.main was a manual test harness, so they and their now-unused imports 
are removed while the live generateKeyPair/validate/execute paths are kept.
---
 .../apache/airavata/agent/mapper/AgentMapper.java  | 28 -------
 .../airavata/agent/model/AgentExecutionEntity.java | 67 ---------------
 .../agent/model/AgentExecutionStatusEntity.java    | 95 ----------------------
 .../agent/repository/AgentExecutionRepository.java | 27 ------
 .../repository/AgentExecutionStatusRepository.java | 27 ------
 .../apache/airavata/credential/util/SSHUtil.java   | 29 -------
 .../apache/airavata/credential/util/Utility.java   | 28 -------
 .../orchestration/mapper/ExecutionMapper.java      | 14 ----
 .../java/org/apache/airavata/util/StringUtil.java  | 55 -------------
 .../src/test/resources/META-INF/persistence.xml    |  2 -
 10 files changed, 372 deletions(-)

diff --git 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/mapper/AgentMapper.java
 
b/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/mapper/AgentMapper.java
deleted file mode 100644
index dd22a17bbd..0000000000
--- 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/mapper/AgentMapper.java
+++ /dev/null
@@ -1,28 +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.agent.mapper;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-@Mapper
-public interface AgentMapper {
-    AgentMapper INSTANCE = Mappers.getMapper(AgentMapper.class);
-}
diff --git 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/model/AgentExecutionEntity.java
 
b/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/model/AgentExecutionEntity.java
deleted file mode 100644
index 847568c2ab..0000000000
--- 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/model/AgentExecutionEntity.java
+++ /dev/null
@@ -1,67 +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.agent.model;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import org.hibernate.annotations.GenericGenerator;
-
-@Entity
-@Table(name = "AGENT_EXECUTION")
-public class AgentExecutionEntity {
-    @Id
-    @GeneratedValue(generator = "uuid")
-    @GenericGenerator(name = "uuid", strategy = "uuid2")
-    @Column(name = "AGENT_EXECUTION_ID")
-    private String id;
-
-    @Column(name = "AGENT_ID")
-    private String agentId;
-
-    @Column(name = "AIRAVATA_EXPERIMENT_ID")
-    private String airavataExperimentId;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getAgentId() {
-        return agentId;
-    }
-
-    public void setAgentId(String agentId) {
-        this.agentId = agentId;
-    }
-
-    public String getAiravataExperimentId() {
-        return airavataExperimentId;
-    }
-
-    public void setAiravataExperimentId(String airavataExperimentId) {
-        this.airavataExperimentId = airavataExperimentId;
-    }
-}
diff --git 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/model/AgentExecutionStatusEntity.java
 
b/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/model/AgentExecutionStatusEntity.java
deleted file mode 100644
index 1685113e54..0000000000
--- 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/model/AgentExecutionStatusEntity.java
+++ /dev/null
@@ -1,95 +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.agent.model;
-
-import jakarta.persistence.*;
-import org.hibernate.annotations.GenericGenerator;
-
-@Entity
-@Table(name = "AGENT_EXECUTION_STATUS")
-public class AgentExecutionStatusEntity {
-
-    public static enum ExecutionStatus {
-        SUBMITTED_TO_CLUSTER,
-        FAILED,
-        CONNECTED,
-        CONNECTION_BROKEN,
-        TERMINATING,
-        TERMINATED,
-    }
-
-    @Id
-    @GeneratedValue(generator = "uuid")
-    @GenericGenerator(name = "uuid", strategy = "uuid2")
-    @Column(name = "AGENT_EXECUTION_STATUS_ID")
-    private String id;
-
-    @ManyToOne(targetEntity = AgentExecutionEntity.class, fetch = 
FetchType.EAGER, cascade = CascadeType.ALL)
-    private AgentExecutionEntity agentExecution;
-
-    @Column(name = "UPDATED_TIME")
-    private long updateTime;
-
-    @Column(name = "STATUS")
-    private ExecutionStatus status;
-
-    @Column(name = "ADDITIONAL_INFO", length = 2000)
-    private String additionalInfo;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public AgentExecutionEntity getAgentExecutionEntity() {
-        return agentExecution;
-    }
-
-    public void setAgentExecutionEntity(AgentExecutionEntity agentExecution) {
-        this.agentExecution = agentExecution;
-    }
-
-    public long getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(long updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public ExecutionStatus getStatus() {
-        return status;
-    }
-
-    public void setStatus(ExecutionStatus status) {
-        this.status = status;
-    }
-
-    public String getAdditionalInfo() {
-        return additionalInfo;
-    }
-
-    public void setAdditionalInfo(String additionalInfo) {
-        this.additionalInfo = additionalInfo;
-    }
-}
diff --git 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/repository/AgentExecutionRepository.java
 
b/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/repository/AgentExecutionRepository.java
deleted file mode 100644
index 8bf3ae91e1..0000000000
--- 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/repository/AgentExecutionRepository.java
+++ /dev/null
@@ -1,27 +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.agent.repository;
-
-import org.apache.airavata.agent.model.AgentExecutionEntity;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface AgentExecutionRepository extends 
CrudRepository<AgentExecutionEntity, String> {}
diff --git 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/repository/AgentExecutionStatusRepository.java
 
b/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/repository/AgentExecutionStatusRepository.java
deleted file mode 100644
index d3c050fa97..0000000000
--- 
a/airavata-api/agent-service/src/main/java/org/apache/airavata/agent/repository/AgentExecutionStatusRepository.java
+++ /dev/null
@@ -1,27 +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.agent.repository;
-
-import org.apache.airavata.agent.model.AgentExecutionStatusEntity;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface AgentExecutionStatusRepository extends 
CrudRepository<AgentExecutionStatusEntity, String> {}
diff --git 
a/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/SSHUtil.java
 
b/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/SSHUtil.java
index 1058d6c2c2..a43154c733 100644
--- 
a/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/SSHUtil.java
+++ 
b/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/SSHUtil.java
@@ -20,9 +20,6 @@
 package org.apache.airavata.credential.util;
 
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.concurrent.TimeUnit;
 import org.apache.airavata.credential.ssh.SSHConnectionServiceImpl;
 import org.apache.airavata.interfaces.SSHConnectionService;
@@ -89,30 +86,4 @@ public class SSHUtil {
             throw new RuntimeException(e);
         }
     }
-
-    public static void main(String[] args) throws IOException {
-
-        // Test the validate method
-        String username = System.getProperty("user.name");
-        String privateKeyFilepath = System.getProperty("user.home") + 
"/.ssh/id_rsa";
-        String publicKeyFilepath = privateKeyFilepath + ".pub";
-        String passphrase = "changeme";
-        String hostname = "changeme";
-
-        Path privateKeyPath = Paths.get(privateKeyFilepath);
-        Path publicKeyPath = Paths.get(publicKeyFilepath);
-
-        SSHCredential sshCredential;
-        try {
-            sshCredential = SSHCredential.newBuilder()
-                    .setPassphrase(passphrase)
-                    .setPublicKey(new 
String(Files.readAllBytes(publicKeyPath), "UTF-8"))
-                    .setPrivateKey(new 
String(Files.readAllBytes(privateKeyPath), "UTF-8"))
-                    .build();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        boolean result = validate(hostname, 22, username, sshCredential);
-        System.out.println(result);
-    }
 }
diff --git 
a/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/Utility.java
 
b/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/Utility.java
index 528eef25db..d68bd72205 100644
--- 
a/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/Utility.java
+++ 
b/airavata-api/credential-service/src/main/java/org/apache/airavata/credential/util/Utility.java
@@ -19,11 +19,9 @@
 */
 package org.apache.airavata.credential.util;
 
-import java.io.FileInputStream;
 import java.io.StringWriter;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
-import java.security.KeyStore;
 import java.security.Security;
 import java.security.interfaces.RSAPublicKey;
 import java.text.DateFormat;
@@ -66,32 +64,6 @@ public class Utility {
         return df.parse(date);
     }
 
-    public static String encrypt(String stringToEncrypt) {
-        return null;
-    }
-
-    public static KeyStore loadKeyStore(String keyStoreFile) throws Exception {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        // get user password and file input stream
-        char[] password = getPassword();
-
-        java.io.FileInputStream fis = null;
-        try {
-            fis = new FileInputStream(keyStoreFile);
-            ks.load(fis, password);
-
-            return ks;
-        } finally {
-            if (fis != null) {
-                fis.close();
-            }
-        }
-    }
-
-    public static char[] getPassword() {
-        return new char[0];
-    }
-
     /**
      * Generates an SSH key pair and returns a new SSHCredential proto with 
the keys set.
      */
diff --git 
a/airavata-api/orchestration-service/src/main/java/org/apache/airavata/orchestration/mapper/ExecutionMapper.java
 
b/airavata-api/orchestration-service/src/main/java/org/apache/airavata/orchestration/mapper/ExecutionMapper.java
index bb6702392a..5a902328ad 100644
--- 
a/airavata-api/orchestration-service/src/main/java/org/apache/airavata/orchestration/mapper/ExecutionMapper.java
+++ 
b/airavata-api/orchestration-service/src/main/java/org/apache/airavata/orchestration/mapper/ExecutionMapper.java
@@ -20,8 +20,6 @@
 package org.apache.airavata.orchestration.mapper;
 
 import java.sql.Timestamp;
-import org.apache.airavata.compute.model.QueueStatusEntity;
-import org.apache.airavata.iam.model.GatewayEntity;
 import org.apache.airavata.mapper.CommonMapperConversions;
 import org.apache.airavata.model.application.io.proto.InputDataObjectType;
 import org.apache.airavata.model.application.io.proto.OutputDataObjectType;
@@ -35,11 +33,9 @@ import org.apache.airavata.model.status.proto.JobState;
 import org.apache.airavata.model.status.proto.JobStatus;
 import org.apache.airavata.model.status.proto.ProcessState;
 import org.apache.airavata.model.status.proto.ProcessStatus;
-import org.apache.airavata.model.status.proto.QueueStatusModel;
 import org.apache.airavata.model.status.proto.TaskState;
 import org.apache.airavata.model.status.proto.TaskStatus;
 import org.apache.airavata.model.task.proto.TaskModel;
-import org.apache.airavata.model.workspace.proto.Gateway;
 import org.apache.airavata.orchestration.model.*;
 import org.mapstruct.Mapper;
 import org.mapstruct.Mapping;
@@ -393,16 +389,6 @@ public interface ExecutionMapper extends 
CommonMapperConversions {
 
     ProcessWorkflowEntity processWorkflowToEntity(ProcessWorkflow model);
 
-    // --- QueueStatus ---
-    QueueStatusModel queueStatusToModel(QueueStatusEntity entity);
-
-    QueueStatusEntity queueStatusToEntity(QueueStatusModel model);
-
-    // --- Gateway ---
-    Gateway gatewayToModel(GatewayEntity entity);
-
-    GatewayEntity gatewayToEntity(Gateway model);
-
     // --- UserConfigurationData ---
 
     /**
diff --git 
a/airavata-api/src/main/java/org/apache/airavata/util/StringUtil.java 
b/airavata-api/src/main/java/org/apache/airavata/util/StringUtil.java
index d3874b03a3..56f9964b95 100644
--- a/airavata-api/src/main/java/org/apache/airavata/util/StringUtil.java
+++ b/airavata-api/src/main/java/org/apache/airavata/util/StringUtil.java
@@ -25,8 +25,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 public class StringUtil {
     public static final String DELIMETER = ",";
@@ -50,59 +48,6 @@ public class StringUtil {
         return parameterMap;
     }
 
-    // Merits for the following function should go to
-    // http://blog.houen.net/java-get-url-from-string/
-    public static List<String> getURLS(String text) {
-        List<String> links = new ArrayList<String>();
-        String regex = 
"\\(?\\b((http|https|ftp)://|www[.])[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]";
-        Pattern p = Pattern.compile(regex);
-        Matcher m = p.matcher(text);
-        while (m.find()) {
-            String urlStr = m.group();
-            if (urlStr.startsWith("(") && urlStr.endsWith(")")) {
-                urlStr = urlStr.substring(1, urlStr.length() - 1);
-            }
-            if (!links.contains(urlStr)) {
-                links.add(urlStr);
-            }
-        }
-        return links;
-    }
-
-    public static String createHTMLUrlTaggedString2(String value, List<String> 
pullLinks) {
-        for (String url : pullLinks) {
-            String hyperlinkString = "<a href='" + url + "'>" + url + "</a>";
-            value = value.replaceAll(Pattern.quote(url), hyperlinkString);
-        }
-        return value;
-    }
-
-    public static String createHTMLUrlTaggedString(String value) {
-        String urledString = "";
-        int lastIndex = 0, index = 0;
-        while (index != -1) {
-            index = value.toLowerCase().indexOf("://", lastIndex);
-            if (index != -1) {
-                int beginIndex = value.lastIndexOf(" ", index);
-                urledString += value.substring(lastIndex, beginIndex + 1);
-                int endIndex = value.indexOf(" ", index);
-                if (beginIndex == -1) {
-                    beginIndex = 0;
-                } else {
-                    beginIndex++;
-                }
-                if (endIndex == -1) {
-                    endIndex = value.length();
-                }
-                String url = value.substring(beginIndex, endIndex);
-                urledString += "<a href='" + url + "'>" + url + "</a>";
-                lastIndex = endIndex;
-            }
-        }
-        urledString += value.substring(lastIndex, value.length());
-        return urledString;
-    }
-
     private static boolean isQuoted(String s, String delimiter) {
         // Check if we need quotes
         if (s.contains(delimiter)) {
diff --git a/airavata-api/src/test/resources/META-INF/persistence.xml 
b/airavata-api/src/test/resources/META-INF/persistence.xml
index fd1705f77b..f3137a0184 100644
--- a/airavata-api/src/test/resources/META-INF/persistence.xml
+++ b/airavata-api/src/test/resources/META-INF/persistence.xml
@@ -28,8 +28,6 @@
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
 
     <!-- agent-service -->
-    <class>org.apache.airavata.agent.model.AgentExecutionEntity</class>
-    <class>org.apache.airavata.agent.model.AgentExecutionStatusEntity</class>
     <class>org.apache.airavata.agent.model.PlanEntity</class>
 
     <!-- compute-service -->

Reply via email to