Class DerivedDataManagerMock
java.lang.Object
com.e1c.g5.v8.dt.internal.snapshot.DerivedDataManagerMock
- All Implemented Interfaces:
IDerivedDataManager
-
Field Summary
Fields inherited from interface com._1c.g5.v8.derived.IDerivedDataManager
SERVICE_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObjectStatusListener
(IDerivedDataObjectStatusListener listener, long bmObjectId, String... segments) Adds listener for DD status changes of the given object and set of tracked DD segments.void
addObjectStatusListener
(IDerivedDataObjectStatusListener listener, Map<Long, Collection<String>> scope) Adds listener for DD status changes of the given DD change scope.void
addStatusListener
(IDerivedDataStatusListener listener) Adds listener that will be notified about derived data status changes.void
Applies all forced updates provided byIDerivedDataConfigurationContributor
'svoid
blockAsyncPipeline
(boolean forcedStop) Blocks the async. processing pipeline.void
blockAsyncPipeline
(boolean forcedStop, boolean wait) Blocks the async. processing pipelinevoid
completeWrappingOperationIfApplicable
(Object bmOperationHandle) Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this threadvoid
Disables auto-wrapping of BM tasks with orchestrator operations for the current thread.void
Disables implicit waiting of the DD independenly of the current system status.void
Dumps current pipeline statevoid
Enables an auto-wrapping of BM tasks with orchestrator operations for the current thread.void
Enables implicit waiting of the DD independenly of the current system status.Gets the current status of DD for the corresponding BM model.Gets the sync event consumer for the integration with the event processing flow ofIBmModel
.int
int
void
implicitDerivedDataWait
(Object computationCause) Waits for the derived data computation from the BM task that is wrapped by the implicit/explicit orchestrated operationboolean
Checks if all derived data parts are computed.boolean
isComputed
(long bmObjectId, String segmentId) Checks if the given part is computed for the given BM object.boolean
isComputed
(long bmObjectId, String partId, boolean strict) Checks if the given part is computed for the given BM object.boolean
isComputed
(long bmObjectId, Collection<String> segmentIds) Checks if the given parts are computed for the given BM object.boolean
isComputed
(String... segmentIds) Checks if the given DD segments are computed (if applicable) for all the BM objects.boolean
isComputed
(Collection<String> segmentIds) Checks if the given parts are computed (if applicable) for all the BM objects.boolean
isIdle()
Checks if the computation pipeline is idlevoid
Marks a current thread as a current modal operation participant.void
Prepares the async. computation facility for closing.void
Forces the DD mechanism to recompute all the known parts of all the known objects.void
Removes specific DD object status listener instance from the notification chain.void
removeOperation
(Object handle) Removes the previously scheduled operation.void
Removes listener that will be notified about derived data status changes.void
resetActiveWrappingOperationContext
(OperationContext operationContext) Resets the active wrapping operation context associated with the current thread.void
Resets the lock being set earlierscheduleModalOperation
(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, DerivedDataSegmentBucket stage, IModalOperationController modalOperationController) Schedules the orchestrated modal operation.scheduleOperation
(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, DerivedDataSegmentBucket stage) Schedules the orchestrated operation.setStageLock
(DerivedDataSegmentBucket stage, boolean allowDataComputing) Locks the async. pipeline stage (to support manual operations with external pipeline state control).void
Enables the massive computing mode for the DD pipeline.void
startWrappingOperationIfNesessary
(Object bmOperationHandle) Starts implicit wrapping operation for the specifiedIBmTask
in this thread in case if no operation is manually started alreadyvoid
supplyImplicitOperationContextIfApplicable
(Object computationCause, Runnable asyncEventScheduler) Computes synchronous derived data pending for the current session (if any).void
unblockAsyncPipeline
(boolean forcedStop) Force unblocking of the async. pipeline.boolean
updateDerivedData
(IDerivedDataUpdate update, long waitTimeout, Object computationCause) Updates derivided data using the providedIDerivedDataUpdate
updateboolean
updateDerviedData
(IDerivedDataUpdate update, long waitTimeout) Updates derivided data using the providedIDerivedDataUpdate
updateboolean
waitAllComputations
(long timeout) Wait till all computations are finished or waiting time exceeds the specified value.boolean
waitComputation
(long timeout, boolean priority, String... scope) Waits completion of the given scopevoid
waitComputation
(Map<Long, Collection<String>> scope) Waits till the given scope of computations is finished.boolean
waitComputation
(Map<Long, Collection<String>> scope, long timeout) Waits till the given scope of computations is finished or waiting time exceeds the specified value.boolean
waitComputationExt
(Map<Object, Collection<String>> scope, long timeout) Waits till the given scope of computations is finished or waiting time exceeds the specified value.boolean
waitImportantDataComputations
(long timeout) Waits all important DD's to be computed.boolean
waitOperationComputation
(Object handle, long timeout) Waits the given operation computation
-
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 interfaceIDerivedDataManager
- Parameters:
listener
- The listener instance. Cannot benull
. 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 theIDerivedDataManager.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 benull
or empty due to performance reasons. To track down computation of the entire DD segment useIDerivedDataManager#addStatusListener(IDerivedDataStatusListener)
instead}.segments
- DD segment filter allows to subscribe for specific segments of DD. Cannot benull
-
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 interfaceIDerivedDataManager
- Parameters:
listener
- The listener instance. Cannot benull
. 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 theIDerivedDataManager.removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener)
will remove all subscriptions.scope
- Tracked DD segments mapped to corresponding BM object ids. Cannot benull
. Scope entries cannot containnull
or empty sets of tracked DD segments.
-
addStatusListener
Description copied from interface:IDerivedDataManager
Adds listener that will be notified about derived data status changes.- Specified by:
addStatusListener
in interfaceIDerivedDataManager
- 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 interfaceIDerivedDataManager
- 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 interfaceIDerivedDataManager
- 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 interfaceIDerivedDataManager
-
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 interfaceIDerivedDataManager
-
getDerivedDataStatus
Description copied from interface:IDerivedDataManager
Gets the current status of DD for the corresponding BM model.- Specified by:
getDerivedDataStatus
in interfaceIDerivedDataManager
- 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 interfaceIDerivedDataManager
- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given parts are computed (if applicable) for all the BM objects.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given parts are computed for the given BM object.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
bmObjectId
- the ID of the BM object to check- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given part is computed for the given BM object.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
bmObjectId
- the ID of the BM object to checksegmentId
- the ID of the part to check- Returns:
true
if computed,false
otherwise
-
isComputed
Description copied from interface:IDerivedDataManager
Checks if the given part is computed for the given BM object.- Specified by:
isComputed
in interfaceIDerivedDataManager
- Parameters:
bmObjectId
- the ID of the BM object to checkpartId
- the ID of the part to checkstrict
- 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
Description copied from interface:IDerivedDataManager
Checks if the given DD segments are computed (if applicable) for all the BM objects.- Specified by:
isComputed
in interfaceIDerivedDataManager
- 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 interfaceIDerivedDataManager
-
removeObjectStatusListener
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 interfaceIDerivedDataManager
- Parameters:
listener
- The listener that should be removed. Cannot benull
.
-
removeStatusListener
Description copied from interface:IDerivedDataManager
Removes listener that will be notified about derived data status changes.- Specified by:
removeStatusListener
in interfaceIDerivedDataManager
- 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 interfaceIDerivedDataManager
- Parameters:
forcedStop
- Unblocks the forced block in case if true. Unblocks usual lock instead.
-
updateDerviedData
Description copied from interface:IDerivedDataManager
Updates derivided data using the providedIDerivedDataUpdate
update- Specified by:
updateDerviedData
in interfaceIDerivedDataManager
- Parameters:
update
- The update to performwaitTimeout
- 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 providedIDerivedDataUpdate
update- Specified by:
updateDerivedData
in interfaceIDerivedDataManager
- Parameters:
update
- The update to performwaitTimeout
- Waiting time (in milliseconds) for the updated DD to be scheduled in the pipelinecomputationCause
- The designator of operation or service which caused the update. May benull
- 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 interfaceIDerivedDataManager
- Parameters:
computationCause
- The object bound to the computation context and used to track computations. Can benull
- Throws:
InterruptedException
-
waitAllComputations
Description copied from interface:IDerivedDataManager
Wait till all computations are finished or waiting time exceeds the specified value.- Specified by:
waitAllComputations
in interfaceIDerivedDataManager
- 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
Description copied from interface:IDerivedDataManager
Waits all important DD's to be computed. The rule to select important DD's is the following:
- All data from
DerivedDataSegmentBucket.SYNC
bucket - All data from
DerivedDataSegmentBucket.AFTER_SYNC
bucket - All data from
DerivedDataSegmentBucket.NORMAL
bucket having a priority greater thenDerivedDataSegmentDefinition.LOW_PRIORITY
- Specified by:
waitImportantDataComputations
in interfaceIDerivedDataManager
- 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.
- All data from
-
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 interfaceIDerivedDataManager
- Parameters:
timeout
- The wait timeoutpriority
- The data that is being waited are priority computationsscope
- The scope (parts) to wait- Returns:
- True if the wait was successful; false if it was timed out
- Throws:
InterruptedException
-
waitComputation
Description copied from interface:IDerivedDataManager
Waits till the given scope of computations is finished.- Specified by:
waitComputation
in interfaceIDerivedDataManager
- 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 InterruptedExceptionDescription copied from interface:IDerivedDataManager
Waits till the given scope of computations is finished or waiting time exceeds the specified value.- Specified by:
waitComputation
in interfaceIDerivedDataManager
- 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 IDstimeout
- 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
Description copied from interface:IDerivedDataManager
Waits the given operation computation- Specified by:
waitOperationComputation
in interfaceIDerivedDataManager
- Parameters:
handle
- The operation computation handle. May not beNullPointerException
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 InterruptedExceptionDescription copied from interface:IDerivedDataManager
Waits till the given scope of computations is finished or waiting time exceeds the specified value.- Specified by:
waitComputationExt
in interfaceIDerivedDataManager
- 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 IDstimeout
- 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 interfaceIDerivedDataManager
-
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. SeeOperationType.MODAL
for details- Specified by:
scheduleModalOperation
in interfaceIDerivedDataManager
- Parameters:
operation
- The operation logic to schedule. May not benull
stage
- The target stage for the scheduling. May not benull
modalOperationController
- The modal operation controller. May not benull
- 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 interfaceIDerivedDataManager
- Parameters:
operation
- The operation logic to schedule. May not benull
operationType
- The type of the operation. May not benull
important
- The designator of an important operation. The system waits for important operations computation during closing of projects, etcstage
- The target stage for the scheduling. May not benull
- 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 interfaceIDerivedDataManager
- Parameters:
stage
- The stage to lock. May not benull
- Returns:
- The status of a target stage at the moment of a lock call. May not be
null
-
resetStageLock
Description copied from interface:IDerivedDataManager
Resets the lock being set earlier- Specified by:
resetStageLock
in interfaceIDerivedDataManager
- Parameters:
stage
- The stage to re-set the bucket. May not benull
. 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 interfaceIDerivedDataManager
- Returns:
- True if no computations are done/possible at the moment
-
removeOperation
Description copied from interface:IDerivedDataManager
Removes the previously scheduled operation. Does nothing if the operation is already removed/computed- Specified by:
removeOperation
in interfaceIDerivedDataManager
- Parameters:
handle
- The operation handle taken from theIDerivedDataManager#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 interfaceIDerivedDataManager
-
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 interfaceIDerivedDataManager
-
startWrappingOperationIfNesessary
Description copied from interface:IDerivedDataManager
Starts implicit wrapping operation for the specifiedIBmTask
in this thread in case if no operation is manually started already- Specified by:
startWrappingOperationIfNesessary
in interfaceIDerivedDataManager
- Parameters:
bmOperationHandle
- The BM operation handle to wrap with the orchestrated operation. May not benull
-
completeWrappingOperationIfApplicable
Description copied from interface:IDerivedDataManager
Complete implicit wrapping operation if the implicit wrapping operation were started earlier in this thread- Specified by:
completeWrappingOperationIfApplicable
in interfaceIDerivedDataManager
- Parameters:
bmOperationHandle
- The BM operation handle to wrap with the orchestrated operation. May not benull
-
implicitDerivedDataWait
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 interfaceIDerivedDataManager
- Parameters:
computationCause
- The cause of the computation. May not beNullPointerException
- Throws:
InterruptedException
-
resetActiveWrappingOperationContext
Description copied from interface:IDerivedDataManager
Resets the active wrapping operation context associated with the current thread.- Specified by:
resetActiveWrappingOperationContext
in interfaceIDerivedDataManager
- Parameters:
operationContext
- The context to reset. May not benull
-
applyForcedUpdates
public void applyForcedUpdates()Description copied from interface:IDerivedDataManager
Applies all forced updates provided byIDerivedDataConfigurationContributor
's- Specified by:
applyForcedUpdates
in interfaceIDerivedDataManager
-
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 interfaceIDerivedDataManager
-
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 interfaceIDerivedDataManager
-
getScheduleOperationCallCounter
public int getScheduleOperationCallCounter() -
getRemoveOperationCallCounter
public int getRemoveOperationCallCounter() -
getEventConsumer
Description copied from interface:IDerivedDataManager
Gets the sync event consumer for the integration with the event processing flow ofIBmModel
. Also it's possible to supply BM events directly to the consumer in complex scenarios of managed data updates- Specified by:
getEventConsumer
in interfaceIDerivedDataManager
- Returns:
- The DD
BmEvent
consumer. May not benull
-
dumpPipeline
public void dumpPipeline()Description copied from interface:IDerivedDataManager
Dumps current pipeline state- Specified by:
dumpPipeline
in interfaceIDerivedDataManager
-