Package helma.main
Class Server
java.lang.Object
helma.main.Server
- All Implemented Interfaces:
Runnable
Helma server main class.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionServer
(ServerConfig config) Constructs a new Server instance with an array of command line options. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Make sure this server has an ApplicationManager (e.g.static void
check if we are running on a Java 2 VM - otherwise exit with an error messagestatic void
checkRunning
(ServerConfig config) Check wheter a server is already running on any of the given ports - otherwise exit with an error messagegetApplication
(String name) Get an Application by nameObject[]
Get an Iterator over the applications currently running on this Server.String[]
Get the explicit list of apps if started with -a optiongetAppsProperties
(String appName) Return the apps.properties entries for a given applicationstatic ServerConfig
parse the command line arguments, read a given server.properties file and check the values given for server portsReturn the server-wide db.propertiesGet the Home directory of this server.org.apache.commons.logging.Log
Get a logger to use for output in this server.Return the server.properties for this servergetProperty
(String key) static Server
Get the main Server instance.static org.apache.xmlrpc.WebServer
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 havevoid
init()
initialize the serverstatic Server
loadServer
(String[] args) Entry point used by launcher.jar to load a server instancestatic void
Static main entry point.static void
parseArgs
(ServerConfig config, String[] args) parse argument list from command line and store values in given ServerConfig objectstatic void
print the usage hintsstatic void
printUsageError
(String msg) print the usage hints and prefix them with a message.void
run()
The main method of the Server.void
shutdown()
void
start()
void
startApplication
(String name) void
stop()
void
stopApplication
(String name)
-
Field Details
-
version
- See Also:
-
buildDate
- See Also:
-
commitHash
- See Also:
-
hopHome
-
starttime
public final long starttime -
paranoid
public boolean paranoid -
jetty
-
xmlrpc
protected org.apache.xmlrpc.WebServer xmlrpc
-
-
Constructor Details
-
Server
Constructs a new Server instance with an array of command line options. TODO make this a singleton- Parameters:
config
- the configuration
-
-
Method Details
-
main
Static main entry point.- Parameters:
args
- the command line arguments- Throws:
IOException
-
loadServer
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
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
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
get main property file from home dir or vice versa, depending on what we have- Throws:
Exception
-
printUsageError
print the usage hints and prefix them with a message. -
printUsageError
public static void printUsageError()print the usage hints -
checkRunning
Check wheter a server is already running on any of the given ports - otherwise exit with an error message -
init
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. -
checkAppManager
public void checkAppManager()Make sure this server has an ApplicationManager (e.g. used when accessed from CommandlineRunner) -
getApplications
Get an Iterator over the applications currently running on this Server. -
getApplication
Get an Application by name -
getLogger
public org.apache.commons.logging.Log getLogger()Get a logger to use for output in this server. -
getHopHome
Get the Home directory of this server. -
getApplicationsOption
Get the explicit list of apps if started with -a option- Returns:
-
getServer
Get the main Server instance. -
getXmlRpcServer
public static org.apache.xmlrpc.WebServer getXmlRpcServer()Get the Server's XML-RPC web server. -
getProperty
- Parameters:
key
- ...- Returns:
- ...
-
getProperties
Return the server.properties for this server- Returns:
- the server.properties
-
getDbProperties
Return the server-wide db.properties- Returns:
- the server-wide db.properties
-
getAppsProperties
Return the apps.properties entries for a given application- Parameters:
appName
- the app name- Returns:
- the apps.properties subproperties for the given app
-
getAppsHome
- Returns:
- ...
-
getDbHome
- Returns:
- ...
-
getExtensions
- Returns:
- ...
-
startApplication
- Parameters:
name
- ...
-
stopApplication
- Parameters:
name
- ...
-