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 1473b35621418062de12ebb1f3414135006b6394 Author: yasithdev <[email protected]> AuthorDate: Fri Mar 27 22:19:16 2026 -0500 refactor: convert file-server to plain library, normalize paths to /api/v1/files/* --- modules/file-server/pom.xml | 33 ---------- .../main/assembly/file-service-bin-assembly.xml | 75 ---------------------- .../file/server/FileServerApplication.java | 35 ---------- .../file/server/FileServerConfiguration.java | 4 +- .../file/server/config/FileServerConfig.java | 9 +++ .../file/server/controller/FileController.java | 8 +-- .../src/main/resources/application.properties | 10 --- 7 files changed, 13 insertions(+), 161 deletions(-) diff --git a/modules/file-server/pom.xml b/modules/file-server/pom.xml index 0276417a25..07d8d06268 100644 --- a/modules/file-server/pom.xml +++ b/modules/file-server/pom.xml @@ -54,18 +54,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.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -75,31 +67,6 @@ under the License. </compilerArgs> </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>file-service-distribution-package</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <tarLongFileMode>posix</tarLongFileMode> - <finalName>${file.service.dist.name}</finalName> - <descriptors> - <descriptor>src/main/assembly/file-service-bin-assembly.xml</descriptor> - </descriptors> - <attach>false</attach> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> - - <properties> - <file.service.dist.name>apache-airavata-file-server-${project.version}</file.service.dist.name> - </properties> </project> diff --git a/modules/file-server/src/main/assembly/file-service-bin-assembly.xml b/modules/file-server/src/main/assembly/file-service-bin-assembly.xml deleted file mode 100644 index d925f39ab5..0000000000 --- a/modules/file-server/src/main/assembly/file-service-bin-assembly.xml +++ /dev/null @@ -1,75 +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>${file.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.properties</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/file-server/src/main/java/org/apache/airavata/file/server/FileServerApplication.java b/modules/file-server/src/main/java/org/apache/airavata/file/server/FileServerApplication.java deleted file mode 100644 index 81561ec160..0000000000 --- a/modules/file-server/src/main/java/org/apache/airavata/file/server/FileServerApplication.java +++ /dev/null @@ -1,35 +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.file.server; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration; -import org.springframework.boot.context.properties.EnableConfigurationProperties; - -@SpringBootApplication( - scanBasePackages = "org.apache.airavata.file.server", - exclude = {GroovyTemplateAutoConfiguration.class}) -@EnableConfigurationProperties(FileServerConfiguration.class) -public class FileServerApplication { - public static void main(String[] args) { - SpringApplication.run(FileServerApplication.class, args); - } -} diff --git a/modules/file-server/src/main/java/org/apache/airavata/file/server/FileServerConfiguration.java b/modules/file-server/src/main/java/org/apache/airavata/file/server/FileServerConfiguration.java index f89823bd2e..69db3671b8 100644 --- a/modules/file-server/src/main/java/org/apache/airavata/file/server/FileServerConfiguration.java +++ b/modules/file-server/src/main/java/org/apache/airavata/file/server/FileServerConfiguration.java @@ -39,10 +39,10 @@ public class FileServerConfiguration { return AdaptorSupportImpl.getInstance(); } - @Value("${airavata.server.host:localhost}") + @Value("${airavata.thrift.host:localhost}") private String airavataServerHost; - @Value("${airavata.server.port:8930}") + @Value("${airavata.thrift.port:8930}") private int airavataServerPort; @Bean diff --git a/modules/file-server/src/main/java/org/apache/airavata/file/server/config/FileServerConfig.java b/modules/file-server/src/main/java/org/apache/airavata/file/server/config/FileServerConfig.java new file mode 100644 index 0000000000..fd80405546 --- /dev/null +++ b/modules/file-server/src/main/java/org/apache/airavata/file/server/config/FileServerConfig.java @@ -0,0 +1,9 @@ +package org.apache.airavata.file.server.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackages = "org.apache.airavata.file.server") +public class FileServerConfig { +} diff --git a/modules/file-server/src/main/java/org/apache/airavata/file/server/controller/FileController.java b/modules/file-server/src/main/java/org/apache/airavata/file/server/controller/FileController.java index c433817021..fd17237392 100644 --- a/modules/file-server/src/main/java/org/apache/airavata/file/server/controller/FileController.java +++ b/modules/file-server/src/main/java/org/apache/airavata/file/server/controller/FileController.java @@ -30,11 +30,11 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -@Controller +@RestController +@RequestMapping("/api/v1/files") public class FileController { private static final Logger logger = LoggerFactory.getLogger(FileController.class); @@ -43,7 +43,6 @@ public class FileController { private AirvataFileService fileService; @GetMapping("/list/{live}/{processId}") - @ResponseBody public Object listFilesRoot(@PathVariable String live, @PathVariable String processId) throws Exception { String relPath = "/"; try { @@ -55,7 +54,6 @@ public class FileController { } @GetMapping("/list/{live}/{processId}/{*subPath}") - @ResponseBody public Object listFiles(@PathVariable String live, @PathVariable String processId, @PathVariable String subPath) throws Exception { String relPath = subPath.startsWith("/") ? subPath : "/" + subPath; @@ -73,7 +71,6 @@ public class FileController { } @GetMapping("/download/{live}/{processId}/{*subPath}") - @ResponseBody public ResponseEntity downloadFile( @PathVariable String live, @PathVariable String processId, @PathVariable String subPath) { String relPath = subPath.startsWith("/") ? subPath : "/" + subPath; @@ -92,7 +89,6 @@ public class FileController { } @PostMapping("/upload/{live}/{processId}/{*subPath}") - @ResponseBody public ResponseEntity uploadFile( @PathVariable String live, @PathVariable String processId, diff --git a/modules/file-server/src/main/resources/application.properties b/modules/file-server/src/main/resources/application.properties deleted file mode 100644 index 44675bb7ba..0000000000 --- a/modules/file-server/src/main/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -spring.servlet.multipart.max-file-size=10MB -spring.servlet.multipart.max-request-size=10MB - -# Unified Airavata server (all services on single port) -airavata.server.host=localhost -airavata.server.port=8930 - -server.port=8050 - -management.endpoints.web.exposure.include=health
