airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: adding workflow catalog properties and fixing issues with starting up databases
Date Fri, 05 Feb 2016 19:38:08 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop fb75a2f7e -> e21fae79e


adding workflow catalog properties and fixing issues with starting up databases


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

Branch: refs/heads/develop
Commit: e21fae79eeb6c7aae6f482db3e20e5745ccac6ed
Parents: fb75a2f
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Fri Feb 5 14:40:04 2016 -0500
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Fri Feb 5 14:40:04 2016 -0500

----------------------------------------------------------------------
 .../airavata/api/server/AiravataAPIServer.java  |  13 +-
 .../api/server/util/AppCatalogInitUtil.java     |   4 +-
 .../server/util/ExperimentCatalogInitUtil.java  | 203 +++++++++++++++++++
 .../api/server/util/RegistryInitUtil.java       | 203 -------------------
 .../server/util/WorkflowCatalogInitUtil.java    |   4 +-
 .../handler/AiravataServerHandlerTest.java      |   4 +-
 .../main/resources/airavata-server.properties   |  16 +-
 .../main/resources/workflowcatalog-derby.sql    |  14 +-
 .../main/resources/workflowcatalog-mysql.sql    |  16 +-
 9 files changed, 238 insertions(+), 239 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
index 49ddec7..d2e50ef 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
@@ -32,14 +32,13 @@ import org.apache.airavata.api.server.security.SecurityManagerFactory;
 import org.apache.airavata.api.server.security.interceptor.SecurityModule;
 import org.apache.airavata.api.server.util.AppCatalogInitUtil;
 import org.apache.airavata.api.server.util.Constants;
-import org.apache.airavata.api.server.util.RegistryInitUtil;
+import org.apache.airavata.api.server.util.ExperimentCatalogInitUtil;
 import org.apache.airavata.api.server.util.WorkflowCatalogInitUtil;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.IServer;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.error.AiravataErrorType;
 import org.apache.airavata.model.error.AiravataSystemException;
-import org.apache.airavata.registry.core.workflow.catalog.utils.WorkflowCatalogUtils;
 import org.apache.airavata.security.AiravataSecurityException;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.server.TThreadPoolServer;
