Interface ISynchronizationStrategy

  • All Known Subinterfaces:
    IPersistableSynchronizationStrategy

    public interface ISynchronizationStrategy
    Describes a strategy of the synchronization between projects and connected infobases. Infobase synchronization strategies are defined by extensions. An infobase synchronization strategy extension is defined in plugin.xml.

    Following is an example definition of an infobase synchronization strategy extension:

     <extension point="com._1c.g5.v8.dt.platform.services.core.infobaseSynchronizationStrategies">
       <strategy
         id="com._1c.g5.v8.dt.platform.services.core.synchronizationStrategy.ExampleStrategy"
         class="com.example.ExampleStrategyClass">
         name="Example Strategy">
         description="This is example strategy"
         <supportedRuntimes
           runtime="com._1c.g5.v8.dt.platform.runtime.8.3.8">
         </supportedRuntimes>
       </strategy>
     </extension>
     

    Synchronization strategy defines when to load project metadata objects changes to connected infobases. Strategy can perform one-to-one and one-to-many connections with infobases. Synchronization strategies can be stateful, can buffers changes, errors, etc.

    Clients may implement IPersistableSynchronizationStrategy to save and restore synchronization strategy state between DT IDE sessions.

    Strategies may be contained in IInfobaseSynchronizationSettings and then will be available to be selected by the user of DT IDE.

    This interface is intended to be implemented and registered by clients. Instances of strategies are not intended to be explicitly created or used by client.

    See Also:
    IPersistableSynchronizationStrategy, IInfobaseConnection, IInfobaseSynchronizationSettings, IInfobaseSynchronizationManager
    • Method Detail

      • getConnections

        Map<InfobaseReference,​IInfobaseConnection> getConnections()
        Returns a map of all connected infobases and infobase connections. Returned map is immutable.
        Returns:
        a map of all connected infobases and infobase connections, never null, can be empty
      • getSynchronizationState

        InfobaseSynchronizationState getSynchronizationState​(InfobaseReference infobase)
        Returns the infobase synchronization state for the provided infobase.
        Parameters:
        infobase - the infobase to get synchronization state for, cannot be null
        Returns:
        the infobase synchronization state, never null
      • getEqualityState

        InfobaseEqualityState getEqualityState​(InfobaseReference infobase)
        Returns the infobase equality state for the provided infobase.
        Parameters:
        infobase - the infobase to get equality state for, cannot be null
        Returns:
        the infobase equality state, never null
      • getChangedObjects

        Set<org.eclipse.emf.ecore.EObject> getChangedObjects​(InfobaseReference infobase)
        Returns a set of changes metadata objects that is bufferred by this strategy and intended to be loaded to the infobase, when required.
        Parameters:
        infobase - the infobase that is connected, cannot be null
        Returns:
        a set of changes objects that is bufferred by this strategy, neveer null
      • infobaseConnected

        void infobaseConnected​(org.eclipse.core.resources.IProject project,
                               InfobaseReference infobase,
                               IInfobaseConnection connection,
                               InfobaseSynchronizationState state)
        Notifies the strategy that the project was connected with the provided infobase using the provided infobase connection.

        One strategy instance can be connected with many infobases - then loads and updates will be performed for all connected infobases.

        Parameters:
        project - the project, that was connected, cannot be null
        infobase - the infobase that was connected, cannot be null
        connection - the connection to infobases, cannot be null
        state - the infobase connection state, cannot be null
      • infobaseDisconnected

        void infobaseDisconnected​(org.eclipse.core.resources.IProject project,
                                  InfobaseReference infobase)
        Notifiess the strategy that the project was disconnected with the provided infobase.
        Parameters:
        project - the project, that was disconnected, cannot be null
        infobase - the infobase that was disconnected, cannot be null
      • infobaseSynchronizationStateChangeRequested

        void infobaseSynchronizationStateChangeRequested​(InfobaseReference infobase,
                                                         InfobaseSynchronizationState state)
        Notifiess the strategy that the infobase synchronization state change is requested for the provided infobase.
        Parameters:
        infobase - the infobase to change synchronization state for, cannot be null
        state - new infobase synchronization state, cannot be null
      • objectsChanged

        void objectsChanged​(Collection<org.eclipse.emf.common.util.URI> changedObjects,
                            org.eclipse.core.runtime.IProgressMonitor monitor)
        Notifiess the strategy that a set of metadata objects were changed in the project, this strategy belongs to.

        Strategy can load them to connected infobases using stored infobase connection, or buffer them for later usage.

        Parameters:
        changedObjects - a set of changed objects, cannot be null
        monitor - the progress monitor to report progress to, cannot be null
      • objectsDeleted

        void objectsDeleted​(Set<org.eclipse.emf.ecore.EObject> deletedObjects,
                            org.eclipse.core.runtime.IProgressMonitor monitor)
        Notifiess the strategy that a set of metadata objects were deleted in the project, this strategy belongs to.

        Strategy can load them to connected infobases using stored infobase connection, or buffer them for later usage.

        Parameters:
        deletedObjects - a set of deleted objects, cannot be null
        monitor - the progress monitor to report progress to, cannot be null
      • fullReloadRequested

        void fullReloadRequested​(InfobaseReference infobase,
                                 org.eclipse.core.runtime.IProgressMonitor monitor)
        Notifiess the strategy that full reload of the project configuration content to the provided infobase is required.
        Parameters:
        infobase - the infobase to request full load for, cannot be null
        monitor - the progress monitor to report progress to, cannot be null
      • infobaseDatabaseUpdateRequested

        boolean infobaseDatabaseUpdateRequested​(InfobaseReference infobase,
                                                IInfobaseUpdateCallback updateCallback,
                                                org.eclipse.core.runtime.IProgressMonitor monitor)
                                         throws InfobaseSynchronizationException
        Notifiess the strategy that database update of the provided infobase is requested. Strategy is intended to load all previously buffered changes before database update execution (if there are any).

        Update must be performed synchronously.

        Parameters:
        infobase - the infobase to request update for, cannot be null
        updateCallback - the callback executed when database structure changes or update conflict are received, cannot be null; callback may not be executed if there is matching conditions
        monitor - the progress monitor to report progress to, cannot be null
        Returns:
        whether infobase configuration was successfully updated and synchronized with the project, false if update was aborted
        Throws:
        InfobaseSynchronizationException - if infobase database update fails
      • infobasePullChangesRequested

        boolean infobasePullChangesRequested​(InfobaseReference infobase,
                                             IInfobaseChangesPullCallback changesPullCallback,
                                             org.eclipse.core.runtime.IProgressMonitor monitor)
                                      throws InfobaseSynchronizationException
        Notifies the strategy that infobase configuration changes pull is requested. Changes must be processed with the provide changes pull callback.

        Pull changes request must be performed synchronously.

        Parameters:
        infobase - the infobase to request update for, cannot be null
        changesPullCallback - the callback executed when infobase changes are received, cannot be null; callback may not be executed if there is matching conditions
        monitor - the progress monitor to report progress to, cannot be null
        Returns:
        whether infobase configuration changes was successfully resolved and pulled to the project, false if resolve was aborted
        Throws:
        InfobaseSynchronizationException - if infobase database update fails
      • getConnection

        IInfobaseConnection getConnection​(InfobaseReference actualInfobase)
        Returns connection of this strategy for the given infobase. Can return null, if not connected with the provided infobase.
        Parameters:
        infobase - the infobase to get connection for, cannot be null
        Returns:
        the infobase connection or null, if not connected