You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/12/17 00:21:51 UTC

[1/5] airavata git commit: adding data mover code to data manager

Repository: airavata
Updated Branches:
  refs/heads/master 36da4ee4d -> 6572a8214


http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerImplTest.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerImplTest.java b/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerImplTest.java
deleted file mode 100644
index f644520..0000000
--- a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerImplTest.java
+++ /dev/null
@@ -1,205 +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.data.catalog.core;
-
-import org.apache.airavata.data.catalog.cpi.DataManagerException;
-import org.apache.airavata.data.catalog.core.utils.AppCatInit;
-import org.apache.airavata.data.catalog.core.utils.DataCatInit;
-import org.apache.airavata.model.data.resource.DataReplicaLocationModel;
-import org.apache.airavata.model.data.resource.DataResourceModel;
-import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.DataCatalog;
-import org.apache.airavata.data.catalog.cpi.DataManager;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.UUID;
-
-public class DataManagerImplTest {
-    private final static Logger logger = LoggerFactory.getLogger(DataManagerImplTest.class);
-    private static AppCatInit appCatInit;
-    private static DataCatInit dataCatInit;
-    private static DataManager dataManager;
-    private static DataResourceModel dataResourceModel;
-    private static DataReplicaLocationModel dataReplicaLocationModel;
-
-    @BeforeClass
-    public static void setUp() {
-        try {
-            System.out.println("********** SET UP ************");
-            appCatInit = new AppCatInit("appcatalog-derby.sql");
-            appCatInit.initializeDB();
-            dataCatInit = new DataCatInit("datacatalog-derby.sql");
-            dataCatInit.initializeDB();
-            DataCatalog dataCatalog = RegistryFactory.getDataCatalog();
-            DataManagerImplTest.dataManager = new DataManagerImpl(dataCatalog);
-            dataResourceModel = new DataResourceModel();
-            dataResourceModel.setResourceName("test-file.txt");
-            dataReplicaLocationModel = new DataReplicaLocationModel();
-            dataReplicaLocationModel.setReplicaName("1-st-replica");
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    @AfterClass
-    public static void tearDown() throws Exception {
-        System.out.println("********** TEAR DOWN ************");
-        dataCatInit.stopDerbyServer();
-    }
-
-    @Test
-    public void testPublishDataResource(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            org.junit.Assert.assertNotNull(resourceId);
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testRemoveDataResource(){
-        try {
-            boolean result = dataManager.removeResource("234234234");
-            Assert.assertFalse(result);
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            Assert.assertNotNull(resourceId);
-            result = dataManager.removeResource(resourceId);
-            Assert.assertTrue(result);
-            result = dataManager.removeResource(resourceId);
-            Assert.assertFalse(result);
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testGetDataResource(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            Assert.assertNotNull(resourceId);
-            DataResourceModel persistedCopy = dataManager.getResource(resourceId);
-            Assert.assertNotNull(persistedCopy);
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testUpdateDataResource(){
-        try {
-            dataResourceModel.setResourceId(UUID.randomUUID().toString());
-            boolean result = dataManager.updateResource(dataResourceModel);
-            Assert.assertFalse(result);
-            dataManager.registerResource(dataResourceModel);
-            dataResourceModel.setResourceName("updated-name");
-            dataManager.updateResource(dataResourceModel);
-            dataResourceModel = dataManager.getResource(dataResourceModel.getResourceId());
-            Assert.assertTrue(dataResourceModel.getResourceName().equals("updated-name"));
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testPublishReplicaLocation(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            dataReplicaLocationModel.setResourceId(resourceId);
-            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
-            org.junit.Assert.assertNotNull(replicaId);
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testRemoveReplicaLocation(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            dataReplicaLocationModel.setResourceId(resourceId);
-            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
-            boolean result = dataManager.removeReplicaLocation(replicaId);
-            Assert.assertTrue(result);
-            result = dataManager.removeReplicaLocation(dataReplicaLocationModel.getReplicaId());
-            Assert.assertFalse(result);
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testGetReplicaLocation(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            dataReplicaLocationModel.setResourceId(resourceId);
-            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
-            DataReplicaLocationModel persistedCopy = dataManager.getReplicaLocation(replicaId);
-            Assert.assertNotNull(persistedCopy);
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testUpdateReplicaLocation(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            dataReplicaLocationModel.setResourceId(resourceId);
-            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
-            DataReplicaLocationModel persistedCopy = dataManager.getReplicaLocation(replicaId);
-            persistedCopy.setReplicaDescription("updated-description");
-            dataManager.updateReplicaLocation(persistedCopy);
-            persistedCopy = dataManager.getReplicaLocation(replicaId);
-            Assert.assertTrue(persistedCopy.getReplicaDescription().equals("updated-description"));
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testGetAllReplicaLocations(){
-        try {
-            String resourceId = dataManager.registerResource(dataResourceModel);
-            dataReplicaLocationModel.setResourceId(resourceId);
-            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
-            List<DataReplicaLocationModel> replicaLocationModelList = dataManager.getAllReplicaLocations(resourceId);
-            Assert.assertTrue(replicaLocationModelList.get(0).getReplicaId().equals(replicaId));
-        } catch (DataManagerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/AppCatInit.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/AppCatInit.java b/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/AppCatInit.java
deleted file mode 100644
index c07f051..0000000
--- a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/AppCatInit.java
+++ /dev/null
@@ -1,320 +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.data.catalog.core.utils;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.net.URI;
-import java.sql.*;
-import java.util.StringTokenizer;
-
-public class AppCatInit {
-    private static final Logger logger = LoggerFactory.getLogger(AppCatInit.class);
-    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
-    public  String scriptName = "appcatalog-derby.sql";
-    private NetworkServerControl server;
-    private static final String delimiter = ";";
-    public static final String COMPUTE_RESOURCE_TABLE = "COMPUTE_RESOURCE";
-    private String jdbcUrl = null;
-    private String jdbcDriver = null;
-    private String jdbcUser = null;
-    private String jdbcPassword = null;
-
-    public AppCatInit(String scriptName) {
-        this.scriptName = scriptName;
-    }
-
-    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
-        if (suffix.length() > buffer.length()) {
-            return false;
-        }
-        // this loop is done on purpose to avoid memory allocation performance
-        // problems on various JDKs
-        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
-        // implementation is ok though does allocation/copying
-        // StringBuffer.toString().endsWith() does massive memory
-        // allocation/copying on JDK 1.5
-        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
-        int endIndex = suffix.length() - 1;
-        int bufferIndex = buffer.length() - 1;
-        while (endIndex >= 0) {
-            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
-                return false;
-            }
-            bufferIndex--;
-            endIndex--;
-        }
-        return true;
-    }
-
-    private static boolean isServerStarted(NetworkServerControl server, int ntries)
-    {
-        for (int i = 1; i <= ntries; i ++)
-        {
-            try {
-                Thread.sleep(500);
-                server.ping();
-                return true;
-            }
-            catch (Exception e) {
-                if (i == ntries)
-                    return false;
-            }
-        }
-        return false;
-    }
-
-    public void initializeDB() {
-
-        try{
-            jdbcDriver = ServerSettings.getSetting("appcatalog.jdbc.driver");
-            jdbcUrl = ServerSettings.getSetting("appcatalog.jdbc.url");
-            jdbcUser = ServerSettings.getSetting("appcatalog.jdbc.user");
-            jdbcPassword = ServerSettings.getSetting("appcatalog.jdbc.password");
-            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read properties", e);
-        }
-
-        startDerbyInServerMode();
-        if(!isServerStarted(server, 20)){
-           throw new RuntimeException("Derby server cound not started within five seconds...");
-        }
-//      startDerbyInEmbeddedMode();
-
-        Connection conn = null;
-        try {
-            Class.forName(jdbcDriver).newInstance();
-            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
-            if (!isDatabaseStructureCreated(COMPUTE_RESOURCE_TABLE, conn)) {
-                executeSQLScript(conn);
-                logger.info("New Database created for App Catalog !!!");
-            } else {
-                logger.debug("Database already created for App Catalog!");
-            }
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new RuntimeException("Database failure", e);
-        } finally {
-            try {
-                if (conn != null){
-                    if (!conn.getAutoCommit()) {
-                        conn.commit();
-                    }
-                    conn.close();
-                }
-            } catch (SQLException e) {
-                logger.error(e.getMessage(), e);
-            }
-        }
-    }
-
-    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
-        try {
-            System.out.println("Running a query to test the database tables existence.");
-            // check whether the tables are already created with a query
-            Statement statement = null;
-            try {
-                statement = conn.createStatement();
-                ResultSet rs = statement.executeQuery("select * from " + tableName);
-                if (rs != null) {
-                    rs.close();
-                }
-            } finally {
-                try {
-                    if (statement != null) {
-                        statement.close();
-                    }
-                } catch (SQLException e) {
-                    return false;
-                }
-            }
-        } catch (SQLException e) {
-            return false;
-        }
-
-        return true;
-    }
-
-    private void executeSQLScript(Connection conn) throws Exception {
-        StringBuffer sql = new StringBuffer();
-        BufferedReader reader = null;
-        try{
-
-        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
-        reader = new BufferedReader(new InputStreamReader(inputStream));
-        String line;
-        while ((line = reader.readLine()) != null) {
-            line = line.trim();
-            if (line.startsWith("//")) {
-                continue;
-            }
-            if (line.startsWith("--")) {
-                continue;
-            }
-            StringTokenizer st = new StringTokenizer(line);
-            if (st.hasMoreTokens()) {
-                String token = st.nextToken();
-                if ("REM".equalsIgnoreCase(token)) {
-                    continue;
-                }
-            }
-            sql.append(" ").append(line);
-
-            // SQL defines "--" as a comment to EOL
-            // and in Oracle it may contain a hint
-            // so we cannot just remove it, instead we must end it
-            if (line.indexOf("--") >= 0) {
-                sql.append("\n");
-            }
-            if ((checkStringBufferEndsWith(sql, delimiter))) {
-                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
-                sql.replace(0, sql.length(), "");
-            }
-        }
-        // Catch any statements not followed by ;
-        if (sql.length() > 0) {
-            executeSQL(sql.toString(), conn);
-        }
-        }catch (IOException e){
-            logger.error("Error occurred while executing SQL script for creating Airavata database", e);
-            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
-        }finally {
-            if (reader != null) {
-                reader.close();
-            }
-
-        }
-
-    }
-
-    private static void executeSQL(String sql, Connection conn) throws Exception {
-        // Check and ignore empty statements
-        if ("".equals(sql.trim())) {
-            return;
-        }
-
-        Statement statement = null;
-        try {
-            logger.debug("SQL : " + sql);
-
-            boolean ret;
-            int updateCount = 0, updateCountTotal = 0;
-            statement = conn.createStatement();
-            ret = statement.execute(sql);
-            updateCount = statement.getUpdateCount();
-            do {
-                if (!ret) {
-                    if (updateCount != -1) {
-                        updateCountTotal += updateCount;
-                    }
-                }
-                ret = statement.getMoreResults();
-                if (ret) {
-                    updateCount = statement.getUpdateCount();
-                }
-            } while (ret);
-
-            logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
-            SQLWarning warning = conn.getWarnings();
-            while (warning != null) {
-                logger.warn(warning + " sql warning");
-                warning = warning.getNextWarning();
-            }
-            conn.clearWarnings();
-        } catch (SQLException e) {
-            if (e.getSQLState().equals("X0Y32")) {
-                // eliminating the table already exception for the derby
-                // database
-                logger.info("Table Already Exists", e);
-            } else {
-                throw new Exception("Error occurred while executing : " + sql, e);
-            }
-        } finally {
-            if (statement != null) {
-                try {
-                    statement.close();
-                } catch (SQLException e) {
-                    logger.error("Error occurred while closing result set.", e);
-                }
-            }
-        }
-    }
-
-    private void startDerbyInServerMode() {
-        try {
-            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
-            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
-                    20000,
-                    jdbcUser, jdbcPassword);
-            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
-            server.start(consoleWriter);
-        } catch (IOException e) {
-            logger.error("Unable to start Apache derby in the server mode! Check whether " +
-                    "specified port is available");
-        } catch (Exception e) {
-            logger.error("Unable to start Apache derby in the server mode! Check whether " +
-                    "specified port is available");
-        }
-
-    }
-
-    public static int getPort(String jdbcURL){
-        try{
-            String cleanURI = jdbcURL.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getPort();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return -1;
-        }
-    }
-
-    private void startDerbyInEmbeddedMode(){
-        try {
-            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
-            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
-        } catch (ClassNotFoundException e) {
-            logger.error(e.getMessage(), e);
-        } catch (SQLException e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    public void stopDerbyServer() {
-        try {
-            server.shutdown();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/DataCatInit.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/DataCatInit.java b/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/DataCatInit.java
deleted file mode 100644
index e63f7ed..0000000
--- a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/utils/DataCatInit.java
+++ /dev/null
@@ -1,315 +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.data.catalog.core.utils;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.registry.core.data.catalog.utils.DataCatalogConstants;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.net.URI;
-import java.sql.*;
-import java.util.StringTokenizer;
-
-public class DataCatInit {
-    private static final Logger logger = LoggerFactory.getLogger(DataCatInit.class);
-    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
-    public  String scriptName = "datacatalog-derby.sql";
-    private NetworkServerControl server;
-    private static final String delimiter = ";";
-    private String jdbcUrl = null;
-    private String jdbcDriver = null;
-    private String jdbcUser = null;
-    private String jdbcPassword = null;
-
-    public DataCatInit(String scriptName) {
-        this.scriptName = scriptName;
-    }
-
-    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
-        if (suffix.length() > buffer.length()) {
-            return false;
-        }
-        // this loop is done on purpose to avoid memory allocation performance
-        // problems on various JDKs
-        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
-        // implementation is ok though does allocation/copying
-        // StringBuffer.toString().endsWith() does massive memory
-        // allocation/copying on JDK 1.5
-        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
-        int endIndex = suffix.length() - 1;
-        int bufferIndex = buffer.length() - 1;
-        while (endIndex >= 0) {
-            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
-                return false;
-            }
-            bufferIndex--;
-            endIndex--;
-        }
-        return true;
-    }
-
-    private static boolean isServerStarted(NetworkServerControl server, int ntries)
-    {
-        for (int i = 1; i <= ntries; i ++)
-        {
-            try {
-                Thread.sleep(500);
-                server.ping();
-                return true;
-            }
-            catch (Exception e) {
-                if (i == ntries)
-                    return false;
-            }
-        }
-        return false;
-    }
-
-    public void initializeDB() {
-        try{
-            jdbcDriver = ServerSettings.getSetting("datacatalog.jdbc.driver");
-            jdbcUrl = ServerSettings.getSetting("datacatalog.jdbc.url");
-            jdbcUser = ServerSettings.getSetting("datacatalog.jdbc.user");
-            jdbcPassword = ServerSettings.getSetting("datacatalog.jdbc.password");
-            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read properties", e);
-        }
-
-        startDerbyInServerMode();
-        if(!isServerStarted(server, 20)){
-           throw new RuntimeException("Derby server could not started within five seconds...");
-        }
-        Connection conn = null;
-        try {
-            Class.forName(jdbcDriver).newInstance();
-            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
-            if (!isDatabaseStructureCreated(DataCatalogConstants.CONFIGURATION, conn)) {
-                executeSQLScript(conn);
-                logger.info("New Database created for Data Catalog !!!");
-            } else {
-                logger.debug("Database already created for Data Catalog!");
-            }
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new RuntimeException("Database failure", e);
-        } finally {
-            try {
-                if (conn != null){
-                    if (!conn.getAutoCommit()) {
-                        conn.commit();
-                    }
-                    conn.close();
-                }
-            } catch (SQLException e) {
-                logger.error(e.getMessage(), e);
-            }
-        }
-    }
-
-    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
-        try {
-            System.out.println("Running a query to test the database tables existence.");
-            // check whether the tables are already created with a query
-            Statement statement = null;
-            try {
-                statement = conn.createStatement();
-                ResultSet rs = statement.executeQuery("select * from " + tableName);
-                if (rs != null) {
-                    rs.close();
-                }
-            } finally {
-                try {
-                    if (statement != null) {
-                        statement.close();
-                    }
-                } catch (SQLException e) {
-                    return false;
-                }
-            }
-        } catch (SQLException e) {
-            return false;
-        }
-
-        return true;
-    }
-
-    private void executeSQLScript(Connection conn) throws Exception {
-        StringBuffer sql = new StringBuffer();
-        BufferedReader reader = null;
-        try{
-
-        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
-        reader = new BufferedReader(new InputStreamReader(inputStream));
-        String line;
-        while ((line = reader.readLine()) != null) {
-            line = line.trim();
-            if (line.startsWith("//")) {
-                continue;
-            }
-            if (line.startsWith("--")) {
-                continue;
-            }
-            StringTokenizer st = new StringTokenizer(line);
-            if (st.hasMoreTokens()) {
-                String token = st.nextToken();
-                if ("REM".equalsIgnoreCase(token)) {
-                    continue;
-                }
-            }
-            sql.append(" ").append(line);
-
-            // SQL defines "--" as a comment to EOL
-            // and in Oracle it may contain a hint
-            // so we cannot just remove it, instead we must end it
-            if (line.indexOf("--") >= 0) {
-                sql.append("\n");
-            }
-            if ((checkStringBufferEndsWith(sql, delimiter))) {
-                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
-                sql.replace(0, sql.length(), "");
-            }
-        }
-        // Catch any statements not followed by ;
-        if (sql.length() > 0) {
-            executeSQL(sql.toString(), conn);
-        }
-        }catch (IOException e){
-            logger.error("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
-            throw new Exception("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
-        }finally {
-            if (reader != null) {
-                reader.close();
-            }
-        }
-    }
-
-    private static void executeSQL(String sql, Connection conn) throws Exception {
-        // Check and ignore empty statements
-        if ("".equals(sql.trim())) {
-            return;
-        }
-
-        Statement statement = null;
-        try {
-            logger.debug("SQL : " + sql);
-
-            boolean ret;
-            int updateCount = 0, updateCountTotal = 0;
-            statement = conn.createStatement();
-            ret = statement.execute(sql);
-            updateCount = statement.getUpdateCount();
-            do {
-                if (!ret) {
-                    if (updateCount != -1) {
-                        updateCountTotal += updateCount;
-                    }
-                }
-                ret = statement.getMoreResults();
-                if (ret) {
-                    updateCount = statement.getUpdateCount();
-                }
-            } while (ret);
-
-            logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
-            SQLWarning warning = conn.getWarnings();
-            while (warning != null) {
-                logger.warn(warning + " sql warning");
-                warning = warning.getNextWarning();
-            }
-            conn.clearWarnings();
-        } catch (SQLException e) {
-            if (e.getSQLState().equals("X0Y32")) {
-                // eliminating the table already exception for the derby
-                // database
-                logger.info("Table Already Exists", e);
-            } else {
-                throw new Exception("Error occurred while executing : " + sql, e);
-            }
-        } finally {
-            if (statement != null) {
-                try {
-                    statement.close();
-                } catch (SQLException e) {
-                    logger.error("Error occurred while closing result set.", e);
-                }
-            }
-        }
-    }
-
-    private void startDerbyInServerMode() {
-        try {
-            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
-            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
-                    20000,
-                    jdbcUser, jdbcPassword);
-            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
-            server.start(consoleWriter);
-        } catch (IOException e) {
-            logger.error("Unable to start Apache derby in the server mode! Check whether " +
-                    "specified port is available");
-        } catch (Exception e) {
-            logger.error("Unable to start Apache derby in the server mode! Check whether " +
-                    "specified port is available");
-        }
-
-    }
-
-    public static int getPort(String jdbcURL){
-        try{
-            String cleanURI = jdbcURL.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getPort();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return -1;
-        }
-    }
-
-    private void startDerbyInEmbeddedMode(){
-        try {
-            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
-            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
-        } catch (ClassNotFoundException e) {
-            logger.error(e.getMessage(), e);
-        } catch (SQLException e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    public void stopDerbyServer() {
-        try {
-            server.shutdown();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManager.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManager.java b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManager.java
deleted file mode 100644
index 8c2150f..0000000
--- a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManager.java
+++ /dev/null
@@ -1,98 +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.data.catalog.cpi;
-
-import org.apache.airavata.model.data.resource.DataReplicaLocationModel;
-import org.apache.airavata.model.data.resource.DataResourceModel;
-
-import java.util.List;
-
-public interface DataManager {
-
-    /**
-     * To create a new dataResourceModel. This is how the system comes to know about already
-     * existing resources
-     * @param dataResourceModel
-     * @return
-     */
-    String registerResource(DataResourceModel dataResourceModel) throws DataManagerException;
-
-    /**
-     * To remove a resource entry from the replica catalog
-     * @param resourceId
-     * @return
-     */
-    boolean removeResource(String resourceId) throws DataManagerException;
-
-
-    /**
-     * To update an existing data resource model
-     * @param dataResourceModel
-     * @return
-     * @throws DataManagerException
-     */
-    boolean updateResource(DataResourceModel dataResourceModel) throws DataManagerException;
-
-    /**
-     * To retrieve a resource object providing the resourceId
-     * @param resourceId
-     * @return
-     */
-    DataResourceModel getResource(String resourceId) throws DataManagerException;
-
-    /**
-     * To create a new data replica location. This is how the system comes to know about already
-     * existing resources
-     * @param dataReplicaLocationModel
-     * @return
-     */
-    String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException;
-
-    /**
-     * To remove a replica entry from the replica catalog
-     * @param replicaId
-     * @return
-     */
-    boolean removeReplicaLocation(String replicaId) throws DataManagerException;
-
-    /**
-     * To update an existing data replica model
-     * @param dataReplicaLocationModel
-     * @return
-     * @throws DataManagerException
-     */
-    boolean updateReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException;
-
-    /**
-     * To retrieve a replica object providing the replicaId
-     * @param replicaId
-     * @return
-     */
-    DataReplicaLocationModel getReplicaLocation(String replicaId) throws DataManagerException;
-
-    /**
-     * To retrieve all the replica entries for a given resource id
-     * @param resourceId
-     * @return
-     * @throws DataCatalogException
-     */
-    List<DataReplicaLocationModel> getAllReplicaLocations(String resourceId) throws DataManagerException;
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerConstants.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerConstants.java b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerConstants.java
deleted file mode 100644
index eb98326..0000000
--- a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerConstants.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.data.catalog.cpi;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataManagerConstants {
-    private final static Logger logger = LoggerFactory.getLogger(DataManagerConstants.class);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerException.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerException.java b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerException.java
deleted file mode 100644
index 5fef3eb..0000000
--- a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/catalog/cpi/DataManagerException.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.data.catalog.cpi;
-
-public class DataManagerException extends Exception{
-
-    public DataManagerException(Throwable e) {
-        super(e);
-    }
-
-    public DataManagerException(String message) {
-        super(message, null);
-    }
-
-    public DataManagerException(String message, Throwable e) {
-        super(message, e);
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManager.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManager.java b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManager.java
new file mode 100644
index 0000000..5b2d3f3
--- /dev/null
+++ b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManager.java
@@ -0,0 +1,109 @@
+/*
+ *
+ * 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.data.manager.cpi;
+
+import org.apache.airavata.model.data.resource.DataReplicaLocationModel;
+import org.apache.airavata.model.data.resource.DataResourceModel;
+
+import java.util.List;
+
+public interface DataManager {
+
+    /**
+     * To create a new dataResourceModel. This is how the system comes to know about already
+     * existing resources
+     * @param dataResourceModel
+     * @return
+     */
+    String registerResource(DataResourceModel dataResourceModel) throws DataManagerException;
+
+    /**
+     * To remove a resource entry from the replica catalog
+     * @param resourceId
+     * @return
+     */
+    boolean removeResource(String resourceId) throws DataManagerException;
+
+
+    /**
+     * To update an existing data resource model
+     * @param dataResourceModel
+     * @return
+     * @throws DataManagerException
+     */
+    boolean updateResource(DataResourceModel dataResourceModel) throws DataManagerException;
+
+    /**
+     * To retrieve a resource object providing the resourceId
+     * @param resourceId
+     * @return
+     */
+    DataResourceModel getResource(String resourceId) throws DataManagerException;
+
+    /**
+     * To create a new data replica location. This is how the system comes to know about already
+     * existing resources
+     * @param dataReplicaLocationModel
+     * @return
+     */
+    String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException;
+
+    /**
+     * To remove a replica entry from the replica catalog
+     * @param replicaId
+     * @return
+     */
+    boolean removeReplicaLocation(String replicaId) throws DataManagerException;
+
+    /**
+     * To update an existing data replica model
+     * @param dataReplicaLocationModel
+     * @return
+     * @throws DataManagerException
+     */
+    boolean updateReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException;
+
+    /**
+     * To retrieve a replica object providing the replicaId
+     * @param replicaId
+     * @return
+     */
+    DataReplicaLocationModel getReplicaLocation(String replicaId) throws DataManagerException;
+
+    /**
+     * To retrieve all the replica entries for a given resource id
+     * @param resourceId
+     * @return
+     * @throws DataCatalogException
+     */
+    List<DataReplicaLocationModel> getAllReplicaLocations(String resourceId) throws DataManagerException;
+
+
+    /**
+     * API method to copy a resource to the provided destination storage resource. Only resources of type FILE can be
+     * copied using this API method. Method returns the new replicaId.
+     * @param dataResourceId
+     * @param destStorageResourceId
+     * @param destinationParentPath
+     * @return
+     */
+    String copyResource(String dataResourceId, String destStorageResourceId, String destinationParentPath) throws DataManagerException;
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerConstants.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerConstants.java b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerConstants.java
new file mode 100644
index 0000000..d46604a
--- /dev/null
+++ b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerConstants.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.data.manager.cpi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataManagerConstants {
+    private final static Logger logger = LoggerFactory.getLogger(DataManagerConstants.class);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerException.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerException.java b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerException.java
new file mode 100644
index 0000000..b1c1cb8
--- /dev/null
+++ b/modules/data-manager/data-manager-cpi/src/main/java/org/apache/airavata/data/manager/cpi/DataManagerException.java
@@ -0,0 +1,35 @@
+/**
+ * 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.data.manager.cpi;
+
+public class DataManagerException extends Exception{
+
+    public DataManagerException(Throwable e) {
+        super(e);
+    }
+
+    public DataManagerException(String message) {
+        super(message, null);
+    }
+
+    public DataManagerException(String message, Throwable e) {
+        super(message, e);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/pom.xml
----------------------------------------------------------------------
diff --git a/modules/data-manager/pom.xml b/modules/data-manager/pom.xml
index cf898ea..eb81d40 100644
--- a/modules/data-manager/pom.xml
+++ b/modules/data-manager/pom.xml
@@ -15,6 +15,10 @@
     <name>Airavata Data Manager</name>
     <url>http://airavata.apache.org/</url>
 
+    <modules>
+        <module>data-manager-cpi</module>
+        <module>data-manager-core</module>
+    </modules>
     <dependencies>
         <dependency>
             <groupId>org.apache.airavata</groupId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
index 336eb0b..a881e7b 100644
--- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
+++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
@@ -2737,6 +2737,16 @@ service Airavata {
                     2: airavata_errors.AiravataClientException ace,
                     3: airavata_errors.AiravataSystemException ase,
                     4: airavata_errors.AuthorizationException ae)
+
+ string copyDataResource(1: required security_model.AuthzToken authzToken,
+                         2: required string resourceId,
+                         3: required string destStorageResourceId,
+                         4: required string destinationParentPath)
+           throws (1: airavata_errors.InvalidRequestException ire,
+                   2: airavata_errors.AiravataClientException ace,
+                   3: airavata_errors.AiravataSystemException ase,
+                   4: airavata_errors.AuthorizationException ae)
+
  //End of API
  }
 


[3/5] airavata git commit: adding data mover code to data manager

Posted by sc...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
index 3b8976d..5fa7f87 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
@@ -42468,6 +42468,333 @@ uint32_t Airavata_getDataResource_presult::read(::apache::thrift::protocol::TPro
   return xfer;
 }
 
+
+Airavata_copyDataResource_args::~Airavata_copyDataResource_args() throw() {
+}
+
+
+uint32_t Airavata_copyDataResource_args::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+  apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+  uint32_t xfer = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TType ftype;
+  int16_t fid;
+
+  xfer += iprot->readStructBegin(fname);
+
+  using ::apache::thrift::protocol::TProtocolException;
+
+  bool isset_authzToken = false;
+  bool isset_resourceId = false;
+  bool isset_destStorageResourceId = false;
+  bool isset_destinationParentPath = false;
+
+  while (true)
+  {
+    xfer += iprot->readFieldBegin(fname, ftype, fid);
+    if (ftype == ::apache::thrift::protocol::T_STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->authzToken.read(iprot);
+          isset_authzToken = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->resourceId);
+          isset_resourceId = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 3:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->destStorageResourceId);
+          isset_destStorageResourceId = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 4:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->destinationParentPath);
+          isset_destinationParentPath = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      default:
+        xfer += iprot->skip(ftype);
+        break;
+    }
+    xfer += iprot->readFieldEnd();
+  }
+
+  xfer += iprot->readStructEnd();
+
+  if (!isset_authzToken)
+    throw TProtocolException(TProtocolException::INVALID_DATA);
+  if (!isset_resourceId)
+    throw TProtocolException(TProtocolException::INVALID_DATA);
+  if (!isset_destStorageResourceId)
+    throw TProtocolException(TProtocolException::INVALID_DATA);
+  if (!isset_destinationParentPath)
+    throw TProtocolException(TProtocolException::INVALID_DATA);
+  return xfer;
+}
+
+uint32_t Airavata_copyDataResource_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
+  uint32_t xfer = 0;
+  apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+  xfer += oprot->writeStructBegin("Airavata_copyDataResource_args");
+
+  xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1);
+  xfer += this->authzToken.write(oprot);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("resourceId", ::apache::thrift::protocol::T_STRING, 2);
+  xfer += oprot->writeString(this->resourceId);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("destStorageResourceId", ::apache::thrift::protocol::T_STRING, 3);
+  xfer += oprot->writeString(this->destStorageResourceId);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("destinationParentPath", ::apache::thrift::protocol::T_STRING, 4);
+  xfer += oprot->writeString(this->destinationParentPath);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldStop();
+  xfer += oprot->writeStructEnd();
+  return xfer;
+}
+
+
+Airavata_copyDataResource_pargs::~Airavata_copyDataResource_pargs() throw() {
+}
+
+
+uint32_t Airavata_copyDataResource_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
+  uint32_t xfer = 0;
+  apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+  xfer += oprot->writeStructBegin("Airavata_copyDataResource_pargs");
+
+  xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1);
+  xfer += (*(this->authzToken)).write(oprot);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("resourceId", ::apache::thrift::protocol::T_STRING, 2);
+  xfer += oprot->writeString((*(this->resourceId)));
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("destStorageResourceId", ::apache::thrift::protocol::T_STRING, 3);
+  xfer += oprot->writeString((*(this->destStorageResourceId)));
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("destinationParentPath", ::apache::thrift::protocol::T_STRING, 4);
+  xfer += oprot->writeString((*(this->destinationParentPath)));
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldStop();
+  xfer += oprot->writeStructEnd();
+  return xfer;
+}
+
+
+Airavata_copyDataResource_result::~Airavata_copyDataResource_result() throw() {
+}
+
+
+uint32_t Airavata_copyDataResource_result::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+  apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+  uint32_t xfer = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TType ftype;
+  int16_t fid;
+
+  xfer += iprot->readStructBegin(fname);
+
+  using ::apache::thrift::protocol::TProtocolException;
+
+
+  while (true)
+  {
+    xfer += iprot->readFieldBegin(fname, ftype, fid);
+    if (ftype == ::apache::thrift::protocol::T_STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->success);
+          this->__isset.success = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 1:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ire.read(iprot);
+          this->__isset.ire = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ace.read(iprot);
+          this->__isset.ace = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 3:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ase.read(iprot);
+          this->__isset.ase = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 4:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ae.read(iprot);
+          this->__isset.ae = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      default:
+        xfer += iprot->skip(ftype);
+        break;
+    }
+    xfer += iprot->readFieldEnd();
+  }
+
+  xfer += iprot->readStructEnd();
+
+  return xfer;
+}
+
+uint32_t Airavata_copyDataResource_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
+
+  uint32_t xfer = 0;
+
+  xfer += oprot->writeStructBegin("Airavata_copyDataResource_result");
+
+  if (this->__isset.success) {
+    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0);
+    xfer += oprot->writeString(this->success);
+    xfer += oprot->writeFieldEnd();
+  } else if (this->__isset.ire) {
+    xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1);
+    xfer += this->ire.write(oprot);
+    xfer += oprot->writeFieldEnd();
+  } else if (this->__isset.ace) {
+    xfer += oprot->writeFieldBegin("ace", ::apache::thrift::protocol::T_STRUCT, 2);
+    xfer += this->ace.write(oprot);
+    xfer += oprot->writeFieldEnd();
+  } else if (this->__isset.ase) {
+    xfer += oprot->writeFieldBegin("ase", ::apache::thrift::protocol::T_STRUCT, 3);
+    xfer += this->ase.write(oprot);
+    xfer += oprot->writeFieldEnd();
+  } else if (this->__isset.ae) {
+    xfer += oprot->writeFieldBegin("ae", ::apache::thrift::protocol::T_STRUCT, 4);
+    xfer += this->ae.write(oprot);
+    xfer += oprot->writeFieldEnd();
+  }
+  xfer += oprot->writeFieldStop();
+  xfer += oprot->writeStructEnd();
+  return xfer;
+}
+
+
+Airavata_copyDataResource_presult::~Airavata_copyDataResource_presult() throw() {
+}
+
+
+uint32_t Airavata_copyDataResource_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+  apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+  uint32_t xfer = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TType ftype;
+  int16_t fid;
+
+  xfer += iprot->readStructBegin(fname);
+
+  using ::apache::thrift::protocol::TProtocolException;
+
+
+  while (true)
+  {
+    xfer += iprot->readFieldBegin(fname, ftype, fid);
+    if (ftype == ::apache::thrift::protocol::T_STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString((*(this->success)));
+          this->__isset.success = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 1:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ire.read(iprot);
+          this->__isset.ire = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ace.read(iprot);
+          this->__isset.ace = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 3:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ase.read(iprot);
+          this->__isset.ase = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 4:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->ae.read(iprot);
+          this->__isset.ae = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      default:
+        xfer += iprot->skip(ftype);
+        break;
+    }
+    xfer += iprot->readFieldEnd();
+  }
+
+  xfer += iprot->readStructEnd();
+
+  return xfer;
+}
+
 void AiravataClient::getAPIVersion(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken)
 {
   send_getAPIVersion(authzToken);
@@ -52194,6 +52521,79 @@ void AiravataClient::recv_getDataResource( ::apache::airavata::model::data::reso
   throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getDataResource failed: unknown result");
 }
 
+void AiravataClient::copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath)
+{
+  send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath);
+  recv_copyDataResource(_return);
+}
+
+void AiravataClient::send_copyDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath)
+{
+  int32_t cseqid = 0;
+  oprot_->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_CALL, cseqid);
+
+  Airavata_copyDataResource_pargs args;
+  args.authzToken = &authzToken;
+  args.resourceId = &resourceId;
+  args.destStorageResourceId = &destStorageResourceId;
+  args.destinationParentPath = &destinationParentPath;
+  args.write(oprot_);
+
+  oprot_->writeMessageEnd();
+  oprot_->getTransport()->writeEnd();
+  oprot_->getTransport()->flush();
+}
+
+void AiravataClient::recv_copyDataResource(std::string& _return)
+{
+
+  int32_t rseqid = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TMessageType mtype;
+
+  iprot_->readMessageBegin(fname, mtype, rseqid);
+  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
+    ::apache::thrift::TApplicationException x;
+    x.read(iprot_);
+    iprot_->readMessageEnd();
+    iprot_->getTransport()->readEnd();
+    throw x;
+  }
+  if (mtype != ::apache::thrift::protocol::T_REPLY) {
+    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+    iprot_->readMessageEnd();
+    iprot_->getTransport()->readEnd();
+  }
+  if (fname.compare("copyDataResource") != 0) {
+    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+    iprot_->readMessageEnd();
+    iprot_->getTransport()->readEnd();
+  }
+  Airavata_copyDataResource_presult result;
+  result.success = &_return;
+  result.read(iprot_);
+  iprot_->readMessageEnd();
+  iprot_->getTransport()->readEnd();
+
+  if (result.__isset.success) {
+    // _return pointer has now been filled
+    return;
+  }
+  if (result.__isset.ire) {
+    throw result.ire;
+  }
+  if (result.__isset.ace) {
+    throw result.ace;
+  }
+  if (result.__isset.ase) {
+    throw result.ase;
+  }
+  if (result.__isset.ae) {
+    throw result.ae;
+  }
+  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "copyDataResource failed: unknown result");
+}
+
 bool AiravataProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) {
   ProcessMap::iterator pfn;
   pfn = processMap_.find(fname);
@@ -61193,6 +61593,72 @@ void AiravataProcessor::process_getDataResource(int32_t seqid, ::apache::thrift:
   }
 }
 
+void AiravataProcessor::process_copyDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
+{
+  void* ctx = NULL;
+  if (this->eventHandler_.get() != NULL) {
+    ctx = this->eventHandler_->getContext("Airavata.copyDataResource", callContext);
+  }
+  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Airavata.copyDataResource");
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->preRead(ctx, "Airavata.copyDataResource");
+  }
+
+  Airavata_copyDataResource_args args;
+  args.read(iprot);
+  iprot->readMessageEnd();
+  uint32_t bytes = iprot->getTransport()->readEnd();
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->postRead(ctx, "Airavata.copyDataResource", bytes);
+  }
+
+  Airavata_copyDataResource_result result;
+  try {
+    iface_->copyDataResource(result.success, args.authzToken, args.resourceId, args.destStorageResourceId, args.destinationParentPath);
+    result.__isset.success = true;
+  } catch ( ::apache::airavata::api::error::InvalidRequestException &ire) {
+    result.ire = ire;
+    result.__isset.ire = true;
+  } catch ( ::apache::airavata::api::error::AiravataClientException &ace) {
+    result.ace = ace;
+    result.__isset.ace = true;
+  } catch ( ::apache::airavata::api::error::AiravataSystemException &ase) {
+    result.ase = ase;
+    result.__isset.ase = true;
+  } catch ( ::apache::airavata::api::error::AuthorizationException &ae) {
+    result.ae = ae;
+    result.__isset.ae = true;
+  } catch (const std::exception& e) {
+    if (this->eventHandler_.get() != NULL) {
+      this->eventHandler_->handlerError(ctx, "Airavata.copyDataResource");
+    }
+
+    ::apache::thrift::TApplicationException x(e.what());
+    oprot->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_EXCEPTION, seqid);
+    x.write(oprot);
+    oprot->writeMessageEnd();
+    oprot->getTransport()->writeEnd();
+    oprot->getTransport()->flush();
+    return;
+  }
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->preWrite(ctx, "Airavata.copyDataResource");
+  }
+
+  oprot->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_REPLY, seqid);
+  result.write(oprot);
+  oprot->writeMessageEnd();
+  bytes = oprot->getTransport()->writeEnd();
+  oprot->getTransport()->flush();
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->postWrite(ctx, "Airavata.copyDataResource", bytes);
+  }
+}
+
 ::boost::shared_ptr< ::apache::thrift::TProcessor > AiravataProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
   ::apache::thrift::ReleaseHandler< AiravataIfFactory > cleanup(handlerFactory_);
   ::boost::shared_ptr< AiravataIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
@@ -75000,5 +75466,108 @@ void AiravataConcurrentClient::recv_getDataResource( ::apache::airavata::model::
   } // end while(true)
 }
 
+void AiravataConcurrentClient::copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath)
+{
+  int32_t seqid = send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath);
+  recv_copyDataResource(_return, seqid);
+}
+
+int32_t AiravataConcurrentClient::send_copyDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath)
+{
+  int32_t cseqid = this->sync_.generateSeqId();
+  ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_);
+  oprot_->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_CALL, cseqid);
+
+  Airavata_copyDataResource_pargs args;
+  args.authzToken = &authzToken;
+  args.resourceId = &resourceId;
+  args.destStorageResourceId = &destStorageResourceId;
+  args.destinationParentPath = &destinationParentPath;
+  args.write(oprot_);
+
+  oprot_->writeMessageEnd();
+  oprot_->getTransport()->writeEnd();
+  oprot_->getTransport()->flush();
+
+  sentry.commit();
+  return cseqid;
+}
+
+void AiravataConcurrentClient::recv_copyDataResource(std::string& _return, const int32_t seqid)
+{
+
+  int32_t rseqid = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TMessageType mtype;
+
+  // the read mutex gets dropped and reacquired as part of waitForWork()
+  // The destructor of this sentry wakes up other clients
+  ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid);
+
+  while(true) {
+    if(!this->sync_.getPending(fname, mtype, rseqid)) {
+      iprot_->readMessageBegin(fname, mtype, rseqid);
+    }
+    if(seqid == rseqid) {
+      if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
+        ::apache::thrift::TApplicationException x;
+        x.read(iprot_);
+        iprot_->readMessageEnd();
+        iprot_->getTransport()->readEnd();
+        sentry.commit();
+        throw x;
+      }
+      if (mtype != ::apache::thrift::protocol::T_REPLY) {
+        iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+        iprot_->readMessageEnd();
+        iprot_->getTransport()->readEnd();
+      }
+      if (fname.compare("copyDataResource") != 0) {
+        iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+        iprot_->readMessageEnd();
+        iprot_->getTransport()->readEnd();
+
+        // in a bad state, don't commit
+        using ::apache::thrift::protocol::TProtocolException;
+        throw TProtocolException(TProtocolException::INVALID_DATA);
+      }
+      Airavata_copyDataResource_presult result;
+      result.success = &_return;
+      result.read(iprot_);
+      iprot_->readMessageEnd();
+      iprot_->getTransport()->readEnd();
+
+      if (result.__isset.success) {
+        // _return pointer has now been filled
+        sentry.commit();
+        return;
+      }
+      if (result.__isset.ire) {
+        sentry.commit();
+        throw result.ire;
+      }
+      if (result.__isset.ace) {
+        sentry.commit();
+        throw result.ace;
+      }
+      if (result.__isset.ase) {
+        sentry.commit();
+        throw result.ase;
+      }
+      if (result.__isset.ae) {
+        sentry.commit();
+        throw result.ae;
+      }
+      // in a bad state, don't commit
+      throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "copyDataResource failed: unknown result");
+    }
+    // seqid != rseqid
+    this->sync_.updatePending(fname, mtype, rseqid);
+
+    // this will temporarily unlock the readMutex, and let other clients get work done
+    this->sync_.waitForWork(seqid);
+  } // end while(true)
+}
+
 }}} // namespace
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
index 9d9df84..5a4d1e4 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
@@ -2284,6 +2284,7 @@ class AiravataIf {
   virtual void updateDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const  ::apache::airavata::model::data::resource::DataResourceModel& dataResourceModel) = 0;
   virtual void removeDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId) = 0;
   virtual void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId) = 0;
+  virtual void copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) = 0;
 };
 
 class AiravataIfFactory {
@@ -2763,6 +2764,9 @@ class AiravataNull : virtual public AiravataIf {
   void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& /* _return */, const  ::apache::airavata::model::security::AuthzToken& /* authzToken */, const std::string& /* resourceId */) {
     return;
   }
+  void copyDataResource(std::string& /* _return */, const  ::apache::airavata::model::security::AuthzToken& /* authzToken */, const std::string& /* resourceId */, const std::string& /* destStorageResourceId */, const std::string& /* destinationParentPath */) {
+    return;
+  }
 };
 
 
@@ -21893,6 +21897,154 @@ class Airavata_getDataResource_presult {
 
 };
 
+
+class Airavata_copyDataResource_args {
+ public:
+
+  Airavata_copyDataResource_args(const Airavata_copyDataResource_args&);
+  Airavata_copyDataResource_args& operator=(const Airavata_copyDataResource_args&);
+  Airavata_copyDataResource_args() : resourceId(), destStorageResourceId(), destinationParentPath() {
+  }
+
+  virtual ~Airavata_copyDataResource_args() throw();
+   ::apache::airavata::model::security::AuthzToken authzToken;
+  std::string resourceId;
+  std::string destStorageResourceId;
+  std::string destinationParentPath;
+
+  void __set_authzToken(const  ::apache::airavata::model::security::AuthzToken& val);
+
+  void __set_resourceId(const std::string& val);
+
+  void __set_destStorageResourceId(const std::string& val);
+
+  void __set_destinationParentPath(const std::string& val);
+
+  bool operator == (const Airavata_copyDataResource_args & rhs) const
+  {
+    if (!(authzToken == rhs.authzToken))
+      return false;
+    if (!(resourceId == rhs.resourceId))
+      return false;
+    if (!(destStorageResourceId == rhs.destStorageResourceId))
+      return false;
+    if (!(destinationParentPath == rhs.destinationParentPath))
+      return false;
+    return true;
+  }
+  bool operator != (const Airavata_copyDataResource_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const Airavata_copyDataResource_args & ) const;
+
+  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+
+class Airavata_copyDataResource_pargs {
+ public:
+
+
+  virtual ~Airavata_copyDataResource_pargs() throw();
+  const  ::apache::airavata::model::security::AuthzToken* authzToken;
+  const std::string* resourceId;
+  const std::string* destStorageResourceId;
+  const std::string* destinationParentPath;
+
+  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _Airavata_copyDataResource_result__isset {
+  _Airavata_copyDataResource_result__isset() : success(false), ire(false), ace(false), ase(false), ae(false) {}
+  bool success :1;
+  bool ire :1;
+  bool ace :1;
+  bool ase :1;
+  bool ae :1;
+} _Airavata_copyDataResource_result__isset;
+
+class Airavata_copyDataResource_result {
+ public:
+
+  Airavata_copyDataResource_result(const Airavata_copyDataResource_result&);
+  Airavata_copyDataResource_result& operator=(const Airavata_copyDataResource_result&);
+  Airavata_copyDataResource_result() : success() {
+  }
+
+  virtual ~Airavata_copyDataResource_result() throw();
+  std::string success;
+   ::apache::airavata::api::error::InvalidRequestException ire;
+   ::apache::airavata::api::error::AiravataClientException ace;
+   ::apache::airavata::api::error::AiravataSystemException ase;
+   ::apache::airavata::api::error::AuthorizationException ae;
+
+  _Airavata_copyDataResource_result__isset __isset;
+
+  void __set_success(const std::string& val);
+
+  void __set_ire(const  ::apache::airavata::api::error::InvalidRequestException& val);
+
+  void __set_ace(const  ::apache::airavata::api::error::AiravataClientException& val);
+
+  void __set_ase(const  ::apache::airavata::api::error::AiravataSystemException& val);
+
+  void __set_ae(const  ::apache::airavata::api::error::AuthorizationException& val);
+
+  bool operator == (const Airavata_copyDataResource_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    if (!(ire == rhs.ire))
+      return false;
+    if (!(ace == rhs.ace))
+      return false;
+    if (!(ase == rhs.ase))
+      return false;
+    if (!(ae == rhs.ae))
+      return false;
+    return true;
+  }
+  bool operator != (const Airavata_copyDataResource_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const Airavata_copyDataResource_result & ) const;
+
+  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _Airavata_copyDataResource_presult__isset {
+  _Airavata_copyDataResource_presult__isset() : success(false), ire(false), ace(false), ase(false), ae(false) {}
+  bool success :1;
+  bool ire :1;
+  bool ace :1;
+  bool ase :1;
+  bool ae :1;
+} _Airavata_copyDataResource_presult__isset;
+
+class Airavata_copyDataResource_presult {
+ public:
+
+
+  virtual ~Airavata_copyDataResource_presult() throw();
+  std::string* success;
+   ::apache::airavata::api::error::InvalidRequestException ire;
+   ::apache::airavata::api::error::AiravataClientException ace;
+   ::apache::airavata::api::error::AiravataSystemException ase;
+   ::apache::airavata::api::error::AuthorizationException ae;
+
+  _Airavata_copyDataResource_presult__isset __isset;
+
+  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+
+};
+
 class AiravataClient : virtual public AiravataIf {
  public:
   AiravataClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
@@ -22326,6 +22478,9 @@ class AiravataClient : virtual public AiravataIf {
   void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId);
   void send_getDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId);
   void recv_getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return);
+  void copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath);
+  void send_copyDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath);
+  void recv_copyDataResource(std::string& _return);
  protected:
   boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
   boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
@@ -22477,6 +22632,7 @@ class AiravataProcessor : public ::apache::thrift::TDispatchProcessor {
   void process_updateDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_removeDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_getDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
+  void process_copyDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
  public:
   AiravataProcessor(boost::shared_ptr<AiravataIf> iface) :
     iface_(iface) {
@@ -22616,6 +22772,7 @@ class AiravataProcessor : public ::apache::thrift::TDispatchProcessor {
     processMap_["updateDataResource"] = &AiravataProcessor::process_updateDataResource;
     processMap_["removeDataResource"] = &AiravataProcessor::process_removeDataResource;
     processMap_["getDataResource"] = &AiravataProcessor::process_getDataResource;
+    processMap_["copyDataResource"] = &AiravataProcessor::process_copyDataResource;
   }
 
   virtual ~AiravataProcessor() {}
@@ -23951,6 +24108,16 @@ class AiravataMultiface : virtual public AiravataIf {
     return;
   }
 
+  void copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) {
+    size_t sz = ifaces_.size();
+    size_t i = 0;
+    for (; i < (sz - 1); ++i) {
+      ifaces_[i]->copyDataResource(_return, authzToken, resourceId, destStorageResourceId, destinationParentPath);
+    }
+    ifaces_[i]->copyDataResource(_return, authzToken, resourceId, destStorageResourceId, destinationParentPath);
+    return;
+  }
+
 };
 
 // The 'concurrent' client is a thread safe client that correctly handles
@@ -24389,6 +24556,9 @@ class AiravataConcurrentClient : virtual public AiravataIf {
   void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId);
   int32_t send_getDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId);
   void recv_getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const int32_t seqid);
+  void copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath);
+  int32_t send_copyDataResource(const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath);
+  void recv_copyDataResource(std::string& _return, const int32_t seqid);
  protected:
   boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
   boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
index 4be84d3..38db54e 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
@@ -2715,6 +2715,11 @@ class AiravataHandler : virtual public AiravataIf {
     printf("getDataResource\n");
   }
 
+  void copyDataResource(std::string& _return, const  ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) {
+    // Your implementation goes here
+    printf("copyDataResource\n");
+  }
+
 };
 
 int main(int argc, char **argv) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
index bcdeb0b..4cc073b 100644
--- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
@@ -3164,6 +3164,18 @@ interface AiravataIf {
    * @throws \Airavata\API\Error\AuthorizationException
    */
   public function getDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $resourceId
+   * @param string $destStorageResourceId
+   * @param string $destinationParentPath
+   * @return string
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -11973,6 +11985,72 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("getDataResource failed: unknown result");
   }
 
+  public function copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath)
+  {
+    $this->send_copyDataResource($authzToken, $resourceId, $destStorageResourceId, $destinationParentPath);
+    return $this->recv_copyDataResource();
+  }
+
+  public function send_copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath)
+  {
+    $args = new \Airavata\API\Airavata_copyDataResource_args();
+    $args->authzToken = $authzToken;
+    $args->resourceId = $resourceId;
+    $args->destStorageResourceId = $destStorageResourceId;
+    $args->destinationParentPath = $destinationParentPath;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'copyDataResource', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('copyDataResource', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_copyDataResource()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_copyDataResource_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_copyDataResource_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("copyDataResource failed: unknown result");
+  }
+
 }
 
 // HELPER FUNCTIONS AND STRUCTURES
@@ -53585,4 +53663,328 @@ class Airavata_getDataResource_result {
 
 }
 
+class Airavata_copyDataResource_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $resourceId = null;
+  /**
+   * @var string
+   */
+  public $destStorageResourceId = null;
+  /**
+   * @var string
+   */
+  public $destinationParentPath = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'resourceId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'destStorageResourceId',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'destinationParentPath',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['resourceId'])) {
+        $this->resourceId = $vals['resourceId'];
+      }
+      if (isset($vals['destStorageResourceId'])) {
+        $this->destStorageResourceId = $vals['destStorageResourceId'];
+      }
+      if (isset($vals['destinationParentPath'])) {
+        $this->destinationParentPath = $vals['destinationParentPath'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_copyDataResource_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->resourceId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->destStorageResourceId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->destinationParentPath);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_copyDataResource_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->resourceId !== null) {
+      $xfer += $output->writeFieldBegin('resourceId', TType::STRING, 2);
+      $xfer += $output->writeString($this->resourceId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->destStorageResourceId !== null) {
+      $xfer += $output->writeFieldBegin('destStorageResourceId', TType::STRING, 3);
+      $xfer += $output->writeString($this->destStorageResourceId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->destinationParentPath !== null) {
+      $xfer += $output->writeFieldBegin('destinationParentPath', TType::STRING, 4);
+      $xfer += $output->writeString($this->destinationParentPath);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_copyDataResource_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        3 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        4 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_copyDataResource_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_copyDataResource_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote
index 5c82656..0d08767 100755
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote
@@ -160,6 +160,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
   print('  void updateDataResource(AuthzToken authzToken, DataResourceModel dataResourceModel)')
   print('  void removeDataResource(AuthzToken authzToken, string resourceId)')
   print('  DataResourceModel getDataResource(AuthzToken authzToken, string resourceId)')
+  print('  string copyDataResource(AuthzToken authzToken, string resourceId, string destStorageResourceId, string destinationParentPath)')
   print('')
   sys.exit(0)
 
@@ -1032,6 +1033,12 @@ elif cmd == 'getDataResource':
     sys.exit(1)
   pp.pprint(client.getDataResource(eval(args[0]),args[1],))
 
+elif cmd == 'copyDataResource':
+  if len(args) != 4:
+    print('copyDataResource requires 4 args')
+    sys.exit(1)
+  pp.pprint(client.copyDataResource(eval(args[0]),args[1],args[2],args[3],))
+
 else:
   print('Unrecognized method %s' % cmd)
   sys.exit(1)

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
index 1ff70ac..81d711f 100644
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
@@ -2658,6 +2658,16 @@ class Iface:
     """
     pass
 
+  def copyDataResource(self, authzToken, resourceId, destStorageResourceId, destinationParentPath):
+    """
+    Parameters:
+     - authzToken
+     - resourceId
+     - destStorageResourceId
+     - destinationParentPath
+    """
+    pass
+
 
 class Client(Iface):
   def __init__(self, iprot, oprot=None):
@@ -9891,6 +9901,51 @@ class Client(Iface):
       raise result.ae
     raise TApplicationException(TApplicationException.MISSING_RESULT, "getDataResource failed: unknown result")
 
+  def copyDataResource(self, authzToken, resourceId, destStorageResourceId, destinationParentPath):
+    """
+    Parameters:
+     - authzToken
+     - resourceId
+     - destStorageResourceId
+     - destinationParentPath
+    """
+    self.send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath)
+    return self.recv_copyDataResource()
+
+  def send_copyDataResource(self, authzToken, resourceId, destStorageResourceId, destinationParentPath):
+    self._oprot.writeMessageBegin('copyDataResource', TMessageType.CALL, self._seqid)
+    args = copyDataResource_args()
+    args.authzToken = authzToken
+    args.resourceId = resourceId
+    args.destStorageResourceId = destStorageResourceId
+    args.destinationParentPath = destinationParentPath
+    args.write(self._oprot)
+    self._oprot.writeMessageEnd()
+    self._oprot.trans.flush()
+
+  def recv_copyDataResource(self):
+    iprot = self._iprot
+    (fname, mtype, rseqid) = iprot.readMessageBegin()
+    if mtype == TMessageType.EXCEPTION:
+      x = TApplicationException()
+      x.read(iprot)
+      iprot.readMessageEnd()
+      raise x
+    result = copyDataResource_result()
+    result.read(iprot)
+    iprot.readMessageEnd()
+    if result.success is not None:
+      return result.success
+    if result.ire is not None:
+      raise result.ire
+    if result.ace is not None:
+      raise result.ace
+    if result.ase is not None:
+      raise result.ase
+    if result.ae is not None:
+      raise result.ae
+    raise TApplicationException(TApplicationException.MISSING_RESULT, "copyDataResource failed: unknown result")
+
 
 class Processor(Iface, TProcessor):
   def __init__(self, handler):
@@ -10032,6 +10087,7 @@ class Processor(Iface, TProcessor):
     self._processMap["updateDataResource"] = Processor.process_updateDataResource
     self._processMap["removeDataResource"] = Processor.process_removeDataResource
     self._processMap["getDataResource"] = Processor.process_getDataResource
+    self._processMap["copyDataResource"] = Processor.process_copyDataResource
 
   def process(self, iprot, oprot):
     (name, type, seqid) = iprot.readMessageBegin()
@@ -14279,6 +14335,37 @@ class Processor(Iface, TProcessor):
     oprot.writeMessageEnd()
     oprot.trans.flush()
 
+  def process_copyDataResource(self, seqid, iprot, oprot):
+    args = copyDataResource_args()
+    args.read(iprot)
+    iprot.readMessageEnd()
+    result = copyDataResource_result()
+    try:
+      result.success = self._handler.copyDataResource(args.authzToken, args.resourceId, args.destStorageResourceId, args.destinationParentPath)
+      msg_type = TMessageType.REPLY
+    except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
+      raise
+    except apache.airavata.api.error.ttypes.InvalidRequestException as ire:
+      msg_type = TMessageType.REPLY
+      result.ire = ire
+    except apache.airavata.api.error.ttypes.AiravataClientException as ace:
+      msg_type = TMessageType.REPLY
+      result.ace = ace
+    except apache.airavata.api.error.ttypes.AiravataSystemException as ase:
+      msg_type = TMessageType.REPLY
+      result.ase = ase
+    except apache.airavata.api.error.ttypes.AuthorizationException as ae:
+      msg_type = TMessageType.REPLY
+      result.ae = ae
+    except Exception as ex:
+      msg_type = TMessageType.EXCEPTION
+      logging.exception(ex)
+      result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
+    oprot.writeMessageBegin("copyDataResource", msg_type, seqid)
+    result.write(oprot)
+    oprot.writeMessageEnd()
+    oprot.trans.flush()
+
 
 # HELPER FUNCTIONS AND STRUCTURES
 
@@ -43863,3 +43950,236 @@ class getDataResource_result:
 
   def __ne__(self, other):
     return not (self == other)
+
+class copyDataResource_args:
+  """
+  Attributes:
+   - authzToken
+   - resourceId
+   - destStorageResourceId
+   - destinationParentPath
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRUCT, 'authzToken', (apache.airavata.model.security.ttypes.AuthzToken, apache.airavata.model.security.ttypes.AuthzToken.thrift_spec), None, ), # 1
+    (2, TType.STRING, 'resourceId', None, None, ), # 2
+    (3, TType.STRING, 'destStorageResourceId', None, None, ), # 3
+    (4, TType.STRING, 'destinationParentPath', None, None, ), # 4
+  )
+
+  def __init__(self, authzToken=None, resourceId=None, destStorageResourceId=None, destinationParentPath=None,):
+    self.authzToken = authzToken
+    self.resourceId = resourceId
+    self.destStorageResourceId = destStorageResourceId
+    self.destinationParentPath = destinationParentPath
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRUCT:
+          self.authzToken = apache.airavata.model.security.ttypes.AuthzToken()
+          self.authzToken.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.STRING:
+          self.resourceId = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      elif fid == 3:
+        if ftype == TType.STRING:
+          self.destStorageResourceId = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      elif fid == 4:
+        if ftype == TType.STRING:
+          self.destinationParentPath = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('copyDataResource_args')
+    if self.authzToken is not None:
+      oprot.writeFieldBegin('authzToken', TType.STRUCT, 1)
+      self.authzToken.write(oprot)
+      oprot.writeFieldEnd()
+    if self.resourceId is not None:
+      oprot.writeFieldBegin('resourceId', TType.STRING, 2)
+      oprot.writeString(self.resourceId)
+      oprot.writeFieldEnd()
+    if self.destStorageResourceId is not None:
+      oprot.writeFieldBegin('destStorageResourceId', TType.STRING, 3)
+      oprot.writeString(self.destStorageResourceId)
+      oprot.writeFieldEnd()
+    if self.destinationParentPath is not None:
+      oprot.writeFieldBegin('destinationParentPath', TType.STRING, 4)
+      oprot.writeString(self.destinationParentPath)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    if self.authzToken is None:
+      raise TProtocol.TProtocolException(message='Required field authzToken is unset!')
+    if self.resourceId is None:
+      raise TProtocol.TProtocolException(message='Required field resourceId is unset!')
+    if self.destStorageResourceId is None:
+      raise TProtocol.TProtocolException(message='Required field destStorageResourceId is unset!')
+    if self.destinationParentPath is None:
+      raise TProtocol.TProtocolException(message='Required field destinationParentPath is unset!')
+    return
+
+
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.authzToken)
+    value = (value * 31) ^ hash(self.resourceId)
+    value = (value * 31) ^ hash(self.destStorageResourceId)
+    value = (value * 31) ^ hash(self.destinationParentPath)
+    return value
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class copyDataResource_result:
+  """
+  Attributes:
+   - success
+   - ire
+   - ace
+   - ase
+   - ae
+  """
+
+  thrift_spec = (
+    (0, TType.STRING, 'success', None, None, ), # 0
+    (1, TType.STRUCT, 'ire', (apache.airavata.api.error.ttypes.InvalidRequestException, apache.airavata.api.error.ttypes.InvalidRequestException.thrift_spec), None, ), # 1
+    (2, TType.STRUCT, 'ace', (apache.airavata.api.error.ttypes.AiravataClientException, apache.airavata.api.error.ttypes.AiravataClientException.thrift_spec), None, ), # 2
+    (3, TType.STRUCT, 'ase', (apache.airavata.api.error.ttypes.AiravataSystemException, apache.airavata.api.error.ttypes.AiravataSystemException.thrift_spec), None, ), # 3
+    (4, TType.STRUCT, 'ae', (apache.airavata.api.error.ttypes.AuthorizationException, apache.airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ), # 4
+  )
+
+  def __init__(self, success=None, ire=None, ace=None, ase=None, ae=None,):
+    self.success = success
+    self.ire = ire
+    self.ace = ace
+    self.ase = ase
+    self.ae = ae
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 0:
+        if ftype == TType.STRING:
+          self.success = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      elif fid == 1:
+        if ftype == TType.STRUCT:
+          self.ire = apache.airavata.api.error.ttypes.InvalidRequestException()
+          self.ire.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.STRUCT:
+          self.ace = apache.airavata.api.error.ttypes.AiravataClientException()
+          self.ace.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 3:
+        if ftype == TType.STRUCT:
+          self.ase = apache.airavata.api.error.ttypes.AiravataSystemException()
+          self.ase.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 4:
+        if ftype == TType.STRUCT:
+          self.ae = apache.airavata.api.error.ttypes.AuthorizationException()
+          self.ae.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('copyDataResource_result')
+    if self.success is not None:
+      oprot.writeFieldBegin('success', TType.STRING, 0)
+      oprot.writeString(self.success)
+      oprot.writeFieldEnd()
+    if self.ire is not None:
+      oprot.writeFieldBegin('ire', TType.STRUCT, 1)
+      self.ire.write(oprot)
+      oprot.writeFieldEnd()
+    if self.ace is not None:
+      oprot.writeFieldBegin('ace', TType.STRUCT, 2)
+      self.ace.write(oprot)
+      oprot.writeFieldEnd()
+    if self.ase is not None:
+      oprot.writeFieldBegin('ase', TType.STRUCT, 3)
+      self.ase.write(oprot)
+      oprot.writeFieldEnd()
+    if self.ae is not None:
+      oprot.writeFieldBegin('ae', TType.STRUCT, 4)
+      self.ae.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.success)
+    value = (value * 31) ^ hash(self.ire)
+    value = (value * 31) ^ hash(self.ace)
+    value = (value * 31) ^ hash(self.ase)
+    value = (value * 31) ^ hash(self.ae)
+    return value
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java
deleted file mode 100644
index b11548e..0000000
--- a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java
+++ /dev/null
@@ -1,34 +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.data.catalog.core;
-
-import org.apache.airavata.data.catalog.cpi.DataManager;
-import org.apache.airavata.data.catalog.cpi.DataManagerException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataManagerFactory {
-    private final static Logger logger = LoggerFactory.getLogger(DataManagerFactory.class);
-
-    public static DataManager getDataManager() throws DataManagerException {
-        return new DataManagerImpl();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java
deleted file mode 100644
index d54479d..0000000
--- a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java
+++ /dev/null
@@ -1,207 +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.data.catalog.core;
-
-import org.apache.airavata.model.data.resource.DataReplicaLocationModel;
-import org.apache.airavata.model.data.resource.DataResourceModel;
-import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.DataCatalog;
-import org.apache.airavata.registry.cpi.DataCatalogException;
-
-import org.apache.airavata.data.catalog.cpi.DataManager;
-import org.apache.airavata.data.catalog.cpi.DataManagerException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class DataManagerImpl implements DataManager {
-    private final static Logger logger = LoggerFactory.getLogger(DataManagerImpl.class);
-
-    private final DataCatalog dataCatalog;
-
-    public DataManagerImpl() throws DataManagerException {
-        try {
-            this.dataCatalog = RegistryFactory.getDataCatalog();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    public DataManagerImpl(DataCatalog dataCatalog){
-        this.dataCatalog = dataCatalog;
-    }
-
-    /**
-     * To create a replica entry for an already existing file(s). This is how the system comes to know about already
-     * existing resources
-     * @param dataResourceModel
-     * @return
-     */
-    @Override
-    public String registerResource(DataResourceModel dataResourceModel) throws DataManagerException {
-        try {
-            String resourceId = dataCatalog.publishResource(dataResourceModel);
-            return resourceId;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To remove a resource entry from the replica catalog
-     * @param resourceId
-     * @return
-     */
-    @Override
-    public boolean removeResource(String resourceId) throws DataManagerException {
-        try {
-            boolean result = dataCatalog.removeResource(resourceId);
-            return result;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To update an existing data resource model
-     * @param dataResourceModel
-     * @return
-     * @throws DataCatalogException
-     */
-    @Override
-    public boolean updateResource(DataResourceModel dataResourceModel) throws DataManagerException {
-        try {
-            boolean result = dataCatalog.updateResource(dataResourceModel);
-            return result;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To retrieve a resource object providing the resourceId
-     * @param resourceId
-     * @return
-     */
-    @Override
-    public DataResourceModel getResource(String resourceId) throws DataManagerException {
-        try {
-            DataResourceModel dataResource = dataCatalog.getResource(resourceId);
-            return dataResource;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To create a new data replica location. This is how the system comes to know about already
-     * existing resources
-     *
-     * @param dataReplicaLocationModel
-     * @return
-     */
-    @Override
-    public String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException {
-        try {
-            String replicaId = dataCatalog.publishReplicaLocation(dataReplicaLocationModel);
-            return replicaId;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To remove a replica entry from the replica catalog
-     *
-     * @param replicaId
-     * @return
-     */
-    @Override
-    public boolean removeReplicaLocation(String replicaId) throws DataManagerException {
-        try {
-            boolean result = dataCatalog.removeReplicaLocation(replicaId);
-            return result;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To update an existing data replica model
-     *
-     * @param dataReplicaLocationModel
-     * @return
-     * @throws DataCatalogException
-     */
-    @Override
-    public boolean updateReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException {
-        try {
-            boolean result = dataCatalog.updateReplicaLocation(dataReplicaLocationModel);
-            return result;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To retrieve a replica object providing the replicaId
-     *
-     * @param replicaId
-     * @return
-     */
-    @Override
-    public DataReplicaLocationModel getReplicaLocation(String replicaId) throws DataManagerException {
-        try {
-            DataReplicaLocationModel dataReplicaLocationModel = dataCatalog.getReplicaLocation(replicaId);
-            return dataReplicaLocationModel;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-
-    /**
-     * To retrieve all the replica entries for a given resource id
-     *
-     * @param resourceId
-     * @return
-     * @throws DataCatalogException
-     */
-    @Override
-    public List<DataReplicaLocationModel> getAllReplicaLocations(String resourceId) throws DataManagerException {
-        try {
-            List<DataReplicaLocationModel> dataReplicaLocationModelList = dataCatalog.getAllReplicaLocations(resourceId);
-            return dataReplicaLocationModelList;
-        } catch (DataCatalogException e) {
-            logger.error(e.getMessage(), e);
-            throw new DataManagerException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java
new file mode 100644
index 0000000..cd92146
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.data.manager.core;
+
+import org.apache.airavata.data.manager.cpi.DataManager;
+import org.apache.airavata.data.manager.cpi.DataManagerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataManagerFactory {
+    private final static Logger logger = LoggerFactory.getLogger(DataManagerFactory.class);
+
+    public static DataManager getDataManager() throws DataManagerException {
+        return new DataManagerImpl();
+    }
+}
\ No newline at end of file


[2/5] airavata git commit: adding data mover code to data manager

Posted by sc...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
new file mode 100644
index 0000000..4b79af1
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
@@ -0,0 +1,393 @@
+/*
+ *
+ * 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.data.manager.core;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.client.CredentialStoreClientFactory;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.credential.store.datamodel.SSHCredential;
+import org.apache.airavata.credential.store.exception.CredentialStoreException;
+import org.apache.airavata.data.manager.core.ssh.SSHUtils;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
+import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
+import org.apache.airavata.model.data.movement.DataMovementInterface;
+import org.apache.airavata.model.data.movement.DataMovementProtocol;
+import org.apache.airavata.model.data.movement.SCPDataMovement;
+import org.apache.airavata.model.data.resource.DataReplicaLocationModel;
+import org.apache.airavata.model.data.resource.DataResourceModel;
+import org.apache.airavata.model.data.resource.DataResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.DataCatalog;
+import org.apache.airavata.registry.cpi.DataCatalogException;
+
+import org.apache.airavata.data.manager.cpi.DataManager;
+import org.apache.airavata.data.manager.cpi.DataManagerException;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+public class DataManagerImpl implements DataManager {
+    private final static Logger logger = LoggerFactory.getLogger(DataManagerImpl.class);
+
+    private final AppCatalog appCatalog;
+    private final DataCatalog dataCatalog;
+
+    public DataManagerImpl() throws DataManagerException {
+        try {
+            this.appCatalog = RegistryFactory.getAppCatalog();
+            this.dataCatalog = RegistryFactory.getDataCatalog();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    public DataManagerImpl(AppCatalog appCatalog, DataCatalog dataCatalog){
+        this.appCatalog = appCatalog;
+        this.dataCatalog = dataCatalog;
+    }
+
+    /**
+     * To create a replica entry for an already existing file(s). This is how the system comes to know about already
+     * existing resources
+     * @param dataResourceModel
+     * @return
+     */
+    @Override
+    public String registerResource(DataResourceModel dataResourceModel) throws DataManagerException {
+        try {
+            String resourceId = dataCatalog.publishResource(dataResourceModel);
+            return resourceId;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To remove a resource entry from the replica catalog
+     * @param resourceId
+     * @return
+     */
+    @Override
+    public boolean removeResource(String resourceId) throws DataManagerException {
+        try {
+            boolean result = dataCatalog.removeResource(resourceId);
+            return result;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To update an existing data resource model
+     * @param dataResourceModel
+     * @return
+     * @throws DataCatalogException
+     */
+    @Override
+    public boolean updateResource(DataResourceModel dataResourceModel) throws DataManagerException {
+        try {
+            boolean result = dataCatalog.updateResource(dataResourceModel);
+            return result;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To retrieve a resource object providing the resourceId
+     * @param resourceId
+     * @return
+     */
+    @Override
+    public DataResourceModel getResource(String resourceId) throws DataManagerException {
+        try {
+            DataResourceModel dataResource = dataCatalog.getResource(resourceId);
+            return dataResource;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To create a new data replica location. This is how the system comes to know about already
+     * existing resources
+     *
+     * @param dataReplicaLocationModel
+     * @return
+     */
+    @Override
+    public String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException {
+        try {
+            String replicaId = dataCatalog.publishReplicaLocation(dataReplicaLocationModel);
+            return replicaId;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To remove a replica entry from the replica catalog
+     *
+     * @param replicaId
+     * @return
+     */
+    @Override
+    public boolean removeReplicaLocation(String replicaId) throws DataManagerException {
+        try {
+            boolean result = dataCatalog.removeReplicaLocation(replicaId);
+            return result;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To update an existing data replica model
+     *
+     * @param dataReplicaLocationModel
+     * @return
+     * @throws DataCatalogException
+     */
+    @Override
+    public boolean updateReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException {
+        try {
+            boolean result = dataCatalog.updateReplicaLocation(dataReplicaLocationModel);
+            return result;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To retrieve a replica object providing the replicaId
+     *
+     * @param replicaId
+     * @return
+     */
+    @Override
+    public DataReplicaLocationModel getReplicaLocation(String replicaId) throws DataManagerException {
+        try {
+            DataReplicaLocationModel dataReplicaLocationModel = dataCatalog.getReplicaLocation(replicaId);
+            return dataReplicaLocationModel;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * To retrieve all the replica entries for a given resource id
+     *
+     * @param resourceId
+     * @return
+     * @throws DataCatalogException
+     */
+    @Override
+    public List<DataReplicaLocationModel> getAllReplicaLocations(String resourceId) throws DataManagerException {
+        try {
+            List<DataReplicaLocationModel> dataReplicaLocationModelList = dataCatalog.getAllReplicaLocations(resourceId);
+            return dataReplicaLocationModelList;
+        } catch (DataCatalogException e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * API method to copy a resource to the provided destination storage resource. Only resources of type FILE can be
+     * copied using this API method.
+     *
+     * @param dataResourceId
+     * @param destStorageResourceId
+     * @param destinationParentPath
+     * @return
+     */
+    @Override
+    public String copyResource(String dataResourceId, String destStorageResourceId, String destinationParentPath) throws DataManagerException {
+        try {
+            DataResourceModel dataResourceModel = dataCatalog.getResource(dataResourceId);
+            if(dataResourceModel.getDataResourceType() != DataResourceType.FILE)
+                throw new DataCatalogException("Only resources of type FILE can be transferred using this method");
+
+            StorageResourceDescription destinationStorageResource = appCatalog.getStorageResource()
+                    .getStorageResource(destStorageResourceId);
+            if(destinationStorageResource == null)
+                throw new DataCatalogException("Invalid destination storage resource id");
+
+            List<DataReplicaLocationModel> replicaLocationModels = dataResourceModel.getReplicaLocations();
+            if(replicaLocationModels == null || replicaLocationModels.size() == 0)
+                throw new DataCatalogException("No replicas available for the given data resource");
+            //FIXME This should be an intelligent selection
+            DataReplicaLocationModel sourceReplica = replicaLocationModels.get(0);
+
+            StorageResourceDescription sourceStorageResource = appCatalog.getStorageResource()
+                    .getStorageResource(sourceReplica.getStorageResourceId());
+            if(sourceStorageResource == null)
+                throw new DataCatalogException("Cannot find storage resource of the source replica");
+
+            //FIXME Currently we support only SCP data movement protocol
+            List<DataMovementInterface> sourceDataMovementInterfaces = sourceStorageResource.getDataMovementInterfaces();
+            Optional<DataMovementInterface> sourceDataMovementInterface = sourceDataMovementInterfaces.stream()
+                    .filter(dmi -> dmi.getDataMovementProtocol() == DataMovementProtocol.SCP).findFirst();
+            if(!sourceDataMovementInterface.isPresent())
+                throw new DataCatalogException("No matching DMI found for source storage resource");
+            List<DataMovementInterface> destDataMovementInterfaces = destinationStorageResource.getDataMovementInterfaces();
+            Optional<DataMovementInterface> destDataMovementInterface = destDataMovementInterfaces.stream()
+                    .filter(dmi -> dmi.getDataMovementProtocol() == DataMovementProtocol.SCP).findFirst();
+            if(!destDataMovementInterface.isPresent())
+                throw new DataCatalogException("No matching DMI found for destination storage resource");
+
+            //Finding the gateway specific storage preferences for resources
+            GatewayResourceProfile gatewayProfile = appCatalog.getGatewayProfile().getGatewayProfile(dataResourceModel.getGatewayId());
+            List<StoragePreference> storagePreferences = gatewayProfile.getStoragePreferences();
+            Optional<StoragePreference> sourceResourcePreference = storagePreferences.stream()
+                    .filter(sp -> sp.getStorageResourceId() == sourceStorageResource.getStorageResourceId()).findFirst();
+            if(!sourceResourcePreference.isPresent())
+                throw new DataCatalogException("Could not find storage preference for storage resource id:"
+                        + sourceStorageResource.getStorageResourceId());
+            Optional<StoragePreference> destResourcePreference = storagePreferences.stream()
+                    .filter(sp -> sp.getStorageResourceId() == destinationStorageResource.getStorageResourceId()).findFirst();
+            if(!destResourcePreference.isPresent())
+                throw new DataCatalogException("Could not find storage preference for storage resource id:"
+                        + destinationStorageResource.getStorageResourceId());
+
+
+            String destFilePath = copyUsingScp(gatewayProfile, sourceStorageResource, sourceDataMovementInterface.get(),
+                    sourceResourcePreference.get(), sourceReplica, destinationStorageResource, destDataMovementInterface.get(),
+                    destResourcePreference.get(), destinationParentPath);
+
+            DataReplicaLocationModel dataReplicaLocationModel = new DataReplicaLocationModel();
+            dataReplicaLocationModel.setResourceId(dataResourceId);
+            dataReplicaLocationModel.setFileAbsolutePath(destFilePath);
+            String replicaId = this.registerReplicaLocation(dataReplicaLocationModel);
+            return replicaId;
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new DataManagerException(e);
+        }
+    }
+
+    /**
+     * This method copies the provided source replica to the destination storage resource and returns the absolute file path
+     * of the destination file. This method uses the credential store service to fetch required credentials for talking to
+     * storage resources
+     *
+     * @param gatewayProfile
+     * @param sourceStorageResource
+     * @param sourceDataMovementInterface
+     * @param sourceResourcePreference
+     * @param sourceReplica
+     * @param destStorageResource
+     * @param destDataMovementInterface
+     * @param destResourcePreference
+     * @param destinationParentPath
+     * @return
+     * @throws TException
+     * @throws ApplicationSettingsException
+     * @throws AppCatalogException
+     * @throws JSchException
+     * @throws IOException
+     */
+    private String copyUsingScp(GatewayResourceProfile gatewayProfile, StorageResourceDescription sourceStorageResource,
+                              DataMovementInterface sourceDataMovementInterface, StoragePreference sourceResourcePreference,
+                              DataReplicaLocationModel sourceReplica, StorageResourceDescription destStorageResource,
+                              DataMovementInterface destDataMovementInterface, StoragePreference destResourcePreference,
+                              String destinationParentPath)
+            throws TException, ApplicationSettingsException, AppCatalogException, JSchException, IOException {
+        //Creating JSch sessions
+        //Source session
+        CredentialStoreService.Client credentialStoreServiceClient = getCredentialStoreServiceClient();
+        String sourceHostName =  sourceStorageResource.getHostName();
+        SCPDataMovement sourceSCPDMI = appCatalog.getComputeResource().getSCPDataMovement(sourceDataMovementInterface.getDataMovementInterfaceId());
+        int sourcePort = sourceSCPDMI.getSshPort();
+        String sourceLoginUserName = sourceResourcePreference.getLoginUserName();
+        JSch sourceJSch = new JSch();
+        String sourceCredentialStoreToken;
+        if(sourceResourcePreference.getResourceSpecificCredentialStoreToken() != null
+                && !sourceResourcePreference.getResourceSpecificCredentialStoreToken().isEmpty()){
+            sourceCredentialStoreToken = sourceResourcePreference.getResourceSpecificCredentialStoreToken();
+        }else{
+            sourceCredentialStoreToken = gatewayProfile.getCredentialStoreToken();
+        }
+        SSHCredential sourceSshCredential = credentialStoreServiceClient.getSSHCredential(sourceCredentialStoreToken,
+                gatewayProfile.getGatewayID());
+        sourceJSch.addIdentity(sourceSshCredential.getPrivateKey(), sourceSshCredential.getPublicKey(), sourceSshCredential.
+                getPassphrase().getBytes());
+        Session sourceSession = sourceJSch.getSession(sourceLoginUserName, sourceHostName, sourcePort);
+        String sourceFilePath = sourceReplica.getFileAbsolutePath();
+
+        //Destination session
+        String destHostName =  destStorageResource.getHostName();
+        SCPDataMovement destSCPDMI = appCatalog.getComputeResource().getSCPDataMovement(destDataMovementInterface
+                .getDataMovementInterfaceId());
+        int destPort = destSCPDMI.getSshPort();
+        String destLoginUserName = sourceResourcePreference.getLoginUserName();
+        JSch destJSch = new JSch();
+        String destCredentialStoreToken;
+        if(destResourcePreference.getResourceSpecificCredentialStoreToken() != null
+                && !destResourcePreference.getResourceSpecificCredentialStoreToken().isEmpty()){
+            destCredentialStoreToken = destResourcePreference.getResourceSpecificCredentialStoreToken();
+        }else{
+            destCredentialStoreToken = gatewayProfile.getCredentialStoreToken();
+        }
+        SSHCredential destSshCredential = credentialStoreServiceClient.getSSHCredential(destCredentialStoreToken,
+                gatewayProfile.getGatewayID());
+        destJSch.addIdentity(destSshCredential.getPrivateKey(), destSshCredential.getPublicKey(), destSshCredential.
+                getPassphrase().getBytes());
+        Session destSession = destJSch.getSession(destLoginUserName, destHostName, destPort);
+        if(!destinationParentPath.endsWith(File.separator))
+            destinationParentPath += File.separator;
+        String destFilePath = destinationParentPath + (new File(sourceFilePath).getName());
+
+        SSHUtils.scpThirdParty(sourceFilePath, sourceSession, destFilePath, destSession);
+        return destFilePath;
+    }
+
+    private CredentialStoreService.Client getCredentialStoreServiceClient() throws TException, ApplicationSettingsException {
+        final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
+        final String serverHost = ServerSettings.getCredentialStoreServerHost();
+        try {
+            return CredentialStoreClientFactory.createAiravataCSClient(serverHost, serverPort);
+        } catch (CredentialStoreException e) {
+            throw new TException("Unable to create credential store client...", e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/CommandOutput.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/CommandOutput.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/CommandOutput.java
new file mode 100644
index 0000000..0d8247a
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/CommandOutput.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.data.manager.core.ssh;
+
+import com.jcraft.jsch.Channel;
+import java.io.OutputStream;
+
+public interface CommandOutput {
+    void onOutput(Channel var1);
+
+    OutputStream getStandardError();
+
+    void exitCode(int var1);
+
+    int getExitCode();
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHApiException.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHApiException.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHApiException.java
new file mode 100644
index 0000000..66678e5
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHApiException.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.data.manager.core.ssh;
+
+public class SSHApiException extends Exception {
+
+    public SSHApiException(String message) {
+        super(message);
+    }
+
+    public SSHApiException(String message, Exception e) {
+        super(message, e);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHUtils.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHUtils.java
new file mode 100644
index 0000000..de8c157
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/SSHUtils.java
@@ -0,0 +1,505 @@
+/*
+ *
+ * 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.data.manager.core.ssh;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.*;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Utility class to do all ssh and scp related things.
+ */
+public class SSHUtils {
+    private static final Logger log = LoggerFactory.getLogger(SSHUtils.class);
+
+
+    /**
+     * This will copy a local file to a remote location
+     *
+     * @param remoteFile remote location you want to transfer the file, this cannot be a directory, if user pass
+     *                   a dirctory we do copy it to that directory but we simply return the directory name
+     *                   todo handle the directory name as input and return the proper final output file name
+     * @param localFile  Local file to transfer, this can be a directory
+     * @return returns the final remote file path, so that users can use the new file location
+     */
+    public static String scpTo(String localFile, String remoteFile, Session session) throws IOException,
+            JSchException, SSHApiException {
+        FileInputStream fis = null;
+        String prefix = null;
+        if (new File(localFile).isDirectory()) {
+            prefix = localFile + File.separator;
+        }
+        boolean ptimestamp = true;
+
+        // exec 'scp -t rfile' remotely
+        String command = "scp " + (ptimestamp ? "-p" : "") + " -t " + remoteFile;
+        Channel channel = session.openChannel("exec");
+
+        StandardOutReader stdOutReader = new StandardOutReader();
+        ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
+        ((ChannelExec) channel).setCommand(command);
+
+        // get I/O streams for remote scp
+        OutputStream out = channel.getOutputStream();
+        InputStream in = channel.getInputStream();
+
+        channel.connect();
+
+        if (checkAck(in) != 0) {
+            String error = "Error Reading input Stream";
+            log.error(error);
+            throw new SSHApiException(error);
+        }
+
+        File _lfile = new File(localFile);
+
+        if (ptimestamp) {
+            command = "T" + (_lfile.lastModified() / 1000) + " 0";
+            // The access time should be sent here,
+            // but it is not accessible with JavaAPI ;-<
+            command += (" " + (_lfile.lastModified() / 1000) + " 0\n");
+            out.write(command.getBytes());
+            out.flush();
+            if (checkAck(in) != 0) {
+                String error = "Error Reading input Stream";
+                log.error(error);
+                throw new SSHApiException(error);
+            }
+        }
+
+        // send "C0644 filesize filename", where filename should not include '/'
+        long filesize = _lfile.length();
+        command = "C0644 " + filesize + " ";
+        if (localFile.lastIndexOf('/') > 0) {
+            command += localFile.substring(localFile.lastIndexOf('/') + 1);
+        } else {
+            command += localFile;
+        }
+        command += "\n";
+        out.write(command.getBytes());
+        out.flush();
+        if (checkAck(in) != 0) {
+            String error = "Error Reading input Stream";
+            log.error(error);
+            throw new SSHApiException(error);
+        }
+
+        // send a content of localFile
+        fis = new FileInputStream(localFile);
+        byte[] buf = new byte[1024];
+        while (true) {
+            int len = fis.read(buf, 0, buf.length);
+            if (len <= 0) break;
+            out.write(buf, 0, len); //out.flush();
+        }
+        fis.close();
+        fis = null;
+        // send '\0'
+        buf[0] = 0;
+        out.write(buf, 0, 1);
+        out.flush();
+        if (checkAck(in) != 0) {
+            String error = "Error Reading input Stream";
+            log.error(error);
+            throw new SSHApiException(error);
+        }
+        out.close();
+        stdOutReader.onOutput(channel);
+
+
+        channel.disconnect();
+        if (stdOutReader.getStdErrorString().contains("scp:")) {
+            throw new SSHApiException(stdOutReader.getStdErrorString());
+        }
+        //since remote file is always a file  we just return the file
+        return remoteFile;
+    }
+
+    /**
+     * This method will copy a remote file to a local directory
+     *
+     * @param remoteFile remote file path, this has to be a full qualified path
+     * @param localFile  This is the local file to copy, this can be a directory too
+     * @return returns the final local file path of the new file came from the remote resource
+     */
+    public static void scpFrom(String remoteFile, String localFile, Session session) throws IOException,
+            JSchException, SSHApiException {
+        FileOutputStream fos = null;
+        try {
+            String prefix = null;
+            if (new File(localFile).isDirectory()) {
+                prefix = localFile + File.separator;
+            }
+
+            // exec 'scp -f remotefile' remotely
+            String command = "scp -f " + remoteFile;
+            Channel channel = session.openChannel("exec");
+            ((ChannelExec) channel).setCommand(command);
+
+            StandardOutReader stdOutReader = new StandardOutReader();
+            ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
+            // get I/O streams for remote scp
+            OutputStream out = channel.getOutputStream();
+            InputStream in = channel.getInputStream();
+
+            if (!channel.isClosed()){
+                channel.connect();
+            }
+
+            byte[] buf = new byte[1024];
+
+            // send '\0'
+            buf[0] = 0;
+            out.write(buf, 0, 1);
+            out.flush();
+
+            while (true) {
+                int c = checkAck(in);
+                if (c != 'C') {
+                    break;
+                }
+
+                // read '0644 '
+                in.read(buf, 0, 5);
+
+                long filesize = 0L;
+                while (true) {
+                    if (in.read(buf, 0, 1) < 0) {
+                        // error
+                        break;
+                    }
+                    if (buf[0] == ' ') break;
+                    filesize = filesize * 10L + (long) (buf[0] - '0');
+                }
+
+                String file = null;
+                for (int i = 0; ; i++) {
+                    in.read(buf, i, 1);
+                    if (buf[i] == (byte) 0x0a) {
+                        file = new String(buf, 0, i);
+                        break;
+                    }
+                }
+
+                //System.out.println("filesize="+filesize+", file="+file);
+
+                // send '\0'
+                buf[0] = 0;
+                out.write(buf, 0, 1);
+                out.flush();
+
+                // read a content of lfile
+                fos = new FileOutputStream(prefix == null ? localFile : prefix + file);
+                int foo;
+                while (true) {
+                    if (buf.length < filesize) foo = buf.length;
+                    else foo = (int) filesize;
+                    foo = in.read(buf, 0, foo);
+                    if (foo < 0) {
+                        // error
+                        break;
+                    }
+                    fos.write(buf, 0, foo);
+                    filesize -= foo;
+                    if (filesize == 0L) break;
+                }
+                fos.close();
+                fos = null;
+
+                if (checkAck(in) != 0) {
+                    String error = "Error transfering the file content";
+                    log.error(error);
+                    throw new SSHApiException(error);
+                }
+
+                // send '\0'
+                buf[0] = 0;
+                out.write(buf, 0, 1);
+                out.flush();
+            }
+            stdOutReader.onOutput(channel);
+            if (stdOutReader.getStdErrorString().contains("scp:")) {
+                throw new SSHApiException(stdOutReader.getStdErrorString());
+            }
+
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        } finally {
+            try {
+                if (fos != null) fos.close();
+            } catch (Exception ee) {
+            }
+        }
+    }
+
+    /**
+     * This method will copy a remote file to a local directory
+     *
+     * @param sourceFile remote file path, this has to be a full qualified path
+     * @param sourceSession JSch session for source
+     * @param destinationFile This is the local file to copy, this can be a directory too
+     * @param destinationSession JSch Session for target
+     * @return returns the final local file path of the new file came from the remote resource
+     */
+    public static void scpThirdParty(String sourceFile, Session sourceSession, String destinationFile, Session destinationSession) throws
+            IOException, JSchException {
+        OutputStream sout = null;
+        InputStream sin = null;
+        OutputStream dout = null;
+        InputStream din = null;
+        try {
+            String prefix = null;
+
+            // exec 'scp -f sourceFile'
+            String sourceCommand = "scp -f " + sourceFile;
+            Channel sourceChannel = sourceSession.openChannel("exec");
+            ((ChannelExec) sourceChannel).setCommand(sourceCommand);
+            StandardOutReader sourceStdOutReader = new StandardOutReader();
+            ((ChannelExec) sourceChannel).setErrStream(sourceStdOutReader.getStandardError());
+            // get I/O streams for remote scp
+            sout = sourceChannel.getOutputStream();
+            sin = sourceChannel.getInputStream();
+            sourceChannel.connect();
+
+
+            boolean ptimestamp = true;
+            // exec 'scp -t destinationFile'
+            String command = "scp " + (ptimestamp ? "-p" : "") + " -t " + destinationFile;
+            Channel targetChannel = destinationSession.openChannel("exec");
+            StandardOutReader targetStdOutReader = new StandardOutReader();
+            ((ChannelExec) targetChannel).setErrStream(targetStdOutReader.getStandardError());
+            ((ChannelExec) targetChannel).setCommand(command);
+            // get I/O streams for remote scp
+            dout = targetChannel.getOutputStream();
+            din = targetChannel.getInputStream();
+            targetChannel.connect();
+
+            if (checkAck(din) != 0) {
+                String error = "Error Reading input Stream";
+                log.error(error);
+                throw new Exception(error);
+            }
+
+
+            byte[] buf = new byte[1024];
+
+            // send '\0'
+            buf[0] = 0;
+            sout.write(buf, 0, 1);
+            sout.flush();
+
+            while (true) {
+                int c = checkAck(sin);
+                if (c != 'C') {
+                    break;
+                }
+
+                // read '0644 '
+                sin.read(buf, 0, 5);
+
+                long fileSize = 0L;
+                while (true) {
+                    if (sin.read(buf, 0, 1) < 0) {
+                        // error
+                        break;
+                    }
+                    if (buf[0] == ' ') break;
+                    fileSize = fileSize * 10L + (long) (buf[0] - '0');
+                }
+
+                String fileName = null;
+                for (int i = 0; ; i++) {
+                    sin.read(buf, i, 1);
+                    if (buf[i] == (byte) 0x0a) {
+                        fileName = new String(buf, 0, i);
+                        break;
+                    }
+                }
+                String initData = "C0644 " + fileSize + " " + fileName + "\n";
+                assert dout != null;
+                dout.write(initData.getBytes());
+                dout.flush();
+
+                // send '\0' to source
+                buf[0] = 0;
+                sout.write(buf, 0, 1);
+                sout.flush();
+
+                int rLength;
+                while (true) {
+                    if (buf.length < fileSize) rLength = buf.length;
+                    else rLength = (int) fileSize;
+                    rLength = sin.read(buf, 0, rLength); // read content of the source File
+                    if (rLength < 0) {
+                        // error
+                        break;
+                    }
+                    dout.write(buf, 0, rLength); // write to destination file
+                    fileSize -= rLength;
+                    if (fileSize == 0L) break;
+                }
+
+                // send '\0' to target
+                buf[0] = 0;
+                dout.write(buf, 0, 1);
+                dout.flush();
+                if (checkAck(din) != 0) {
+                    String error = "Error Reading input Stream";
+                    log.error(error);
+                    throw new Exception(error);
+                }
+                dout.close();
+                dout = null;
+
+                if (checkAck(sin) != 0) {
+                    String error = "Error transfering the file content";
+                    log.error(error);
+                    throw new Exception(error);
+                }
+
+                // send '\0'
+                buf[0] = 0;
+                sout.write(buf, 0, 1);
+                sout.flush();
+            }
+
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        } finally {
+            try {
+                if (dout != null) dout.close();
+            } catch (Exception ee) {
+                log.error("", ee);
+            }
+            try {
+                if (din != null) din.close();
+            } catch (Exception ee) {
+                log.error("", ee);
+            }
+            try {
+                if (sout != null) sout.close();
+            } catch (Exception ee) {
+                log.error("", ee);
+            }
+            try {
+                if (din != null) din.close();
+            } catch (Exception ee) {
+                log.error("", ee);
+            }
+        }
+    }
+
+    public static void makeDirectory(String path, Session session) throws IOException, JSchException, SSHApiException {
+
+        // exec 'scp -t rfile' remotely
+        String command = "mkdir -p " + path;
+        Channel channel = session.openChannel("exec");
+        StandardOutReader stdOutReader = new StandardOutReader();
+
+        ((ChannelExec) channel).setCommand(command);
+
+
+        ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
+        try {
+            channel.connect();
+        } catch (JSchException e) {
+
+            channel.disconnect();
+//            session.disconnect();
+
+            throw new SSHApiException("Unable to retrieve command output. Command - " + command +
+                    " on server - " + session.getHost() + ":" + session.getPort() +
+                    " connecting user name - "
+                    + session.getUserName(), e);
+        }
+        stdOutReader.onOutput(channel);
+        if (stdOutReader.getStdErrorString().contains("mkdir:")) {
+            throw new SSHApiException(stdOutReader.getStdErrorString());
+        }
+
+        channel.disconnect();
+    }
+
+    public static List<String> listDirectory(String path, Session session) throws IOException, JSchException,
+            SSHApiException {
+
+        // exec 'scp -t rfile' remotely
+        String command = "ls " + path;
+        Channel channel = session.openChannel("exec");
+        StandardOutReader stdOutReader = new StandardOutReader();
+
+        ((ChannelExec) channel).setCommand(command);
+
+
+        ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
+        try {
+            channel.connect();
+        } catch (JSchException e) {
+
+            channel.disconnect();
+//            session.disconnect();
+
+            throw new SSHApiException("Unable to retrieve command output. Command - " + command +
+                    " on server - " + session.getHost() + ":" + session.getPort() +
+                    " connecting user name - "
+                    + session.getUserName(), e);
+        }
+        stdOutReader.onOutput(channel);
+        stdOutReader.getStdOutputString();
+        if (stdOutReader.getStdErrorString().contains("ls:")) {
+            throw new SSHApiException(stdOutReader.getStdErrorString());
+        }
+        channel.disconnect();
+        return Arrays.asList(stdOutReader.getStdOutputString().split("\n"));
+    }
+
+
+    static int checkAck(InputStream in) throws IOException {
+        int b = in.read();
+        if (b == 0) return b;
+        if (b == -1) return b;
+
+        if (b == 1 || b == 2) {
+            StringBuffer sb = new StringBuffer();
+            int c;
+            do {
+                c = in.read();
+                sb.append((char) c);
+            }
+            while (c != '\n');
+            if (b == 1) { // error
+                System.out.print(sb.toString());
+            }
+            if (b == 2) { // fatal error
+                System.out.print(sb.toString());
+            }
+        }
+        return b;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/StandardOutReader.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/StandardOutReader.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/StandardOutReader.java
new file mode 100644
index 0000000..c03660b
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/ssh/StandardOutReader.java
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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.data.manager.core.ssh;
+
+import com.jcraft.jsch.Channel;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class StandardOutReader implements CommandOutput {
+
+    private static final Logger logger = LoggerFactory.getLogger(StandardOutReader.class);
+    String stdOutputString = null;
+    ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
+    private int exitCode;
+
+    public void onOutput(Channel channel) {
+        try {
+            StringBuffer pbsOutput = new StringBuffer("");
+            InputStream inputStream =  channel.getInputStream();
+            byte[] tmp = new byte[1024];
+            do {
+                while (inputStream.available() > 0) {
+                    int i = inputStream.read(tmp, 0, 1024);
+                    if (i < 0) break;
+                    pbsOutput.append(new String(tmp, 0, i));
+                }
+            } while (!channel.isClosed()) ;
+            String output = pbsOutput.toString();
+            this.setStdOutputString(output);
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        }
+
+    }
+
+
+    public void exitCode(int code) {
+        System.out.println("Program exit code - " + code);
+        this.exitCode = code;
+    }
+
+    @Override
+    public int getExitCode() {
+        return exitCode;
+    }
+
+    public String getStdOutputString() {
+        return stdOutputString;
+    }
+
+    public void setStdOutputString(String stdOutputString) {
+        this.stdOutputString = stdOutputString;
+    }
+
+    public String getStdErrorString() {
+        return errorStream.toString();
+    }
+
+    public OutputStream getStandardError() {
+        return errorStream;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerFactoryTest.java b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerFactoryTest.java
new file mode 100644
index 0000000..359c286
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerFactoryTest.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * 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.aoache.airavata.data.manager.core;
+
+import junit.framework.Assert;
+import org.apache.airavata.data.manager.core.DataManagerImpl;
+import org.apache.airavata.data.manager.cpi.DataManager;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.DataCatalog;
+import org.apache.airavata.registry.cpi.DataCatalogException;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataManagerFactoryTest {
+    private final static Logger logger = LoggerFactory.getLogger(DataManagerFactoryTest.class);
+
+    @Test
+    public void testCreateDataManager() throws DataCatalogException, DataCatalogException, AppCatalogException {
+        DataCatalog dataCatalog = RegistryFactory.getDataCatalog();
+        AppCatalog appCatalog = RegistryFactory.getAppCatalog();
+        DataManager dataManagerImpl = new DataManagerImpl(appCatalog, dataCatalog);
+        Assert.assertNotNull(dataManagerImpl);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerImplTest.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerImplTest.java b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerImplTest.java
new file mode 100644
index 0000000..42c4091
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/DataManagerImplTest.java
@@ -0,0 +1,208 @@
+/*
+ *
+ * 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.aoache.airavata.data.manager.core;
+
+import org.apache.airavata.data.manager.core.DataManagerImpl;
+import org.apache.airavata.data.manager.cpi.DataManagerException;
+import org.aoache.airavata.data.manager.core.utils.AppCatInit;
+import org.aoache.airavata.data.manager.core.utils.DataCatInit;
+import org.apache.airavata.model.data.resource.DataReplicaLocationModel;
+import org.apache.airavata.model.data.resource.DataResourceModel;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.cpi.AppCatalog;
+import org.apache.airavata.registry.cpi.DataCatalog;
+import org.apache.airavata.data.manager.cpi.DataManager;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.UUID;
+
+public class DataManagerImplTest {
+    private final static Logger logger = LoggerFactory.getLogger(DataManagerImplTest.class);
+    private static AppCatInit appCatInit;
+    private static DataCatInit dataCatInit;
+    private static DataManager dataManager;
+    private static DataResourceModel dataResourceModel;
+    private static DataReplicaLocationModel dataReplicaLocationModel;
+
+    @BeforeClass
+    public static void setUp() {
+        try {
+            System.out.println("********** SET UP ************");
+            appCatInit = new AppCatInit("appcatalog-derby.sql");
+            appCatInit.initializeDB();
+            dataCatInit = new DataCatInit("datacatalog-derby.sql");
+            dataCatInit.initializeDB();
+            AppCatalog appCatalog = RegistryFactory.getAppCatalog();
+            DataCatalog dataCatalog = RegistryFactory.getDataCatalog();
+            DataManagerImplTest.dataManager = new DataManagerImpl(appCatalog, dataCatalog);
+            dataResourceModel = new DataResourceModel();
+            dataResourceModel.setResourceName("test-file.txt");
+            dataReplicaLocationModel = new DataReplicaLocationModel();
+            dataReplicaLocationModel.setReplicaName("1-st-replica");
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        dataCatInit.stopDerbyServer();
+    }
+
+    @Test
+    public void testPublishDataResource(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            org.junit.Assert.assertNotNull(resourceId);
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testRemoveDataResource(){
+        try {
+            boolean result = dataManager.removeResource("234234234");
+            Assert.assertFalse(result);
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            Assert.assertNotNull(resourceId);
+            result = dataManager.removeResource(resourceId);
+            Assert.assertTrue(result);
+            result = dataManager.removeResource(resourceId);
+            Assert.assertFalse(result);
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testGetDataResource(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            Assert.assertNotNull(resourceId);
+            DataResourceModel persistedCopy = dataManager.getResource(resourceId);
+            Assert.assertNotNull(persistedCopy);
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testUpdateDataResource(){
+        try {
+            dataResourceModel.setResourceId(UUID.randomUUID().toString());
+            boolean result = dataManager.updateResource(dataResourceModel);
+            Assert.assertFalse(result);
+            dataManager.registerResource(dataResourceModel);
+            dataResourceModel.setResourceName("updated-name");
+            dataManager.updateResource(dataResourceModel);
+            dataResourceModel = dataManager.getResource(dataResourceModel.getResourceId());
+            Assert.assertTrue(dataResourceModel.getResourceName().equals("updated-name"));
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testPublishReplicaLocation(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            dataReplicaLocationModel.setResourceId(resourceId);
+            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
+            org.junit.Assert.assertNotNull(replicaId);
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testRemoveReplicaLocation(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            dataReplicaLocationModel.setResourceId(resourceId);
+            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
+            boolean result = dataManager.removeReplicaLocation(replicaId);
+            Assert.assertTrue(result);
+            result = dataManager.removeReplicaLocation(dataReplicaLocationModel.getReplicaId());
+            Assert.assertFalse(result);
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testGetReplicaLocation(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            dataReplicaLocationModel.setResourceId(resourceId);
+            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
+            DataReplicaLocationModel persistedCopy = dataManager.getReplicaLocation(replicaId);
+            Assert.assertNotNull(persistedCopy);
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testUpdateReplicaLocation(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            dataReplicaLocationModel.setResourceId(resourceId);
+            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
+            DataReplicaLocationModel persistedCopy = dataManager.getReplicaLocation(replicaId);
+            persistedCopy.setReplicaDescription("updated-description");
+            dataManager.updateReplicaLocation(persistedCopy);
+            persistedCopy = dataManager.getReplicaLocation(replicaId);
+            Assert.assertTrue(persistedCopy.getReplicaDescription().equals("updated-description"));
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+
+    @Test
+    public void testGetAllReplicaLocations(){
+        try {
+            String resourceId = dataManager.registerResource(dataResourceModel);
+            dataReplicaLocationModel.setResourceId(resourceId);
+            String replicaId = dataManager.registerReplicaLocation(dataReplicaLocationModel);
+            List<DataReplicaLocationModel> replicaLocationModelList = dataManager.getAllReplicaLocations(resourceId);
+            Assert.assertTrue(replicaLocationModelList.get(0).getReplicaId().equals(replicaId));
+        } catch (DataManagerException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/AppCatInit.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/AppCatInit.java b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/AppCatInit.java
new file mode 100644
index 0000000..cdeb0ce
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/AppCatInit.java
@@ -0,0 +1,320 @@
+/*
+ *
+ * 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.aoache.airavata.data.manager.core.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class AppCatInit {
+    private static final Logger logger = LoggerFactory.getLogger(AppCatInit.class);
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public  String scriptName = "appcatalog-derby.sql";
+    private NetworkServerControl server;
+    private static final String delimiter = ";";
+    public static final String COMPUTE_RESOURCE_TABLE = "COMPUTE_RESOURCE";
+    private String jdbcUrl = null;
+    private String jdbcDriver = null;
+    private String jdbcUser = null;
+    private String jdbcPassword = null;
+
+    public AppCatInit(String scriptName) {
+        this.scriptName = scriptName;
+    }
+
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+
+    private static boolean isServerStarted(NetworkServerControl server, int ntries)
+    {
+        for (int i = 1; i <= ntries; i ++)
+        {
+            try {
+                Thread.sleep(500);
+                server.ping();
+                return true;
+            }
+            catch (Exception e) {
+                if (i == ntries)
+                    return false;
+            }
+        }
+        return false;
+    }
+
+    public void initializeDB() {
+
+        try{
+            jdbcDriver = ServerSettings.getSetting("appcatalog.jdbc.driver");
+            jdbcUrl = ServerSettings.getSetting("appcatalog.jdbc.url");
+            jdbcUser = ServerSettings.getSetting("appcatalog.jdbc.user");
+            jdbcPassword = ServerSettings.getSetting("appcatalog.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read properties", e);
+        }
+
+        startDerbyInServerMode();
+        if(!isServerStarted(server, 20)){
+           throw new RuntimeException("Derby server cound not started within five seconds...");
+        }
+//      startDerbyInEmbeddedMode();
+
+        Connection conn = null;
+        try {
+            Class.forName(jdbcDriver).newInstance();
+            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+            if (!isDatabaseStructureCreated(COMPUTE_RESOURCE_TABLE, conn)) {
+                executeSQLScript(conn);
+                logger.info("New Database created for App Catalog !!!");
+            } else {
+                logger.debug("Database already created for App Catalog!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            try {
+                if (conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+    }
+
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+            System.out.println("Running a query to test the database tables existence.");
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void executeSQLScript(Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+        try{
+
+        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
+        reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            line = line.trim();
+            if (line.startsWith("//")) {
+                continue;
+            }
+            if (line.startsWith("--")) {
+                continue;
+            }
+            StringTokenizer st = new StringTokenizer(line);
+            if (st.hasMoreTokens()) {
+                String token = st.nextToken();
+                if ("REM".equalsIgnoreCase(token)) {
+                    continue;
+                }
+            }
+            sql.append(" ").append(line);
+
+            // SQL defines "--" as a comment to EOL
+            // and in Oracle it may contain a hint
+            // so we cannot just remove it, instead we must end it
+            if (line.indexOf("--") >= 0) {
+                sql.append("\n");
+            }
+            if ((checkStringBufferEndsWith(sql, delimiter))) {
+                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                sql.replace(0, sql.length(), "");
+            }
+        }
+        // Catch any statements not followed by ;
+        if (sql.length() > 0) {
+            executeSQL(sql.toString(), conn);
+        }
+        }catch (IOException e){
+            logger.error("Error occurred while executing SQL script for creating Airavata database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+        }finally {
+            if (reader != null) {
+                reader.close();
+            }
+
+        }
+
+    }
+
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            logger.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                logger.warn(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                logger.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    logger.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    private void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    20000,
+                    jdbcUser, jdbcPassword);
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+
+    }
+
+    public static int getPort(String jdbcURL){
+        try{
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getPort();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        }
+    }
+
+    private void startDerbyInEmbeddedMode(){
+        try {
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
+        } catch (ClassNotFoundException e) {
+            logger.error(e.getMessage(), e);
+        } catch (SQLException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void stopDerbyServer() {
+        try {
+            server.shutdown();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/DataCatInit.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/DataCatInit.java b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/DataCatInit.java
new file mode 100644
index 0000000..d1c8491
--- /dev/null
+++ b/modules/data-manager/data-manager-core/src/test/java/org/aoache/airavata/data/manager/core/utils/DataCatInit.java
@@ -0,0 +1,315 @@
+/*
+ *
+ * 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.aoache.airavata.data.manager.core.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.core.data.catalog.utils.DataCatalogConstants;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class DataCatInit {
+    private static final Logger logger = LoggerFactory.getLogger(DataCatInit.class);
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public  String scriptName = "datacatalog-derby.sql";
+    private NetworkServerControl server;
+    private static final String delimiter = ";";
+    private String jdbcUrl = null;
+    private String jdbcDriver = null;
+    private String jdbcUser = null;
+    private String jdbcPassword = null;
+
+    public DataCatInit(String scriptName) {
+        this.scriptName = scriptName;
+    }
+
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+
+    private static boolean isServerStarted(NetworkServerControl server, int ntries)
+    {
+        for (int i = 1; i <= ntries; i ++)
+        {
+            try {
+                Thread.sleep(500);
+                server.ping();
+                return true;
+            }
+            catch (Exception e) {
+                if (i == ntries)
+                    return false;
+            }
+        }
+        return false;
+    }
+
+    public void initializeDB() {
+        try{
+            jdbcDriver = ServerSettings.getSetting("datacatalog.jdbc.driver");
+            jdbcUrl = ServerSettings.getSetting("datacatalog.jdbc.url");
+            jdbcUser = ServerSettings.getSetting("datacatalog.jdbc.user");
+            jdbcPassword = ServerSettings.getSetting("datacatalog.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read properties", e);
+        }
+
+        startDerbyInServerMode();
+        if(!isServerStarted(server, 20)){
+           throw new RuntimeException("Derby server could not started within five seconds...");
+        }
+        Connection conn = null;
+        try {
+            Class.forName(jdbcDriver).newInstance();
+            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+            if (!isDatabaseStructureCreated(DataCatalogConstants.CONFIGURATION, conn)) {
+                executeSQLScript(conn);
+                logger.info("New Database created for Data Catalog !!!");
+            } else {
+                logger.debug("Database already created for Data Catalog!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            try {
+                if (conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+    }
+
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+            System.out.println("Running a query to test the database tables existence.");
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void executeSQLScript(Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+        try{
+
+        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
+        reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            line = line.trim();
+            if (line.startsWith("//")) {
+                continue;
+            }
+            if (line.startsWith("--")) {
+                continue;
+            }
+            StringTokenizer st = new StringTokenizer(line);
+            if (st.hasMoreTokens()) {
+                String token = st.nextToken();
+                if ("REM".equalsIgnoreCase(token)) {
+                    continue;
+                }
+            }
+            sql.append(" ").append(line);
+
+            // SQL defines "--" as a comment to EOL
+            // and in Oracle it may contain a hint
+            // so we cannot just remove it, instead we must end it
+            if (line.indexOf("--") >= 0) {
+                sql.append("\n");
+            }
+            if ((checkStringBufferEndsWith(sql, delimiter))) {
+                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                sql.replace(0, sql.length(), "");
+            }
+        }
+        // Catch any statements not followed by ;
+        if (sql.length() > 0) {
+            executeSQL(sql.toString(), conn);
+        }
+        }catch (IOException e){
+            logger.error("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata Data Catalog database", e);
+        }finally {
+            if (reader != null) {
+                reader.close();
+            }
+        }
+    }
+
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            logger.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                logger.warn(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                logger.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    logger.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    private void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    20000,
+                    jdbcUser, jdbcPassword);
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+
+    }
+
+    public static int getPort(String jdbcURL){
+        try{
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getPort();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        }
+    }
+
+    private void startDerbyInEmbeddedMode(){
+        try {
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
+        } catch (ClassNotFoundException e) {
+            logger.error(e.getMessage(), e);
+        } catch (SQLException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void stopDerbyServer() {
+        try {
+            server.shutdown();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerFactoryTest.java b/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerFactoryTest.java
deleted file mode 100644
index 42cb8f5..0000000
--- a/modules/data-manager/data-manager-core/src/test/java/org/apache/airavata/data/catalog/core/DataManagerFactoryTest.java
+++ /dev/null
@@ -1,41 +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.data.catalog.core;
-
-import junit.framework.Assert;
-import org.apache.airavata.data.catalog.cpi.DataManager;
-import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.DataCatalog;
-import org.apache.airavata.registry.cpi.DataCatalogException;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataManagerFactoryTest {
-    private final static Logger logger = LoggerFactory.getLogger(DataManagerFactoryTest.class);
-
-    @Test
-    public void testCreateDataManager() throws DataCatalogException, DataCatalogException {
-        DataCatalog dataCatalog = RegistryFactory.getDataCatalog();
-        DataManager dataManagerImpl = new DataManagerImpl(dataCatalog);
-        Assert.assertNotNull(dataManagerImpl);
-    }
-}
\ No newline at end of file


[4/5] airavata git commit: adding data mover code to data manager

Posted by sc...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
index b84b3ac..9d117e5 100644
--- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
+++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
@@ -2324,6 +2324,8 @@ public class Airavata {
 
     public org.apache.airavata.model.data.resource.DataResourceModel getDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException;
 
+    public String copyDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException;
+
   }
 
   public interface AsyncIface {
@@ -2600,6 +2602,8 @@ public class Airavata {
 
     public void getDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
+    public void copyDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
   }
 
   public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -7610,6 +7614,44 @@ public class Airavata {
       throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getDataResource failed: unknown result");
     }
 
+    public String copyDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException
+    {
+      send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath);
+      return recv_copyDataResource();
+    }
+
+    public void send_copyDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath) throws org.apache.thrift.TException
+    {
+      copyDataResource_args args = new copyDataResource_args();
+      args.setAuthzToken(authzToken);
+      args.setResourceId(resourceId);
+      args.setDestStorageResourceId(destStorageResourceId);
+      args.setDestinationParentPath(destinationParentPath);
+      sendBase("copyDataResource", args);
+    }
+
+    public String recv_copyDataResource() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException
+    {
+      copyDataResource_result result = new copyDataResource_result();
+      receiveBase(result, "copyDataResource");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ire != null) {
+        throw result.ire;
+      }
+      if (result.ace != null) {
+        throw result.ace;
+      }
+      if (result.ase != null) {
+        throw result.ase;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "copyDataResource failed: unknown result");
+    }
+
   }
   public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
     public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
@@ -12718,6 +12760,47 @@ public class Airavata {
       }
     }
 
+    public void copyDataResource(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      copyDataResource_call method_call = new copyDataResource_call(authzToken, resourceId, destStorageResourceId, destinationParentPath, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class copyDataResource_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private org.apache.airavata.model.security.AuthzToken authzToken;
+      private String resourceId;
+      private String destStorageResourceId;
+      private String destinationParentPath;
+      public copyDataResource_call(org.apache.airavata.model.security.AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+        this.resourceId = resourceId;
+        this.destStorageResourceId = destStorageResourceId;
+        this.destinationParentPath = destinationParentPath;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("copyDataResource", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        copyDataResource_args args = new copyDataResource_args();
+        args.setAuthzToken(authzToken);
+        args.setResourceId(resourceId);
+        args.setDestStorageResourceId(destStorageResourceId);
+        args.setDestinationParentPath(destinationParentPath);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String getResult() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_copyDataResource();
+      }
+    }
+
   }
 
   public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -12867,6 +12950,7 @@ public class Airavata {
       processMap.put("updateDataResource", new updateDataResource());
       processMap.put("removeDataResource", new removeDataResource());
       processMap.put("getDataResource", new getDataResource());
+      processMap.put("copyDataResource", new copyDataResource());
       return processMap;
     }
 
@@ -17002,6 +17086,36 @@ public class Airavata {
       }
     }
 
+    public static class copyDataResource<I extends Iface> extends org.apache.thrift.ProcessFunction<I, copyDataResource_args> {
+      public copyDataResource() {
+        super("copyDataResource");
+      }
+
+      public copyDataResource_args getEmptyArgsInstance() {
+        return new copyDataResource_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public copyDataResource_result getResult(I iface, copyDataResource_args args) throws org.apache.thrift.TException {
+        copyDataResource_result result = new copyDataResource_result();
+        try {
+          result.success = iface.copyDataResource(args.authzToken, args.resourceId, args.destStorageResourceId, args.destinationParentPath);
+        } catch (org.apache.airavata.model.error.InvalidRequestException ire) {
+          result.ire = ire;
+        } catch (org.apache.airavata.model.error.AiravataClientException ace) {
+          result.ace = ace;
+        } catch (org.apache.airavata.model.error.AiravataSystemException ase) {
+          result.ase = ase;
+        } catch (org.apache.airavata.model.error.AuthorizationException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
   }
 
   public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@@ -17151,6 +17265,7 @@ public class Airavata {
       processMap.put("updateDataResource", new updateDataResource());
       processMap.put("removeDataResource", new removeDataResource());
       processMap.put("getDataResource", new getDataResource());
+      processMap.put("copyDataResource", new copyDataResource());
       return processMap;
     }
 
@@ -27002,395 +27117,96 @@ public class Airavata {
       }
     }
 
-  }
-
-  public static class getAPIVersion_args implements org.apache.thrift.TBase<getAPIVersion_args, getAPIVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAPIVersion_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAPIVersion_args");
-
-    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new getAPIVersion_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new getAPIVersion_argsTupleSchemeFactory());
-    }
-
-    public org.apache.airavata.model.security.AuthzToken authzToken; // required
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      AUTHZ_TOKEN((short)1, "authzToken");
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          case 1: // AUTHZ_TOKEN
-            return AUTHZ_TOKEN;
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-
-    // isset id assignments
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.security.AuthzToken.class)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAPIVersion_args.class, metaDataMap);
-    }
-
-    public getAPIVersion_args() {
-    }
-
-    public getAPIVersion_args(
-      org.apache.airavata.model.security.AuthzToken authzToken)
-    {
-      this();
-      this.authzToken = authzToken;
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public getAPIVersion_args(getAPIVersion_args other) {
-      if (other.isSetAuthzToken()) {
-        this.authzToken = new org.apache.airavata.model.security.AuthzToken(other.authzToken);
-      }
-    }
-
-    public getAPIVersion_args deepCopy() {
-      return new getAPIVersion_args(this);
-    }
-
-    @Override
-    public void clear() {
-      this.authzToken = null;
-    }
-
-    public org.apache.airavata.model.security.AuthzToken getAuthzToken() {
-      return this.authzToken;
-    }
-
-    public getAPIVersion_args setAuthzToken(org.apache.airavata.model.security.AuthzToken authzToken) {
-      this.authzToken = authzToken;
-      return this;
-    }
-
-    public void unsetAuthzToken() {
-      this.authzToken = null;
-    }
-
-    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
-    public boolean isSetAuthzToken() {
-      return this.authzToken != null;
-    }
-
-    public void setAuthzTokenIsSet(boolean value) {
-      if (!value) {
-        this.authzToken = null;
-      }
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      case AUTHZ_TOKEN:
-        if (value == null) {
-          unsetAuthzToken();
-        } else {
-          setAuthzToken((org.apache.airavata.model.security.AuthzToken)value);
-        }
-        break;
-
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      case AUTHZ_TOKEN:
-        return getAuthzToken();
-
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      case AUTHZ_TOKEN:
-        return isSetAuthzToken();
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof getAPIVersion_args)
-        return this.equals((getAPIVersion_args)that);
-      return false;
-    }
-
-    public boolean equals(getAPIVersion_args that) {
-      if (that == null)
-        return false;
-
-      boolean this_present_authzToken = true && this.isSetAuthzToken();
-      boolean that_present_authzToken = true && that.isSetAuthzToken();
-      if (this_present_authzToken || that_present_authzToken) {
-        if (!(this_present_authzToken && that_present_authzToken))
-          return false;
-        if (!this.authzToken.equals(that.authzToken))
-          return false;
-      }
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      List<Object> list = new ArrayList<Object>();
-
-      boolean present_authzToken = true && (isSetAuthzToken());
-      list.add(present_authzToken);
-      if (present_authzToken)
-        list.add(authzToken);
-
-      return list.hashCode();
-    }
-
-    @Override
-    public int compareTo(getAPIVersion_args other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-
-      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetAuthzToken()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("getAPIVersion_args(");
-      boolean first = true;
-
-      sb.append("authzToken:");
-      if (this.authzToken == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.authzToken);
-      }
-      first = false;
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      if (authzToken == null) {
-        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
-      }
-      // check for sub-struct validity
-      if (authzToken != null) {
-        authzToken.validate();
-      }
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
+    public static class copyDataResource<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, copyDataResource_args, String> {
+      public copyDataResource() {
+        super("copyDataResource");
       }
-    }
 
-    private static class getAPIVersion_argsStandardSchemeFactory implements SchemeFactory {
-      public getAPIVersion_argsStandardScheme getScheme() {
-        return new getAPIVersion_argsStandardScheme();
+      public copyDataResource_args getEmptyArgsInstance() {
+        return new copyDataResource_args();
       }
-    }
-
-    private static class getAPIVersion_argsStandardScheme extends StandardScheme<getAPIVersion_args> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, getAPIVersion_args struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            copyDataResource_result result = new copyDataResource_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
           }
-          switch (schemeField.id) {
-            case 1: // AUTHZ_TOKEN
-              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
-                struct.authzToken.read(iprot);
-                struct.setAuthzTokenIsSet(true);
-              } else { 
-                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-              }
-              break;
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            copyDataResource_result result = new copyDataResource_result();
+            if (e instanceof org.apache.airavata.model.error.InvalidRequestException) {
+                        result.ire = (org.apache.airavata.model.error.InvalidRequestException) e;
+                        result.setIreIsSet(true);
+                        msg = result;
+            }
+            else             if (e instanceof org.apache.airavata.model.error.AiravataClientException) {
+                        result.ace = (org.apache.airavata.model.error.AiravataClientException) e;
+                        result.setAceIsSet(true);
+                        msg = result;
+            }
+            else             if (e instanceof org.apache.airavata.model.error.AiravataSystemException) {
+                        result.ase = (org.apache.airavata.model.error.AiravataSystemException) e;
+                        result.setAseIsSet(true);
+                        msg = result;
+            }
+            else             if (e instanceof org.apache.airavata.model.error.AuthorizationException) {
+                        result.ae = (org.apache.airavata.model.error.AuthorizationException) e;
+                        result.setAeIsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
           }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, getAPIVersion_args struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        if (struct.authzToken != null) {
-          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
-          struct.authzToken.write(oprot);
-          oprot.writeFieldEnd();
-        }
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class getAPIVersion_argsTupleSchemeFactory implements SchemeFactory {
-      public getAPIVersion_argsTupleScheme getScheme() {
-        return new getAPIVersion_argsTupleScheme();
+        };
       }
-    }
 
-    private static class getAPIVersion_argsTupleScheme extends TupleScheme<getAPIVersion_args> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-        struct.authzToken.write(oprot);
+      protected boolean isOneway() {
+        return false;
       }
 
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-        struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
-        struct.authzToken.read(iprot);
-        struct.setAuthzTokenIsSet(true);
+      public void start(I iface, copyDataResource_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.copyDataResource(args.authzToken, args.resourceId, args.destStorageResourceId, args.destinationParentPath,resultHandler);
       }
     }
 
   }
 
-  public static class getAPIVersion_result implements org.apache.thrift.TBase<getAPIVersion_result, getAPIVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<getAPIVersion_result>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAPIVersion_result");
+  public static class getAPIVersion_args implements org.apache.thrift.TBase<getAPIVersion_args, getAPIVersion_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAPIVersion_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAPIVersion_args");
 
-    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
-    private static final org.apache.thrift.protocol.TField IRE_FIELD_DESC = new org.apache.thrift.protocol.TField("ire", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-    private static final org.apache.thrift.protocol.TField ACE_FIELD_DESC = new org.apache.thrift.protocol.TField("ace", org.apache.thrift.protocol.TType.STRUCT, (short)2);
-    private static final org.apache.thrift.protocol.TField ASE_FIELD_DESC = new org.apache.thrift.protocol.TField("ase", org.apache.thrift.protocol.TType.STRUCT, (short)3);
-    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new getAPIVersion_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new getAPIVersion_resultTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new getAPIVersion_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getAPIVersion_argsTupleSchemeFactory());
     }
 
-    public String success; // required
-    public org.apache.airavata.model.error.InvalidRequestException ire; // required
-    public org.apache.airavata.model.error.AiravataClientException ace; // required
-    public org.apache.airavata.model.error.AiravataSystemException ase; // required
-    public org.apache.airavata.model.error.AuthorizationException ae; // required
+    public org.apache.airavata.model.security.AuthzToken authzToken; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      SUCCESS((short)0, "success"),
-      IRE((short)1, "ire"),
-      ACE((short)2, "ace"),
-      ASE((short)3, "ase"),
-      AE((short)4, "ae");
+      AUTHZ_TOKEN((short)1, "authzToken");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -27405,16 +27221,387 @@ public class Airavata {
        */
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
-          case 0: // SUCCESS
-            return SUCCESS;
-          case 1: // IRE
-            return IRE;
-          case 2: // ACE
-            return ACE;
-          case 3: // ASE
-            return ASE;
-          case 4: // AE
-            return AE;
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.security.AuthzToken.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAPIVersion_args.class, metaDataMap);
+    }
+
+    public getAPIVersion_args() {
+    }
+
+    public getAPIVersion_args(
+      org.apache.airavata.model.security.AuthzToken authzToken)
+    {
+      this();
+      this.authzToken = authzToken;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getAPIVersion_args(getAPIVersion_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.airavata.model.security.AuthzToken(other.authzToken);
+      }
+    }
+
+    public getAPIVersion_args deepCopy() {
+      return new getAPIVersion_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+    }
+
+    public org.apache.airavata.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public getAPIVersion_args setAuthzToken(org.apache.airavata.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.airavata.model.security.AuthzToken)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getAPIVersion_args)
+        return this.equals((getAPIVersion_args)that);
+      return false;
+    }
+
+    public boolean equals(getAPIVersion_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      List<Object> list = new ArrayList<Object>();
+
+      boolean present_authzToken = true && (isSetAuthzToken());
+      list.add(present_authzToken);
+      if (present_authzToken)
+        list.add(authzToken);
+
+      return list.hashCode();
+    }
+
+    @Override
+    public int compareTo(getAPIVersion_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getAPIVersion_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getAPIVersion_argsStandardSchemeFactory implements SchemeFactory {
+      public getAPIVersion_argsStandardScheme getScheme() {
+        return new getAPIVersion_argsStandardScheme();
+      }
+    }
+
+    private static class getAPIVersion_argsStandardScheme extends StandardScheme<getAPIVersion_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getAPIVersion_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getAPIVersion_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getAPIVersion_argsTupleSchemeFactory implements SchemeFactory {
+      public getAPIVersion_argsTupleScheme getScheme() {
+        return new getAPIVersion_argsTupleScheme();
+      }
+    }
+
+    private static class getAPIVersion_argsTupleScheme extends TupleScheme<getAPIVersion_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+      }
+    }
+
+  }
+
+  public static class getAPIVersion_result implements org.apache.thrift.TBase<getAPIVersion_result, getAPIVersion_result._Fields>, java.io.Serializable, Cloneable, Comparable<getAPIVersion_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAPIVersion_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
+    private static final org.apache.thrift.protocol.TField IRE_FIELD_DESC = new org.apache.thrift.protocol.TField("ire", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+    private static final org.apache.thrift.protocol.TField ACE_FIELD_DESC = new org.apache.thrift.protocol.TField("ace", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+    private static final org.apache.thrift.protocol.TField ASE_FIELD_DESC = new org.apache.thrift.protocol.TField("ase", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getAPIVersion_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getAPIVersion_resultTupleSchemeFactory());
+    }
+
+    public String success; // required
+    public org.apache.airavata.model.error.InvalidRequestException ire; // required
+    public org.apache.airavata.model.error.AiravataClientException ace; // required
+    public org.apache.airavata.model.error.AiravataSystemException ase; // required
+    public org.apache.airavata.model.error.AuthorizationException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      IRE((short)1, "ire"),
+      ACE((short)2, "ace"),
+      ASE((short)3, "ase"),
+      AE((short)4, "ae");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // IRE
+            return IRE;
+          case 2: // ACE
+            return ACE;
+          case 3: // ASE
+            return ASE;
+          case 4: // AE
+            return AE;
           default:
             return null;
         }
@@ -75650,15 +75837,1248 @@ public class Airavata {
       }
     }
 
-    private static class updateResourceScheduleing_resultStandardSchemeFactory implements SchemeFactory {
-      public updateResourceScheduleing_resultStandardScheme getScheme() {
-        return new updateResourceScheduleing_resultStandardScheme();
+    private static class updateResourceScheduleing_resultStandardSchemeFactory implements SchemeFactory {
+      public updateResourceScheduleing_resultStandardScheme getScheme() {
+        return new updateResourceScheduleing_resultStandardScheme();
+      }
+    }
+
+    private static class updateResourceScheduleing_resultStandardScheme extends StandardScheme<updateResourceScheduleing_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, updateResourceScheduleing_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.airavata.model.error.AuthorizationException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, updateResourceScheduleing_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class updateResourceScheduleing_resultTupleSchemeFactory implements SchemeFactory {
+      public updateResourceScheduleing_resultTupleScheme getScheme() {
+        return new updateResourceScheduleing_resultTupleScheme();
+      }
+    }
+
+    private static class updateResourceScheduleing_resultTupleScheme extends TupleScheme<updateResourceScheduleing_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, updateResourceScheduleing_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetAe()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, updateResourceScheduleing_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.ae = new org.apache.airavata.model.error.AuthorizationException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class validateExperiment_args implements org.apache.thrift.TBase<validateExperiment_args, validateExperiment_args._Fields>, java.io.Serializable, Cloneable, Comparable<validateExperiment_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("validateExperiment_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+    private static final org.apache.thrift.protocol.TField AIRAVATA_EXPERIMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("airavataExperimentId", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new validateExperiment_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new validateExperiment_argsTupleSchemeFactory());
+    }
+
+    public org.apache.airavata.model.security.AuthzToken authzToken; // required
+    public String airavataExperimentId; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken"),
+      AIRAVATA_EXPERIMENT_ID((short)2, "airavataExperimentId");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          case 2: // AIRAVATA_EXPERIMENT_ID
+            return AIRAVATA_EXPERIMENT_ID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.security.AuthzToken.class)));
+      tmpMap.put(_Fields.AIRAVATA_EXPERIMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("airavataExperimentId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(validateExperiment_args.class, metaDataMap);
+    }
+
+    public validateExperiment_args() {
+    }
+
+    public validateExperiment_args(
+      org.apache.airavata.model.security.AuthzToken authzToken,
+      String airavataExperimentId)
+    {
+      this();
+      this.authzToken = authzToken;
+      this.airavataExperimentId = airavataExperimentId;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public validateExperiment_args(validateExperiment_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.airavata.model.security.AuthzToken(other.authzToken);
+      }
+      if (other.isSetAiravataExperimentId()) {
+        this.airavataExperimentId = other.airavataExperimentId;
+      }
+    }
+
+    public validateExperiment_args deepCopy() {
+      return new validateExperiment_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+      this.airavataExperimentId = null;
+    }
+
+    public org.apache.airavata.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public validateExperiment_args setAuthzToken(org.apache.airavata.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    public String getAiravataExperimentId() {
+      return this.airavataExperimentId;
+    }
+
+    public validateExperiment_args setAiravataExperimentId(String airavataExperimentId) {
+      this.airavataExperimentId = airavataExperimentId;
+      return this;
+    }
+
+    public void unsetAiravataExperimentId() {
+      this.airavataExperimentId = null;
+    }
+
+    /** Returns true if field airavataExperimentId is set (has been assigned a value) and false otherwise */
+    public boolean isSetAiravataExperimentId() {
+      return this.airavataExperimentId != null;
+    }
+
+    public void setAiravataExperimentIdIsSet(boolean value) {
+      if (!value) {
+        this.airavataExperimentId = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.airavata.model.security.AuthzToken)value);
+        }
+        break;
+
+      case AIRAVATA_EXPERIMENT_ID:
+        if (value == null) {
+          unsetAiravataExperimentId();
+        } else {
+          setAiravataExperimentId((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      case AIRAVATA_EXPERIMENT_ID:
+        return getAiravataExperimentId();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      case AIRAVATA_EXPERIMENT_ID:
+        return isSetAiravataExperimentId();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof validateExperiment_args)
+        return this.equals((validateExperiment_args)that);
+      return false;
+    }
+
+    public boolean equals(validateExperiment_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      boolean this_present_airavataExperimentId = true && this.isSetAiravataExperimentId();
+      boolean that_present_airavataExperimentId = true && that.isSetAiravataExperimentId();
+      if (this_present_airavataExperimentId || that_present_airavataExperimentId) {
+        if (!(this_present_airavataExperimentId && that_present_airavataExperimentId))
+          return false;
+        if (!this.airavataExperimentId.equals(that.airavataExperimentId))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      List<Object> list = new ArrayList<Object>();
+
+      boolean present_authzToken = true && (isSetAuthzToken());
+      list.add(present_authzToken);
+      if (present_authzToken)
+        list.add(authzToken);
+
+      boolean present_airavataExperimentId = true && (isSetAiravataExperimentId());
+      list.add(present_airavataExperimentId);
+      if (present_airavataExperimentId)
+        list.add(airavataExperimentId);
+
+      return list.hashCode();
+    }
+
+    @Override
+    public int compareTo(validateExperiment_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAiravataExperimentId()).compareTo(other.isSetAiravataExperimentId());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAiravataExperimentId()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.airavataExperimentId, other.airavataExperimentId);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("validateExperiment_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("airavataExperimentId:");
+      if (this.airavataExperimentId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.airavataExperimentId);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      if (airavataExperimentId == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataExperimentId' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class validateExperiment_argsStandardSchemeFactory implements SchemeFactory {
+      public validateExperiment_argsStandardScheme getScheme() {
+        return new validateExperiment_argsStandardScheme();
+      }
+    }
+
+    private static class validateExperiment_argsStandardScheme extends StandardScheme<validateExperiment_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, validateExperiment_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 2: // AIRAVATA_EXPERIMENT_ID
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.airavataExperimentId = iprot.readString();
+                struct.setAiravataExperimentIdIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, validateExperiment_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.airavataExperimentId != null) {
+          oprot.writeFieldBegin(AIRAVATA_EXPERIMENT_ID_FIELD_DESC);
+          oprot.writeString(struct.airavataExperimentId);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class validateExperiment_argsTupleSchemeFactory implements SchemeFactory {
+      public validateExperiment_argsTupleScheme getScheme() {
+        return new validateExperiment_argsTupleScheme();
+      }
+    }
+
+    private static class validateExperiment_argsTupleScheme extends TupleScheme<validateExperiment_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, validateExperiment_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+        oprot.writeString(struct.airavataExperimentId);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, validateExperiment_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        struct.authzToken = new org.apache.airavata.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+        struct.airavataExperimentId = iprot.readString();
+        struct.setAiravataExperimentIdIsSet(true);
+      }
+    }
+
+  }
+
+  public static class validateExperiment_result implements org.apache.thrift.TBase<validateExperiment_result, validateExperiment_result._Fields>, java.io.Serializable, Cloneable, Comparable<validateExperiment_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("validateExperiment_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+    private static final org.apache.thrift.protocol.TField IRE_FIELD_DESC = new org.apache.thrift.protocol.TField("ire", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+    private static final org.apache.thrift.protocol.TField ENF_FIELD_DESC = new org.apache.thrift.protocol.TField("enf", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+    private static final org.apache.thrift.protocol.TField ACE_FIELD_DESC = new org.apache.thrift.protocol.TField("ace", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+    private static final org.apache.thrift.protocol.TField ASE_FIELD_DESC = new org.apache.thrift.protocol.TField("ase", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new validateExperiment_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new validateExperiment_resultTupleSchemeFactory());
+    }
+
+    public boolean success; // required
+    public org.apache.airavata.model.error.InvalidRequestException ire; // required
+    public org.apache.airavata.model.error.ExperimentNotFoundException enf; // required
+    public org.apache.airavata.model.error.AiravataClientException ace; // required
+    public org.apache.airavata.model.error.AiravataSystemException ase; // required
+    public org.apache.airavata.model.error.AuthorizationException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      IRE((short)1, "ire"),
+      ENF((short)2, "enf"),
+      ACE((short)3, "ace"),
+      ASE((short)4, "ase"),
+      AE((short)5, "ae");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // IRE
+            return IRE;
+          case 2: // ENF
+            return ENF;
+          case 3: // ACE
+            return ACE;
+          case 4: // ASE
+            return ASE;
+          case 5: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    private static final int __SUCCESS_ISSET_ID = 0;
+    private byte __isset_bitfield = 0;
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+      tmpMap.put(_Fields.IRE, new org.apache.thrift.meta_data.FieldMetaData("ire", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+      tmpMap.put(_Fields.ENF, new org.apache.thrift.meta_data.FieldMetaData("enf", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+      tmpMap.put(_Fields.ACE, new org.apache.thrift.meta_data.FieldMetaData("ace", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+      tmpMap.put(_Fields.ASE, new org.apache.thrift.meta_data.FieldMetaData("ase", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(validateExperiment_result.class, metaDataMap);
+    }
+
+    public validateExperiment_result() {
+    }
+
+    public validateExperiment_result(
+      boolean success,
+      org.apache.airavata.model.error.InvalidRequestException ire,
+      org.apache.airavata.model.error.ExperimentNotFoundException enf,
+      org.apache.airavata.model.error.AiravataClientException ace,
+      org.apache.airavata.model.error.AiravataSystemException ase,
+      org.apache.airavata.model.error.AuthorizationException ae)
+    {
+      this();
+      this.success = success;
+      setSuccessIsSet(true);
+      this.ire = ire;
+      this.enf = enf;
+      this.ace = ace;
+      this.ase = ase;
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public validateExperiment_result(validateExperiment_result other) {
+      __isset_bitfield = other.__isset_bitfield;
+      this.success = other.success;
+      if (other.isSetIre()) {
+        this.ire = new org.apache.airavata.model.error.InvalidRequestException(other.ire);
+      }
+      if (other.isSetEnf()) {
+        this.enf = new org.apache.airavata.model.error.ExperimentNotFoundException(other.enf);
+      }
+      if (other.isSetAce()) {
+        this.ace = new org.apache.airavata.model.error.AiravataClientException(other.ace);
+      }
+      if (other.isSetAse()) {
+        this.ase = new org.apache.airavata.model.error.AiravataSystemException(other.ase);
+      }
+      if (other.isSetAe()) {
+        this.ae = new org.apache.airavata.model.error.AuthorizationException(other.ae);
+      }
+    }
+
+    public validateExperiment_result deepCopy() {
+      return new validateExperiment_result(this);
+    }
+
+    @Override
+    public void clear() {
+      setSuccessIsSet(false);
+      this.success = false;
+      this.ire = null;
+      this.enf = null;
+      this.ace = null;
+      this.ase = null;
+      this.ae = null;
+    }
+
+    public boolean isSuccess() {
+      return this.success;
+    }
+
+    public validateExperiment_result setSuccess(boolean success) {
+      this.success = success;
+      setSuccessIsSet(true);
+      return this;
+    }
+
+    public void unsetSuccess() {
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+    }
+
+    public org.apache.airavata.model.error.InvalidRequestException getIre() {
+      return this.ire;
+    }
+
+    public validateExperiment_result setIre(org.apache.airavata.model.error.InvalidRequestException ire) {
+      this.ire = ire;
+      return this;
+    }
+
+    public void unsetIre() {
+      this.ire = null;
+    }
+
+    /** Returns true if field ire is set (has been assigned a value) and false otherwise */
+    public boolean isSetIre() {
+      return this.ire != null;
+    }
+
+    public void setIreIsSet(boolean value) {
+      if (!value) {
+        this.ire = null;
+      }
+    }
+
+    public org.apache.airavata.model.error.ExperimentNotFoundException getEnf() {
+      return this.enf;
+    }
+
+    public validateExperiment_result setEnf(org.apache.airavata.model.error.ExperimentNotFoundException enf) {
+      this.enf = enf;
+      return this;
+    }
+
+    public void unsetEnf() {
+      this.enf = null;
+    }
+
+    /** Returns true if field enf is set (has been assigned a value) and false otherwise */
+    public boolean isSetEnf() {
+      return this.enf != null;
+    }
+
+    public void setEnfIsSet(boolean value) {
+      if (!value) {
+        this.enf = null;
+      }
+    }
+
+    public org.apache.airavata.model.error.AiravataClientException getAce() {
+      return this.ace;
+    }
+
+    public validateExperiment_result setAce(org.apache.airavata.model.error.AiravataClientException ace) {
+      this.ace = ace;
+      return this;
+    }
+
+    public void unsetAce() {
+      this.ace = null;
+    }
+
+    /** Returns true if field ace is set (has been assigned a value) and false otherwise */
+    public boolean isSetAce() {
+      return this.ace != null;
+    }
+
+    public void setAceIsSet(boolean value) {
+      if (!value) {
+        this.ace = null;
+      }
+    }
+
+    public org.apache.airavata.model.error.AiravataSystemException getAse() {
+      return this.ase;
+    }
+
+    public validateExperiment_result setAse(org.apache.airavata.model.error.AiravataSystemException ase) {
+      this.ase = ase;
+      return this;
+    }
+
+    public void unsetAse() {
+      this.ase = null;
+    }
+
+    /** Returns true if field ase is set (has been assigned a value) and false otherwise */
+    public boolean isSetAse() {
+      return this.ase != null;
+    }
+
+    public void setAseIsSet(boolean value) {
+      if (!value) {
+        this.ase = null;
+      }
+    }
+
+    public org.apache.airavata.model.error.AuthorizationException getAe() {
+      return this.ae;
+    }
+
+    public validateExperiment_result setAe(org.apache.airavata.model.error.AuthorizationException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((Boolean)value);
+        }
+        break;
+
+      case IRE:
+        if (value == null) {
+          unsetIre();
+        } else {
+          setIre((org.apache.airavata.model.error.InvalidRequestException)value);
+        }
+        break;
+
+      case ENF:
+        if (value == null) {
+          unsetEnf();
+        } else {
+          setEnf((org.apache.airavata.model.error.ExperimentNotFoundException)value);
+        }
+        break;
+
+      case ACE:
+        if (value == null) {
+          unsetAce();
+        } else {
+          setAce((org.apache.airavata.model.error.AiravataClientException)value);
+        }
+        break;
+
+      case ASE:
+        if (value == null) {
+          unsetAse();
+        } else {
+          setAse((org.apache.airavata.model.error.AiravataSystemException)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.airavata.model.error.AuthorizationException)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return isSuccess();
+
+      case IRE:
+        return getIre();
+
+      case ENF:
+        return getEnf();
+
+      case ACE:
+        return getAce();
+
+      case ASE:
+        return getAse();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case IRE:
+        return isSetIre();
+      case ENF:
+        return isSetEnf();
+      case ACE:
+        return isSetAce();
+      case ASE:
+        return isSetAse();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof validateExperiment_result)
+        return this.equals((validateExperiment_result)that);
+      return false;
+    }
+
+    public boolean equals(validateExperiment_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true;
+      boolean that_present_success = true;
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (this.success != that.success)
+          return false;
+      }
+
+      boolean this_present_ire = true && this.isSetIre();
+      boolean that_present_ire = true && that.isSetIre();
+      if (this_present_ire || that_present_ire) {
+        if (!(this_present_ire && that_present_ire))
+          return false;
+        if (!this.ire.equals(that.ire))
+          return false;
+      }
+
+      boolean this_present_enf = true && this.isSetEnf();
+      boolean that_present_enf = true && that.isSetEnf();
+      if (this_present_enf || that_present_enf) {
+        if (!(this_present_enf && that_present_enf))
+          return false;
+        if (!this.enf.equals(that.enf))
+          return false;
+      }
+
+      boolean this_present_ace = true && this.isSetAce();
+      boolean that_present_ace = true && that.isSetAce();
+      if (this_present_ace || that_present_ace) {
+        if (!(this_present_ace && that_present_ace))
+          return false;
+        if (!this.ace.equals(that.ace))
+          return false;
+      }
+
+      boolean this_present_ase = true && this.isSetAse();
+      boolean that_present_ase = true && that.isSetAse();
+      if (this_present_ase || that_present_ase) {
+        if (!(this_present_ase && that_present_ase))
+          return false;
+        if (!this.ase.equals(that.ase))
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      List<Object> list = new ArrayList<Object>();
+
+      boolean present_success = true;
+      list.add(present_success);
+      if (present_success)
+        list.add(success);
+
+      boolean present_ire = true && (isSetIre());
+      list.add(present_ire);
+      if (present_ire)
+        list.add(ire);
+
+      boolean present_enf = true && (isSetEnf());
+      list.add(present_enf);
+      if (present_enf)
+        list.add(enf);
+
+      boolean present_ace = true && (isSetAce());
+      list.add(present_ace);
+      if (present_ace)
+        list.add(ace);
+
+      boolean present_ase = true && (isSetAse());
+      list.add(present_ase);
+      if (present_ase)
+        list.add(ase);
+
+      boolean present_ae = true && (isSetAe());
+      list.add(present_ae);
+      if (present_ae)
+        list.add(ae);
+
+      return list.hashCode();
+    }
+
+    @Override
+    public int compareTo(validateExperiment_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetIre()).compareTo(other.isSetIre());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetIre()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ire, other.ire);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetEnf()).compareTo(other.isSetEnf());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetEnf()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.enf, other.enf);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAce()).compareTo(other.isSetAce());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAce()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ace, other.ace);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAse()).compareTo(other.isSetAse());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAse()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ase, other.ase);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("validateExperiment_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      sb.append(this.success);
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ire:");
+      if (this.ire == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ire);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("enf:");
+      if (this.enf == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.enf);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ace:");
+      if (this.ace == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ace);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ase:");
+      if (this.ase == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ase);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+        __isset_bitfield = 0;
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class validateExperiment_resultStandardSchemeFactory implements SchemeFactory {
+      public validateExperiment_resultStandardScheme getScheme() {
+        return new validateExperiment_resultStandardScheme();
       }
     }
 
-    private static class updateResourceScheduleing_resultStandardScheme extends StandardScheme<updateResourceScheduleing_result> {
+    private static class validateExperiment_resultStandardScheme extends StandardScheme<validateExperiment_result> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, updateResourceScheduleing_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, validateExperiment_result struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -75668,7 +77088,51 @@ public class Airavata {
             break;
           }
           switch (schemeField.id) {
-            case 1: // AE
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+                struct.success = iprot.readBool();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // IRE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ire = new org.apache.airavata.model.error.InvalidRequestException();
+                struct.ire.read(iprot);
+                struct.setIreIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 2: // ENF
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.enf = new org.apache.airavata.model.error.ExperimentNotFoundException();
+                struct.enf.read(iprot);
+                struct.setEnfIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 3: // ACE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ace = new org.apa

<TRUNCATED>

[5/5] airavata git commit: adding data mover code to data manager

Posted by sc...@apache.org.
adding data mover code to data manager


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6572a821
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6572a821
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6572a821

Branch: refs/heads/master
Commit: 6572a821436871df07d5747949c16c14fce69444
Parents: 36da4ee
Author: scnakandala <su...@gmail.com>
Authored: Wed Dec 16 18:21:39 2015 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Wed Dec 16 18:21:39 2015 -0500

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |    62 +-
 .../java/org/apache/airavata/api/Airavata.java  | 37488 +++++++++--------
 .../main/resources/lib/airavata/Airavata.cpp    |   569 +
 .../src/main/resources/lib/airavata/Airavata.h  |   170 +
 .../lib/airavata/Airavata_server.skeleton.cpp   |     5 +
 .../resources/lib/Airavata/API/Airavata.php     |   402 +
 .../lib/apache/airavata/api/Airavata-remote     |     7 +
 .../lib/apache/airavata/api/Airavata.py         |   320 +
 .../data/catalog/core/DataManagerFactory.java   |    34 -
 .../data/catalog/core/DataManagerImpl.java      |   207 -
 .../data/manager/core/DataManagerFactory.java   |    34 +
 .../data/manager/core/DataManagerImpl.java      |   393 +
 .../data/manager/core/ssh/CommandOutput.java    |    34 +
 .../data/manager/core/ssh/SSHApiException.java  |    33 +
 .../data/manager/core/ssh/SSHUtils.java         |   505 +
 .../manager/core/ssh/StandardOutReader.java     |    86 +
 .../manager/core/DataManagerFactoryTest.java    |    45 +
 .../data/manager/core/DataManagerImplTest.java  |   208 +
 .../data/manager/core/utils/AppCatInit.java     |   320 +
 .../data/manager/core/utils/DataCatInit.java    |   315 +
 .../catalog/core/DataManagerFactoryTest.java    |    41 -
 .../data/catalog/core/DataManagerImplTest.java  |   205 -
 .../data/catalog/core/utils/AppCatInit.java     |   320 -
 .../data/catalog/core/utils/DataCatInit.java    |   315 -
 .../airavata/data/catalog/cpi/DataManager.java  |    98 -
 .../data/catalog/cpi/DataManagerConstants.java  |    28 -
 .../data/catalog/cpi/DataManagerException.java  |    35 -
 .../airavata/data/manager/cpi/DataManager.java  |   109 +
 .../data/manager/cpi/DataManagerConstants.java  |    28 +
 .../data/manager/cpi/DataManagerException.java  |    35 +
 modules/data-manager/pom.xml                    |     4 +
 .../airavata-apis/airavata_api.thrift           |    10 +
 32 files changed, 23212 insertions(+), 19253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 1ad1536..0917f5e 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -32,9 +32,9 @@ import org.apache.airavata.credential.store.client.CredentialStoreClientFactory;
 import org.apache.airavata.credential.store.cpi.CredentialStoreService;
 import org.apache.airavata.credential.store.datamodel.SSHCredential;
 import org.apache.airavata.credential.store.exception.CredentialStoreException;
-import org.apache.airavata.data.catalog.core.DataManagerFactory;
-import org.apache.airavata.data.catalog.cpi.DataManager;
-import org.apache.airavata.data.catalog.cpi.DataManagerException;
+import org.apache.airavata.data.manager.core.DataManagerFactory;
+import org.apache.airavata.data.manager.cpi.DataManager;
+import org.apache.airavata.data.manager.cpi.DataManagerException;
 import org.apache.airavata.messaging.core.MessageContext;
 import org.apache.airavata.messaging.core.Publisher;
 import org.apache.airavata.messaging.core.PublisherFactory;
@@ -4069,17 +4069,6 @@ public class AiravataServerHandler implements Airavata.Iface {
      * *
      */
 
-    /**
-     * Create new data resource. Resourse ID is returned
-     * @param authzToken
-     * @param dataResourceModel
-     * @return
-     * @throws InvalidRequestException
-     * @throws AiravataClientException
-     * @throws AiravataSystemException
-     * @throws AuthorizationException
-     * @throws TException
-     */
     @Override
     @SecurityCheck
     public String registerDataResource(AuthzToken authzToken, DataResourceModel dataResourceModel) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
@@ -4095,16 +4084,6 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
-    /**
-     * Update exisiting data resource
-     * @param authzToken
-     * @param dataResourceModel
-     * @throws InvalidRequestException
-     * @throws AiravataClientException
-     * @throws AiravataSystemException
-     * @throws AuthorizationException
-     * @throws TException
-     */
     @Override
     @SecurityCheck
     public void updateDataResource(AuthzToken authzToken, DataResourceModel dataResourceModel) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
@@ -4120,16 +4099,6 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
-    /**
-     * Remove existing data resource
-     * @param authzToken
-     * @param resourceId
-     * @throws InvalidRequestException
-     * @throws AiravataClientException
-     * @throws AiravataSystemException
-     * @throws AuthorizationException
-     * @throws TException
-     */
     @Override
     @SecurityCheck
     public void removeDataResource(AuthzToken authzToken, String resourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
@@ -4145,17 +4114,6 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
-    /**
-     * Retreive existing data resource
-     * @param authzToken
-     * @param resourceId
-     * @return
-     * @throws InvalidRequestException
-     * @throws AiravataClientException
-     * @throws AiravataSystemException
-     * @throws AuthorizationException
-     * @throws TException
-     */
     @Override
     @SecurityCheck
     public DataResourceModel getDataResource(AuthzToken authzToken, String resourceId) throws InvalidRequestException,
@@ -4172,6 +4130,20 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
+    @Override
+    public String copyDataResource(AuthzToken authzToken, String resourceId, String destStorageResourceId, String destinationParentPath) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+        try {
+            DataManager dataManager = DataManagerFactory.getDataManager();
+            return dataManager.copyResource(resourceId, destStorageResourceId, destinationParentPath);
+        } catch (DataManagerException e) {
+            String msg = "Error in copying the data resource "+resourceId+".";
+            logger.error(msg, e);
+            AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage(msg+" More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
     private WorkflowCatalog getWorkflowCatalog() {
 		if (workflowCatalog == null) {
 			try {