checkRunning ();
if (websrvPort==0) checkRunning (rmiPort); else checkRunning (websrvPort); checkRunning (xmlrpcPort);
    public Server (String[] args) {	starttime = System.currentTimeMillis();	String homeDir = null;	boolean usageError = false;	// file names of various property files	String propfile = null;	String dbPropfile = "db.properties";	String appsPropfile = null;	// parse arguments	for (int i=0; i<args.length; i++) {	    if (args[i].equals ("-h") && i+1<args.length)	        homeDir = args[++i];	    else if (args[i].equals ("-f") && i+1<args.length)	        propfile = args[++i];	    else if (args[i].equals ("-p") && i+1<args.length) {	        try {	            rmiPort = Integer.parseInt (args[++i]);	        } catch (Exception portx) {	            usageError = true;	        }	    } else if (args[i].equals ("-x") && i+1<args.length) {	        try {	            xmlrpcPort = Integer.parseInt (args[++i]);	        } catch (Exception portx) {	            usageError = true;	        }	    } else if (args[i].equals ("-w") && i+1<args.length) {	        try {	            websrvPort = Integer.parseInt (args[++i]);	        } catch (Exception portx) {	            usageError = true;	        }	    } else	        usageError = true;	}	if (usageError ) {	    System.out.println ("usage: java helma.objectmodel.db.Server [-h dir] [-f file] [-p port] [-w port] [-x port]");	    System.out.println ("  -h dir     Specify hop home directory");	    System.out.println ("  -f file    Specify server.properties file");	    System.out.println ("  -p port    Specify RMI port number");	    System.out.println ("  -w port    Specify port number for embedded Web server");	    System.out.println ("  -x port    Specify XML-RPC port number");	    getLogger().log ("Usage Error - exiting");	    System.exit (0);	}	// get main property file from home dir or vice versa, depending on what we have.	// get property file from hopHome	if (propfile == null) {	    if (homeDir != null)	        propfile = new File (homeDir, "server.properties").getAbsolutePath ();	    else	        propfile = new File ("server.properties").getAbsolutePath ();	}	// create system properties	sysProps = new SystemProperties (propfile);	// get hopHome from property file	if (homeDir == null)	    homeDir = sysProps.getProperty ("hophome");	if (homeDir == null)	    homeDir =  new File (propfile).getParent ();	// create hopHome File object	hopHome = new File (homeDir);	// from now on it's safe to call getLogger()	getLogger().log ("Starting Helma "+version);	getLogger().log ("propfile = "+propfile);	getLogger().log ("hopHome = "+hopHome);	File helper = new File (hopHome, "db.properties");	dbPropfile = helper.getAbsolutePath ();	dbProps = new SystemProperties (dbPropfile);	DbSource.setDefaultProps (dbProps);	getLogger().log ("dbPropfile = "+dbPropfile);	appsPropfile = sysProps.getProperty ("appsPropFile");	if (appsPropfile != null && !"".equals (appsPropfile.trim()))	    helper = new File (appsPropfile);	else	    helper = new File (hopHome, "apps.properties");	appsPropfile = helper.getAbsolutePath ();	appsProps = new SystemProperties (appsPropfile);	getLogger().log ("appsPropfile = "+appsPropfile);	paranoid = "true".equalsIgnoreCase (sysProps.getProperty ("paranoid"));	String language = sysProps.getProperty ("language");	String country = sysProps.getProperty ("country");	String timezone = sysProps.getProperty ("timezone");	if (language != null && country != null)	    Locale.setDefault (new Locale (language, country));	if (timezone != null)	    TimeZone.setDefault (TimeZone.getTimeZone (timezone));	getLogger().log ("Locale = "+Locale.getDefault());	getLogger().log ("TimeZone = "+TimeZone.getDefault().getDisplayName (Locale.getDefault ()));	dbSources = new Hashtable ();	try {	    checkRunning ();  // check if a server is already running with this db	} catch (Exception running) {	    System.out.println (running.getMessage ());	    System.exit (1);	}	// nmgr = new NodeManager (this, sysProps);	// try to load the extensions	extensions = new Vector ();	if (sysProps.getProperty ("extensions")!=null) {	    StringTokenizer tok=new StringTokenizer (sysProps.getProperty ("extensions"),",");	    while(tok.hasMoreTokens ()) {	        String extClassName = tok.nextToken ().trim ();	        try {	            Class extClass = Class.forName (extClassName);	            HelmaExtension ext = (HelmaExtension) extClass.newInstance ();	            ext.init (this);	            extensions.add (ext);	            getLogger ().log ("loaded: " + extClassName);	        } catch (Exception e) {	            getLogger ().log ("error:  " + extClassName + " (" + e.toString () + ")");	        }	    }	}	// Start running, finishing setup and then entering a loop to check changes	// in the apps.properties file.	mainThread = new Thread (this);	mainThread.start ();    }