Package adams.flow.dropwizard
Class GenericServer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.dropwizard.AbstractRESTProvider
-
- adams.flow.dropwizard.GenericServer
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler,adams.core.CleanUpHandler,adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.SizeOfHandler,adams.flow.core.FlowContextHandler,RESTProvider,Serializable
public class GenericServer extends AbstractRESTProvider implements adams.core.AdditionalInformationHandler
Generic REST service provider, which allows you to assemble the REST plugins that should make up the service.
Automatically sets the flow context of plugins, if they should implement the adams.flow.core.FlowContextHandler interface.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-config-file <adams.core.io.PlaceholderFile> (property: configFile) The YAML config file to use for the application, see here for details on the format: https://www.dropwizard.io/en/stable/manual/configuration.html default: ${CWD}-plugin <adams.flow.dropwizard.RESTPlugin> [-plugin ...] (property: plugins) The plugins that make up the REST service. default:
-health-check <com.codahale.metrics.health.HealthCheck> [-health-check ...] (property: healthChecks) The health checks to register. default: adams.flow.dropwizard.healthcheck.Dummy
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGenericServer.GenericApplication
-
Field Summary
Fields Modifier and Type Field Description protected com.codahale.metrics.health.HealthCheck[]m_HealthChecksthe healthchecks.protected RESTPlugin[]m_Pluginsthe plugins that make up the server.-
Fields inherited from class adams.flow.dropwizard.AbstractRESTProvider
m_Application, m_ConfigFile, m_Environment, m_Owner, m_Running
-
-
Constructor Summary
Constructors Constructor Description GenericServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigurePlugins(RESTPlugin[] plugins)For configuring the plugins, e.g., setting the flow context.voiddefineOptions()Adds options to the internal list of options.protected com.github.fracpete.javautils.struct.Struct2<io.dropwizard.core.Application,io.dropwizard.core.setup.Environment>doStart()Performs the actual start of the service.StringgetAdditionalInformation()Returns the additional information.protected com.codahale.metrics.health.HealthCheck[]getDefaultHealthChecks()Returns the default health checks to use.protected RESTPlugin[]getDefaultPlugins()Returns the default plugins to use.com.codahale.metrics.health.HealthCheck[]getHealthChecks()Returns the health checks in use.RESTPlugin[]getPlugins()Returns the REST plugins in use.StringglobalInfo()Returns a string describing the object.StringhealthChecksTipText()Returns the tip text for this property.StringpluginsTipText()Returns the tip text for this property.voidsetHealthChecks(com.codahale.metrics.health.HealthCheck[] value)Sets the health checks to use.voidsetPlugins(RESTPlugin[] value)Sets the REST plugins to use.-
Methods inherited from class adams.flow.dropwizard.AbstractRESTProvider
check, cleanUp, configFileTipText, doStop, getConfigFile, getFlowContext, isRunning, log, setConfigFile, setFlowContext, start, stop
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Plugins
protected RESTPlugin[] m_Plugins
the plugins that make up the server.
-
m_HealthChecks
protected com.codahale.metrics.health.HealthCheck[] m_HealthChecks
the healthchecks.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.core.option.AbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
getAdditionalInformation
public String getAdditionalInformation()
Returns the additional information.- Specified by:
getAdditionalInformationin interfaceadams.core.AdditionalInformationHandler- Returns:
- the additional information, null or 0-length string for no information
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classAbstractRESTProvider
-
getDefaultPlugins
protected RESTPlugin[] getDefaultPlugins()
Returns the default plugins to use.- Returns:
- the default
-
setPlugins
public void setPlugins(RESTPlugin[] value)
Sets the REST plugins to use.- Parameters:
value- the plugins
-
getPlugins
public RESTPlugin[] getPlugins()
Returns the REST plugins in use.- Returns:
- the plugins
-
pluginsTipText
public String pluginsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultHealthChecks
protected com.codahale.metrics.health.HealthCheck[] getDefaultHealthChecks()
Returns the default health checks to use.- Returns:
- the default
-
setHealthChecks
public void setHealthChecks(com.codahale.metrics.health.HealthCheck[] value)
Sets the health checks to use.- Parameters:
value- the checks
-
getHealthChecks
public com.codahale.metrics.health.HealthCheck[] getHealthChecks()
Returns the health checks in use.- Returns:
- the checks
-
healthChecksTipText
public String healthChecksTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
configurePlugins
public void configurePlugins(RESTPlugin[] plugins)
For configuring the plugins, e.g., setting the flow context.- Parameters:
plugins- the plugins to configure
-
doStart
protected com.github.fracpete.javautils.struct.Struct2<io.dropwizard.core.Application,io.dropwizard.core.setup.Environment> doStart() throws ExceptionPerforms the actual start of the service.- Specified by:
doStartin classAbstractRESTProvider- Returns:
- the tuple of application and environment
- Throws:
Exception- if start fails
-
-