* Rename Config to ServerConfig in order to prepare for an ApplicationConfig class.
This commit is contained in:
parent
beed995659
commit
e307d212fd
3 changed files with 12 additions and 13 deletions
|
@ -39,7 +39,7 @@ public class CommandlineRunner {
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
Config config = new Config();
|
ServerConfig config = new ServerConfig();
|
||||||
String commandStr = null;
|
String commandStr = null;
|
||||||
Vector funcArgs = new Vector();
|
Vector funcArgs = new Vector();
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class Server implements Runnable {
|
||||||
/**
|
/**
|
||||||
* Constructs a new Server instance with an array of command line options.
|
* Constructs a new Server instance with an array of command line options.
|
||||||
*/
|
*/
|
||||||
public Server(Config config) {
|
public Server(ServerConfig config) {
|
||||||
server = this;
|
server = this;
|
||||||
starttime = System.currentTimeMillis();
|
starttime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public class Server implements Runnable {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
checkJavaVersion();
|
checkJavaVersion();
|
||||||
|
|
||||||
Config config = null;
|
ServerConfig config = null;
|
||||||
try {
|
try {
|
||||||
config = getConfig(args);
|
config = getConfig(args);
|
||||||
} catch (Exception cex) {
|
} catch (Exception cex) {
|
||||||
|
@ -162,12 +162,12 @@ public class Server implements Runnable {
|
||||||
/**
|
/**
|
||||||
* parse the command line arguments, read a given server.properties file
|
* parse the command line arguments, read a given server.properties file
|
||||||
* and check the values given for server ports
|
* and check the values given for server ports
|
||||||
* @return Config if successfull
|
* @return ServerConfig if successfull
|
||||||
* @throws Exception on any configuration error
|
* @throws Exception on any configuration error
|
||||||
*/
|
*/
|
||||||
public static Config getConfig(String[] args) throws Exception {
|
public static ServerConfig getConfig(String[] args) throws Exception {
|
||||||
|
|
||||||
Config config = new Config();
|
ServerConfig config = new ServerConfig();
|
||||||
|
|
||||||
// get possible environment setting for helma home
|
// get possible environment setting for helma home
|
||||||
if (System.getProperty("helma.home")!=null) {
|
if (System.getProperty("helma.home")!=null) {
|
||||||
|
@ -220,11 +220,11 @@ public class Server implements Runnable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse argument list from command line and store values
|
* parse argument list from command line and store values
|
||||||
* in given Config object
|
* in given ServerConfig object
|
||||||
* @throws Exception when argument can't be parsed into an InetAddrPort
|
* @throws Exception when argument can't be parsed into an InetAddrPort
|
||||||
* or invalid token is given.
|
* or invalid token is given.
|
||||||
*/
|
*/
|
||||||
public static void parseArgs(Config config, String[] args) throws Exception {
|
public static void parseArgs(ServerConfig config, String[] args) throws Exception {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
if (args[i].equals("-h") && ((i + 1) < args.length)) {
|
if (args[i].equals("-h") && ((i + 1) < args.length)) {
|
||||||
config.homeDir = new File(args[++i]);
|
config.homeDir = new File(args[++i]);
|
||||||
|
@ -268,7 +268,7 @@ public class Server implements Runnable {
|
||||||
* get main property file from home dir or vice versa,
|
* get main property file from home dir or vice versa,
|
||||||
* depending on what we have
|
* depending on what we have
|
||||||
*/
|
*/
|
||||||
public static void guessConfig(Config config) throws Exception {
|
public static void guessConfig(ServerConfig config) throws Exception {
|
||||||
// get property file from hopHome:
|
// get property file from hopHome:
|
||||||
if (config.propFile == null) {
|
if (config.propFile == null) {
|
||||||
if (config.homeDir != null) {
|
if (config.homeDir != null) {
|
||||||
|
@ -347,7 +347,7 @@ public class Server implements Runnable {
|
||||||
* Check wheter a server is already running on any of the given ports
|
* Check wheter a server is already running on any of the given ports
|
||||||
* - otherwise exit with an error message
|
* - otherwise exit with an error message
|
||||||
*/
|
*/
|
||||||
public static void checkRunning(Config config) {
|
public static void checkRunning(ServerConfig config) {
|
||||||
// check if any of the specified server ports is in use already
|
// check if any of the specified server ports is in use already
|
||||||
try {
|
try {
|
||||||
if (config.websrvPort != null) {
|
if (config.websrvPort != null) {
|
||||||
|
@ -420,8 +420,7 @@ public class Server implements Runnable {
|
||||||
// set the current working directory to the helma home dir.
|
// set the current working directory to the helma home dir.
|
||||||
// note that this is not a real cwd, which is not supported
|
// note that this is not a real cwd, which is not supported
|
||||||
// by java. It makes sure relative to absolute path name
|
// by java. It makes sure relative to absolute path name
|
||||||
// conversion is done right, so for Helma code, this should
|
// conversion is done right, so for Helma code, this should work.
|
||||||
// work.
|
|
||||||
System.setProperty("user.dir", hopHome.getPath());
|
System.setProperty("user.dir", hopHome.getPath());
|
||||||
|
|
||||||
// from now on it's safe to call getLogger() because hopHome is set up
|
// from now on it's safe to call getLogger() because hopHome is set up
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.io.File;
|
||||||
* Utility class for server config
|
* Utility class for server config
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Config {
|
public class ServerConfig {
|
||||||
|
|
||||||
InetAddrPort rmiPort = null;
|
InetAddrPort rmiPort = null;
|
||||||
InetAddrPort xmlrpcPort = null;
|
InetAddrPort xmlrpcPort = null;
|
Loading…
Add table
Add a link
Reference in a new issue