Interface ExecutionPlanBuilder


  • @ProviderType
    public interface ExecutionPlanBuilder
    Helps to construct an execution plan that can be serialized and given to the packaging backend for execution.
    • Method Detail

      • load

        @NotNull
        @NotNull ExecutionPlanBuilder load​(@NotNull
                                           @NotNull java.io.InputStream in)
                                    throws java.io.IOException
        Loads the tasks from a serialized plan and replaces the plans already in this builder.
        Parameters:
        in - input stream to the data.
        Returns:
        this
        Throws:
        java.io.IOException - if an I/O error occurrs.
      • save

        @NotNull
        @NotNull ExecutionPlanBuilder save​(@NotNull
                                           @NotNull java.io.OutputStream out)
                                    throws java.io.IOException,
                                           PackageException
        Serializes the tasks of this plan.
        Parameters:
        out - the output stream
        Returns:
        this
        Throws:
        java.io.IOException - if an I/O error occurrs.
        PackageException - if this builder does not have valid tasks.
      • addTask

        @NotNull
        @NotNull PackageTaskBuilder addTask()
        Adds a new task to this builder.
        Returns:
        an package task builder that helps to assemble the task.
      • with

        @NotNull
        @NotNull ExecutionPlanBuilder with​(@NotNull
                                           @NotNull Session session)
        Sets the JCR session for this execution plan.
        Parameters:
        session - the session
        Returns:
        this
      • with

        @NotNull
        @NotNull ExecutionPlanBuilder with​(@NotNull
                                           @NotNull java.util.Set<PackageId> externalPackages)
        Sets packages handled externally ahead of execution for prevalidation of plan
        Parameters:
        externalPackages - Set of package ids handled by other builder
        Returns:
        this
      • preview

        @NotNull
        @NotNull java.util.Set<PackageId> preview()
                                           throws java.io.IOException,
                                                  PackageException
        Triggers validation and returns PackageIds of all packages to be installed by this builder
        Returns:
        Set of packages to be installed by this builder.
        Throws:
        java.io.IOException - if an I/O error occurs.
        PackageException - if the plan is not valid.
      • execute

        @NotNull
        @NotNull ExecutionPlan execute()
                                throws java.io.IOException,
                                       PackageException
        Builds an executes the plan synchronously. Does not throw an exception in case one or multiple task executions fail, therefore the caller should check ExecutionPlan.hasErrors() after calling this method.
        Returns:
        the execution plan.
        Throws:
        java.io.IOException - if an I/O error occurs.
        PackageException - if the plan contains an unsupported task.