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:
-
A project is started as a response on user activity (e.g. import operation) using one of the following methods:
#startProject(IDtProject, ProjectStartType)
#startProject(IDtProject, ProjectStartType, Map)
startWorkspaceProjects(Collection, IProgressMonitor)
- The started project has its processing pipeline. The pipeline consists of stages to perform. A pipeline-stage
component should request the job to perform with the
requestJob(IDtProject, ProjectPipelineJob)
. After the job is finished it is required to notify the orchestrator usingjobComplete(IDtProject, ProjectPipelineJob)
orjobInterrupted(IDtProject, ProjectPipelineJob)
in case of success or interruption respectively.
For more information seeProjectPipelineJob
. - The project state changes, especially pipeline treat changes can be kept through an orchestrator listener.
- Project operations initiated by user actions should be surrouned within begin/end-operation methods.
Each operation is described by its name, a set of project it affects and the pipeline stage after the operation is applicable.
Operation can be of an exclusive, half-exclusive or background type.
Exclusive operations are performed exclusively and neither pipeline stages nor other operations can be executed at that time.
Half-exclusive operations allow to perform the pipeline stage that is placed after its target stage, but it prohibits the execution of other operations.
Background operations are low-priority operations that do not affect the model and they can be executed at the time the pipeline stage processing is running.
For more information see the methods for operation manipulation:enqueueHalfExclusiveOperation(String, Collection, ProjectPipelineJob)
(and corresponding for other types),tryStartOperation(Object)
,endOperation(Object)
. -
A project is stopped on a user action (closing project, exiting IDE etc.) using the
stopProject(IDtProject, ProjectStopType)
orstopWorkspaceProjects(Collection, IProgressMonitor)
methods.
All the methods are thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(IWorkspaceOrchestratorListener listener)
Adds the specifiedlistener
.Object
beginBackgroundOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Shortcut for theenqueueBackgroundOperation(String, Collection, ProjectPipelineJob)
followed by waiting until thetryStartOperation(Object)
is succeed.Object
beginExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Shortcut for theenqueueExclusiveOperation(String, Collection, ProjectPipelineJob)
followed by waiting until thetryStartOperation(Object)
is succeed.Object
beginHalfExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Shortcut for theenqueueHalfExclusiveOperation(String, Collection, ProjectPipelineJob)
followed by waiting until thetryStartOperation(Object)
is succeed.void
cancelOperation(Object handle)
Cancels the operation associated with the specifiedhandle
.void
endOperation(Object handle)
Ends the operation associated with the specifiedhandle
.Object
enqueueBackgroundOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Enqueues background operation.Object
enqueueExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Enqueues the exclusive operation.Object
enqueueHalfExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Enqueues half exclusive operation.boolean
isStarted(IDtProject project)
Checks whether the specifiedproject
is started or not.boolean
isStarted(org.eclipse.core.resources.IProject project)
Checks whether the specifiedproject
is started or not.void
jobCancelled(IDtProject project, ProjectPipelineJob job)
Notifies orchestrator that the job is cancelled.void
jobComplete(IDtProject project, ProjectPipelineJob job)
Notifies orchestrator that the job is complete.void
jobInterrupted(IDtProject project, ProjectPipelineJob job)
Notifies orchestrator that the job is interrupted.void
removeListener(IWorkspaceOrchestratorListener listener)
Removes the specifiedlistener
.boolean
requestJob(IDtProject project, ProjectPipelineJob job)
Requests execution project pipeline job.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 specifiedproject
.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 specifiedproject
.void
startWorkspaceProjects(Collection<WorkspaceProjectStartRequest> startRequests, org.eclipse.core.runtime.IProgressMonitor monitor)
Starts the specified project contexts.void
stopProject(IDtProject project, ProjectStopType stopType)
Stops the specifiedproject
.void
stopWorkspaceProjects(Collection<WorkspaceProjectStopRequest> stopRequests, org.eclipse.core.runtime.IProgressMonitor monitor)
Stops the specified project contexts.boolean
tryStartOperation(Object handle)
Tries to start operation associated with the specifiedhandle
object.void
waitUntilStarted(IDtProject project, Duration duration)
Wait until the specifiedproject
is started.void
waitUntilStopped(IDtProject project, Duration duration)
Wait until the specifiedproject
is stopped.-
Methods inherited from interface com._1c.g5.wiring.IManagedService
activate, deactivate
-
-
-
-
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 specifiedproject
.Note: this method is a shortcut for
startProject(String, String, Collection, IProject, Object, ProjectStartType, Map, IProgressMonitor)
with an empty map as thecustomProperties
argument.- Parameters:
projectType
- the project type, cannot benull
.projectName
- the project name, cannot benull
.projectNatures
- the project natures, cannot benull
.workspaceProject
- the corresponding workspace project, can benull
.extraData
- extra data, can benull
.startType
- the start type, cannot benull
.progressMonitor
- the progress monitor, cannot benull
.- Throws:
IllegalArgumentException
- if theproject
orstartType
isnull
.- 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 specifiedproject
.It performs the next sequence of actions:
- (Optional) Shedules build if the
startType
is clean-import - Collects dependent projects for the specified one
- Stops the collected projects with an appropriate stop type
- Starts the specified project
- Starts the dependent projects with an appropriate start type
If the project is already started it does nothing.
- Parameters:
projectType
- the project type, cannot benull
.projectName
- the project name, cannot benull
.projectNatures
- the project natures, cannot benull
.workspaceProject
- the corresponding workspace project, can benull
.extraData
- extra data, can benull
.startType
- the start type, cannot benull
.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 benull
.- Throws:
IllegalArgumentException
- if theproject
orstartType
isnull
.
- (Optional) Shedules build if the
-
stopProject
void stopProject(IDtProject project, ProjectStopType stopType)
Stops the specifiedproject
.It performs the next sequence of actions:
- Collects dependent projects for the specified one
- Stops the collected projects with an appropriate stop type
- Stops the specified project
- 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 benull
.stopType
- the stop type, cannot benull
.- Throws:
IllegalArgumentException
- if theproject
orstopType
isnull
.
-
startWorkspaceProjects
void startWorkspaceProjects(Collection<WorkspaceProjectStartRequest> startRequests, org.eclipse.core.runtime.IProgressMonitor monitor)
Starts the specified project contexts.It performs the next sequence of actions:
- Collects dependent projects for each project of the specified contexts
- Stops the collected projects with an appropriate stop type
- Starts the specified project contexts
- Starts the dependent projects with an appropriate start type
If the project is already started it does nothing.
- Parameters:
startRequests
- the start requests, cannot benull
.monitor
- the progress monitor, can benull
. If it'snull
theNullProgressMonitor
will be used.- Throws:
IllegalArgumentException
- if theprojectContexts
isnull
or it containsnull
.
-
stopWorkspaceProjects
void stopWorkspaceProjects(Collection<WorkspaceProjectStopRequest> stopRequests, org.eclipse.core.runtime.IProgressMonitor monitor)
Stops the specified project contexts.It performs the next sequence of actions:
- Collects dependent projects for each project of the specified contexts
- Stops the collected projects with an appropriate stop type
- Stops the specified project contexts
- 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 benull
.monitor
- the progress monitor, can benull
. If it'snull
theNullProgressMonitor
will be used.- Throws:
IllegalArgumentException
- if theprojectContexts
isnull
or it containsnull
.
-
isStarted
boolean isStarted(IDtProject project)
Checks whether the specifiedproject
is started or not.- Parameters:
project
- the project to check, cannot benull
.- Returns:
true
if theproject
is started,false
- otherwise.- Throws:
IllegalArgumentException
- if theproject
orstopType
isnull
.
-
isStarted
boolean isStarted(org.eclipse.core.resources.IProject project)
Checks whether the specifiedproject
is started or not.- Parameters:
project
- the project to check, cannot benull
.- Returns:
true
if theproject
is started,false
- otherwise.- Throws:
IllegalArgumentException
- if theproject
orstopType
isnull
.
-
waitUntilStopped
void waitUntilStopped(IDtProject project, Duration duration)
Wait until the specifiedproject
is stopped.Note: Use only for testing!
- Parameters:
project
- the project to wait for stop, cannot benull
.duration
- the duration to wait, cannot benull
.- Throws:
IllegalArgumentException
- if theproject
orduration
isnull
.
-
waitUntilStarted
void waitUntilStarted(IDtProject project, Duration duration)
Wait until the specifiedproject
is started.Note: Use only for testing!
- Parameters:
project
- the project to wait for start, cannot benull
.duration
- the duration to wait, cannot benull
.- Throws:
IllegalArgumentException
- if theproject
orduration
isnull
.
-
enqueueExclusiveOperation
Object enqueueExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Enqueues the exclusive operation.- Parameters:
name
- the operation name, cannot benull
.projects
- the projects the operation affects, cannot benull
.afterJob
- the stage the operation executed after, cannot benull
.- 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 benull
.projects
- the projects the operation affects, cannot benull
.afterJob
- the stage the operation executed after, cannot benull
.- 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 benull
.projects
- the projects the operation affects, cannot benull
.afterJob
- the stage the operation executed after, cannot benull
.- Returns:
- the operation handle, never
null
.
-
beginExclusiveOperation
Object beginExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Shortcut for theenqueueExclusiveOperation(String, Collection, ProjectPipelineJob)
followed by waiting until thetryStartOperation(Object)
is succeed.- Parameters:
name
- the operation name, cannot benull
.projects
- the projects the operation affects, cannot benull
.afterJob
- the stage the operation executed after, cannot benull
.- Returns:
- the operation handle, never
null
.
-
beginHalfExclusiveOperation
Object beginHalfExclusiveOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Shortcut for theenqueueHalfExclusiveOperation(String, Collection, ProjectPipelineJob)
followed by waiting until thetryStartOperation(Object)
is succeed.- Parameters:
name
- the operation name, cannot benull
.projects
- the projects the operation affects, cannot benull
.afterJob
- the stage the operation executed after, cannot benull
.- Returns:
- the operation handle, never
null
.
-
beginBackgroundOperation
Object beginBackgroundOperation(String name, Collection<IDtProject> projects, ProjectPipelineJob afterJob)
Shortcut for theenqueueBackgroundOperation(String, Collection, ProjectPipelineJob)
followed by waiting until thetryStartOperation(Object)
is succeed.- Parameters:
name
- the operation name, cannot benull
.projects
- the projects the operation affects, cannot benull
.afterJob
- the stage the operation executed after, cannot benull
.- Returns:
- the operation handle, never
null
.
-
tryStartOperation
boolean tryStartOperation(Object handle)
Tries to start operation associated with the specifiedhandle
object.- Parameters:
handle
- the operation handle, cannot benull
.- Returns:
true
if the operation allowed,false
otherwise.
-
endOperation
void endOperation(Object handle)
Ends the operation associated with the specifiedhandle
.- Parameters:
handle
- the operation handle, cannot benull
.
-
cancelOperation
void cancelOperation(Object handle)
Cancels the operation associated with the specifiedhandle
.- Parameters:
handle
- the operation handle, cannot benull
.
-
addListener
void addListener(IWorkspaceOrchestratorListener listener)
Adds the specifiedlistener
.- Parameters:
listener
- the orchestrator listener to add, cannot benull
.- Throws:
IllegalArgumentException
- if thelistener
isnull
.
-
removeListener
void removeListener(IWorkspaceOrchestratorListener listener)
Removes the specifiedlistener
.- Parameters:
listener
- the orchestrator listener to remove, cannot benull
.- Throws:
IllegalArgumentException
- if thelistener
isnull
.
-
requestJob
boolean requestJob(IDtProject project, ProjectPipelineJob job)
Requests execution project pipeline job.- Parameters:
project
- the project, cannot benull
.job
- the job, cannot benull
.- 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 benull
.job
- the job, cannot benull
.
-
jobCancelled
void jobCancelled(IDtProject project, ProjectPipelineJob job)
Notifies orchestrator that the job is cancelled.- Parameters:
project
- the project, cannot benull
.job
- the job, cannot benull
.
-
jobInterrupted
void jobInterrupted(IDtProject project, ProjectPipelineJob job)
Notifies orchestrator that the job is interrupted.- Parameters:
project
- the project, cannot benull
.job
- the job, cannot benull
.
-
-