public final class WebServerManager
extends java.lang.Object
WebServer
attribute use this
manager to register, start, and stop web applications while checking for
conflicts with other web applications. This manager creates and starts up
new web servers, one server per unique port, and shuts down web servers when
no more models are using them.Red (ltrnc) |
Red (ltrnc) |
Modifier and Type | Method and Description |
---|---|
static WebServerManager |
getInstance()
Return the existing web server manager; create and return a new one if
none is present yet.
|
boolean |
isRegistered(java.lang.String fullModelName,
int portNumber)
Return true if the given application is registered with the
server associated with the given port; false otherwise.
|
boolean |
isRunning(java.lang.String fullModelName,
int portNumber)
Return true if the given application is registered with the
server associated with the given port and this server is running;
false otherwise.
|
int |
register(WebApplicationInfo appInfo,
int portNumber,
boolean dynamicPortSelection)
Register the following application with the manager.
|
void |
unregister(WebApplicationInfo appInfo,
int portNumber)
Unregister the following application with the manager.
|
public static WebServerManager getInstance()
public boolean isRegistered(java.lang.String fullModelName, int portNumber)
fullModelName
- The full name of the modelportNumber
- The port this application would be hosted onpublic boolean isRunning(java.lang.String fullModelName, int portNumber)
fullModelName
- The full name of the modelportNumber
- The port this application would be hosted onpublic int register(WebApplicationInfo appInfo, int portNumber, boolean dynamicPortSelection) throws java.lang.Exception
appInfo
- Information about the registered web applicationportNumber
- The desired port number to host this web application onjava.lang.Exception
- thrown if web server cannot be instantiated or if
application conflicts with an already-registered applicationpublic void unregister(WebApplicationInfo appInfo, int portNumber) throws java.lang.Exception
appInfo
- Information about the unregistered web applicationportNumber
- The port number that this application is running onjava.lang.Exception
- if there is no server associated with this port,
the application is not running on the server associated with this port,
or the application cannot be stopped.