Package com.sodius.mdw.server.launch
Interface LaunchManager
public interface LaunchManager
Manages the launch executions.
A launch is the execution of a service on the server.
A launch provides information on its state and on the result of the execution.
This interface is not intended to be implemented by clients.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringOption to query the path where files can be generated by the executed service, e.g.:static final StringOption to query the launch context to retrieve the originatingHttpServletRequest.static final StringOption to query the launch context to retrieve the originating servlet request URL.static final StringOption to query the evaluation context to retrieve the executed service, e.g.:static final StringOption to query the evaluation context to retrieve the launch status custom properties, so that a service developer can send information to the caller of the execution. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLaunchInterceptor(LaunchInterceptor interceptor) Registers a new launch interceptor that listens for a launch at various steps of its execution.createLaunch(Service service, PropertySet launchProperties) Creates a new launch for the specified service and launch properties.Returns the launch associated with the specified identifier.voidremoveLaunchInterceptor(LaunchInterceptor interceptor) Unregisters a launch interceptor previously registered on this manager.
-
Field Details
-
OPTION_SERVICE
Option to query the evaluation context to retrieve the executed service, e.g.:Service service = (Service) ScriptContainer.context.getProperty(LaunchManager.OPTION_SERVICE);
-
OPTION_HTTP_REQUEST
Option to query the launch context to retrieve the originatingHttpServletRequest.Querying the servlet request shall typically be done in the
LaunchInterceptor.launchScheduled()method. Note it is not suitable for thelaunchStarted()andlaunchCompleted()methods, as those are executed in a different thread and theHttpServletRequestinstance might contain incomplete information. Also note that such option is not available when the launch was scheduled and resumed on server restart. Therefore it is important for aLaunchInterceptornot to assume this option is always present. -
OPTION_HTTP_REQUEST_URI
Option to query the launch context to retrieve the originating servlet request URL. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters. -
OPTION_STATUS
Option to query the evaluation context to retrieve the launch status custom properties, so that a service developer can send information to the caller of the execution.The
com.sodius.mdw.core.util.PropertySetinstance associated to this option is guaranteed to exist to in the evaluation context. -
OPTION_EVALUATION_DIRECTORY
Option to query the path where files can be generated by the executed service, e.g.:String directory = (String) context.getProperty(LaunchManager.OPTION_EVALUATION_DIRECTORY);
This is notably useful for services implemented with an Operation, as ones implemented with a Ruleset are recommended to generate files through text templates. Files generated in this directory will be available as result of the launch.- Since:
- 2.3.0
- See Also:
-
-
Method Details
-
getLaunch
Returns the launch associated with the specified identifier.- Parameters:
id- the launch identifier- Returns:
- the launch associated with the specified identifier,
nullif none. - See Also:
-
createLaunch
Creates a new launch for the specified service and launch properties. The created launch is added in the queue and executed as soon as possible.- Parameters:
service- the service to execute.launchProperties- the properties to create the launch, with a value associated to each service declared parameter.- Returns:
- the new launch.
- Throws:
CoreException- if the launch cannot be created, for example if the server is in maintenance mode or if a value is not set for a service parameter in the launch properties.- Since:
- 2.3.0
-
addLaunchInterceptor
Registers a new launch interceptor that listens for a launch at various steps of its execution.- Parameters:
interceptor- a new launch interceptor.- Since:
- 2.3.0
-
removeLaunchInterceptor
Unregisters a launch interceptor previously registered on this manager.- Parameters:
interceptor- a launch interceptor to unregister.- Since:
- 2.3.0
-