You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2020/01/02 20:24:44 UTC
[airavata-mft] branch master updated: Converting Agent to a Spring
application and adding the distribution build
This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
The following commit(s) were added to refs/heads/master by this push:
new e111bfe Converting Agent to a Spring application and adding the distribution build
e111bfe is described below
commit e111bfe597c6f1ed51b69c9c4ac967b6a4af1e84
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Thu Jan 2 15:24:27 2020 -0500
Converting Agent to a Spring application and adding the distribution build
---
agent/pom.xml | 32 +++++-
agent/src/main/assembly/agent-bin-assembly.xml | 89 ++++++++++++++++
.../apache/airavata/mft/agent/ConsulTester.java | 48 ---------
.../org/apache/airavata/mft/agent/MFTAgent.java | 101 ++++++++++++------
agent/src/main/resources/application.properties | 22 ++++
.../resources/distribution/bin/agent-daemon.sh | 113 +++++++++++++++++++++
agent/src/main/resources/distribution/bin/agent.sh | 71 +++++++++++++
.../src/main/resources/distribution/bin/setenv.sh | 46 +++++++++
.../distribution/conf/application.properties | 22 ++++
.../main/resources/distribution/conf/logback.xml | 54 ++++++++++
pom.xml | 6 +-
11 files changed, 521 insertions(+), 83 deletions(-)
diff --git a/agent/pom.xml b/agent/pom.xml
index b317647..54a4361 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -58,6 +58,36 @@
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.26</version>
</dependency>
-
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven.assembly.plugin}</version>
+ <executions>
+ <execution>
+ <id>mft-agent-distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <tarLongFileMode>posix</tarLongFileMode>
+ <finalName>${agent.dist.name}</finalName>
+ <descriptors>
+ <descriptor>src/main/assembly/agent-bin-assembly.xml</descriptor>
+ </descriptors>
+ <attach>false</attach>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <agent.dist.name>MFT-Agent-0.01</agent.dist.name>
+ <maven.assembly.plugin>3.1.1</maven.assembly.plugin>
+ </properties>
</project>
\ No newline at end of file
diff --git a/agent/src/main/assembly/agent-bin-assembly.xml b/agent/src/main/assembly/agent-bin-assembly.xml
new file mode 100644
index 0000000..b6227da
--- /dev/null
+++ b/agent/src/main/assembly/agent-bin-assembly.xml
@@ -0,0 +1,89 @@
+<!--
+
+ 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.
+
+-->
+<!DOCTYPE assembly [
+ <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*>
+ <!ELEMENT id (#PCDATA)>
+ <!ELEMENT includeBaseDirectory (#PCDATA)>
+ <!ELEMENT baseDirectory (#PCDATA)>
+ <!ELEMENT formats (format)*>
+ <!ELEMENT format (#PCDATA)>
+ <!ELEMENT fileSets (fileSet)*>
+ <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*>
+ <!ELEMENT directory (#PCDATA)>
+ <!ELEMENT outputDirectory (#PCDATA)>
+ <!ELEMENT includes (include)*>
+ <!ELEMENT include (#PCDATA)>
+ <!ELEMENT dependencySets (dependencySet)*>
+ <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*>
+ ]>
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>${agent.dist.name}</baseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</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>logback.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>
diff --git a/agent/src/main/java/org/apache/airavata/mft/agent/ConsulTester.java b/agent/src/main/java/org/apache/airavata/mft/agent/ConsulTester.java
deleted file mode 100644
index f11dfbf..0000000
--- a/agent/src/main/java/org/apache/airavata/mft/agent/ConsulTester.java
+++ /dev/null
@@ -1,48 +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.mft.agent;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.orbitz.consul.Consul;
-import com.orbitz.consul.KeyValueClient;
-import org.apache.airavata.mft.admin.models.TransferRequest;
-
-import java.util.Collections;
-
-public class ConsulTester {
- public static void main(String args[]) throws Exception {
- Consul client = Consul.builder().build();
- KeyValueClient kvClient = client.keyValueClient();
- ObjectMapper mapper = new ObjectMapper();
-
- TransferRequest request = new TransferRequest();
- request.setSourceId("40107348-c457-4b0d-b206-b923caa2ab8d");
- request.setSourceType("SCP");
- request.setSourceToken("866d421e-3624-434f-ae71-04a90d39e70c");
-
- request.setDestinationId("24cf4870-ee50-4076-b97c-aeb481fec324");
- request.setDestinationType("SCP");
- request.setDestinationToken("866d421e-3624-434f-ae71-04a90d39e70c");
-
- request.setTransferId("transfer010");
-
- String asString = mapper.writeValueAsString(request);
-
- kvClient.putValue("agent0/messages/" + request.getTransferId(), asString);
- }
-}
diff --git a/agent/src/main/java/org/apache/airavata/mft/agent/MFTAgent.java b/agent/src/main/java/org/apache/airavata/mft/agent/MFTAgent.java
index bc6f6ad..e3a9977 100644
--- a/agent/src/main/java/org/apache/airavata/mft/agent/MFTAgent.java
+++ b/agent/src/main/java/org/apache/airavata/mft/agent/MFTAgent.java
@@ -40,18 +40,38 @@ import org.apache.airavata.mft.transport.local.LocalSender;
import org.apache.airavata.mft.transport.scp.SCPMetadataCollector;
import org.apache.airavata.mft.transport.scp.SCPReceiver;
import org.apache.airavata.mft.transport.scp.SCPSender;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.context.annotation.PropertySource;
-import java.util.Collections;
+import java.util.Arrays;
import java.util.Optional;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
-public class MFTAgent {
+@PropertySource("classpath:application.properties")
+@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
+public class MFTAgent implements CommandLineRunner {
+
+ private static final Logger logger = LoggerFactory.getLogger(MFTAgent.class);
private final TransportMediator mediator = new TransportMediator();
- private String agentId = "agent0";
+
+ @org.springframework.beans.factory.annotation.Value("${agent.id}")
+ private String agentId;
+ @org.springframework.beans.factory.annotation.Value("${agent.host}")
+ private String agentHost;
+ @org.springframework.beans.factory.annotation.Value("${agent.user}")
+ private String agentUser;
+ @org.springframework.beans.factory.annotation.Value("${agent.supported.protocols}")
+ private String supportedProtocols;
+
private final Semaphore mainHold = new Semaphore(0);
private Consul client;
@@ -75,12 +95,7 @@ public class MFTAgent {
private void acceptRequests() {
cacheListener = newValues -> {
- // Cache notifies all paths with "foo" the root path
- // If you want to watch only "foo" value, you must filter other paths
-
newValues.values().forEach(value -> {
-
- // Values are encoded in key/value store, decode it if needed
Optional<String> decodedValue = value.getValueAsString();
decodedValue.ifPresent(v -> {
System.out.println(String.format("Value is: %s", v));
@@ -88,7 +103,7 @@ public class MFTAgent {
TransferRequest request = null;
try {
request = mapper.readValue(v, TransferRequest.class);
- System.out.println("Received request " + request.getTransferId());
+ logger.info("Received request " + request.getTransferId());
admin.updateTransferState(request.getTransferId(), new TransferState().setState("STARTING")
.setPercentage(0).setUpdateTimeMils(System.currentTimeMillis()));
@@ -99,7 +114,7 @@ public class MFTAgent {
MetadataCollector metadataCollector = MFTAgent.this.resolveMetadataCollector(request.getSourceType());
ResourceMetadata metadata = metadataCollector.getGetResourceMetadata(request.getSourceId(), request.getSourceToken());
- System.out.println("File size " + metadata.getResourceSize());
+ logger.debug("File size " + metadata.getResourceSize());
admin.updateTransferState(request.getTransferId(), new TransferState().setState("STARTED")
.setPercentage(0).setUpdateTimeMils(System.currentTimeMillis()));
@@ -107,11 +122,11 @@ public class MFTAgent {
try {
admin.updateTransferState(id, st);
} catch (MFTAdminException e) {
- e.printStackTrace();
+ logger.error("Failed while updating transfer state", e);
}
});
- System.out.println("Submitted transfer " + transferId);
+ logger.info("Submitted transfer " + transferId);
} catch (Exception e) {
e.printStackTrace();
@@ -121,11 +136,12 @@ public class MFTAgent {
.setPercentage(0).setUpdateTimeMils(System.currentTimeMillis()));
} catch (MFTAdminException ex) {
ex.printStackTrace();
+ logger.warn(ex.getMessage());
// Ignore
}
}
} finally {
- System.out.println("Deleting key " + value.getKey());
+ logger.info("Deleting key " + value.getKey());
kvClient.deleteKey(value.getKey()); // Due to bug in consul https://github.com/hashicorp/consul/issues/571
}
});
@@ -137,9 +153,14 @@ public class MFTAgent {
}
private boolean connectAgent() throws MFTAdminException {
- ImmutableSession session = ImmutableSession.builder().name(agentId).behavior("delete").ttl(sessionTTLSeconds + "s").build();
- SessionCreatedResponse sessResp = client.sessionClient().createSession(session);
- String lockPath = "mft/agent/live/" + agentId;
+ final ImmutableSession session = ImmutableSession.builder()
+ .name(agentId)
+ .behavior("delete")
+ .ttl(sessionTTLSeconds + "s").build();
+
+ final SessionCreatedResponse sessResp = client.sessionClient().createSession(session);
+ final String lockPath = "mft/agent/live/" + agentId;
+
boolean acquired = kvClient.acquireLock(lockPath, sessResp.getId());
if (acquired) {
@@ -148,28 +169,42 @@ public class MFTAgent {
client.sessionClient().renewSession(sessResp.getId());
} catch (ConsulException e) {
if (e.getCode() == 404) {
+ logger.error("Can not renew session as it is expired");
+ stop();
+ }
+ logger.warn("Errored while renewing the session", e);
+ try {
+ boolean status = kvClient.acquireLock(lockPath, sessResp.getId());
+ if (!status) {
+ logger.error("Can not renew session as it is expired");
+ stop();
+ }
+ } catch (Exception ex) {
+ logger.error("Can not renew session as it is expired");
stop();
}
- e.printStackTrace();
} catch (Exception e) {
try {
boolean status = kvClient.acquireLock(lockPath, sessResp.getId());
if (!status) {
+ logger.error("Can not renew session as it is expired");
stop();
}
} catch (Exception ex) {
+ logger.error("Can not renew session as it is expired");
stop();
}
}
}, sessionRenewSeconds, sessionRenewSeconds, TimeUnit.SECONDS);
- admin.registerAgent(new AgentInfo()
+
+ this.admin.registerAgent(new AgentInfo()
.setId(agentId)
- .setHost("localhost")
- .setUser("dimuthu")
- .setSupportedProtocols(Collections.singletonList("SCP")));
+ .setHost(agentHost)
+ .setUser(agentUser)
+ .setSupportedProtocols(Arrays.asList(supportedProtocols.split(","))));
}
- System.out.println("Lock status " + acquired);
+ logger.info("Acquired lock " + acquired);
return acquired;
}
@@ -181,13 +216,12 @@ public class MFTAgent {
}
public void stop() {
- System.out.println("Stopping Agent " + agentId);
+ logger.info("Stopping Agent " + agentId);
disconnectAgent();
mainHold.release();
}
public void start() throws Exception {
- System.out.println("Starting Agent");
init();
boolean connected = connectAgent();
if (!connected) {
@@ -196,13 +230,6 @@ public class MFTAgent {
acceptRequests();
}
- public static void main(String args[]) throws Exception {
- MFTAgent agent = new MFTAgent();
- agent.start();
- agent.mainHold.acquire();
- System.out.println("Agent exited");
- }
-
// TODO load from reflection to avoid dependencies
private Connector resolveConnector(String type, String direction) {
switch (type) {
@@ -235,4 +262,16 @@ public class MFTAgent {
}
return null;
}
+
+ @Override
+ public void run(String... args) throws Exception {
+ logger.info("Starting Agent " + agentId);
+ start();
+ mainHold.acquire();
+ logger.info("Agent exited");
+ }
+
+ public static void main(String args[]) throws Exception {
+ SpringApplication.run(MFTAgent.class);
+ }
}
diff --git a/agent/src/main/resources/application.properties b/agent/src/main/resources/application.properties
new file mode 100644
index 0000000..463b513
--- /dev/null
+++ b/agent/src/main/resources/application.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+spring.main.web-application-type=NONE
+agent.id=agent0
+agent.host=localhost
+agent.user=dimuthu
+agent.supported.protocols=SCP,LOCAL
\ No newline at end of file
diff --git a/agent/src/main/resources/distribution/bin/agent-daemon.sh b/agent/src/main/resources/distribution/bin/agent-daemon.sh
new file mode 100644
index 0000000..28e16ff
--- /dev/null
+++ b/agent/src/main/resources/distribution/bin/agent-daemon.sh
@@ -0,0 +1,113 @@
+#!/usr/bin/env bash
+
+# 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.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+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"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+LOGO=true
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/airavata-daemon.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+SERVICE_NAME="MFT Agent"
+PID_PATH_NAME="${AIRAVATA_HOME}/bin/service-pid"
+
+case $1 in
+ start)
+ echo "Starting $SERVICE_NAME ..."
+ if [ ! -f $PID_PATH_NAME ]; then
+ nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+ org.apache.airavata.mft.agent.MFTAgent ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
+ echo $! > $PID_PATH_NAME
+ echo "$SERVICE_NAME started ..."
+ else
+ echo "$SERVICE_NAME is already running ..."
+ fi
+ ;;
+ stop)
+ if [ -f $PID_PATH_NAME ]; then
+ PID=$(cat $PID_PATH_NAME);
+ echo "$SERVICE_NAME stoping ..."
+ kill $PID;
+ RETRY=0
+ while kill -0 $PID 2> /dev/null; do
+ echo "Waiting for the process $PID to be stopped"
+ RETRY=`expr ${RETRY} + 1`
+ if [ "${RETRY}" -gt "20" ]
+ then
+ echo "Forcefully killing the process as it is not responding ..."
+ kill -9 $PID
+ fi
+ sleep 1
+ done
+ echo "$SERVICE_NAME stopped ..."
+ rm $PID_PATH_NAME
+ else
+ echo "$SERVICE_NAME is not running ..."
+ fi
+ ;;
+ restart)
+ if [ -f $PID_PATH_NAME ]; then
+ PID=$(cat $PID_PATH_NAME);
+ echo "$SERVICE_NAME stopping ...";
+ kill $PID;
+ RETRY=0
+ while kill -0 $PID 2> /dev/null; do
+ echo "Waiting for the process $PID to be stopped"
+ RETRY=`expr ${RETRY} + 1`
+ if [ "${RETRY}" -gt "20" ]
+ then
+ echo "Forcefully killing the process as it is not responding ..."
+ kill -9 $PID
+ fi
+ sleep 1
+ done
+ echo "$SERVICE_NAME stopped ...";
+ rm $PID_PATH_NAME
+ echo "$SERVICE_NAME starting ..."
+ nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+ org.apache.airavata.helix.impl.controller.HelixController ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
+ echo $! > $PID_PATH_NAME
+ echo "$SERVICE_NAME started ..."
+ else
+ echo "$SERVICE_NAME is not running ..."
+ fi
+ ;;
+ -h)
+ echo "Usage: agent-daemon.sh"
+
+ echo "command options:"
+ echo " start Start server in daemon mode"
+ echo " stop Stop server running in daemon mode"
+ echo " restart Restart server in daemon mode"
+ echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)"
+ echo " -h Display this help and exit"
+ shift
+ exit 0
+ ;;
+esac
+
diff --git a/agent/src/main/resources/distribution/bin/agent.sh b/agent/src/main/resources/distribution/bin/agent.sh
new file mode 100644
index 0000000..49f43e4
--- /dev/null
+++ b/agent/src/main/resources/distribution/bin/agent.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+# 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.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+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"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/airavata.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+# parse command arguments
+for var in "$@"
+do
+ case ${var} in
+ -xdebug)
+ AIRAVATA_COMMAND="${AIRAVATA_COMMAND}"
+ JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=*:8000"
+ shift
+ ;;
+ -log)
+ shift
+ LOG_FILE="$1"
+ shift
+ # If relative path, expand to absolute path using the user's $CWD
+ if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then
+ LOG_FILE="${CWD}/${LOG_FILE}"
+ fi
+ ;;
+ -h)
+ echo "Usage: agent.sh"
+
+ echo "command options:"
+ echo " -xdebug Start MFT Agent under JPDA debugger"
+ echo " -h Display this help and exit"
+ shift
+ exit 0
+ ;;
+ *)
+ EXTRA_ARGS="${EXTRA_ARGS} ${var}"
+ shift
+ ;;
+ esac
+done
+
+java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+ org.apache.airavata.mft.agent.MFTAgent ${AIRAVATA_COMMAND} $*
+
diff --git a/agent/src/main/resources/distribution/bin/setenv.sh b/agent/src/main/resources/distribution/bin/setenv.sh
new file mode 100755
index 0000000..9e894e1
--- /dev/null
+++ b/agent/src/main/resources/distribution/bin/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# 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.
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+
+# Only set AIRAVATA_HOME if not already set
+[ -z "$AIRAVATA_HOME" ] && AIRAVATA_HOME=`cd "$PRGDIR/.." ; pwd`
+
+AIRAVATA_CLASSPATH=""
+
+for f in "$AIRAVATA_HOME"/lib/*.jar
+do
+ AIRAVATA_CLASSPATH="$AIRAVATA_CLASSPATH":$f
+done
+
+export AIRAVATA_HOME
+export AIRAVATA_CLASSPATH
diff --git a/agent/src/main/resources/distribution/conf/application.properties b/agent/src/main/resources/distribution/conf/application.properties
new file mode 100644
index 0000000..463b513
--- /dev/null
+++ b/agent/src/main/resources/distribution/conf/application.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+spring.main.web-application-type=NONE
+agent.id=agent0
+agent.host=localhost
+agent.user=dimuthu
+agent.supported.protocols=SCP,LOCAL
\ No newline at end of file
diff --git a/agent/src/main/resources/distribution/conf/logback.xml b/agent/src/main/resources/distribution/conf/logback.xml
new file mode 100644
index 0000000..a1e67fe
--- /dev/null
+++ b/agent/src/main/resources/distribution/conf/logback.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+
+ 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.
+
+-->
+<configuration>
+
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d [%t] %-5p %c{30} %m [%X]%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="LOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <File>../logs/airavata.log</File>
+ <Append>true</Append>
+ <encoder>
+ <pattern>%d [%t] %-5p %c{30} %m [%X]%n</pattern>
+ </encoder>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>../logs/airavata.log.%d{yyyy-MM-dd}</fileNamePattern>
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>1GB</totalSizeCap>
+ </rollingPolicy>
+ </appender>
+
+ <logger name="ch.qos.logback" level="WARN"/>
+ <logger name="org.apache.helix" level="WARN"/>
+ <logger name="org.apache.zookeeper" level="ERROR"/>
+ <logger name="org.apache.airavata" level="INFO"/>
+ <logger name="org.hibernate" level="ERROR"/>
+ <logger name="net.schmizz.sshj" level="WARN"/>
+ <root level="INFO">
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="LOGFILE"/>
+ </root>
+</configuration>
diff --git a/pom.xml b/pom.xml
index 9127fb9..179adfb 100755
--- a/pom.xml
+++ b/pom.xml
@@ -52,9 +52,9 @@
<inceptionYear>2011</inceptionYear>
<scm>
- <connection>scm:git:https://github.com/apache/airavata.git</connection>
- <developerConnection>scm:git:https://github.com/apache/airavata.git</developerConnection>
- <url>https://github.com/apache/airavata</url>
+ <connection>scm:git:https://github.com/apache/airavata-mft.git</connection>
+ <developerConnection>scm:git:https://github.com/apache/airavata-mft.git</developerConnection>
+ <url>https://github.com/apache/airavata-mft</url>
<tag>HEAD</tag>
</scm>