Interface IComparisonManager

  • All Superinterfaces:
    IManagedService

    public interface IComparisonManager
    extends IManagedService
    The service responsible for managing comparison and merge of V8 projects.

    WORKFLOW DESCRIPTION

    The manager supports parallel processes of comparison and merge of different targets. Every target is represented by a pair of data sources (each of which can be a DT project, a file system folder etc.) with an optional third data source (the so called "common ancestor" of three-way comparison and merge processes). Comparison (and merge) processes, corresponding to these targets, are defined and accessed by so called comparison process handles which are essentially tuples of identifiers of their data sources.
    A comparison process is started by calling the #start(IComparisonProcessHandle, MatchingStrategy) method for its corresponding handle. Comparison is an asynchronous process, reporting its status changes to subscribers. When the comparison process is fully finished, the "Queue Finished" status is reported.

    For all active comparison processes defined by their handles, comparison sessions are created. Comparison sessions provide access to the comparison model. During and after comparison, the client may communicate with and affect the process itself and its underlying model using the corresponding session. Some operations may even lead to restarting of the finished comparison process.

    For certain handles (namely, handles with a V8 project as the main side), merging processes are supported. A merging process can be started upon fully finished comparison processes. During this operation, no interaction with the comparison model is allowed. In some scenarios, various post-merge actions may be performed as decided by the client. After performing those actions (or ignoring them), the merge process is finished. After merging, the comparison process session is automatically discarded.

    • Field Detail

      • SERVICE_NAME

        static final String SERVICE_NAME
        Public name of the service for the lifecycle management.
        See Also:
        Constant Field Values
    • Method Detail

      • startComparison

        void startComparison​(CompareMergeProcessBatch batch)
        Schedules asynchronous job that will start the comparison of projects specified by the given batch of compare/merge processes.
        Parameters:
        batch - the batch of compare/merge processes to start comparison for, cannot be null or empty
      • stop

        void stop​(ComparisonProcessHandle handle)
        Forgets the compare/merge process defined by the specified handle and discards its comparison session. Stops the whole batch of compare/merge processes this handle relates to if this batch is under active comparison. Does nothing if the process in under active merge.
        Parameters:
        handle - the handle, not null
      • getHandle

        ComparisonProcessHandle getHandle​(IV8Project v8Project)
        Returns the handle of a comparison process with the specified V8 project as the main participant.
        Parameters:
        v8Project - the V8 project, not null
        Returns:
        the handle or null if there is no comparison process with the specified V8 project
      • getStatus

        ComparisonProcessStatus getStatus​(ComparisonProcessHandle handle)
        Returns the status of a comparison process managed by this.
        Parameters:
        handle - the handle of comparison, not null
        Returns:
        the status of comparison, may be null in case if the handle is not known to this
      • hasActiveComparison

        boolean hasActiveComparison()
        Tells if there any active comparison being executed at the moment.
        Returns:
        true if any comparison is being executed, false otherwise
      • startMerge

        org.eclipse.core.runtime.IStatus startMerge​(CompareMergeProcessBatch batch,
                                                    org.eclipse.core.runtime.IProgressMonitor monitor)
        Schedules asynchronous job that will merge changes detected in the specified batch of compare/merge processes.

        NOTE that it is not possible to schedule the job if the processes in the batch have not yet been fully compared.

        Parameters:
        batch - the batch of compare/merge processes to start merge for, cannot be null or empty
        monitor - the progress monitor, may be null
        Returns:
        Status.OK_STATUS if the merge job has been successfully scheduled, an error status otherwise
      • getComparisonSession

        IComparisonSession getComparisonSession​(ComparisonProcessHandle handle)
        Returns the comparison session for the specified comparison process handle.
        Parameters:
        handle - the handle, not null
        Returns:
        the session, may be null if the handle is not known to the manager
      • getPotentialCorrespondingNodes

        List<ComparisonNode> getPotentialCorrespondingNodes​(ComparisonProcessHandle handle,
                                                            ComparisonNode node,
                                                            ComparisonSide sourceSide)
        Returns a list of candidate nodes for setting as corresponding to the specified node.
        Parameters:
        handle - the comparison process handle, not null
        node - the comparison result node to find potential correspondences for, not null
        sourceSide - the source side of the correspondence, not null
        Returns:
        a list of comparison result nodes, never null
      • ableToBreakCorrespondence

        boolean ableToBreakCorrespondence​(ComparisonProcessHandle handle,
                                          ComparisonNode comparisonResultNode)
        Checks if there is a participant able to break a correspondence stored in the specified node.
        Parameters:
        handle - the comparison process handle, not null
        comparisonResultNode - the node to check whether the correspondence represented by it can be broken, not null
        Returns:
        true if at least one participant is able to break the correspondence, and false otherwise
      • getMergeSettingsSerializerService

        IMergeSettingsSerializerService getMergeSettingsSerializerService()
        Returns instance of merge settings serialization service.
        Returns:
        implementation of the serialization service, cannot be null