Class GroovyServer

  • All Implemented Interfaces:
    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 GroovyServer
    extends AbstractRESTProvider
    GenericREST service provider, which allows you to assemble the REST plugins that should make up the service from Groovy scripts.
    Scripts either need to implement adams.flow.rest.RESTPlugin interface or be derived from the adams.flow.rest.AbstractRESTPlugin superclass.
    Automatically sets the flow context of plugins, if they should implement the adams.flow.core.FlowContextHandler interface.
    If implementing the adams.core.logging.LoggingLevelHandler interface, they plugin receives the same logging level as this server.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -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.core.io.PlaceholderFile> [-plugin ...] (property: plugins)
        The plugins (ie the Groovy scripts) that make up the REST service.
        default:
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_UnparametrizedScripts

        protected adams.core.io.PlaceholderFile[] m_UnparametrizedScripts
        the scripts with the plugins that make up the server.
      • m_ParametrizedScripts

        protected GroovyPlugin[] m_ParametrizedScripts
        the parametrized scripts.
    • Constructor Detail

      • GroovyServer

        public GroovyServer()
    • 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
      • 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
      • setUnparametrizedScripts

        public void setUnparametrizedScripts​(adams.core.io.PlaceholderFile[] value)
        Sets the non-parametrized REST Groovy scripts to use.
        Parameters:
        value - the scripts
      • getUnparametrizedScripts

        public adams.core.io.PlaceholderFile[] getUnparametrizedScripts()
        Returns the non-parametrized REST Groovy scripts in use.
        Returns:
        the scripts
      • unparametrizedScriptsTipText

        public String unparametrizedScriptsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setParametrizedScripts

        public void setParametrizedScripts​(GroovyPlugin[] value)
        Sets the parametrized REST Groovy scripts to use.
        Parameters:
        value - the scripts
      • getParametrizedScripts

        public GroovyPlugin[] getParametrizedScripts()
        Returns the parametrized REST Groovy scripts in use.
        Returns:
        the scripts
      • parametrizedScriptsTipText

        public String parametrizedScriptsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • loadPlugins

        protected Object[] loadPlugins()
                                throws Exception
        Loads the plugin scripts.
        Returns:
        the loaded plugins
        Throws:
        Exception - if loading fails
      • configurePlugins

        protected void configurePlugins​(Object[] plugins)
        For configuring the plugins, e.g., setting the flow context and logging level.
        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