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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Option to query the path where files can be generated by the executed service, e.g.:
    static final String
    Option to query the launch context to retrieve the originating HttpServletRequest.
    static final String
    Option to query the launch context to retrieve the originating servlet request URL.
    static final String
    Option to query the evaluation context to retrieve the executed service, e.g.:
    static final String
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    void
    Unregisters a launch interceptor previously registered on this manager.
  • Field Details

    • OPTION_SERVICE

      static final String OPTION_SERVICE
      Option to query the evaluation context to retrieve the executed service, e.g.:
       Service service = (Service) ScriptContainer.context.getProperty(LaunchManager.OPTION_SERVICE);
       
      See Also:
    • OPTION_HTTP_REQUEST

      static final String OPTION_HTTP_REQUEST
      Option to query the launch context to retrieve the originating HttpServletRequest.

      Querying the servlet request shall typically be done in the LaunchInterceptor.launchScheduled() method. Note it is not suitable for the launchStarted() and launchCompleted() methods, as those are executed in a different thread and the HttpServletRequest instance 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 a LaunchInterceptor not to assume this option is always present.

      See Also:
    • OPTION_HTTP_REQUEST_URI

      static final String 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.
      See Also:
    • OPTION_STATUS

      static final String 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.PropertySet instance associated to this option is guaranteed to exist to in the evaluation context.

      See Also:
    • OPTION_EVALUATION_DIRECTORY

      static final String 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

      Launch getLaunch(String id)
      Returns the launch associated with the specified identifier.
      Parameters:
      id - the launch identifier
      Returns:
      the launch associated with the specified identifier, null if none.
      See Also:
    • createLaunch

      Launch createLaunch(Service service, PropertySet launchProperties) throws CoreException
      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

      void addLaunchInterceptor(LaunchInterceptor interceptor)
      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

      void removeLaunchInterceptor(LaunchInterceptor interceptor)
      Unregisters a launch interceptor previously registered on this manager.
      Parameters:
      interceptor - a launch interceptor to unregister.
      Since:
      2.3.0