airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [2/8] airavata git commit: adding gatewayId to the replica catalog
Date Mon, 14 Dec 2015 16:05:43 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/modules/replica-catalog/src/test/java/org/apache/airavata/replica/catalog/utils/DataCatInit.java
----------------------------------------------------------------------
diff --git a/modules/replica-catalog/src/test/java/org/apache/airavata/replica/catalog/utils/DataCatInit.java
b/modules/replica-catalog/src/test/java/org/apache/airavata/replica/catalog/utils/DataCatInit.java
new file mode 100644
index 0000000..3d1d936
--- /dev/null
+++ b/modules/replica-catalog/src/test/java/org/apache/airavata/replica/catalog/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.apache.airavata.replica.catalog.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.core.replica.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/d3a5a5ea/modules/replica-catalog/src/test/resources/id_rsa
----------------------------------------------------------------------
diff --git a/modules/replica-catalog/src/test/resources/id_rsa b/modules/replica-catalog/src/test/resources/id_rsa
new file mode 100644
index 0000000..4527347
--- /dev/null
+++ b/modules/replica-catalog/src/test/resources/id_rsa
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,4882DC230357A4388E4A1690AB275C75
+
+/REcchTscfYjoYsJ8W6C1o0elvwpEpz/orX7+uoRTv0Iar9KxCOIg+Ms24cfO2Jn
+0PLHbB373XWTCtLMWojY0EgOJvQlzP3T4rzllGW/4nm+xhioxmxHY5nV3hi1JeFg
+H4BS9OJH1bfZvlLZiIgjmDQEKM2hMRjm2SXv9wrreZfiAgF1D7XfIYd15Tkaitzh
+bGkeAAFucC1Se3dw8aDvou5o9hLSyq/o6qg3WUcUMTSl8Cwh/8ubVjKpdonB0JO8
+hekvaeMkKCe4lh4ITsvQ09pyC3OpK+KzOVHbJeFZNGZ3uSNDnegG1I4AOpd+ypAt
+ZF5NZDQBW/LS85pghRS/LEjPJhW1M2Z05lpDWNpN4B2T51BomOvHKZKcuZk97V45
+1s/BI8I3sUsEyUqHumZXdSpnsSY10GfE+agY+0ltLRNtC+UMyDOZnQXepG7AZsAp
+xRlzuNvCt21oWdZPUuc8eHStAjzaxnbOlEG1AO1FMS11uXKSH8MfMSk0yYBUvQSv
+Ug5GZv9jkuSlHxBNGZqZU/xPNzkgixeRiBGyQAg75UcxXjTgQGawSL196baR3kS7
+66o+13Aq3hEtnUqePb1iD0XqxDKRdNe8oZiI+eTzjqNL6m0dWQeVLUO8nzRqR37S
++/fpY/NQWkEubeRmunVq074rdjvZOk9oBXBTe5eMDhUbqM3yKN9GYx9MYDjAK06Y
+nvZmtl6So979JyGlAFXuc9YqxYiS/BGmOZ/iYLeSC0Bn566c0+nHydfnsxdZWicO
+YzvZrqte/LywJWZkcjHv9St8hCram346M9QTBDAp9id2RuQiIW0cx4PUOeEzN+AC
+AEQM5qIkqZYyx9z3eTZJIP/aT7bwQdRlZ7lJ8AIwX8AaLAwlDNDdwAjXojiPuqe3
+AWnfrWSHsdiojgoSxbmbDH8lZz110tk3TId2yjOZC5Fsy4eOW68/GQZMKeWD3ylT
+ajpNYZyYUlERUJDsFDoJA877lbaGii/D5vAU5HSZUnFJeiCXTGWfBlouG/GnNhrk
+I+sfajxagJBHTa1Gamo12h/0xUftxuWqp1Sh3uTInoGowmWYEazNw9FFm/fjT6Sr
+sYpw0UD77vPsziWqaZyLyvc0hVEyupnvKwz0B2IdvTHOgF//XEezjy3Ivu6c/cJs
+qt4z8WACX+yeepzyEkJ5aVluHUtjNG+EfkFhnhg9dGZ5pOVVck6M6fo4b8dw15NF
+e0OPgLU8hfwqUwalG3QVrlZjhdPlDk0rAKTDWiQuvozkLcrT862tYkxrKnAcMdZN
+uEgbbKkuF32csp9zbgJtGBf/yvI1BaomIN/ZSp02h0onlAYC4u/ybA/bjDEWy8Qv
+u1m9YKpQYQtXiY5bB3++FzVVOBpkjyBPd/S9m5apPw4FP5IECSszcGFz7ReAG2AY
+u4wTnDcL19tGn0k1Z03VVgESAh04SxVZBKzC6BtTEYwwYkP2HoG11XEEfIQ5JY7W
+IowHL1WcPx69C2TbGt3JGkIjPatXR67sFKGiRceJzTEjsoUbjaqsRJO8QZN6vq31
+8iuI0VFM8VAG4bTc10s/18QaPd3lpKIo/OIIxUJc+c5GrppcHib9CEaCD0qn7vEd
+-----END RSA PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/modules/replica-catalog/src/test/resources/id_rsa.pub
----------------------------------------------------------------------
diff --git a/modules/replica-catalog/src/test/resources/id_rsa.pub b/modules/replica-catalog/src/test/resources/id_rsa.pub
new file mode 100644
index 0000000..c7eaaf3
--- /dev/null
+++ b/modules/replica-catalog/src/test/resources/id_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH5ggPJf0yYW39EEW2PsEojMLILZX/EvaMnghsj9/0HPY3C+DpFx5PAeYND4ITxZWnRjQmKsYN6Z7tL4wYbWfhMPUk8urKEB8ncdQK7tZZHdJuUmprfIi02LgeE2JmM13eimF2fEMRrCFqqMnCM63ihE/jzcyhwosRjlKfzYv5C23a8orGZh9g1V2LxjA7lkUyga7B/nsJBk75SA/uJZ4TcfeWS3okk2Pv8mKLmN23WKfAqvQadDkUphYPITa7MpdaUoVIDkUllzE82V6KQ4tXcbh1xSktv6k8sR9e7BsZSJVHFHoDitV9dcQGZIOdzmpNw2ZfmNW6IdrfrrVER7Cb
supun@156-56-179-175.dhcp-bl.indiana.edu

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/modules/replica-catalog/src/test/resources/known_hosts
----------------------------------------------------------------------
diff --git a/modules/replica-catalog/src/test/resources/known_hosts b/modules/replica-catalog/src/test/resources/known_hosts
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0f320b5..dfa5f2b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -551,7 +551,7 @@
 				<module>modules/commons</module>
                 <module>modules/messaging</module>
 				<module>modules/gfac</module>
