Class DerivedDataManagerMock

java.lang.Object
com.e1c.g5.v8.dt.internal.snapshot.DerivedDataManagerMock
All Implemented Interfaces:
IDerivedDataManager

public class DerivedDataManagerMock extends Object implements IDerivedDataManager
  • Constructor Details

    • DerivedDataManagerMock

      public DerivedDataManagerMock()
  • Method Details

    • addObjectStatusListener

      public void addObjectStatusListener(IDerivedDataObjectStatusListener listener, long bmObjectId, String... segments)
      Description copied from interface: IDerivedDataManager
      Adds listener for DD status changes of the given object and set of tracked DD segments.
      Specified by:
      addObjectStatusListener in interface IDerivedDataManager
      Parameters:
      listener - The listener instance. Cannot be null. One can re-use the same instance of the listener to subscribe for different sets of objects and segments, but in this case the call to the IDerivedDataManager.removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener) will remove all subscriptions.
      bmObjectId - The identifier of the object which DD changes are being notified via the supplied listener. Cannot be null or empty due to performance reasons. To track down computation of the entire DD segment use IDerivedDataManager#addStatusListener(IDerivedDataStatusListener) instead}.
      segments - DD segment filter allows to subscribe for specific segments of DD. Cannot be null
    • addObjectStatusListener

      public void addObjectStatusListener(IDerivedDataObjectStatusListener listener, Map<Long,Collection<String>> scope)
      Description copied from interface: IDerivedDataManager
      Adds listener for DD status changes of the given DD change scope. The scope is defined as a map of BM object identifiers to the respective traked DD segments.
      Specified by:
      addObjectStatusListener in interface IDerivedDataManager
      Parameters:
      listener - The listener instance. Cannot be null. One can re-use the same instance of the listener to subscribe for different sets of objects and segments, but in this case the call to the IDerivedDataManager.removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener) will remove all subscriptions.
      scope - Tracked DD segments mapped to corresponding BM object ids. Cannot be null. Scope entries cannot contain null or empty sets of tracked DD segments.
    • addStatusListener

      public void addStatusListener(IDerivedDataStatusListener listener)
      Description copied from interface: IDerivedDataManager
      Adds listener that will be notified about derived data status changes.
      Specified by:
      addStatusListener in interface IDerivedDataManager
      Parameters:
      listener - the listener that should be notified
    • blockAsyncPipeline

      public void blockAsyncPipeline(boolean forcedStop)
      Description copied from interface: IDerivedDataManager
      Blocks the async. processing pipeline. This methods waits until all current DD operations are finished before return from the call.
      Specified by:
      blockAsyncPipeline in interface IDerivedDataManager
      Parameters:
      forcedStop - Locks pipeline in forced mode. In case if true, could be unlocked only with corresponding value of the flag. Forced lock is being used to prevent file sycnhronization opearions/etc to remove manually defined locks.
    • blockAsyncPipeline

      public void blockAsyncPipeline(boolean forcedStop, boolean wait)
      Description copied from interface: IDerivedDataManager
      Blocks the async. processing pipeline
      Specified by:
      blockAsyncPipeline in interface IDerivedDataManager
      Parameters:
      forcedStop - Locks pipeline in forced mode. In case if true, could be unlocked only with corresponding value of the flag. Forced lock is being used to prevent file sycnhronization opearions/etc to remove manually defined locks.
      wait - Wait until all running operations in the current pipeline are completed
    • disableImplicitWaiting

      public void disableImplicitWaiting()
      Description copied from interface: IDerivedDataManager
      Disables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.
      Specified by:
      disableImplicitWaiting in interface IDerivedDataManager
    • enableImplicitWaiting

      public void enableImplicitWaiting()
      Description copied from interface: IDerivedDataManager
      Enables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.
      Specified by:
      enableImplicitWaiting in interface IDerivedDataManager
    • getDerivedDataStatus

      public DerivedDataStatus getDerivedDataStatus()
      Description copied from interface: IDerivedDataManager
      Gets the current status of DD for the corresponding BM model.
      Specified by:
      getDerivedDataStatus in interface IDerivedDataManager
      Returns:
      The overall status of the DD facility.
    • isAllComputed

      public boolean isAllComputed()
      Description copied from interface: IDerivedDataManager
      Checks if all derived data parts are computed.
      Specified by:
      isAllComputed in interface IDerivedDataManager
      Returns:
      true if computed, false otherwise
    • isComputed

      public boolean isComputed(Collection<String> segmentIds)
      Description copied from interface: IDerivedDataManager
      Checks if the given parts are computed (if applicable) for all the BM objects.
      Specified by:
      isComputed in interface IDerivedDataManager
      Returns:
      true if computed, false otherwise
    • isComputed

      public boolean isComputed(long bmObjectId, Collection<String> segmentIds)
      Description copied from interface: IDerivedDataManager
      Checks if the given parts are computed for the given BM object.
      Specified by:
      isComputed in interface IDerivedDataManager
      Parameters:
      bmObjectId - the ID of the BM object to check
      Returns:
      true if computed, false otherwise
    • isComputed

      public boolean isComputed(long bmObjectId, String segmentId)
      Description copied from interface: IDerivedDataManager
      Checks if the given part is computed for the given BM object.
      Specified by:
      isComputed in interface IDerivedDataManager
      Parameters:
      bmObjectId - the ID of the BM object to check
      segmentId - the ID of the part to check
      Returns:
      true if computed, false otherwise
    • isComputed

      public boolean isComputed(long bmObjectId, String partId, boolean strict)
      Description copied from interface: IDerivedDataManager
      Checks if the given part is computed for the given BM object.
      Specified by:
      isComputed in interface IDerivedDataManager
      Parameters:
      bmObjectId - the ID of the BM object to check
      partId - the ID of the part to check
      strict - In strict mode caller expecting, that part must be calculated. In case if part is still not indicated, the method will return false
      Returns:
      true if computed, false otherwise
    • isComputed

      public boolean isComputed(String... segmentIds)
      Description copied from interface: IDerivedDataManager
      Checks if the given DD segments are computed (if applicable) for all the BM objects.
      Specified by:
      isComputed in interface IDerivedDataManager
      Parameters:
      segmentIds - Array of the DD segment Ids to check
      Returns:
      true if computed, false otherwise
    • recomputeAll

      public void recomputeAll()
      Description copied from interface: IDerivedDataManager
      Forces the DD mechanism to recompute all the known parts of all the known objects.
      Specified by:
      recomputeAll in interface IDerivedDataManager
    • removeObjectStatusListener

      public void removeObjectStatusListener(IDerivedDataObjectStatusListener listener)
      Description copied from interface: IDerivedDataManager
      Removes specific DD object status listener instance from the notification chain. All subscriptions of the given listener instance will be removed as a result.
      Specified by:
      removeObjectStatusListener in interface IDerivedDataManager
      Parameters:
      listener - The listener that should be removed. Cannot be null.
    • removeStatusListener

      public void removeStatusListener(IDerivedDataStatusListener listener)
      Description copied from interface: IDerivedDataManager
      Removes listener that will be notified about derived data status changes.
      Specified by:
      removeStatusListener in interface IDerivedDataManager
      Parameters:
      listener - the listener that should be removed.
    • unblockAsyncPipeline

      public void unblockAsyncPipeline(boolean forcedStop)
      Description copied from interface: IDerivedDataManager
      Force unblocking of the async. pipeline. Could stay blocked after the call of this method if async. DD computation prerequisites are not met yet.
      Specified by:
      unblockAsyncPipeline in interface IDerivedDataManager
      Parameters:
      forcedStop - Unblocks the forced block in case if true. Unblocks usual lock instead.
    • updateDerviedData

      public boolean updateDerviedData(IDerivedDataUpdate update, long waitTimeout)
      Description copied from interface: IDerivedDataManager
      Updates derivided data using the provided IDerivedDataUpdate update
      Specified by:
      updateDerviedData in interface IDerivedDataManager
      Parameters:
      update - The update to perform
      waitTimeout - Waiting time (in milliseconds) for the updated DD to be re-computed; 0 means no wait
      Returns:
      True if the requested DD were computed until the end of the waiting period; false otherwise
    • updateDerivedData

      public boolean updateDerivedData(IDerivedDataUpdate update, long waitTimeout, Object computationCause)
      Description copied from interface: IDerivedDataManager
      Updates derivided data using the provided IDerivedDataUpdate update
      Specified by:
      updateDerivedData in interface IDerivedDataManager
      Parameters:
      update - The update to perform
      waitTimeout - Waiting time (in milliseconds) for the updated DD to be scheduled in the pipeline
      computationCause - The designator of operation or service which caused the update. May be null
      Returns:
      True if the requested DD were computed until the end of the waiting period; false otherwise
    • supplyImplicitOperationContextIfApplicable

      public void supplyImplicitOperationContextIfApplicable(Object computationCause, Runnable asyncEventScheduler) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Computes synchronous derived data pending for the current session (if any). The computation is synchronous.
      Specified by:
      supplyImplicitOperationContextIfApplicable in interface IDerivedDataManager
      Parameters:
      computationCause - The object bound to the computation context and used to track computations. Can be null
      Throws:
      InterruptedException
    • waitAllComputations

      public boolean waitAllComputations(long timeout) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Wait till all computations are finished or waiting time exceeds the specified value.
      Specified by:
      waitAllComputations in interface IDerivedDataManager
      Parameters:
      timeout - the maximum time to wait in milliseconds
      Returns:
      true if all derived data has been computed by the time this method returns, false otherwise
      Throws:
      InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computations.
    • waitImportantDataComputations

      public boolean waitImportantDataComputations(long timeout) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits all important DD's to be computed. The rule to select important DD's is the following:
      Specified by:
      waitImportantDataComputations in interface IDerivedDataManager
      Parameters:
      timeout - the maximum time to wait in milliseconds
      Returns:
      true if all derived data has been computed by the time this method returns, false otherwise
      Throws:
      InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computations.
    • waitComputation

      public boolean waitComputation(long timeout, boolean priority, String... scope) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits completion of the given scope
      Specified by:
      waitComputation in interface IDerivedDataManager
      Parameters:
      timeout - The wait timeout
      priority - The data that is being waited are priority computations
      scope - The scope (parts) to wait
      Returns:
      True if the wait was successful; false if it was timed out
      Throws:
      InterruptedException
    • waitComputation

      public void waitComputation(Map<Long,Collection<String>> scope) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits till the given scope of computations is finished.
      Specified by:
      waitComputation in interface IDerivedDataManager
      Parameters:
      scope - the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs
      Throws:
      InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation
    • waitComputation

      public boolean waitComputation(Map<Long,Collection<String>> scope, long timeout) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits till the given scope of computations is finished or waiting time exceeds the specified value.
      Specified by:
      waitComputation in interface IDerivedDataManager
      Parameters:
      scope - the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs
      timeout - the maximum time to wait in milliseconds
      Returns:
      true if the given scope has been computed by the time this method returns, false otherwise
      Throws:
      InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation.
    • waitOperationComputation

      public boolean waitOperationComputation(Object handle, long timeout) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits the given operation computation
      Specified by:
      waitOperationComputation in interface IDerivedDataManager
      Parameters:
      handle - The operation computation handle. May not be NullPointerException
      timeout - the maximum time to wait in milliseconds
      Returns:
      true if the given scope has been computed by the time this method returns, false otherwise
      Throws:
      InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation.
    • waitComputationExt

      public boolean waitComputationExt(Map<Object,Collection<String>> scope, long timeout) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits till the given scope of computations is finished or waiting time exceeds the specified value.
      Specified by:
      waitComputationExt in interface IDerivedDataManager
      Parameters:
      scope - the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs
      timeout - the maximum time to wait in milliseconds
      Returns:
      true if the given scope has been computed by the time this method returns, false otherwise
      Throws:
      InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation.
    • startMassiveComputing

      public void startMassiveComputing()
      Description copied from interface: IDerivedDataManager
      Enables the massive computing mode for the DD pipeline. The mode is being desingaged after computing of all registered important tasks
      Specified by:
      startMassiveComputing in interface IDerivedDataManager
    • scheduleModalOperation

      public Object scheduleModalOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, DerivedDataSegmentBucket stage, IModalOperationController modalOperationController)
      Description copied from interface: IDerivedDataManager
      Schedules the orchestrated modal operation. See OperationType.MODAL for details
      Specified by:
      scheduleModalOperation in interface IDerivedDataManager
      Parameters:
      operation - The operation logic to schedule. May not be null
      stage - The target stage for the scheduling. May not be null
      modalOperationController - The modal operation controller. May not be null
      Returns:
      The operation handle for external operation referencing, may not be null
    • scheduleOperation

      public Object scheduleOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, DerivedDataSegmentBucket stage)
      Description copied from interface: IDerivedDataManager
      Schedules the orchestrated operation.
      Specified by:
      scheduleOperation in interface IDerivedDataManager
      Parameters:
      operation - The operation logic to schedule. May not be null
      operationType - The type of the operation. May not be null
      important - The designator of an important operation. The system waits for important operations computation during closing of projects, etc
      stage - The target stage for the scheduling. May not be null
      Returns:
      The operation handle for external operation referencing, may not be null
    • setStageLock

      public StageLockRequestResult setStageLock(DerivedDataSegmentBucket stage, boolean allowDataComputing)
      Description copied from interface: IDerivedDataManager
      Locks the async. pipeline stage (to support manual operations with external pipeline state control). Locked bucket tasks are being computed yet the pipeline can't switch to the next stage. The pre-set lock is being activated only after switching of the pipeline to the target stage. Before the activation the lock doesn't affect the computation.
      Specified by:
      setStageLock in interface IDerivedDataManager
      Parameters:
      stage - The stage to lock. May not be null
      Returns:
      The status of a target stage at the moment of a lock call. May not be null
    • resetStageLock

      public void resetStageLock(DerivedDataSegmentBucket stage)
      Description copied from interface: IDerivedDataManager
      Resets the lock being set earlier
      Specified by:
      resetStageLock in interface IDerivedDataManager
      Parameters:
      stage - The stage to re-set the bucket. May not be null. If block isn't set - does nothing.
    • isIdle

      public boolean isIdle()
      Description copied from interface: IDerivedDataManager
      Checks if the computation pipeline is idle
      Specified by:
      isIdle in interface IDerivedDataManager
      Returns:
      True if no computations are done/possible at the moment
    • removeOperation

      public void removeOperation(Object handle)
      Description copied from interface: IDerivedDataManager
      Removes the previously scheduled operation. Does nothing if the operation is already removed/computed
      Specified by:
      removeOperation in interface IDerivedDataManager
      Parameters:
      handle - The operation handle taken from the IDerivedDataManager#scheduleOperation(Consumer, OperationType, DerivedDataSegmentBucket) call. May not be null.
    • markAsModalOperationParticipant

      public void markAsModalOperationParticipant()
      Description copied from interface: IDerivedDataManager
      Marks a current thread as a current modal operation participant. The mark is removed automatically on the completion of the corresponding modal operation
      Specified by:
      markAsModalOperationParticipant in interface IDerivedDataManager
    • prepareForClose

      public void prepareForClose()
      Description copied from interface: IDerivedDataManager
      Prepares the async. computation facility for closing. Blocks all unnecessary data computations and scheduled operations and waits until all required computations are done
      Specified by:
      prepareForClose in interface IDerivedDataManager
    • startWrappingOperationIfNesessary

      public void startWrappingOperationIfNesessary(Object bmOperationHandle)
      Description copied from interface: IDerivedDataManager
      Starts implicit wrapping operation for the specified IBmTask in this thread in case if no operation is manually started already
      Specified by:
      startWrappingOperationIfNesessary in interface IDerivedDataManager
      Parameters:
      bmOperationHandle - The BM operation handle to wrap with the orchestrated operation. May not be null
    • completeWrappingOperationIfApplicable

      public void completeWrappingOperationIfApplicable(Object bmOperationHandle)
      Description copied from interface: IDerivedDataManager
      Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this thread
      Specified by:
      completeWrappingOperationIfApplicable in interface IDerivedDataManager
      Parameters:
      bmOperationHandle - The BM operation handle to wrap with the orchestrated operation. May not be null
    • implicitDerivedDataWait

      public void implicitDerivedDataWait(Object computationCause) throws InterruptedException
      Description copied from interface: IDerivedDataManager
      Waits for the derived data computation from the BM task that is wrapped by the implicit/explicit orchestrated operation
      Specified by:
      implicitDerivedDataWait in interface IDerivedDataManager
      Parameters:
      computationCause - The cause of the computation. May not be NullPointerException
      Throws:
      InterruptedException
    • resetActiveWrappingOperationContext

      public void resetActiveWrappingOperationContext(OperationContext operationContext)
      Description copied from interface: IDerivedDataManager
      Resets the active wrapping operation context associated with the current thread.
      Specified by:
      resetActiveWrappingOperationContext in interface IDerivedDataManager
      Parameters:
      operationContext - The context to reset. May not be null
    • applyForcedUpdates

      public void applyForcedUpdates()
      Description copied from interface: IDerivedDataManager
      Applies all forced updates provided by IDerivedDataConfigurationContributor's
      Specified by:
      applyForcedUpdates in interface IDerivedDataManager
    • disableAutoWrapping

      public void disableAutoWrapping()
      Description copied from interface: IDerivedDataManager
      Disables auto-wrapping of BM tasks with orchestrator operations for the current thread. Used for async data computations being controlled directly by the async pipeline. The disablement stays on during the whole thread lifecycle
      Specified by:
      disableAutoWrapping in interface IDerivedDataManager
    • enableAutoWrapping

      public void enableAutoWrapping()
      Description copied from interface: IDerivedDataManager
      Enables an auto-wrapping of BM tasks with orchestrator operations for the current thread. Used to restore an auto-wrapping being disabled previously
      Specified by:
      enableAutoWrapping in interface IDerivedDataManager
    • getScheduleOperationCallCounter

      public int getScheduleOperationCallCounter()
    • getRemoveOperationCallCounter

      public int getRemoveOperationCallCounter()
    • getEventConsumer

      public BiConsumer<BmEvent,Boolean> getEventConsumer()
      Description copied from interface: IDerivedDataManager
      Gets the sync event consumer for the integration with the event processing flow of IBmModel. Also it's possible to supply BM events directly to the consumer in complex scenarios of managed data updates
      Specified by:
      getEventConsumer in interface IDerivedDataManager
      Returns:
      The DD BmEvent consumer. May not be null
    • dumpPipeline

      public void dumpPipeline()
      Description copied from interface: IDerivedDataManager
      Dumps current pipeline state
      Specified by:
      dumpPipeline in interface IDerivedDataManager