airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [airavata-sandbox] branch master updated: Added database related files and updated thrift files to add more methods (#24)
Date Tue, 05 Dec 2017 12:51:41 GMT
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git


The following commit(s) were added to refs/heads/master by this push:
     new e8a8495  Added database related files and updated thrift files to add more methods
(#24)
e8a8495 is described below

commit e8a8495e0d3439ae93e7fa0149465844095e2dbc
Author: Harsha Phulwani <harshaphulwani16@gmail.com>
AuthorDate: Tue Dec 5 07:51:39 2017 -0500

    Added database related files and updated thrift files to add more methods (#24)
    
    * Added Added initial files for entities,repositories for allocation manager module
    
    * Revert "Added Added initial files for entities,repositories for allocation manager module"
    
    This reverts commit 645c7fc51f2855e1149bc506c20d13501ce39515.
    
    * Added entities,repositories,utils and updated pom file
    
    * Added entities,repositories,utils and updated pom file
    
    * Revert "Added entities,repositories,utils and updated pom file"
    
    This reverts commit 9859fd79e659db94e86489cdb2611e84a3c398c4.
    
    * Added entities,repositories,utils and updated pom file
    
    * Added test cases,persistance files
    
    * Deleted binary files
    
    * Updated thrift file to add more methods
---
 .../airavata-allocation-manager-server/pom.xml     |  34 +++
 .../UserAllocationDetailRepository.java            |   6 +-
 .../src/main/resources/META-INF/persistence.xml    |  11 +
 .../main/resources/allocation-manager-mysql.sql    |  58 ++++
 .../AllocationManagerServerHandlerTest.java        |  86 ++++++
 .../allocation/manager/util/Initialize.java        | 296 +++++++++++++++++++++
 .../airavata/allocation/manager/models/Domain.java |   1 +
 .../thrift_models/allocation_manager_cpi.thrift    |  14 +
 8 files changed, 502 insertions(+), 4 deletions(-)

diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
index 1cd1814..94cdb66 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
@@ -64,6 +64,40 @@
 			<artifactId>javax.persistence</artifactId>
 			<version>2.0.0</version>
 		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.7.10</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.dozer</groupId>
+			<artifactId>dozer</artifactId>
+			<version>5.4.0</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.slf4j</groupId>
+					<artifactId>slf4j-log4j12</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.openjpa</groupId>
+			<artifactId>openjpa-all</artifactId>
+			<version>2.2.0</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.34</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
+		<dependency>
+			<groupId>org.apache.thrift</groupId>
+			<artifactId>libthrift</artifactId>
+			<version>0.10.0</version>
+			<type>pom</type>
+		</dependency>
 	</dependencies>
 	<properties>
 		<maven.compiler.source>1.8</maven.compiler.source>
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
index 394f2b8..adfd6d2 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
@@ -1,13 +1,11 @@
 package org.apache.airavata.allocation.manager.db.repositories;
 
 import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
-import org.apache.airavata.allocation.manager.models.*;
+import org.apache.airavata.allocation.manager.models.UserAllocationDetail;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class UserAllocationDetailRepository 
-        //extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity,
UserAllocationDetailPK>{
-        extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String>
{
+public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail,
UserAllocationDetailEntity, String> {
     private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
 
     public UserAllocationDetailRepository(){
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/resources/META-INF/persistence.xml
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..a006ad6
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+
+    <persistence-unit name="airavata-allocation-manager">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity</class>
+        <class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity</class>
+        <class>org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity</class>
+        <class>org.apache.airavata.allocation.manager.db.entities.UserDetailEntity</class>
+    </persistence-unit>
+</persistence>
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
new file mode 100644
index 0000000..20824f6
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+CREATE TABLE IF NOT EXISTS USER_ALLOCATION_DETAILS (
+    REQUESTED_DATE BIGINT NOT NULL,
+    TITLE TEXT NOT NULL,
+    PROJECT_DESCRIPTION TEXT NOT NULL,
+    KEYWORDS TEXT,
+    FIELD_OF_SCIENCE TEXT,
+    DOCUMENTS BLOB,
+    TYPE_OF_ALLOCATION VARCHAR (255) NOT NULL,
+    USERNAME VARCHAR (255) NOT NULL,
+    PROJECT_ID VARCHAR (255) ,
+    APPLICATIONS_TO_BE_USED TEXT,
+    SPECIFIC_RESOURCE_SELECTION TEXT,
+    SERVICE_UNITS BIGINT default 1,
+    TYPICAL_SU_PER_JOB BIGINT,
+    MAX_MEMORY_PER_CPU BIGINT,
+    DISK_USAGE_RANGE_PER_JOB BIGINT,
+    NUMBER_OF_CPU_PER_JOB BIGINT,
+    PROJECT_REVIEWED_AND_FUNDED_BY TEXT,
+    PRIMARY KEY (PROJECT_ID, USERNAME)
+);
+
+CREATE TABLE IF NOT EXISTS USER_DETAILS (
+    USERNAME VARCHAR (255) PRIMARY KEY,
+    PASSWORD VARCHAR (255) NOT NULL,
+    FULL_NAME TEXT,
+    EMAIL TEXT NOT NULL,
+    USER_TYPE VARCHAR (255) NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS REQUEST_STATUS (
+    PROJECT_ID VARCHAR (255) PRIMARY KEY,
+    STATUS VARCHAR (255) NOT NULL,
+    REVIEWERS TEXT,
+    START_DATE BIGINT,
+    END_DATE BIGINT,
+    AWARD_ALLOCATION BIGINT
+);
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/test/java/org/apache/airavata/allocation/manager/AllocationManagerServerHandlerTest.java
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/test/java/org/apache/airavata/allocation/manager/AllocationManagerServerHandlerTest.java
new file mode 100644
index 0000000..80dc934
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/test/java/org/apache/airavata/allocation/manager/AllocationManagerServerHandlerTest.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.allocation.manager;
+
+import junit.framework.Assert;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.allocation.manager.models.*;
+import org.apache.airavata.allocation.manager.server.AllocationManagerServerHandler;
+import org.apache.airavata.allocation.manager.util.Initialize;
+import org.apache.thrift.TException;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class AllocationManagerServerHandlerTest {
+    private final static Logger logger = LoggerFactory.getLogger(AllocationManagerServerHandlerTest.class);
+
+    @BeforeClass
+    public static void setup() throws AllocationManagerException, SQLException {
+        Initialize initialize = new Initialize("sharing-registry-derby.sql");
+        initialize.initializeDB();
+    }
+
+    @Test
+    public void test() throws Exception {
+        AllocationManagerServerHandler allocationManagerServerHandler = new AllocationManagerServerHandler();
+
+      //Creating requests
+        UserAllocationDetail userAllocationDetails = new UserAllocationDetail();
+        UserAllocationDetailPK userAllocationDetailPK = new UserAllocationDetailPK(); 
+        userAllocationDetailPK.setProjectId("123");
+        userAllocationDetailPK.setUsername("harsha");
+        userAllocationDetails.setId(userAllocationDetailPK);
+        userAllocationDetails.setApplicationsToBeUsed("AB, BC");
+        userAllocationDetails.setDiskUsageRangePerJob(2L);
+        userAllocationDetails.setTypicalSuPerJob(12l);
+        userAllocationDetails.setTitle("Chemistry Project");
+        userAllocationDetails.setSpecificResourceSelection("resource");
+        userAllocationDetails.setServiceUnits(2L);
+        userAllocationDetails.setProjectDescription("This project does the calculation ...");
+        userAllocationDetails.setProjectReviewedAndFundedBy("NSA");
+        userAllocationDetails.setMaxMemoryPerCpu(100L);
+        userAllocationDetails.setDiskUsageRangePerJob(20L);
+        userAllocationDetails.setNumberOfCpuPerJob(5L);
+        userAllocationDetails.setKeywords("chemistry,biology");
+        userAllocationDetails.setFieldOfScience("chemistry");
+        userAllocationDetails.setTypeOfAllocation("community");
+
+
+        Assert.assertNotNull(allocationManagerServerHandler.createAllocationRequest(userAllocationDetails));
+        Assert.assertEquals(allocationManagerServerHandler.getAllocationRequest("123"),userAllocationDetails);
+
+        UserAllocationDetail userAllocationDetails1 = new UserAllocationDetail();
+        UserAllocationDetailPK userAllocationDetailPK1 = new UserAllocationDetailPK(); 
+        userAllocationDetailPK1.setProjectId("123");
+        userAllocationDetailPK1.setUsername("harsha");
+        userAllocationDetails1.setId(userAllocationDetailPK1);
+
+        Assert.assertTrue(allocationManagerServerHandler.isAllocationRequestExists(userAllocationDetailPK1.getProjectId()));
+        Assert.assertEquals(allocationManagerServerHandler.createAllocationRequest(userAllocationDetails1),"There
exist project with the id");
+
+        Assert.assertTrue(allocationManagerServerHandler.deleteAllocationRequest("123"));
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/test/java/org/apache/airavata/allocation/manager/util/Initialize.java
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/test/java/org/apache/airavata/allocation/manager/util/Initialize.java
new file mode 100644
index 0000000..05c7240
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/test/java/org/apache/airavata/allocation/manager/util/Initialize.java
@@ -0,0 +1,296 @@
+/**
+ *
+ * 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.allocation.manager.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.allocation.manager.db.utils.JPAUtils;
+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 Initialize {
+    private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public  String scriptName ;
+    private NetworkServerControl server;
+    private static final String delimiter = ";";
+    public static final String PERSISTANT_DATA = "Configuration";
+
+    public Initialize(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() throws SQLException{
+        String jdbcUrl = null;
+        String jdbcUser = null;
+        String jdbcPassword = null;
+        try{
+            jdbcUrl = ServerSettings.getSetting("sharingcatalog.jdbc.url");
+            jdbcUser = ServerSettings.getSetting("sharingcatalog.jdbc.user");
+            jdbcPassword = ServerSettings.getSetting("sharingcatalog.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...");
+        }
+
+        Connection conn = null;
+        try {
+            Class.forName(JPAUtils.readServerProperties(JPAUtils.SHARING_REG_JDBC_DRIVER)).newInstance();
+            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+            if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
+                executeSQLScript(conn);
+                logger.info("New Database created for Registry");
+            } else {
+                logger.debug("Database already created for Registry!");
+            }
+        } 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");
+            String jdbcURL = JPAUtils.readServerProperties(JPAUtils.SHARING_REG_JDBC_URL);
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            server = new NetworkServerControl(InetAddress.getByName(uri.getHost()),
+                    20000,
+                    JPAUtils.readServerProperties(JPAUtils.SHARING_REG_JDBC_USER), JPAUtils.readServerProperties(JPAUtils.SHARING_REG_JDBC_USER));
+            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 void stopDerbyServer() throws SQLException{
+        try {
+            server.shutdown();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new SQLException("Error while stopping derby server", e);
+        }
+    }
+}
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
index 6de324d..6a68356 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
@@ -791,3 +791,4 @@ public class Domain implements org.apache.thrift.TBase<Domain, Domain._Fields>,
   }
 }
 
+>>>>>>> 80a1930c4052868744cf676a4ac05a0587781f98
diff --git a/allocation-manager/thrift_models/allocation_manager_cpi.thrift b/allocation-manager/thrift_models/allocation_manager_cpi.thrift
old mode 100644
new mode 100755
index b8b3116..9139f0f
--- a/allocation-manager/thrift_models/allocation_manager_cpi.thrift
+++ b/allocation-manager/thrift_models/allocation_manager_cpi.thrift
@@ -53,6 +53,20 @@ service AllocationRegistryService{
     <p>API method to update the status of a request</p>
     */
     void updateAllocationRequestStatus(1: required string projectId, 2: required string status)
+/**
+    <p>API method to get all requests for admin</p>
+    */
+    list<allocation_manager_models.UserAllocationDetail> getAllRequestsForAdmin(1:
required string userName)
+
+/**
+    <p>API method to assign reviewers</p>
+    */
+    bool assignReviewers(1:required allocation_manager_models.UserAllocationDetailPK projectId
, 2: required string userName)
+
+/**
+    <p>API method to update request submitted by reviewer</p>
+    */
+    bool updateRequestByReviewer(1:required allocation_manager_models.UserAllocationDetailPK
projectId, 2:required allocation_manager_models.UserAllocationDetail userAllocationDetail)
 
 
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@airavata.apache.org" <commits@airavata.apache.org>'].

Mime
View raw message