| java.lang.Object com.martiansoftware.nailgun.NGServer
NGServer | public class NGServer implements Runnable(Code) | | Listens for new connections from NailGun clients and launches
NGSession threads to process them.
This class can be run as a standalone server or can be embedded
within larger applications as a means of providing command-line
interaction with the application.
author: Marty Lamb |
Constructor Summary | |
public | NGServer(InetAddress addr, int port) Creates a new NGServer that will listen at the specified address and
on the specified port.
This does not cause the server to start listening. | public | NGServer() Creates a new NGServer that will listen on the default port
(defined in NGConstants.DEFAULT_PORT ).
This does not cause the server to start listening. |
Method Summary | |
public boolean | allowsNailsByClassName() Returns a flag that indicates whether Nail lookups by classname
are allowed. | public AliasManager | getAliasManager() Returns the AliasManager in use by this NGServer. | public Class | getDefaultNailClass() Returns the default class that will be used if no Nails
can be found via alias or classname. | public Map | getNailStats() Returns a snapshot of this NGServer's nail statistics. | public int | getPort() Returns the port on which this server is (or will be) listening. | public boolean | isRunning() Returns true iff the server is currently running. | public static void | main(String[] args) Creates and starts a new NGServer . | void | nailFinished(Class nailClass) Provides a means for an NGSession to register the completion of
a nails execution with the server. | void | nailStarted(Class nailClass) Provides a means for an NGSession to register the starting of
a nail execution with the server. | public void | run() Listens for new connections and launches NGSession threads
to process them. | public void | setAllowNailsByClassName(boolean allowNailsByClassName) Sets a flag that determines whether Nails can be executed by class name. | public void | setDefaultNailClass(Class defaultNailClass) Sets the default class to use for the Nail if no Nails can
be found via alias or classname. | public void | shutdown(boolean exitVM) Shuts down the server. |
err | final public PrintStream err(Code) | | System.err at the time of the NGServer's creation
|
out | final public PrintStream out(Code) | | System.out at the time of the NGServer's creation
|
NGServer | public NGServer(InetAddress addr, int port)(Code) | | Creates a new NGServer that will listen at the specified address and
on the specified port.
This does not cause the server to start listening. To do
so, create a new Thread wrapping this NGServer
and start it.
Parameters: addr - the address at which to listen, or null to bindto all local addresses Parameters: port - the port on which to listen. |
NGServer | public NGServer()(Code) | | Creates a new NGServer that will listen on the default port
(defined in NGConstants.DEFAULT_PORT ).
This does not cause the server to start listening. To do
so, create a new Thread wrapping this NGServer
and start it.
|
allowsNailsByClassName | public boolean allowsNailsByClassName()(Code) | | Returns a flag that indicates whether Nail lookups by classname
are allowed. If this is false, Nails can only be run via aliases.
a flag that indicates whether Nail lookups by classnameare allowed. |
getAliasManager | public AliasManager getAliasManager()(Code) | | Returns the AliasManager in use by this NGServer.
the AliasManager in use by this NGServer. |
getDefaultNailClass | public Class getDefaultNailClass()(Code) | | Returns the default class that will be used if no Nails
can be found via alias or classname.
the default class that will be used if no Nailscan be found via alias or classname. |
getNailStats | public Map getNailStats()(Code) | | Returns a snapshot of this NGServer's nail statistics. The result is a java.util.Map ,
keyed by class name, with NailStats objects as values.
a snapshot of this NGServer's nail statistics. |
getPort | public int getPort()(Code) | | Returns the port on which this server is (or will be) listening.
the port on which this server is (or will be) listening. |
isRunning | public boolean isRunning()(Code) | | Returns true iff the server is currently running.
true iff the server is currently running. |
main | public static void main(String[] args) throws NumberFormatException, UnknownHostException(Code) | | Creates and starts a new NGServer . A single optional
argument is valid, specifying the port on which this NGServer
should listen. If omitted, NGServer.DEFAULT_PORT will be used.
Parameters: args - a single optional argument specifying the port on which to listen. throws: NumberFormatException - if a non-numeric port is specified |
nailFinished | void nailFinished(Class nailClass)(Code) | | Provides a means for an NGSession to register the completion of
a nails execution with the server.
Parameters: nailClass - the nail class that finished |
nailStarted | void nailStarted(Class nailClass)(Code) | | Provides a means for an NGSession to register the starting of
a nail execution with the server.
Parameters: nailClass - the nail class that was launched |
run | public void run()(Code) | | Listens for new connections and launches NGSession threads
to process them.
|
setAllowNailsByClassName | public void setAllowNailsByClassName(boolean allowNailsByClassName)(Code) | | Sets a flag that determines whether Nails can be executed by class name.
If this is false, Nails can only be run via aliases (and you should
probably remove ng-alias from the AliasManager).
Parameters: allowNailsByClassName - true iff Nail lookups by classname are allowed |
setDefaultNailClass | public void setDefaultNailClass(Class defaultNailClass)(Code) | | Sets the default class to use for the Nail if no Nails can
be found via alias or classname. (may be null ,
in which case NailGun will use its own default)
Parameters: defaultNailClass - the default class to use for the Nailif no Nails can be found via alias or classname.(may be null , in which case NailGun will useits own default) |
shutdown | public void shutdown(boolean exitVM)(Code) | | Shuts down the server. The server will stop listening
and its thread will finish. Any running nails will be allowed
to finish.
Any nails that provide a
public static void nailShutdown(NGServer)
method will have this method called with this NGServer as its sole
parameter.
Parameters: exitVM - if true, this method will also exit the JVM aftercalling nailShutdown() on any nails. This may prevent currentlyrunning nails from exiting gracefully, but may be necessary in orderto perform some tasks, such as shutting down any AWT or Swing threadsimplicitly launched by your nails. |
|
|