diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java index 528a2bf0ea1..4922233ae5d 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java @@ -205,6 +205,12 @@ public class ServerLauncher extends Thread _port = "0"; } + + if (_serverPortRange != null && (_port == null || _port.equals("0"))) + { + _port = _serverPortRange; + } + { // start new server try @@ -367,6 +373,7 @@ public class ServerLauncher extends Thread private ServerSocket _serverSocket; private String _path; private ArrayList _connections; + private String _serverPortRange; private ISSLProperties _sslProperties; @@ -409,6 +416,28 @@ public class ServerLauncher extends Thread _connections = new ArrayList(); init(portStr); } + + + /** + * Constructor + * @param portStr the port for the daemon socket to run on + * @param serverPortRange the port range for launched servers + */ + public ServerLauncher(String portStr, String serverPortRange) + { + String pluginPath = System.getProperty("A_PLUGIN_PATH"); + if (pluginPath == null) + { + System.out.println("A_PLUGIN_PATH is not defined"); + System.exit(-1); + } + + _path = pluginPath.trim(); + + _serverPortRange = serverPortRange; + _connections = new ArrayList(); + init(portStr); + } private String getKeyStoreLocation() { @@ -612,10 +641,16 @@ public class ServerLauncher extends Thread * Entry point into the DataStore daemon * * @param args the port for the daemon to run on (default is 4035). Optionally, the second arg specifies whether to use SSL or not. + * an optional second arg can be used to specify the port range of servers that get launched */ public static void main(String args[]) { - if (args.length > 0) + if (args.length == 2) + { + ServerLauncher theServer = new ServerLauncher(args[0], args[1]); + theServer.start(); + } + else if (args.length == 1) { ServerLauncher theServer = new ServerLauncher(args[0]); theServer.start(); diff --git a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/aix/daemon.pl b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/aix/daemon.pl index 23853b8a131..3149d0e9d03 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/aix/daemon.pl +++ b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/aix/daemon.pl @@ -14,7 +14,7 @@ $isHelp = $helpFlag cmp $port; if ($isHelp == 0) { print("command usage:\n"); - print("daemon.linux [ | -]\n"); + print("daemon.linux [ | -] [ -]\n"); 0; } else @@ -25,10 +25,9 @@ else if ($match != 0) { - print("To run the server daemon, you must be root\n"); - 0; + print("WARNING: To run the server daemon, you must have root authority\n"); } - else + { $dir= $ENV{PWD}; $plugins_dir=$dir; @@ -39,6 +38,13 @@ else $ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath"; - system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port"); + if (defined($ARGV[1])) + { + system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port $ARGV[1]"); + } + else + { + system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port"); + } } } diff --git a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/linux/daemon.pl b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/linux/daemon.pl index 23853b8a131..3149d0e9d03 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/linux/daemon.pl +++ b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/linux/daemon.pl @@ -14,7 +14,7 @@ $isHelp = $helpFlag cmp $port; if ($isHelp == 0) { print("command usage:\n"); - print("daemon.linux [ | -]\n"); + print("daemon.linux [ | -] [ -]\n"); 0; } else @@ -25,10 +25,9 @@ else if ($match != 0) { - print("To run the server daemon, you must be root\n"); - 0; + print("WARNING: To run the server daemon, you must have root authority\n"); } - else + { $dir= $ENV{PWD}; $plugins_dir=$dir; @@ -39,6 +38,13 @@ else $ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath"; - system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port"); + if (defined($ARGV[1])) + { + system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port $ARGV[1]"); + } + else + { + system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port"); + } } } diff --git a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/unix/daemon.pl b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/unix/daemon.pl index 6ac6927f355..3149d0e9d03 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/unix/daemon.pl +++ b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/scripts/unix/daemon.pl @@ -1,42 +1,50 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w - +$port = "4035"; +$helpFlag = "-h"; + if (defined($ARGV[0])) -{ +{ $port = $ARGV[0]; } -else + + +$isHelp = $helpFlag cmp $port; +if ($isHelp == 0) { - $port = "4035"; -} - -#$user = $ENV{USER}; - -$trace = $ENV{DSTORE_TRACING_ON}; -$user=`whoami`; chomp($user); -$match = $user cmp "root"; - -if ($match != 0) -{ - print("To run the server daemon, you must be root\n"); - 0; + print("command usage:\n"); + print("daemon.linux [ | -] [ -]\n"); + 0; } else { - $dir= $ENV{PWD}; - - $plugins_dir=$dir; - - $ENV{A_PLUGIN_PATH}="$plugins_dir/"; - - $oldClasspath = $ENV{CLASSPATH}; - - $ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath"; + $trace = $ENV{DSTORE_TRACING_ON}; + $user=`whoami`; chomp($user); + $match = $user cmp "root"; + if ($match != 0) + { + print("WARNING: To run the server daemon, you must have root authority\n"); + } + { + $dir= $ENV{PWD}; + $plugins_dir=$dir; + + $ENV{A_PLUGIN_PATH}="$plugins_dir/"; - system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port"); - $ENV{CLASSPATH}=$oldClasspath; - + $oldClasspath = $ENV{CLASSPATH}; + + $ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath"; + + if (defined($ARGV[1])) + { + system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port $ARGV[1]"); + } + else + { + system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port"); + } + } }