groovyModule
element. For example:<groovyModule name="FlightManagementSystem" id="1" >
groovyImplementation
element declares the groovy script file which implements the script. For example:<groovyModule name="FlightManagementSystem" id="1" > <groovyImplementation path="fms.groovy" /> </groovyModule>The
path
attribute refer to the file which implements the groovy script. The path of this file is by default relative to the application.xml
file which declares the module.
init
: called once after the framework has been initializedstart
: called when the module is startedend
: called when the module is shutdownsubscribe
: called when the module is notified from a Service invocationpublic default void init(Module module) { } public default void start(Module module) { } public default void start() { } public default void end() { } public default void subscribe(ServiceInstance instance) { }
defaultSendEntryPoint
element defines the default method which will be called by default when invoking automatically a Service[1]
<method_name>(ServiceInstance service)
. The method will be called each time a Service invoked automatically is invoked (just before sending its result).<groovyModule name="FlightManagementSystem" id="1" > <groovyImplementation path="fms.groovy" > <defaultSendEntryPoint method="publish" /> </groovyImplementation> </module>
FlightManagementSystem
module:position
publish servicedirectTo
event servicecomputeFlightPlan
request-response service<groovyModule name="FlightManagementSystem" id="1" > <groovyImplementation path="fms.groovy" /> <interfaces> <subscribe service="position" /> <eventReceived service="directTo"/> <requestReceived service="computeFlightPlan"/> </interfaces> </groovyModule>
public void subscribe(ServiceInstance service) { if (service.getName().equals("position")) { // get position ... } else if (service.getName().equals("directTo")) { // compute directTo ... } else if (service.getName().equals("computeFlightPlan")) { // compute FlightPlan and sends the response ... } }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence