Skip to content
Permalink
Browse files
Adding support to override conf files
  • Loading branch information
DImuthuUpe committed Mar 9, 2020
1 parent d292ee7 commit 333ae46943f410497f12ee64f6ff25217f45d9f3
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 16 deletions.
@@ -20,8 +20,13 @@
import org.apache.airavata.mft.admin.MFTConsulClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AppConfig {

@org.springframework.beans.factory.annotation.Value("${consul.host}")
@@ -52,7 +52,10 @@
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

@PropertySource("classpath:application.properties")
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class MFTAgent implements CommandLineRunner {

@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -22,17 +22,24 @@
import org.apache.airavata.mft.api.service.TransferApiRequest;
import org.dozer.DozerBeanMapper;
import org.dozer.loader.api.BeanMappingBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

@Configuration
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AppConfig {

@org.springframework.beans.factory.annotation.Value("${consul.host}")
String consulHost;
public String consulHost;

@org.springframework.beans.factory.annotation.Value("${consul.port}")
Integer consulPort;
public Integer consulPort;

@Bean
public MFTConsulClient mftConsulClient() {
@@ -29,11 +29,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;

import java.util.List;
import java.util.Optional;

@GRpcService
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class MFTApiHandler extends MFTApiServiceGrpc.MFTApiServiceImplBase {

private static final Logger logger = LoggerFactory.getLogger(MFTApiHandler.class);
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -20,8 +20,13 @@
import org.apache.airavata.mft.admin.MFTConsulClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AppConfig {

@org.springframework.beans.factory.annotation.Value("${consul.host}")
@@ -19,8 +19,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.orbitz.consul.Consul;
import com.orbitz.consul.KeyValueClient;
import com.orbitz.consul.cache.ConsulCache;
import com.orbitz.consul.cache.KVCache;
import com.orbitz.consul.model.kv.Value;
@@ -43,7 +41,10 @@
import java.util.Optional;
import java.util.concurrent.Semaphore;

@PropertySource("classpath:application.properties")
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
@SpringBootApplication()
@ComponentScan(basePackages = {"org.apache.airavata.mft"})
@EntityScan("org.apache.airavata.mft.api.db.entities")
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -22,8 +22,13 @@
import org.apache.airavata.mft.resource.server.backend.sql.SQLResourceBackend;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AppConfig {
@Bean
public ResourceBackend resourceBackend() {
@@ -28,9 +28,14 @@
import org.apache.airavata.registry.api.client.RegistryServiceClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.PropertySource;

import java.util.Optional;

@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AiravataResourceBackend implements ResourceBackend {

private static final Logger logger = LoggerFactory.getLogger(AiravataResourceBackend.class);
@@ -27,9 +27,14 @@
import org.apache.airavata.mft.resource.service.*;
import org.dozer.DozerBeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;

import java.util.Optional;

@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class SQLResourceBackend implements ResourceBackend {

@Autowired
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -22,8 +22,13 @@
import org.apache.airavata.mft.secret.server.backend.sql.SQLSecretBackend;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AppConfig {

@Bean
@@ -22,9 +22,14 @@
import org.apache.airavata.mft.secret.server.backend.SecretBackend;
import org.apache.airavata.mft.secret.service.*;
import org.apache.airavata.model.credential.store.SSHCredential;
import org.springframework.context.annotation.PropertySource;

import java.util.Optional;

@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class AiravataSecretBackend implements SecretBackend {

@org.springframework.beans.factory.annotation.Value("${credential.server.host}")
@@ -23,9 +23,14 @@
import org.apache.airavata.mft.secret.service.*;
import org.dozer.DozerBeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;

import java.util.Optional;

@PropertySource(value = {
"classpath:application.properties",
"file:${app.conf.dir}/application.properties"
}, ignoreResourceNotFound = true)
public class SQLSecretBackend implements SecretBackend {

@Autowired
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -23,7 +23,7 @@ CWD="$PWD"
cd ${AIRAVATA_HOME}/bin
LOGO_FILE="logo.txt"

JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
JAVA_OPTS="-Dapp.conf.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlogging.config=file:${AIRAVATA_HOME}/conf/logback.xml"
AIRAVATA_COMMAND=""
EXTRA_ARGS=""
SERVERS=""
@@ -116,6 +116,13 @@ public Boolean isAvailable(String resourceId, String credentialToken) throws Exc
}
}


public static void main(String args[]) {
ResourceServiceGrpc.ResourceServiceBlockingStub resourceClient = ResourceServiceClient.buildClient("149.165.156.124", 7002);
SCPResource scpResource = resourceClient.getSCPResource(SCPResourceGetRequest.newBuilder().setResourceId("STORAGE:/var/www/portals/gateway-user-data/django-seagrid/dimuthu/Default_Project/Clone_of_Clone_of_Clone_of_Clone_of_Clone_of_Clone_of_Clone_of_Clone_of_Clone_of_Gaussian16_on_Mar_6_2020_148_AM/Gaussian.com:seagrid:pgadev.scigap.org_7ddf28fd-d503-4ff8-bbc5-3279a7c3b99e").build());
System.out.println(scpResource);
}

private SSHClient getSSHClient(SCPResource scpResource, SCPSecret scpSecret) throws IOException {

SSHClient sshClient = new SSHClient();

0 comments on commit 333ae46

Please sign in to comment.