This is an automated email from the ASF dual-hosted git repository. yasith pushed a commit to branch feat/spring-module-reorg in repository https://gitbox.apache.org/repos/asf/airavata.git
commit e5a68d59ba82231701e442c0b7660ce5a872f7f7 Author: yasithdev <[email protected]> AuthorDate: Fri Mar 27 22:16:55 2026 -0500 refactor: convert agent-service from standalone Boot app to plain library - Remove spring-boot-maven-plugin, maven-assembly-plugin, and actuator dependency - Add AgentServiceConfig for component scanning, entity scanning, JPA repos - Add AgentProperties (@ConfigurationProperties) replacing @Value annotations - Replace local UserContext with unified org.apache.airavata.common.security.UserContext - Delete AgentServiceApplication, AuthzTokenFilter, application.yml, assembly descriptor --- modules/agent-framework/agent-service/pom.xml | 29 --------- .../main/assembly/agent-service-bin-assembly.xml | 76 ---------------------- .../service/AgentServiceApplication.java | 32 --------- .../agent/connection/service/UserContext.java | 53 --------------- .../connection/service/config/AgentProperties.java | 35 ++++++++++ .../service/config/AgentServiceConfig.java | 13 ++++ .../service/config/AuthzTokenFilter.java | 64 ------------------ .../service/controllers/PlanController.java | 6 +- .../service/handlers/AgentConnectionHandler.java | 26 +++----- .../service/handlers/AgentManagementHandler.java | 21 +++--- .../service/services/AiravataFileService.java | 2 +- .../service/services/AiravataService.java | 10 +-- .../src/main/resources/application.yml | 64 ------------------ 13 files changed, 76 insertions(+), 355 deletions(-) diff --git a/modules/agent-framework/agent-service/pom.xml b/modules/agent-framework/agent-service/pom.xml index 53db664256..2075ebf2b5 100644 --- a/modules/agent-framework/agent-service/pom.xml +++ b/modules/agent-framework/agent-service/pom.xml @@ -31,10 +31,6 @@ under the License. <artifactId>agent-service</artifactId> <name>Airavata Agent Service</name> - <properties> - <agent.service.dist.name>apache-airavata-agent-service-${project.version}</agent.service.dist.name> - </properties> - <dependencies> <dependency> <groupId>org.mariadb.jdbc</groupId> @@ -165,35 +161,10 @@ under the License. </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> </dependencies> <build> <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>agent-service-distribution-package</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <tarLongFileMode>posix</tarLongFileMode> - <finalName>${agent.service.dist.name}</finalName> - <descriptors> - <descriptor>src/main/assembly/agent-service-bin-assembly.xml</descriptor> - </descriptors> - <attach>false</attach> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>io.github.ascopes</groupId> <artifactId>protobuf-maven-plugin</artifactId> diff --git a/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml b/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml deleted file mode 100644 index d890127838..0000000000 --- a/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml +++ /dev/null @@ -1,76 +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. - ---> -<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd"> - <id>bin</id> - <includeBaseDirectory>true</includeBaseDirectory> - <baseDirectory>${agent.service.dist.name}</baseDirectory> - <formats> - <format>tar.gz</format> - </formats> - - <fileSets> - <fileSet> - <directory>src/main/resources/distribution/bin</directory> - <outputDirectory>bin</outputDirectory> - <fileMode>777</fileMode> - <includes> - <include>*.sh</include> - </includes> - </fileSet> - <fileSet> - <directory>src/main/resources/distribution/conf</directory> - <outputDirectory>conf</outputDirectory> - <includes> - <include>application.yml</include> - <include>airavata.p12</include> - <include>log4j2.xml</include> - </includes> - </fileSet> - <fileSet> - <directory>./</directory> - <outputDirectory>logs</outputDirectory> - <excludes> - <exclude>*/**</exclude> - </excludes> - </fileSet> - <fileSet> - <directory>target</directory> - <outputDirectory>lib</outputDirectory> - <includes> - <include>*.jar</include> - </includes> - </fileSet> - </fileSets> - - <dependencySets> - <dependencySet> - <useProjectArtifact>false</useProjectArtifact> - <outputDirectory>lib</outputDirectory> - <includes> - <include>*</include> - </includes> - </dependencySet> - </dependencySets> - -</assembly> \ No newline at end of file diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/AgentServiceApplication.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/AgentServiceApplication.java deleted file mode 100644 index 301fb03aad..0000000000 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/AgentServiceApplication.java +++ /dev/null @@ -1,32 +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.connection.service; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; - -@SpringBootApplication -@EnableJpaRepositories() -public class AgentServiceApplication { - public static void main(String[] args) { - SpringApplication.run(AgentServiceApplication.class, args); - } -} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/UserContext.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/UserContext.java deleted file mode 100644 index 0a43f0c675..0000000000 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/UserContext.java +++ /dev/null @@ -1,53 +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.connection.service; - -import java.util.Map; -import org.apache.airavata.model.security.AuthzToken; - -public class UserContext { - - private static final ThreadLocal<AuthzToken> AUTHZ_TOKEN = new ThreadLocal<>(); - - public static AuthzToken authzToken() { - return AUTHZ_TOKEN.get(); - } - - public static void setAuthzToken(AuthzToken token) { - AUTHZ_TOKEN.set(token); - } - - public static String username() { - return getClaim("userName"); - } - - public static String gatewayId() { - return getClaim("gatewayID"); - } - - private static String getClaim(String claimId) { - return AUTHZ_TOKEN.get().getClaimsMap().entrySet().stream() - .filter(entry -> entry.getKey().equalsIgnoreCase(claimId)) - .map(Map.Entry::getValue) - .findFirst() - .orElseThrow(() -> - new IllegalArgumentException("Missing '" + claimId + "' claim in the authentication token")); - } -} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AgentProperties.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AgentProperties.java new file mode 100644 index 0000000000..9656de4723 --- /dev/null +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AgentProperties.java @@ -0,0 +1,35 @@ +package org.apache.airavata.agent.connection.service.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "airavata.agent") +public class AgentProperties { + private String storageResourceId; + private String storagePath; + private Tunnel tunnel = new Tunnel(); + + public String getStorageResourceId() { return storageResourceId; } + public void setStorageResourceId(String s) { this.storageResourceId = s; } + public String getStoragePath() { return storagePath; } + public void setStoragePath(String s) { this.storagePath = s; } + public Tunnel getTunnel() { return tunnel; } + public void setTunnel(Tunnel t) { this.tunnel = t; } + + public static class Tunnel { + private String serverHost; + private int serverPort; + private String serverToken; + private String serverApiUrl; + + public String getServerHost() { return serverHost; } + public void setServerHost(String s) { this.serverHost = s; } + public int getServerPort() { return serverPort; } + public void setServerPort(int p) { this.serverPort = p; } + public String getServerToken() { return serverToken; } + public void setServerToken(String s) { this.serverToken = s; } + public String getServerApiUrl() { return serverApiUrl; } + public void setServerApiUrl(String s) { this.serverApiUrl = s; } + } +} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AgentServiceConfig.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AgentServiceConfig.java new file mode 100644 index 0000000000..35b82a1136 --- /dev/null +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AgentServiceConfig.java @@ -0,0 +1,13 @@ +package org.apache.airavata.agent.connection.service.config; + +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@Configuration +@ComponentScan(basePackages = "org.apache.airavata.agent.connection.service") +@EntityScan(basePackages = "org.apache.airavata.agent.connection.service") +@EnableJpaRepositories(basePackages = "org.apache.airavata.agent.connection.service") +public class AgentServiceConfig { +} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AuthzTokenFilter.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AuthzTokenFilter.java deleted file mode 100644 index afe1e44b11..0000000000 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AuthzTokenFilter.java +++ /dev/null @@ -1,64 +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.connection.service.config; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import jakarta.servlet.FilterChain; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Map; -import org.apache.airavata.agent.connection.service.UserContext; -import org.apache.airavata.model.security.AuthzToken; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -@Component -public class AuthzTokenFilter extends OncePerRequestFilter { - - @Override - protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) - throws ServletException, IOException { - - String authorizationHeader = request.getHeader("Authorization"); - String xClaimsHeader = request.getHeader("X-Claims"); - - if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ") && xClaimsHeader != null) { - try { - String accessToken = authorizationHeader.substring(7); // Remove "Bearer " prefix - ObjectMapper objectMapper = new ObjectMapper(); - Map<String, String> claimsMap = objectMapper.readValue(xClaimsHeader, new TypeReference<>() {}); - - AuthzToken authzToken = new AuthzToken(); - authzToken.setAccessToken(accessToken); - authzToken.setClaimsMap(claimsMap); - - UserContext.setAuthzToken(authzToken); - } catch (Exception e) { - response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Invalid authorization data"); - return; - } - } - - filterChain.doFilter(request, response); - } -} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/controllers/PlanController.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/controllers/PlanController.java index e99766db9d..6f70dedc18 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/controllers/PlanController.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/controllers/PlanController.java @@ -22,7 +22,7 @@ package org.apache.airavata.agent.connection.service.controllers; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; -import org.apache.airavata.agent.connection.service.UserContext; +import org.apache.airavata.common.security.UserContext; import org.apache.airavata.agent.connection.service.db.entity.Plan; import org.apache.airavata.agent.connection.service.handlers.PlanHandler; import org.slf4j.Logger; @@ -60,7 +60,7 @@ public class PlanController { Plan plan = new Plan(); plan.setId(planId); - plan.setUserId(UserContext.username()); + plan.setUserId(UserContext.userId()); plan.setGatewayId(UserContext.gatewayId()); plan.setData(dataAsString); @@ -75,7 +75,7 @@ public class PlanController { @GetMapping("/user") public ResponseEntity<List<Plan>> getPlansByUserId() { - List<Plan> plans = planHandler.getAllPlansByUserId(UserContext.username(), UserContext.gatewayId()); + List<Plan> plans = planHandler.getAllPlansByUserId(UserContext.userId(), UserContext.gatewayId()); return ResponseEntity.ok(plans); } diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java index 56a8f54fce..e62279a05d 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java @@ -30,15 +30,17 @@ import net.devh.boot.grpc.server.service.GrpcService; import org.apache.airavata.agent.*; import org.apache.airavata.agent.AsyncCommand; import org.apache.airavata.agent.connection.service.models.*; +import org.apache.airavata.agent.connection.service.config.AgentProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; @GrpcService public class AgentConnectionHandler extends AgentCommunicationServiceGrpc.AgentCommunicationServiceImplBase { private static final Logger logger = LoggerFactory.getLogger(AgentConnectionHandler.class); + private final AgentProperties agentProperties; + // <streamId, StreamObserver> private final Map<String, StreamObserver<ServerMessage>> ACTIVE_STREAMS = new ConcurrentHashMap<>(); @@ -57,17 +59,9 @@ public class AgentConnectionHandler extends AgentCommunicationServiceGrpc.AgentC private final Map<String, PythonExecutionResponse> PYTHON_EXECUTION_RESPONSE_CACHE = new ConcurrentHashMap<>(); private final Map<String, TunnelCreationResponse> TUNNEL_CREATION_RESPONSE_CACHE = new ConcurrentHashMap<>(); - @Value("${airavata.tunnel.serverHost}") - private String tunnelServerHost; - - @Value("${airavata.tunnel.serverPort}") - private int tunnelServerPort; - - @Value("${airavata.tunnel.serverApiUrl}") - private String tunnelServerApiUrl; - - @Value("${airavata.tunnel.serverToken}") - private String tunnelServerToken; + public AgentConnectionHandler(AgentProperties agentProperties) { + this.agentProperties = agentProperties; + } // response handling public AgentInfoResponse isAgentUp(String agentId) { @@ -479,10 +473,10 @@ public class AgentConnectionHandler extends AgentCommunicationServiceGrpc.AgentC .setExecutionId(executionId) .setLocalPort(tunnelRequest.getLocalPort()) .setLocalBindHost(tunnelRequest.getLocalBindHost()) - .setTunnelServerHost(tunnelServerHost) - .setTunnelServerPort(tunnelServerPort) - .setTunnelServerApiUrl(tunnelServerApiUrl) - .setTunnelServerToken(tunnelServerToken) + .setTunnelServerHost(agentProperties.getTunnel().getServerHost()) + .setTunnelServerPort(agentProperties.getTunnel().getServerPort()) + .setTunnelServerApiUrl(agentProperties.getTunnel().getServerApiUrl()) + .setTunnelServerToken(agentProperties.getTunnel().getServerToken()) .build()) .build()); } catch (Exception e) { diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java index a976a7db8e..9939d25c30 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java @@ -23,7 +23,8 @@ import java.nio.file.Paths; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; -import org.apache.airavata.agent.connection.service.UserContext; +import org.apache.airavata.agent.connection.service.config.AgentProperties; +import org.apache.airavata.common.security.UserContext; import org.apache.airavata.agent.connection.service.config.ClusterApplicationConfig; import org.apache.airavata.agent.connection.service.models.AgentLaunchRequest; import org.apache.airavata.agent.connection.service.models.AgentLaunchResponse; @@ -55,19 +56,15 @@ public class AgentManagementHandler { private static final Logger LOGGER = LoggerFactory.getLogger(AgentManagementHandler.class); private final AiravataService airavataService; private final ClusterApplicationConfig clusterApplicationConfig; - - @Value("${airavata.storageResourceId}") - private String storageResourceId; - - @Value("${airavata.storagePath}") - private String storagePath; + private final AgentProperties agentProperties; @Value("${grpc.server.host}") private String grpcHost; - public AgentManagementHandler(AiravataService airavataService, ClusterApplicationConfig clusterApplicationConfig) { + public AgentManagementHandler(AiravataService airavataService, ClusterApplicationConfig clusterApplicationConfig, AgentProperties agentProperties) { this.airavataService = airavataService; this.clusterApplicationConfig = clusterApplicationConfig; + this.agentProperties = agentProperties; } public AgentTerminateResponse terminateExperiment(String experimentId) { @@ -216,7 +213,7 @@ public class AgentManagementHandler { String projectDir = projectName.replace(" ", "_"); String projectId = airavataService.getProjectId(airavataClient, projectName); AuthzToken authzToken = UserContext.authzToken(); - String userName = UserContext.username(); + String userName = UserContext.userId(); String gatewayId = UserContext.gatewayId(); String appInterfaceId = clusterApplicationConfig.getApplicationInterfaceId(); ExperimentModel experimentModel = new ExperimentModel(); @@ -247,10 +244,10 @@ public class AgentManagementHandler { userConfigurationDataModel.setAiravataAutoSchedule(false); userConfigurationDataModel.setOverrideManualScheduledParams(false); userConfigurationDataModel.setInputStorageResourceId( - StringUtils.isNotBlank(req.getInputStorageId()) ? req.getInputStorageId() : storageResourceId); + StringUtils.isNotBlank(req.getInputStorageId()) ? req.getInputStorageId() : agentProperties.getStorageResourceId()); userConfigurationDataModel.setOutputStorageResourceId( - StringUtils.isNotBlank(req.getOutputStorageId()) ? req.getInputStorageId() : storageResourceId); - String experimentDataDir = Paths.get(storagePath, gatewayId, userName, projectDir, experimentName) + StringUtils.isNotBlank(req.getOutputStorageId()) ? req.getInputStorageId() : agentProperties.getStorageResourceId()); + String experimentDataDir = Paths.get(agentProperties.getStoragePath(), gatewayId, userName, projectDir, experimentName) .toString(); userConfigurationDataModel.setExperimentDataDir(experimentDataDir); userConfigurationDataModel.setGroupResourceProfileId(groupCompResourcePref.getGroupResourceProfileId()); diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataFileService.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataFileService.java index 0e0b61733e..cf990fc8e8 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataFileService.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataFileService.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.apache.airavata.agent.ServerMessage; -import org.apache.airavata.agent.connection.service.UserContext; +import org.apache.airavata.common.security.UserContext; import org.apache.airavata.agent.connection.service.models.DirectoryInfo; import org.apache.airavata.agent.connection.service.models.ExperimentStorageResponse; import org.apache.airavata.agent.connection.service.models.FileInfo; diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java index f00d71a667..5df63cc194 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.airavata.agent.connection.service.UserContext; +import org.apache.airavata.common.security.UserContext; import org.apache.airavata.api.Airavata; import org.apache.airavata.common.util.AiravataClientFactory; import org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference; @@ -69,7 +69,7 @@ public class AiravataService { while (true) { List<Project> userProjects = airavataClient.getUserProjects( - UserContext.authzToken(), UserContext.gatewayId(), UserContext.username(), limit, offset); + UserContext.authzToken(), UserContext.gatewayId(), UserContext.userId(), limit, offset); Optional<Project> defaultProject = userProjects.stream() .filter(project -> projectName.equals(project.getName())) .findFirst(); @@ -84,7 +84,7 @@ public class AiravataService { } throw new RuntimeException( - "Could not find project: " + projectName + " for the user: " + UserContext.username()); + "Could not find project: " + projectName + " for the user: " + UserContext.userId()); } public GroupComputeResourcePreference extractGroupComputeResourcePreference( @@ -99,7 +99,7 @@ public class AiravataService { .filter(preference -> preference.getComputeResourceId().startsWith(remoteCluster))) .findFirst() .orElseThrow(() -> new RuntimeException("Could not find a matching Compute Resource Preference in the " - + groupProfileName + " group resource profile for the user: " + UserContext.username())); + + groupProfileName + " group resource profile for the user: " + UserContext.userId())); } public List<String> getUserExperimentIDs(Airavata.Client airavataClient) throws TException { @@ -113,7 +113,7 @@ public class AiravataService { return airavataClient.searchExperiments( UserContext.authzToken(), UserContext.gatewayId(), - UserContext.username(), + UserContext.userId(), filters, limit, offset); diff --git a/modules/agent-framework/agent-service/src/main/resources/application.yml b/modules/agent-framework/agent-service/src/main/resources/application.yml deleted file mode 100644 index 45de80b923..0000000000 --- a/modules/agent-framework/agent-service/src/main/resources/application.yml +++ /dev/null @@ -1,64 +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. -# - -grpc: - server: - host: localhost - port: 19900 - max-inbound-message-size: 20971520 - -server: - port: 18880 - address: localhost - -spring: - servlet: - multipart: - max-file-size: 200MB - max-request-size: 200MB - datasource: - url: "jdbc:mariadb://localhost:13306/airavata" - username: "airavata" - password: "123456" - driver-class-name: org.mariadb.jdbc.Driver - hikari: - pool-name: AppCatalogPool - leak-detection-threshold: 20000 - jpa: - hibernate: - ddl-auto: update - open-in-view: false - -airavata: - server: - url: localhost - port: 8930 - secure: false - storageResourceId: localhost_77116e91-f042-4d3a-ab9c-3e7b4ebcd5bd - storagePath: /tmp - cluster: - applicationInterfaceId: AiravataAgent_f4313e4d-20c2-4bf6-bff1-8aa0f0b0c1d6 - tunnel: - serverHost: localhost - serverPort: 17000 - serverToken: airavata - serverApiUrl: http://localhost:8000 - -management: - endpoints: - web: - exposure: - include: health
