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, OpenAPISupporter, RESTProvider, Serializable
    Direct Known Subclasses:
    RatsServer

    public class GenericServer
    extends AbstractRESTProvider
    implements adams.core.AdditionalInformationHandler, OpenAPISupporter
    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.
    Optionally, OpenAPI documentation can be made available at <URL>/api-docs/?url=/openapi.json

    -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
     
    -url <java.lang.String> (property: URL)
        The URL of the service.
        default: http://localhost:8080/
     
    -in-interceptor <adams.flow.rest.interceptor.incoming.AbstractInInterceptorGenerator> (property: inInterceptor)
        The interceptor to use for incoming messages.
        default: adams.flow.rest.interceptor.incoming.NullGenerator
     
    -out-interceptor <adams.flow.rest.interceptor.outgoing.AbstractOutInterceptorGenerator> (property: outInterceptor)
        The interceptor to use for outgoing messages.
        default: adams.flow.rest.interceptor.outgoing.NullGenerator
     
    -plugin <adams.flow.rest.RESTPlugin> [-plugin ...] (property: plugins)
        The plugins that make up the REST service.
        default:
     
    -enable-openapi <boolean> (property: enableOpenAPI)
        Whether to enable OpenAPI documentation at <URL>/api-docs/?url=/openapi.json
        default: false
     
    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_EnableOpenAPI

        protected boolean m_EnableOpenAPI
        whether to enable open api documentation.
    • 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.
      • setEnableOpenAPI

        public void setEnableOpenAPI​(boolean value)
        Sets whether to enable OpenAPI documentation.
        Specified by:
        setEnableOpenAPI in interface OpenAPISupporter
        Parameters:
        value - true if to enable
      • getEnableOpenAPI

        public boolean getEnableOpenAPI()
        Returns whether to enable OpenAPI documentation.
        Specified by:
        getEnableOpenAPI in interface OpenAPISupporter
        Returns:
        true if to enable
      • enableOpenAPITipText

        public String enableOpenAPITipText()
        Returns the tip text for this property.
        Specified by:
        enableOpenAPITipText in interface OpenAPISupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • configurePlugins

        protected void configurePlugins​(RESTPlugin[] plugins)
        For configuring the plugins, e.g., setting the flow context.
        Parameters:
        plugins - the plugins to configure
      • doStart

        protected org.apache.cxf.endpoint.Server doStart()
                                                  throws Exception
        Performs the actual start of the service.
        Specified by:
        doStart in class AbstractRESTProvider
        Returns:
        the server instance
        Throws:
        Exception - if start fails