public class ServerLauncher
extends java.lang.Object
How to start server
ServerLauncher can be started simply by starting Magpie with the "-server"
flag. Invoked in this why, Magpie takes a few command line arguments:
-port <port>: Port on which to launch server. Socket server (e.g., what
you would use with Python client) starts on this server, HTTP server will start
on port + 1.
-models <path>: Path to file describing models to be served.
This file should be formatted in YAML and follow the following structure:
Each document should contain the following fields:
Feel free to use HTML formatting in the YAML file. This information will likely be rendered by a web browser
Client Implementation Guide
This code uses a REST interface. Eventually, we may provide a wrapper for this API in other languages. There are a few example webpages using this interface in the Magpie repository.
To do list:
| Modifier and Type | Field and Description |
|---|---|
static int |
ListenPort
Port on which to listen
|
static int |
MaxNumEntries
Maximum mumber of entries to run
|
static java.util.Map<java.lang.String,ModelPackage> |
Models
List of models available to this program
|
static org.glassfish.grizzly.http.server.HttpServer |
Server
Server currently being used
|
static java.util.Date |
StartDate
Time server was launched
|
static int |
ThreadCount
Number of allowed threads
|
static java.util.concurrent.ExecutorService |
ThreadPool
Executor used to prevent too many complex calculations at once.
|
| Constructor and Description |
|---|
ServerLauncher() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args) |
static void |
parseInput(java.lang.String[] args)
Handle input passed to the server.
|
static void |
readInformationFile(java.lang.String path)
Given model information file, configure the handler
|
static void |
startServer()
Given the current settings, start the Magpie server
|
public static int ListenPort
public static java.util.Map<java.lang.String,ModelPackage> Models
public static org.glassfish.grizzly.http.server.HttpServer Server
public static java.util.Date StartDate
public static java.util.concurrent.ExecutorService ThreadPool
public static int ThreadCount
public static int MaxNumEntries
public static void parseInput(java.lang.String[] args)
throws java.lang.Exception
args - Inputjava.lang.Exceptionpublic static void readInformationFile(java.lang.String path)
throws java.lang.Exception
path - Path to model information filejava.lang.Exceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
args - the command line argumentsjava.lang.Exceptionpublic static void startServer()
throws java.lang.Exception
java.lang.Exception