Package helma.main

Class Server

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

public class Server extends Object implements Runnable
Helma server main class.
  • Field Details

  • Constructor Details

    • Server

      public Server(ServerConfig config)
      Constructs a new Server instance with an array of command line options. TODO make this a singleton
      Parameters:
      config - the configuration
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      Static main entry point.
      Parameters:
      args - the command line arguments
      Throws:
      IOException
    • loadServer

      public static Server loadServer(String[] args)
      Entry point used by launcher.jar to load a server instance
      Parameters:
      args - the command line arguments
      Returns:
      the server instance
    • 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(String[] args) throws 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:
      Exception - on any configuration error
    • parseArgs

      public static void parseArgs(ServerConfig config, String[] args) throws Exception
      parse argument list from command line and store values in given ServerConfig object
      Throws:
      Exception - when argument can't be parsed into an InetAddrPort or invalid token is given.
    • guessConfig

      public static void guessConfig(ServerConfig config) throws Exception
      get main property file from home dir or vice versa, depending on what we have
      Throws:
      Exception
    • printUsageError

      public static void printUsageError(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() throws IOException
      initialize the server
      Throws:
      IOException
    • start

      public void start()
    • stop

      public void stop()
    • shutdown

      public void shutdown()
    • 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 Runnable
    • checkAppManager

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

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

      public Application getApplication(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 File getHopHome()
      Get the Home directory of this server.
    • getApplicationsOption

      public String[] getApplicationsOption()
      Get the explicit list of apps if started with -a option
      Returns:
    • 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 String getProperty(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(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 File getAppsHome()
      Returns:
      ...
    • getDbHome

      public File getDbHome()
      Returns:
      ...
    • getExtensions

      public Vector getExtensions()
      Returns:
      ...
    • startApplication

      public void startApplication(String name)
      Parameters:
      name - ...
    • stopApplication

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