Package net.ionite.docval.server
Class DocValHttpServer
- java.lang.Object
-
- java.lang.Thread
-
- net.ionite.docval.server.DocValHttpServer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description DocValHttpServer(String configFile)
Initialize a server with the configuration in the given configuration file.DocValHttpServer(ConfigData configData)
Initialize a server with the configuration in the given configuration data.DocValHttpServer(ValidatorManager validatorManager)
Initialize a server with a validator manager initialized by the caller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(String host, int port)
Add the given IP address/hostname and port number to the listeners.void
halt(int delay)
Stop the servervoid
loadConfigFile()
(Re)load the validation part of the configuration file used in the initializer (if any).
Note that this does *not* reconfigure or re-initialize the listeners specified in the configuration.void
setValidatorManager(ValidatorManager validatorManager)
Replace the validator manager with the given onevoid
start()
Start the server on all the configured listeners-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
DocValHttpServer
public DocValHttpServer(String configFile) throws IOException, ConfigurationError
Initialize a server with the configuration in the given configuration file.- Parameters:
configFile
- The configuration file to read- Throws:
IOException
- if the server could not be startedConfigurationError
- if there is an error in the configuration
-
DocValHttpServer
public DocValHttpServer(ConfigData configData) throws IOException, ConfigurationError
Initialize a server with the configuration in the given configuration data.- Parameters:
configData
- The configuration data to use- Throws:
IOException
- if the server could not be startedConfigurationError
- if there is an error in the configuration
-
DocValHttpServer
public DocValHttpServer(ValidatorManager validatorManager)
Initialize a server with a validator manager initialized by the caller. This server does not start listening automatically, the caller must call addListener() as well.- Parameters:
validatorManager
- the validator manager to use for validation
-
-
Method Detail
-
loadConfigFile
public void loadConfigFile() throws IOException, ConfigurationError
(Re)load the validation part of the configuration file used in the initializer (if any).
Note that this does *not* reconfigure or re-initialize the listeners specified in the configuration.- Throws:
IOException
ConfigurationError
-
setValidatorManager
public void setValidatorManager(ValidatorManager validatorManager)
Replace the validator manager with the given one
-
addListener
public void addListener(String host, int port) throws IOException
Add the given IP address/hostname and port number to the listeners.- Throws:
IOException
- if the port could not be opened for listening.
-
start
public void start()
Start the server on all the configured listeners
-
halt
public void halt(int delay)
Stop the server
-
-