-				<module>modules/data-manager</module>
+				<module>modules/replica-catalog</module>
 				<!--<module>modules/workflow-model</module>-->
 				<module>modules/registry</module>
 				<module>modules/security</module>

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/thrift-interface-descriptions/airavata-api/airavata_api.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-api/airavata_api.thrift b/thrift-interface-descriptions/airavata-api/airavata_api.thrift
index 55e8437..26c1d96 100644
--- a/thrift-interface-descriptions/airavata-api/airavata_api.thrift
+++ b/thrift-interface-descriptions/airavata-api/airavata_api.thrift
@@ -40,7 +40,7 @@ include "gateway_resource_profile_model.thrift"
 include "workflow_data_model.thrift"
 include "security_model.thrift"
 include "data_movement_models.thrift"
-include "data_resource_models.thrift"
+include "replica_catalog_models.thrift"
 
 namespace java org.apache.airavata.api
 namespace php Airavata.API
@@ -2338,13 +2338,13 @@ service Airavata {
  /**
   * Replica Catalog Related API Methods
  **/
- string publishDataResource(1: required security_model.AuthzToken authzToken, 2: required
data_resource_models.DataResourceModel dataResourceModel)
+ string publishDataResource(1: required security_model.AuthzToken authzToken, 2: required
replica_catalog_models.DataResourceModel dataResourceModel)
           throws (1: airavata_errors.InvalidRequestException ire,
                   2: airavata_errors.AiravataClientException ace,
                   3: airavata_errors.AiravataSystemException ase,
                   4: airavata_errors.AuthorizationException ae)
 
- void updateDataResource(1: required security_model.AuthzToken authzToken, 2: required data_resource_models.DataResourceModel
dataResourceModel)
+ void updateDataResource(1: required security_model.AuthzToken authzToken, 2: required replica_catalog_models.DataResourceModel
dataResourceModel)
            throws (1: airavata_errors.InvalidRequestException ire,
                    2: airavata_errors.AiravataClientException ace,
                    3: airavata_errors.AiravataSystemException ase,
@@ -2356,7 +2356,7 @@ service Airavata {
                    3: airavata_errors.AiravataSystemException ase,
                    4: airavata_errors.AuthorizationException ae)
 
- data_resource_models.DataResourceModel getDataResource(1: required security_model.AuthzToken
authzToken, 2: required string resourceId)
+ replica_catalog_models.DataResourceModel getDataResource(1: required security_model.AuthzToken
authzToken, 2: required string resourceId)
             throws (1: airavata_errors.InvalidRequestException ire,
                     2: airavata_errors.AiravataClientException ace,
                     3: airavata_errors.AiravataSystemException ase,

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/thrift-interface-descriptions/airavata-api/airavata_data_models.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-api/airavata_data_models.thrift b/thrift-interface-descriptions/airavata-api/airavata_data_models.thrift
index 118bac4..4e9badf 100644
--- a/thrift-interface-descriptions/airavata-api/airavata_data_models.thrift
+++ b/thrift-interface-descriptions/airavata-api/airavata_data_models.thrift
@@ -30,7 +30,7 @@ include "process_model.thrift"
 include "scheduling_model.thrift"
 include "status_models.thrift"
 include "data_movement_models.thrift"
-include "data_resource_models.thrift"
+include "replica_catalog_models.thrift"
 
 namespace java org.apache.airavata.model
 namespace php Airavata.Model

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/thrift-interface-descriptions/airavata-api/data_resource_models.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-api/data_resource_models.thrift b/thrift-interface-descriptions/airavata-api/data_resource_models.thrift
deleted file mode 100644
index 935d2fc..0000000
--- a/thrift-interface-descriptions/airavata-api/data_resource_models.thrift
+++ /dev/null
@@ -1,61 +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.
- *
- */
-
-  namespace java org.apache.airavata.model.data.resource
-  namespace php Airavata.Model.Data.Resource
-  namespace cpp apache.airavata.model.data.resource
-  namespace py apache.airavata.model.data.resource
-
-enum ReplicaLocationCategory {
-    GATEWAY_DATA_STORE,
-    COMPUTE_RESOURCE,
-    LONG_TERM_STORAGE_RESOURCE,
-    OTHER
-}
-
-enum ReplicaPersistentType {
-    TRANSIENT,
-    PERSISTENT
-}
-
-struct DataResourceModel {
-    1: optional string resourceId,
-    2: optional string resourceName,
-    3: optional string resourceDescription,
-    4: optional string ownerName,
-    5: optional i32 resourceSize,
-    6: optional i64 creationTime,
-    7: optional i64 lastModifiedTime,
-    8: optional map<string, string> resourceMetadata,
-    9: optional list<DataReplicaLocationModel> dataReplicaLocations
-}
-
-struct DataReplicaLocationModel {
-    1: optional string replicaId,
-    2: optional string resourceId,
-    3: optional string replicaName,
-    4: optional string replicaDescription,
-    5: optional i64 creationTime,
-    6: optional i64 lastModifiedTime,
-    7: optional ReplicaLocationCategory replicaLocationCategory,
-    8: optional ReplicaPersistentType replicaPersistentType,
-    9: optional list<string> dataLocations,
-    10: optional map<string, string> replicaMetadata
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/d3a5a5ea/thrift-interface-descriptions/airavata-api/replica_catalog_models.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-api/replica_catalog_models.thrift b/thrift-interface-descriptions/airavata-api/replica_catalog_models.thrift
new file mode 100644
index 0000000..0d44941
--- /dev/null
+++ b/thrift-interface-descriptions/airavata-api/replica_catalog_models.thrift
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ */
+
+  namespace java org.apache.airavata.model.data.resource
+  namespace php Airavata.Model.Data.Resource
+  namespace cpp apache.airavata.model.data.resource
+  namespace py apache.airavata.model.data.resource
+
+enum ReplicaLocationCategory {
+    GATEWAY_DATA_STORE,
+    COMPUTE_RESOURCE,
+    LONG_TERM_STORAGE_RESOURCE,
+    OTHER
+}
+
+enum ReplicaPersistentType {
+    TRANSIENT,
+    PERSISTENT
+}
+
+struct DataResourceModel {
+    1: optional string resourceId,
+    2: optional string gatewayId,
+    3: optional string resourceName,
+    4: optional string resourceDescription,
+    5: optional string ownerName,
+    6: optional i32 resourceSize,
+    7: optional i64 creationTime,
+    8: optional i64 lastModifiedTime,
+    9: optional map<string, string> resourceMetadata,
+    10: optional list<DataReplicaLocationModel> dataReplicaLocations
+}
+
+struct DataReplicaLocationModel {
+    1: optional string replicaId,
+    2: optional string resourceId,
+    3: optional string replicaName,
+    4: optional string replicaDescription,
+    5: optional i64 creationTime,
+    6: optional i64 lastModifiedTime,
+    7: optional ReplicaLocationCategory replicaLocationCategory,
+    8: optional ReplicaPersistentType replicaPersistentType,
+    9: optional list<string> dataLocations,
+    10: optional map<string, string> replicaMetadata
+}


Mime
View raw message