Package adams.flow.rest
Class GroovyServer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.rest.AbstractRESTProvider
-
- adams.flow.rest.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 Summary
Fields Modifier and Type Field Description protected GroovyPlugin[]
m_ParametrizedScripts
the parametrized scripts.protected adams.core.io.PlaceholderFile[]
m_UnparametrizedScripts
the scripts with the plugins that make up the server.-
Fields inherited from class adams.flow.rest.AbstractRESTProvider
m_InInterceptor, m_OutInterceptor, m_Owner, m_Running, m_Server, m_URL
-
-
Constructor Summary
Constructors Constructor Description GroovyServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configurePlugins(Object[] plugins)
For configuring the plugins, e.g., setting the flow context and logging level.void
defineOptions()
Adds options to the internal list of options.protected org.apache.cxf.endpoint.Server
doStart()
Performs the actual start of the service.String
getDefaultURL()
Returns the default URL for the service.GroovyPlugin[]
getParametrizedScripts()
Returns the parametrized REST Groovy scripts in use.adams.core.io.PlaceholderFile[]
getUnparametrizedScripts()
Returns the non-parametrized REST Groovy scripts in use.String
globalInfo()
Returns a string describing the object.protected Object[]
loadPlugins()
Loads the plugin scripts.String
parametrizedScriptsTipText()
Returns the tip text for this property.void
setParametrizedScripts(GroovyPlugin[] value)
Sets the parametrized REST Groovy scripts to use.void
setUnparametrizedScripts(adams.core.io.PlaceholderFile[] value)
Sets the non-parametrized REST Groovy scripts to use.String
unparametrizedScriptsTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.rest.AbstractRESTProvider
check, cleanUp, configureInterceptors, configureTLS, doStop, getDefaultInInterceptor, getDefaultOutInterceptor, getFlowContext, getInInterceptor, getOutInterceptor, getURL, inInterceptorTipText, isRunning, log, outInterceptorTipText, setFlowContext, setInInterceptor, setOutInterceptor, setURL, start, stop, URLTipText
-
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_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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractRESTProvider
-
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.
-
getDefaultURL
public String getDefaultURL()
Returns the default URL for the service.- Specified by:
getDefaultURL
in classAbstractRESTProvider
- Returns:
- the URL
-
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 classAbstractRESTProvider
- Returns:
- the server instance
- Throws:
Exception
- if start fails
-
-