Added all in one server starting feature
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/31f43152 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/31f43152 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/31f43152 Branch: refs/heads/master Commit: 31f431523c331b0bccd54309409b3a8dd19d6b06 Parents: 11558d6 Author: Shameera Rathnayaka <[email protected]> Authored: Fri Jun 24 14:26:41 2016 -0400 Committer: Shameera Rathnayaka <[email protected]> Committed: Tue Jun 28 16:32:37 2016 -0400 ---------------------------------------------------------------------- .../main/resources/bin/airavata-server-start.sh | 18 +++++++++--- .../org/apache/airavata/server/ServerMain.java | 31 +++++++++++++------- 2 files changed, 35 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/31f43152/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 599fdd8..a3c9a72 100644 --- a/distribution/src/main/resources/bin/airavata-server-start.sh +++ b/distribution/src/main/resources/bin/airavata-server-start.sh @@ -27,6 +27,7 @@ EXTRA_ARGS="" SERVERS="" IS_DAEMON_MODE=false LOGO=true +ALL_IN_ONE=false # parse command arguments for var in "$@" @@ -41,7 +42,7 @@ do JAVA_OPTS="${JAVA_OPTS} -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" shift ;; - api | gfac | orchestrator) + apiserver | gfac | orchestrator) if [ -z ${SERVERS} ] ; then SERVERS="${var}" else @@ -49,6 +50,10 @@ do fi shift ;; + all) + ALL_IN_ONE=true + shift + ;; -d) IS_DAEMON_MODE=true shift @@ -63,7 +68,8 @@ do echo " apiserver Start apiserver" echo " gfac Start gfac server" echo " orchestrator Start orchestrator server" - echo " credentialstore Start credentialstore server" + echo " credentialstore Start credentialstore server" + echo " all Start all servers in one JVM" echo "command options:" echo " -d Start server in daemon mode" @@ -82,8 +88,12 @@ do esac done -#add extra argument to the -AIRAVATA_COMMAND="--servers=${SERVERS} ${AIRAVATA_COMMAND} ${EXTRA_ARGS}" +#Construct Airavata command arguments in proper order. +if ${ALL_IN_ONE} ; then + AIRAVATA_COMMAND="--servers=all ${AIRAVATA_COMMAND} ${EXTRA_ARGS}" +else + AIRAVATA_COMMAND="--servers=${SERVERS} ${AIRAVATA_COMMAND} ${EXTRA_ARGS}" +fi #print logo file if ${LOGO} ; then http://git-wip-us.apache.org/repos/asf/airavata/blob/31f43152/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 0661a32..b1db8e1 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 @@ -49,6 +49,7 @@ public class ServerMain { private static boolean systemShutDown=false; private static String STOP_COMMAND_STR = "stop"; + private static String ALL_IN_ONE = "all"; // server names private static String API_SERVER = "apiserver"; private static String CREDENTIAL_STORE = "credentialstore"; @@ -63,27 +64,29 @@ public class ServerMain { private static void loadServers(String serverNames) { try { - if (serverNames !=null){ + if (serverNames != null) { List<String> serversList = handleServerDependencies(serverNames); for (String serverString : serversList) { - serverString=serverString.trim(); + serverString = serverString.trim(); String serverClassName = ServerSettings.getSetting(serverString); Class<?> classInstance; try { classInstance = ServerMain.class - .getClassLoader().loadClass( - serverClassName); - servers.add((IServer)classInstance.newInstance()); + .getClassLoader().loadClass( + serverClassName); + servers.add((IServer) classInstance.newInstance()); } catch (ClassNotFoundException e) { - logger.error("Error while locating server implementation \""+serverString+"\"!!!",e); + logger.error("Error while locating server implementation \"" + serverString + "\"!!!", e); } catch (InstantiationException e) { - logger.error("Error while initiating server instance \""+serverString+"\"!!!",e); + logger.error("Error while initiating server instance \"" + serverString + "\"!!!", e); } catch (IllegalAccessException e) { - logger.error("Error while initiating server instance \""+serverString+"\"!!!",e); - } catch (ClassCastException e){ - logger.error("Invalid server \""+serverString+"\"!!!",e); + logger.error("Error while initiating server instance \"" + serverString + "\"!!!", e); + } catch (ClassCastException e) { + logger.error("Invalid server \"" + serverString + "\"!!!", e); } } + } else { + logger.warn("No server name specify to start, use -h command line option to view help menu ..."); } } catch (ApplicationSettingsException e) { logger.error("Error while retrieving server list!!!",e); @@ -99,6 +102,14 @@ public class ServerMain { private static List<String> handleServerDependencies(String serverNames) { List<String> serverList = new ArrayList<>(Arrays.asList(serverNames.split(","))); + if (serverList.indexOf(ALL_IN_ONE) > -1) { + serverList.clear(); + serverList.add(CREDENTIAL_STORE); // credential store should start before api server + serverList.add(API_SERVER); + serverList.add(ORCHESTRATOR); + serverList.add(GFAC_SERVER); + return serverList; + } // credential store should start before api server int credPos = serverList.indexOf(CREDENTIAL_STORE); if (credPos > 0) { // neither absent nor credentialstore is first element
