Repository: airavata
Updated Branches:
  refs/heads/develop 2d9fd253b -> 4e9c4f049


updating the server start/stop scripts to acomodate registry server


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

Branch: refs/heads/develop
Commit: 4e9c4f049ea778588255fa1f35e36e76be3bafe0
Parents: 2d9fd25
Author: scnakandala <[email protected]>
Authored: Mon Aug 8 14:36:33 2016 -0400
Committer: scnakandala <[email protected]>
Committed: Mon Aug 8 14:36:33 2016 -0400

----------------------------------------------------------------------
 .../main/resources/bin/airavata-server-start.sh |  1 +
 .../org/apache/airavata/server/ServerMain.java  | 33 +++++++++++++-------
 2 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/4e9c4f04/distribution/src/main/resources/bin/airavata-server-start.sh
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/bin/airavata-server-start.sh 
b/distribution/src/main/resources/bin/airavata-server-start.sh
index a4089d9..eb1b077 100644
--- a/distribution/src/main/resources/bin/airavata-server-start.sh
+++ b/distribution/src/main/resources/bin/airavata-server-start.sh
@@ -71,6 +71,7 @@ do
             echo "  gfac                Start gfac server"
             echo "  orchestrator        Start orchestrator server"
             echo "  credentialstore     Start credentialstore server"
+            echo "  registry            Start registry server"
             echo "  all                 Start all servers in one JVM"
 
             echo "command options:"

http://git-wip-us.apache.org/repos/asf/airavata/blob/4e9c4f04/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git 
a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java 
b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index 2e12a32..99387de 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -20,14 +20,6 @@
  */
 package org.apache.airavata.server;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.*;
 import org.apache.airavata.common.utils.ApplicationSettings.ShutdownStrategy;
@@ -38,6 +30,14 @@ import org.apache.zookeeper.server.ServerCnxnFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 public class ServerMain {
        private static List<IServer> servers;
        private static final String SERVERS_KEY="servers";
@@ -55,6 +55,7 @@ public class ServerMain {
        // server names
        private static final String API_SERVER = "apiserver";
        private static final String CREDENTIAL_STORE = "credentialstore";
+       private static final String REGISTRY_SERVER = "regserver";
        private static final String GFAC_SERVER = "gfac";
        private static final String ORCHESTRATOR = "orchestrator";
 
@@ -106,6 +107,7 @@ public class ServerMain {
                List<String> serverList = new 
ArrayList<>(Arrays.asList(serverNames.split(",")));
                if (serverList.indexOf(ALL_IN_ONE) > -1) {
                        serverList.clear();
+                       serverList.add(REGISTRY_SERVER);  // registry server 
should start before everything
                        serverList.add(CREDENTIAL_STORE); // credential store 
should start before api server
                        serverList.add(API_SERVER);
                        serverList.add(ORCHESTRATOR);
@@ -119,11 +121,20 @@ public class ServerMain {
                        serverList.clear();
                        serverList.add(GFAC_SERVER);
                } else {
+                       // registry server should start before everything
+                       int regPos = serverList.indexOf(REGISTRY_SERVER);
+                       if (regPos > 0) {
+                               String temp = serverList.get(0);
+                               serverList.set(0, serverList.get(regPos));
+                               serverList.set(regPos, temp);
+                       }
+
                        // credential store should start before api server
                        int credPos = serverList.indexOf(CREDENTIAL_STORE);
-                       if (credPos > 0) { // neither absent nor 
credentialstore is first element
-                               String temp = serverList.get(0);
-                               serverList.set(0, serverList.get(credPos));
+                       int apiPos = serverList.indexOf(API_SERVER);
+                       if (credPos >= 0 && apiPos >= 0 && (credPos > apiPos)) {
+                               String temp = serverList.get(apiPos);
+                               serverList.set(apiPos, serverList.get(credPos));
                                serverList.set(credPos, temp);
                        }
                }

Reply via email to