@@ -68,9 +67,9 @@ public class AiravataAPIServer implements IServer{
 	
     public void startAiravataServer(Airavata.Processor<Airavata.Iface> airavataAPIServer)
throws AiravataSystemException {
         try {
-            RegistryInitUtil.initializeDB();
+            ExperimentCatalogInitUtil.initializeDB();
             AppCatalogInitUtil.initializeDB();
-//            WorkflowCatalogInitUtil.initializeDB();
+            WorkflowCatalogInitUtil.initializeDB();
             final String serverHost = ServerSettings.getSetting(Constants.API_SERVER_HOST,
null);
             if (!ServerSettings.isTLSEnabled()) {
                 final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT,
"8930"));
@@ -102,7 +101,7 @@ public class AiravataAPIServer implements IServer{
 				new Thread() {
 					public void run() {
                         server.serve();
-						RegistryInitUtil.stopDerbyInServerMode();
+						ExperimentCatalogInitUtil.stopDerbyInServerMode();
 						setStatus(ServerStatus.STOPPED);
 						logger.info("Airavata API Server Stopped.");
 					}
@@ -140,7 +139,7 @@ public class AiravataAPIServer implements IServer{
                 new Thread() {
                     public void run() {
                         TLSServer.serve();
-                        RegistryInitUtil.stopDerbyInServerMode();
+                        ExperimentCatalogInitUtil.stopDerbyInServerMode();
                         setStatus(ServerStatus.STOPPED);
                         logger.info("Airavata API Server over TLS Stopped.");
                     }
@@ -169,7 +168,7 @@ public class AiravataAPIServer implements IServer{
         } catch (TTransportException e) {
             logger.error(e.getMessage());
             setStatus(ServerStatus.FAILED);
-            RegistryInitUtil.stopDerbyInServerMode();
+            ExperimentCatalogInitUtil.stopDerbyInServerMode();
             throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
         } catch (ApplicationSettingsException e) {
             logger.error(e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
index c6dcd22..0be8922 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
@@ -74,9 +74,9 @@ public class AppCatalogInitUtil {
             conn = db.connect();
             if (!DatabaseCreator.isDatabaseStructureCreated(COMPUTE_RESOURCE, conn)) {
                 DatabaseCreator.createRegistryDatabase("database_scripts/appcatalog", conn);
-                logger.info("New Database created for App Catalog");
+                logger.info("New Database created for App Catalog !!!");
             } else {
-                logger.info("Database already created for App Catalog!");
+                logger.info("Database already created for App Catalog !!!");
             }
             GatewayProfileResource gatewayProfileResource = new GatewayProfileResource();
             if (!gatewayProfileResource.isExists(ServerSettings.getDefaultUserGateway())){

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/ExperimentCatalogInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/ExperimentCatalogInitUtil.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/ExperimentCatalogInitUtil.java
new file mode 100644
index 0000000..5e68c40
--- /dev/null
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/ExperimentCatalogInitUtil.java
@@ -0,0 +1,203 @@
+/*
+*
+* 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.api.server.util;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.ProjectResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.UserResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.WorkerResource;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExperimentCatalogInitUtil {
+    public static final String CONFIGURATION_TABLE = "CONFIGURATION";
+    private static final Logger logger = LoggerFactory.getLogger(ExperimentCatalogInitUtil.class);
+    public static final String REGISTRY_JDBC_DRIVER = "registry.jdbc.driver";
+    public static final String REGISTRY_JDBC_URL = "registry.jdbc.url";
+    public static final String REGISTRY_JDBC_USER = "registry.jdbc.user";
+    public static final String REGISTRY_JDBC_PASSWORD = "registry.jdbc.password";
+    public static final String START_DERBY_ENABLE = "start.derby.server.mode";
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public static final String DEFAULT_PROJECT_NAME = "default";
+    private static NetworkServerControl server;
+    private static JdbcStorage db;
+    private static String jdbcURl;
+    private static String jdbcDriver;
+    private static String jdbcUser;
+    private static String jdbcPassword;
+
+
+    public static void initializeDB() {
+        System.setProperty("registry.initialize.state", "0");
+        try{
+            jdbcDriver = ServerSettings.getSetting(REGISTRY_JDBC_DRIVER);
+            jdbcURl = ServerSettings.getSetting(REGISTRY_JDBC_URL);
+            jdbcUser = ServerSettings.getSetting(REGISTRY_JDBC_USER);
+            jdbcPassword = ServerSettings.getSetting(REGISTRY_JDBC_PASSWORD);
+            jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata server properties", e.getMessage());
+        }
+
+        if (getDBType(jdbcURl).equals("derby") && isDerbyStartEnabled()) {
+            startDerbyInServerMode();
+        }
+        db = new JdbcStorage(10, 50, jdbcURl, jdbcDriver, true);
+
+        Connection conn = null;
+        try {
+            conn = db.connect();
+            if (!DatabaseCreator.isDatabaseStructureCreated(CONFIGURATION_TABLE, conn)) {
+                DatabaseCreator.createRegistryDatabase("database_scripts/expcatalog", conn);
+                logger.info("New Database created for Experiment Catalog !!!");
+            } else {
+                logger.info("Database already created for Experiment Catalog !!!");
+            }
+            try{
+                GatewayResource gateway;
+                if (!ExpCatResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway())){
+                    gateway = (GatewayResource)ExpCatResourceUtils.createGateway(ServerSettings.getDefaultUserGateway());
+                    gateway.save();
+                }else {
+                    gateway = (GatewayResource)ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+                }
+
+                UserResource user;
+                if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserGateway())){
+                    user = ExpCatResourceUtils.createUser(ServerSettings.getDefaultUser(),
ServerSettings.getDefaultUserPassword(), ServerSettings.getDefaultUserGateway());
+                    user.save();
+                }else {
+                    user = (UserResource)ExpCatResourceUtils.getUser(ServerSettings.getDefaultUser(),
ServerSettings.getDefaultUserGateway());
+                }
+
+                WorkerResource workerResource;
+                if (!gateway.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUserGateway())){
+                    workerResource = (WorkerResource)gateway.create(ResourceType.GATEWAY_WORKER);
+                    workerResource.setUser(user.getUserName());
+                    workerResource.save();
+                }else {
+                    workerResource =  (WorkerResource)gateway.get(ResourceType.GATEWAY_WORKER,
ServerSettings.getDefaultUser());
+                }
+                ProjectResource projectResource;
+                if (!workerResource.isExists(ResourceType.PROJECT, DEFAULT_PROJECT_NAME)){
+                    projectResource = workerResource.createProject(DEFAULT_PROJECT_NAME);
+                    projectResource.setName(DEFAULT_PROJECT_NAME);
+                    projectResource.setGatewayId(gateway.getGatewayId());
+                    projectResource.save();
+                }
+
+            } catch (ApplicationSettingsException e) {
+                logger.error("Unable to read airavata-server properties...", e.getMessage());
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            db.closeConnection(conn);
+            try {
+                if(conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error("Error while closing database connection...", e.getMessage(),
e);
+            }
+        }
+        System.setProperty("registry.initialize.state", "1");
+    }
+
+    public static String getDBType(String jdbcUrl){
+        try{
+            String cleanURI = jdbcUrl.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getScheme();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+    }
+
+    public static boolean isDerbyStartEnabled(){
+        try {
+            String s = ServerSettings.getSetting(START_DERBY_ENABLE);
+            if("true".equals(s)){
+                return true;
+            }
+        }  catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata server properties", e.getMessage(), e);
+            return false;
+        }
+        return false;
+    }
+
+    public static void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    getPort(jdbcURl),
+                    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 void stopDerbyInServerMode() {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
+            if (server!=null){
+            	try {
+					server.shutdown();
+				} catch (Exception e) {
+		            logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
+				}
+            }
+    }
+
+    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;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
deleted file mode 100644
index 9f61c65..0000000
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
+++ /dev/null
@@ -1,203 +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.api.server.util;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
-import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
-import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.ProjectResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.UserResource;
-import org.apache.airavata.registry.core.experiment.catalog.resources.WorkerResource;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RegistryInitUtil {
-    public static final String CONFIGURATION_TABLE = "CONFIGURATION";
-    private static final Logger logger = LoggerFactory.getLogger(RegistryInitUtil.class);
-    public static final String REGISTRY_JDBC_DRIVER = "registry.jdbc.driver";
-    public static final String REGISTRY_JDBC_URL = "registry.jdbc.url";
-    public static final String REGISTRY_JDBC_USER = "registry.jdbc.user";
-    public static final String REGISTRY_JDBC_PASSWORD = "registry.jdbc.password";
-    public static final String START_DERBY_ENABLE = "start.derby.server.mode";
-    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
-    public static final String DEFAULT_PROJECT_NAME = "default";
-    private static NetworkServerControl server;
-    private static JdbcStorage db;
-    private static String jdbcURl;
-    private static String jdbcDriver;
-    private static String jdbcUser;
-    private static String jdbcPassword;
-
-
-    public static void initializeDB() {
-        System.setProperty("registry.initialize.state", "0");
-        try{
-            jdbcDriver = ServerSettings.getSetting(REGISTRY_JDBC_DRIVER);
-            jdbcURl = ServerSettings.getSetting(REGISTRY_JDBC_URL);
-            jdbcUser = ServerSettings.getSetting(REGISTRY_JDBC_USER);
-            jdbcPassword = ServerSettings.getSetting(REGISTRY_JDBC_PASSWORD);
-            jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read airavata server properties", e.getMessage());
-        }
-
-        if (getDBType(jdbcURl).equals("derby") && isDerbyStartEnabled()) {
-            startDerbyInServerMode();
-        }
-        db = new JdbcStorage(10, 50, jdbcURl, jdbcDriver, true);
-
-        Connection conn = null;
-        try {
-            conn = db.connect();
-            if (!DatabaseCreator.isDatabaseStructureCreated(CONFIGURATION_TABLE, conn)) {
-                DatabaseCreator.createRegistryDatabase("database_scripts/expcatalog", conn);
-                logger.info("New Database created for Registry");
-            } else {
-                logger.info("Database already created for Registry!");
-            }
-            try{
-                GatewayResource gateway;
-                if (!ExpCatResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway())){
-                    gateway = (GatewayResource)ExpCatResourceUtils.createGateway(ServerSettings.getDefaultUserGateway());
-                    gateway.save();
-                }else {
-                    gateway = (GatewayResource)ExpCatResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
-                }
-
-                UserResource user;
-                if (!ExpCatResourceUtils.isUserExist(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserGateway())){
-                    user = ExpCatResourceUtils.createUser(ServerSettings.getDefaultUser(),
ServerSettings.getDefaultUserPassword(), ServerSettings.getDefaultUserGateway());
-                    user.save();
-                }else {
-                    user = (UserResource)ExpCatResourceUtils.getUser(ServerSettings.getDefaultUser(),
ServerSettings.getDefaultUserGateway());
-                }
-
-                WorkerResource workerResource;
-                if (!gateway.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUserGateway())){
-                    workerResource = (WorkerResource)gateway.create(ResourceType.GATEWAY_WORKER);
-                    workerResource.setUser(user.getUserName());
-                    workerResource.save();
-                }else {
-                    workerResource =  (WorkerResource)gateway.get(ResourceType.GATEWAY_WORKER,
ServerSettings.getDefaultUser());
-                }
-                ProjectResource projectResource;
-                if (!workerResource.isExists(ResourceType.PROJECT, DEFAULT_PROJECT_NAME)){
-                    projectResource = workerResource.createProject(DEFAULT_PROJECT_NAME);
-                    projectResource.setName(DEFAULT_PROJECT_NAME);
-                    projectResource.setGatewayId(gateway.getGatewayId());
-                    projectResource.save();
-                }
-
-            } catch (ApplicationSettingsException e) {
-                logger.error("Unable to read airavata-server properties...", e.getMessage());
-            }
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new RuntimeException("Database failure", e);
-        } finally {
-            db.closeConnection(conn);
-            try {
-                if(conn != null){
-                    if (!conn.getAutoCommit()) {
-                        conn.commit();
-                    }
-                    conn.close();
-                }
-            } catch (SQLException e) {
-                logger.error("Error while closing database connection...", e.getMessage(),
e);
-            }
-        }
-        System.setProperty("registry.initialize.state", "1");
-    }
-
-    public static String getDBType(String jdbcUrl){
-        try{
-            String cleanURI = jdbcUrl.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getScheme();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return null;
-        }
-    }
-
-    public static boolean isDerbyStartEnabled(){
-        try {
-            String s = ServerSettings.getSetting(START_DERBY_ENABLE);
-            if("true".equals(s)){
-                return true;
-            }
-        }  catch (ApplicationSettingsException e) {
-            logger.error("Unable to read airavata server properties", e.getMessage(), e);
-            return false;
-        }
-        return false;
-    }
-
-    public static void startDerbyInServerMode() {
-        try {
-            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
-            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
-                    getPort(jdbcURl),
-                    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 void stopDerbyInServerMode() {
-            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
-            if (server!=null){
-            	try {
-					server.shutdown();
-				} catch (Exception e) {
-		            logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
-				}
-            }
-    }
-
-    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;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/WorkflowCatalogInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/WorkflowCatalogInitUtil.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/WorkflowCatalogInitUtil.java
index 2a8b75b..ea20c63 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/WorkflowCatalogInitUtil.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/WorkflowCatalogInitUtil.java
@@ -74,9 +74,9 @@ public class WorkflowCatalogInitUtil {
             conn = db.connect();
             if (!DatabaseCreator.isDatabaseStructureCreated(WORKFLOW, conn)) {
                 DatabaseCreator.createRegistryDatabase("database_scripts/workflowcatalog",
conn);
-                logger.info("New Database created for Workflow Catalog");
+                logger.info("New Database created for Workflow Catalog !!! ");
             } else {
-                logger.info("Database already created for Workflow Catalog!");
+                logger.info("Database already created for Workflow Catalog!!!");
             }
         } catch (Exception e) {
             logger.error(e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/airavata-api/airavata-api-server/src/test/java/org/apache/airavata/api/server/handler/AiravataServerHandlerTest.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/test/java/org/apache/airavata/api/server/handler/AiravataServerHandlerTest.java
b/airavata-api/airavata-api-server/src/test/java/org/apache/airavata/api/server/handler/AiravataServerHandlerTest.java
index 228ac05..453d17d 100644
--- a/airavata-api/airavata-api-server/src/test/java/org/apache/airavata/api/server/handler/AiravataServerHandlerTest.java
+++ b/airavata-api/airavata-api-server/src/test/java/org/apache/airavata/api/server/handler/AiravataServerHandlerTest.java
@@ -23,7 +23,7 @@ package org.apache.airavata.api.server.handler;
 import junit.framework.Assert;
 import org.apache.airavata.api.server.handler.utils.AppCatInit;
 import org.apache.airavata.api.server.handler.utils.ExpCatInit;
-import org.apache.airavata.api.server.util.RegistryInitUtil;
+import org.apache.airavata.api.server.util.ExperimentCatalogInitUtil;
 import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
 import org.apache.airavata.model.application.io.DataType;
 import org.apache.airavata.model.application.io.InputDataObjectType;
@@ -76,7 +76,7 @@ public class AiravataServerHandlerTest {
 
     @AfterClass
     public static void tearDown(){
-        RegistryInitUtil.stopDerbyInServerMode();
+        ExperimentCatalogInitUtil.stopDerbyInServerMode();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index 9275e56..160f49d 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -80,17 +80,17 @@ datacatalog.jdbc.password=airavata
 datacatalog.validationQuery=SELECT 1 from CONFIGURATION
 
 ###########################################################################
-#  Data Catalog DB Configuration
+#  Workflow Catalog DB Configuration
 ###########################################################################
 #for derby [AiravataJPARegistry]
-datacatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-datacatalog.jdbc.url=jdbc:derby://localhost:1527/data_catalog;create=true;user=airavata;password=airavata
+workflowcatalog.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+workflowcatalog.jdbc.url=jdbc:derby://localhost:1527/workflow_catalog;create=true;user=airavata;password=airavata
 # MySql database configuration
-#datacatalog.jdbc.driver=com.mysql.jdbc.Driver
-#datacatalog.jdbc.url=jdbc:mysql://localhost:3306/data_catalog
-datacatalog.jdbc.user=airavata
-datacatalog.jdbc.password=airavata
-datacatalog.validationQuery=SELECT 1 from CONFIGURATION
+#workflowcatalog.jdbc.driver=com.mysql.jdbc.Driver
+#workflowcatalog.jdbc.url=jdbc:mysql://localhost:3306/workflow_catalog
+workflowcatalog.jdbc.user=airavata
+workflowcatalog.jdbc.password=airavata
+workflowcatalog.validationQuery=SELECT 1 from CONFIGURATION
 
 ###########################################################################
 #  Server module Configuration

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/modules/registry/registry-core/src/main/resources/workflowcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/workflowcatalog-derby.sql b/modules/registry/registry-core/src/main/resources/workflowcatalog-derby.sql
index 8c590f8..51a6ddf 100644
--- a/modules/registry/registry-core/src/main/resources/workflowcatalog-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/workflowcatalog-derby.sql
@@ -28,7 +28,7 @@ CREATE TABLE WORKFLOW
         GRAPH CLOB,
         IMAGE BLOB,
         CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
-        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        UPDATE_TIME timestamp DEFAULT '0000-00-00 00:00:00',
         PRIMARY KEY (TEMPLATE_ID)
 );
 
@@ -73,8 +73,8 @@ CREATE TABLE COMPONENT_STATUS
         TEMPLATE_ID VARCHAR (255) NOT NULL,
         STATE VARCHAR(255),
         REASON VARCHAR(255),
-        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-        PRIMARY KEY (STATUS_ID)
+        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
+        PRIMARY KEY (STATUS_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
 
@@ -84,7 +84,7 @@ CREATE TABLE WORKFLOW_STATUS
         TEMPLATE_ID VARCHAR (255) NOT NULL,
         STATE VARCHAR(255),
         REASON VARCHAR(255),
-        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
         PRIMARY KEY (STATUS_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
@@ -96,7 +96,7 @@ CREATE TABLE EDGE
         NAME VARCHAR (255),
         COMPONENT_STATUS_ID VARCHAR(255),
         DESCRIPTION VARCHAR(500),
-        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
         PRIMARY KEY (EDGE_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
@@ -108,7 +108,7 @@ CREATE TABLE PORT
         NAME VARCHAR (255),
         COMPONENT_STATUS_ID VARCHAR(255),
         DESCRIPTION VARCHAR(500),
-        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
         PRIMARY KEY (PORT_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
@@ -122,7 +122,7 @@ CREATE TABLE NODE
         APPLICATION_NAME VARCHAR (255),
         COMPONENT_STATUS_ID VARCHAR(255),
         DESCRIPTION VARCHAR(500),
-        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
         PRIMARY KEY (NODE_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/e21fae79/modules/registry/registry-core/src/main/resources/workflowcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/workflowcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/workflowcatalog-mysql.sql
index 3527d60..5a8ef97 100644
--- a/modules/registry/registry-core/src/main/resources/workflowcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/workflowcatalog-mysql.sql
@@ -27,8 +27,8 @@ CREATE TABLE WORKFLOW
         GATEWAY_ID VARCHAR (255),
         GRAPH LONGTEXT,
         IMAGE BLOB,
-        CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP,
-        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATION_TIME timestamp DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
         PRIMARY KEY (TEMPLATE_ID)
 );
 
@@ -73,8 +73,8 @@ CREATE TABLE COMPONENT_STATUS
         TEMPLATE_ID VARCHAR (255) NOT NULL,
         STATE VARCHAR(255),
         REASON VARCHAR(255),
-        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-        PRIMARY KEY (STATUS_ID)
+        UPDATE_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+        PRIMARY KEY (STATUS_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
 
@@ -84,7 +84,7 @@ CREATE TABLE WORKFLOW_STATUS
         TEMPLATE_ID VARCHAR (255) NOT NULL,
         STATE VARCHAR(255),
         REASON VARCHAR(255),
-        UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
         PRIMARY KEY (STATUS_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
@@ -96,7 +96,7 @@ CREATE TABLE EDGE
         NAME VARCHAR (255),
         COMPONENT_STATUS_ID VARCHAR(255),
         DESCRIPTION VARCHAR(500),
-        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
         PRIMARY KEY (EDGE_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
@@ -108,7 +108,7 @@ CREATE TABLE PORT
         NAME VARCHAR (255),
         COMPONENT_STATUS_ID VARCHAR(255),
         DESCRIPTION VARCHAR(500),
-        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
         PRIMARY KEY (PORT_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
@@ -122,7 +122,7 @@ CREATE TABLE NODE
         APPLICATION_NAME VARCHAR (255),
         COMPONENT_STATUS_ID VARCHAR(255),
         DESCRIPTION VARCHAR(500),
-        CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+        CREATED_TIME TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
         PRIMARY KEY (NODE_ID, TEMPLATE_ID),
         FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE
 );
\ No newline at end of file


Mime
View raw message