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 must follow the following format:
entry <name> // Unique name used to describe this model
Example: java -jar Magpie.jar -server -model volume volume.obj -data data.obj
Client Implementation Guide
This code uses Apache Thrift to define the interface. There are several different commands available through this API, which are described in the "magpie.thrift" file included with this software package. An example for a client that uses the JavaScript interface and an example Python client are provided.
Modifier and Type | Field and Description |
---|---|
static MagpieServerHandler |
Handler
Tool used to handle requests
|
static org.eclipse.jetty.server.Server |
HTTPServer
HTTP server
|
static int |
ListenPort
Port on which to listen
|
static org.apache.thrift.server.TServer |
SocketServer
Socket server
|
Constructor and Description |
---|
ServerLauncher() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isRunning()
Check if the servers are running
|
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
|
static void |
stopServer()
Stop the servers
|
public static int ListenPort
public static org.apache.thrift.server.TServer SocketServer
public static org.eclipse.jetty.server.Server HTTPServer
public static MagpieServerHandler Handler
public static void parseInput(java.lang.String[] args) throws java.lang.Exception
args
- Inputjava.lang.Exception
public static void readInformationFile(java.lang.String path) throws java.lang.Exception
path
- Path to model information filejava.lang.Exception
MagpieServer
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the command line argumentsjava.lang.Exception
public static void startServer() throws org.apache.thrift.transport.TTransportException, java.lang.Exception
org.apache.thrift.transport.TTransportException
java.lang.Exception
public static void stopServer() throws java.lang.Exception
java.lang.Exception
public static boolean isRunning()