Class 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
    • 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.
    • Constructor Detail

      • GenericServer

        public GenericServer()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • getAdditionalInformation

        public String getAdditionalInformation()
        Returns the additional information.
        Specified by:
        getAdditionalInformation in interface adams.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:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class AbstractRESTProvider
      • 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 Exception
        Performs the actual start of the service.
        Specified by:
        doStart in class AbstractRESTProvider
        Returns:
        the tuple of application and environment
        Throws:
        Exception - if start fails