Interface IWorkspaceOrchestrator

  • All Superinterfaces:
    IManagedService

    public interface IWorkspaceOrchestrator
    extends IManagedService
    The workspace orchestrator.

    It coordinates and tracks vital processes over the projects and project-related operations. The orchestrator allows to manipulate and track projects lifecycle stages. In brief this service supports the next types of projects operations:

    • Start/stop projects
    • Check the project state
    • Begin/end operations over the projects
    • Listen for the project state changes or its processing stage changes
    • Request jobs over the project and report when it's performed

    A common use case can be represented as follows:

    All the methods are thread-safe.

    See Also:
    IServicesOrchestrator, ProjectStartType, ProjectStopType, ProjectPipelineJob, IWorkspaceOrchestratorListener
    • Method Detail

      • startProject

        IDtProject startProject​(String projectType,
                                String projectName,
                                Collection<String> projectNatures,
                                org.eclipse.core.resources.IProject workspaceProject,
                                Object extraData,
                                ProjectStartType startType,
                                org.eclipse.core.runtime.IProgressMonitor progressMonitor)
        Starts the specified project.

        Note: this method is a shortcut for startProject(String, String, Collection, IProject, Object, ProjectStartType, Map, IProgressMonitor) with an empty map as the customProperties argument.

        Parameters:
        projectType - the project type, cannot be null.
        projectName - the project name, cannot be null.
        projectNatures - the project natures, cannot be null.
        workspaceProject - the corresponding workspace project, can be null.
        extraData - extra data, can be null.
        startType - the start type, cannot be null.
        progressMonitor - the progress monitor, cannot be null.
        Throws:
        IllegalArgumentException - if the project or startType is null.
        See Also:
        #startProject(IDtProject, ProjectStartType, Map)
      • startProject

        IDtProject startProject​(String projectType,
                                String projectName,
                                Collection<String> projectNatures,
                                org.eclipse.core.resources.IProject workspaceProject,
                                Object extraData,
                                ProjectStartType startType,
                                Map<String,​Object> customProperties,
                                org.eclipse.core.runtime.IProgressMonitor progressMonitor)
        Starts the specified project.

        It performs the next sequence of actions:

        1. (Optional) Shedules build if the startType is clean-import
        2. Collects dependent projects for the specified one
        3. Stops the collected projects with an appropriate stop type
        4. Starts the specified project
        5. Starts the dependent projects with an appropriate start type

        If the project is already started it does nothing.

        Parameters:
        projectType - the project type, cannot be null.
        projectName - the project name, cannot be null.
        projectNatures - the project natures, cannot be null.
        workspaceProject - the corresponding workspace project, can be null.
        extraData - extra data, can be null.
        startType - the start type, cannot be null.
        customProperties - the custom properties map is a map where keys are unique properties and values its values. This properties are accesable by lifecycle services within the start process.
        progressMonitor - the progress monitor, cannot be null.
        Throws:
        IllegalArgumentException - if the project or startType is null.
      • stopProject

        void stopProject​(IDtProject project,
                         ProjectStopType stopType)
        Stops the specified project.

        It performs the next sequence of actions:

        1. Collects dependent projects for the specified one
        2. Stops the collected projects with an appropriate stop type
        3. Stops the specified project
        4. Starts again the dependent projects with an appropriate start type

        If the project is already stopped it does nothing.

        Parameters:
        project - the project to stop, cannot be null.
        stopType - the stop type, cannot be null.
        Throws:
        IllegalArgumentException - if the project or stopType is null.
      • startWorkspaceProjects

        void startWorkspaceProjects​(Collection<WorkspaceProjectStartRequest> startRequests,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
        Starts the specified project contexts.

        It performs the next sequence of actions:

        1. Collects dependent projects for each project of the specified contexts
        2. Stops the collected projects with an appropriate stop type
        3. Starts the specified project contexts
        4. Starts the dependent projects with an appropriate start type

        If the project is already started it does nothing.

        Parameters:
        startRequests - the start requests, cannot be null.
        monitor - the progress monitor, can be null. If it's null the NullProgressMonitor will be used.
        Throws:
        IllegalArgumentException - if the projectContexts is null or it contains null.
      • stopWorkspaceProjects

        void stopWorkspaceProjects​(Collection<WorkspaceProjectStopRequest> stopRequests,
                                   org.eclipse.core.runtime.IProgressMonitor monitor)
        Stops the specified project contexts.

        It performs the next sequence of actions:

        1. Collects dependent projects for each project of the specified contexts
        2. Stops the collected projects with an appropriate stop type
        3. Stops the specified project contexts
        4. Starts again the dependent projects with an appropriate start type

        If the project is already started it does nothing.

        Parameters:
        stopRequests - the stop requests, cannot be null.
        monitor - the progress monitor, can be null. If it's null the NullProgressMonitor will be used.
        Throws:
        IllegalArgumentException - if the projectContexts is null or it contains null.
      • isStarted

        boolean isStarted​(IDtProject project)
        Checks whether the specified project is started or not.
        Parameters:
        project - the project to check, cannot be null.
        Returns:
        true if the project is started, false - otherwise.
        Throws:
        IllegalArgumentException - if the project or stopType is null.
      • isStarted

        boolean isStarted​(org.eclipse.core.resources.IProject project)
        Checks whether the specified project is started or not.
        Parameters:
        project - the project to check, cannot be null.
        Returns:
        true if the project is started, false - otherwise.
        Throws:
        IllegalArgumentException - if the project or stopType is null.
      • waitUntilStopped

        void waitUntilStopped​(IDtProject project,
                              Duration duration)
        Wait until the specified project is stopped.

        Note: Use only for testing!

        Parameters:
        project - the project to wait for stop, cannot be null.
        duration - the duration to wait, cannot be null.
        Throws:
        IllegalArgumentException - if the project or duration is null.
      • waitUntilStarted

        void waitUntilStarted​(IDtProject project,
                              Duration duration)
        Wait until the specified project is started.

        Note: Use only for testing!

        Parameters:
        project - the project to wait for start, cannot be null.
        duration - the duration to wait, cannot be null.
        Throws:
        IllegalArgumentException - if the project or duration is null.
      • enqueueExclusiveOperation

        Object enqueueExclusiveOperation​(String name,
                                         Collection<IDtProject> projects,
                                         ProjectPipelineJob afterJob)
        Enqueues the exclusive operation.
        Parameters:
        name - the operation name, cannot be null.
        projects - the projects the operation affects, cannot be null.
        afterJob - the stage the operation executed after, cannot be null.
        Returns:
        the operation handle, never null.
      • enqueueHalfExclusiveOperation

        Object enqueueHalfExclusiveOperation​(String name,
                                             Collection<IDtProject> projects,
                                             ProjectPipelineJob afterJob)
        Enqueues half exclusive operation.
        Parameters:
        name - the operation name, cannot be null.
        projects - the projects the operation affects, cannot be null.
        afterJob - the stage the operation executed after, cannot be null.
        Returns:
        the operation handle, never null.
      • enqueueBackgroundOperation

        Object enqueueBackgroundOperation​(String name,
                                          Collection<IDtProject> projects,
                                          ProjectPipelineJob afterJob)
        Enqueues background operation.
        Parameters:
        name - the operation name, cannot be null.
        projects - the projects the operation affects, cannot be null.
        afterJob - the stage the operation executed after, cannot be null.
        Returns:
        the operation handle, never null.
      • tryStartOperation

        boolean tryStartOperation​(Object handle)
        Tries to start operation associated with the specified handle object.
        Parameters:
        handle - the operation handle, cannot be null.
        Returns:
        true if the operation allowed, false otherwise.
      • endOperation

        void endOperation​(Object handle)
        Ends the operation associated with the specified handle.
        Parameters:
        handle - the operation handle, cannot be null.
      • cancelOperation

        void cancelOperation​(Object handle)
        Cancels the operation associated with the specified handle.
        Parameters:
        handle - the operation handle, cannot be null.
      • requestJob

        boolean requestJob​(IDtProject project,
                           ProjectPipelineJob job)
        Requests execution project pipeline job.
        Parameters:
        project - the project, cannot be null.
        job - the job, cannot be null.
        Returns:
        true if the execution is allowed, false otherwise.
      • jobComplete

        void jobComplete​(IDtProject project,
                         ProjectPipelineJob job)
        Notifies orchestrator that the job is complete.
        Parameters:
        project - the project, cannot be null.
        job - the job, cannot be null.
      • jobCancelled

        void jobCancelled​(IDtProject project,
                          ProjectPipelineJob job)
        Notifies orchestrator that the job is cancelled.
        Parameters:
        project - the project, cannot be null.
        job - the job, cannot be null.
      • jobInterrupted

        void jobInterrupted​(IDtProject project,
                            ProjectPipelineJob job)
        Notifies orchestrator that the job is interrupted.
        Parameters:
        project - the project, cannot be null.
        job - the job, cannot be null.