helma.main
Class Server

java.lang.Object
  extended by helma.main.Server
All Implemented Interfaces:
java.lang.Runnable

public class Server
extends java.lang.Object
implements java.lang.Runnable

Helma server main class.


Field Summary
protected  org.mortbay.http.ajp.AJP13Listener ajp13
           
protected  java.io.File hopHome
           
protected  org.mortbay.http.HttpServer http
           
 boolean paranoid
           
 long starttime
           
static java.lang.String version
           
protected  org.apache.xmlrpc.WebServer xmlrpc
           
 
Constructor Summary
Server(ServerConfig config)
          Constructs a new Server instance with an array of command line options.
 
Method Summary
 void checkAppManager(int port)
          Make sure this server has an ApplicationManager (e.g. used when accessed from CommandlineRunner)
static void checkJavaVersion()
          check if we are running on a Java 2 VM - otherwise exit with an error message
static void checkRunning(ServerConfig config)
          Check wheter a server is already running on any of the given ports - otherwise exit with an error message
 Application getApplication(java.lang.String name)
          Get an Application by name
 java.lang.Object[] getApplications()
          Get an Iterator over the applications currently running on this Server.
 java.io.File getAppsHome()
           
 ResourceProperties getAppsProperties(java.lang.String appName)
          Return the apps.properties entries for a given application
static ServerConfig getConfig(java.lang.String[] args)
          parse the command line arguments, read a given server.properties file and check the values given for server ports
 java.io.File getDbHome()
           
 ResourceProperties getDbProperties()
          Return the server-wide db.properties
 java.util.Vector getExtensions()
           
 java.io.File getHopHome()
          Get the Home directory of this server.
 org.apache.commons.logging.Log getLogger()
          Get a logger to use for output in this server.
 ResourceProperties getProperties()
          Return the server.properties for this server
 java.lang.String getProperty(java.lang.String key)
           
static Server getServer()
          Get the main Server instance.
static org.apache.xmlrpc.WebServer getXmlRpcServer()
          Get the Server's XML-RPC web server.
static void guessConfig(ServerConfig config)
          get main property file from home dir or vice versa, depending on what we have
 void init()
          initialize the server
static void main(java.lang.String[] args)
          static main entry point.
static void parseArgs(ServerConfig config, java.lang.String[] args)
          parse argument list from command line and store values in given ServerConfig object
static void printUsageError()
          print the usage hints
static void printUsageError(java.lang.String msg)
          print the usage hints and prefix them with a message.
 void run()
          The main method of the Server.
 void start()
           
 void startApplication(java.lang.String name)
           
 void stop()
           
 void stopApplication(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version
See Also:
Constant Field Values

hopHome

protected java.io.File hopHome

starttime

public final long starttime

paranoid

public boolean paranoid

http

protected org.mortbay.http.HttpServer http

ajp13

protected org.mortbay.http.ajp.AJP13Listener ajp13

xmlrpc

protected org.apache.xmlrpc.WebServer xmlrpc
Constructor Detail

Server

public Server(ServerConfig config)
Constructs a new Server instance with an array of command line options.

Method Detail

main

public static void main(java.lang.String[] args)
static main entry point.


checkJavaVersion

public static void checkJavaVersion()
check if we are running on a Java 2 VM - otherwise exit with an error message


getConfig

public static ServerConfig getConfig(java.lang.String[] args)
                              throws java.lang.Exception
parse the command line arguments, read a given server.properties file and check the values given for server ports

Returns:
ServerConfig if successfull
Throws:
java.lang.Exception - on any configuration error

parseArgs

public static void parseArgs(ServerConfig config,
                             java.lang.String[] args)
                      throws java.lang.Exception
parse argument list from command line and store values in given ServerConfig object

Throws:
java.lang.Exception - when argument can't be parsed into an InetAddrPort or invalid token is given.

guessConfig

public static void guessConfig(ServerConfig config)
                        throws java.lang.Exception
get main property file from home dir or vice versa, depending on what we have

Throws:
java.lang.Exception

printUsageError

public static void printUsageError(java.lang.String msg)
print the usage hints and prefix them with a message.


printUsageError

public static void printUsageError()
print the usage hints


checkRunning

public static void checkRunning(ServerConfig config)
Check wheter a server is already running on any of the given ports - otherwise exit with an error message


init

public void init()
initialize the server


start

public void start()

stop

public void stop()

run

public void run()
The main method of the Server. Basically, we set up Applications and than periodically check for changes in the apps.properties file, shutting down apps or starting new ones.

Specified by:
run in interface java.lang.Runnable

checkAppManager

public void checkAppManager(int port)
Make sure this server has an ApplicationManager (e.g. used when accessed from CommandlineRunner)


getApplications

public java.lang.Object[] getApplications()
Get an Iterator over the applications currently running on this Server.


getApplication

public Application getApplication(java.lang.String name)
Get an Application by name


getLogger

public org.apache.commons.logging.Log getLogger()
Get a logger to use for output in this server.


getHopHome

public java.io.File getHopHome()
Get the Home directory of this server.


getServer

public static Server getServer()
Get the main Server instance.


getXmlRpcServer

public static org.apache.xmlrpc.WebServer getXmlRpcServer()
Get the Server's XML-RPC web server.


getProperty

public java.lang.String getProperty(java.lang.String key)
Parameters:
key - ...
Returns:
...

getProperties

public ResourceProperties getProperties()
Return the server.properties for this server

Returns:
the server.properties

getDbProperties

public ResourceProperties getDbProperties()
Return the server-wide db.properties

Returns:
the server-wide db.properties

getAppsProperties

public ResourceProperties getAppsProperties(java.lang.String appName)
Return the apps.properties entries for a given application

Parameters:
appName - the app name
Returns:
the apps.properties subproperties for the given app

getAppsHome

public java.io.File getAppsHome()
Returns:
...

getDbHome

public java.io.File getDbHome()
Returns:
...

getExtensions

public java.util.Vector getExtensions()
Returns:
...

startApplication

public void startApplication(java.lang.String name)
Parameters:
name - ...

stopApplication

public void stopApplication(java.lang.String name)
Parameters:
name - ...


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.