com.mooapi.server
Class Launcher

java.lang.Object
  extended by com.mooapi.server.Launcher

public class Launcher
extends java.lang.Object

This class provides entry points into the MooAPI Game Server.

These entry point allow this software to be used either as a stand-alone application or as a library in part of a larger application. In either case, additional configuration files may be specified, using defaults otherwise.

To use this as a library, simply instantiate this object, optionally specifying an array of locations to Spring Framework configuration files, and call the go() method. To use this as a stand-alone application, use this class as the main class on the command line, followed optionally by the locations of the additional Spring configuration files.

When used as part of a library, multiple instances of this class can co-exist, each having zero or one MooAPI server instances running. However, as each set of configurations file must specify the listening port, only one server with the same configuration can run at once. This also applies to using the default parameters.

The Spring configuration files must contain the following beans:

Name Type Description
connectionIdProvider com.mooapi.server.IdProvider Provides unique IDs for connections
channelIdProvider com.mooapi.server.IdProvider Provides unique IDs for channels
mooServerHandler com.mooapi.server.MooServerHandler Handles I/O events
serverHostName java.lang.String The server's host name
serverPort java.lang.Integer The port on which the server listens
motd java.lang.String The message of the day
inputBufferSize java.lang.Integer The size (in bytes) of the input buffer
idleTime java.lang.Integer The time (in milliseconds) to wait for input

Author:
Steve Taylor

Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
Launcher()
          Initialize this MooAPI server launcher, using the default configuration options.
Launcher(java.lang.String... configLocations)
          Initialize this MooAPI server launcher, specifying the Spring Framework configuration file to use.
 
Method Summary
 void go()
          Launch the MooAPI game server.
static void main(java.lang.String[] args)
          Launch the MooAPI game server.
 void stop()
          Stop the MooAPI game server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final java.util.logging.Logger logger
Constructor Detail

Launcher

public Launcher(java.lang.String... configLocations)
Initialize this MooAPI server launcher, specifying the Spring Framework configuration file to use. See the documentation for the JavaBeans that must be created.

Parameters:
configLocations - The locations of the additional config files.

Launcher

public Launcher()
Initialize this MooAPI server launcher, using the default configuration options.

Method Detail

go

public void go()

Launch the MooAPI game server.

The server is laucned in another thread, so this method returns immediately.


stop

public void stop()

Stop the MooAPI game server.

This will be ignored if the server isn't running.


main

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

Launch the MooAPI game server.

If args[0] contains the location of a Spring Framework configuration file, use that configuration, otherwise use the default server configuration.

Parameters:
args - Command line arguments.


Copyright © 2009. All Rights Reserved.