public final class Server
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isAutoCompiling()
Returns true if auto-compilation has been enabled successfully.
|
static void |
register(java.lang.String name,
java.lang.Class<? extends Model> clazz)
Register a class implementing the [[simudyne.core.Model]] interface with the server.
|
static void |
register(java.lang.String name,
ModelDescriptor config)
Register a user-created ModelConfiguration with the server.
|
static void |
run()
Runs the webserver.
|
static void |
setAutoCompileRoot(java.lang.String path)
Enables auto-compilation of Java files in the specified directory.
|
static void |
setHostname(java.lang.String hostname)
Sets the hostname the webserver binds to.
|
static void |
setPort(int port)
Sets the port for the webserver.
|
static void |
setWebserverRoot(java.lang.String path)
Sets the root directory from which to serve files from the webserver.
|
public static void register(java.lang.String name, ModelDescriptor config)
register(String, java.lang.Class<? extends Model>)
.name
- User friendly name for the modelconfig
- ModelConfiguration specifying the model and its parameters.public static void register(java.lang.String name, java.lang.Class<? extends Model> clazz)
name
- User friendly name for the modelclazz
- Model class referencepublic static void setAutoCompileRoot(java.lang.String path)
Currently only Java models implementing the [[simudyne.core.Model]] interface are supported. Scala support is planned for development.
Note that if you are running from within the SBT build tool, you will need to enable forking of the Compile task for this to work, as otherwise the classpath will not be configured correctly.
path
- Path to the root of Java packages to watch and compile.public static void setWebserverRoot(java.lang.String path)
path
- Path to the root folder to serve.public static void setPort(int port)
port
- Port for the webserver to listen on.public static void setHostname(java.lang.String hostname)
hostname
- Hostname for the webserver to bind to.public static boolean isAutoCompiling()
public static void run()
If there is no terminal connected, this will block and run until the process is terminated.
If a terminal is connected, it will listen to standard-input and exit once it receives the 'exit' string.