Interface IBmModel


  • public interface IBmModel
    Entry point for all interactions with the BM integration mechanism.
    • Method Detail

      • addResourceSyncListener

        void addResourceSyncListener​(IBmWorkspaceSynchronizationListener listener)
        Registers the given workspace synchronization listener.
        Parameters:
        listener - The workspace synchronization listener. May not be null.
      • removeResourceSyncListener

        void removeResourceSyncListener​(IBmWorkspaceSynchronizationListener listener)
        Unregisters the given workspace synchronization listener.
        Parameters:
        listener - The workspace synchronization listener. May not be null.
      • addSyncEventListener

        void addSyncEventListener​(IBmSyncEventListener listener)
        Adds the specified synchronous event listener.
        Parameters:
        listener - The listener to add. May not be null.
      • removeSyncEventListener

        void removeSyncEventListener​(IBmSyncEventListener listener)
        Removes the specified synchronous event listener.
        Parameters:
        listener - The listener to remove. May not be null.
      • addAsyncEventListener

        void addAsyncEventListener​(IBmAsyncEventListener listener,
                                   BmEventFilter... filters)
        Adds a new IBmAsyncEventListener listener with associated a set of filters. Listener is being notified only in case if input matches at least one filter criteria, i.e. filters work in "OR" logic together as triggers.
        Parameters:
        listener - The Listener to add. May not be null.
        filters - The set of associated filters. May be null.
      • removeAsyncEventListener

        void removeAsyncEventListener​(IBmAsyncEventListener listener)
        Removes the specified asynchronous event listener.
        Parameters:
        listener - The listener to remove. May not be null.
      • getLastEnqueuedEventId

        long getLastEnqueuedEventId()
        Returns the ID of the last event enqueued for sending.
        Returns:
        the event ID.
      • waitAllEnqueuedEventsSent

        void waitAllEnqueuedEventsSent()
        Waits till all the events enqueued prior to calling this method are sent.
      • waitEventSent

        void waitEventSent​(long id)
        Waits till the event with the given ID is sent.
        Parameters:
        id - The event ID.
      • waitForProcessing

        @Deprecated
        void waitForProcessing​(long timeOut)
        Deprecated.
        Testing only method for waiting till all the specified providers complete their data processing.
        Parameters:
        timeOut - The maximum time to wait in milliseconds.
      • createLocalContext

        IBmLocalEditingContext createLocalContext​(String name)
        Creates a local context.
        Parameters:
        name - The name of the context. May not be null.
        Returns:
        a newly created local context instance, never null.
      • getGlobalContext

        IBmGlobalEditingContext getGlobalContext()
        Gets the global context instance.
        Returns:
        the global context instance, never null.
      • getEngine

        IBmEngine getEngine()
        Gets the underlying engine.
        Returns:
        the underlying engine, never null.
      • getId

        String getId()
        Gets the identifier of the model.
        Returns:
        the identifier of the model, never null.
      • execute

        <T> T execute​(IBmTask<T> task)
        Executes the given task without recording history.
        • If the task execution causes the transaction deadlock (throw BmDeadlockDetectedException), the transaction is rolled back, and the task executed again.
        • If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
        • If the task throws any exception other than BmDeadlockDetectedException it is re-thrown.
        Parameters:
        task - The task. May not be null.
        Returns:
        the result returned by IBmTask.execute(IBmTransaction, IProgressMonitor) method.
      • executeAndRollback

        <T> T executeAndRollback​(IBmTask<T> task)
        Executes the given task without recording history.
        • If the task execution causes the transaction deadlock (throw BmDeadlockDetectedException), the transaction is rolled back, and the task executed again.
        • If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
        • If the task throws any exception other than BmDeadlockDetectedException it is re-thrown.
        The transaction will be rolled back.
        Parameters:
        task - The task. May not be null.
        Returns:
        the result returned by IBmTask.execute(IBmTransaction, IProgressMonitor) method.
      • executeReadonlyTask

        <T> T executeReadonlyTask​(IBmTask<T> task,
                                  boolean lightweight)
        Executes the given task. The task is executed within read-only transaction.
        • If the task execution causes the transaction deadlock (throw BmDeadlockDetectedException), the transaction is rolled back, and the task executed again.
        • If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
        • If the task throws any exception other than BmDeadlockDetectedException it is re-thrown.
        Parameters:
        task - The task. May not be null.
        lightweight - the flag indicating whether the transaction should be lightweight or not.
        Returns:
        the result returned by IBmTask.execute(IBmTransaction, IProgressMonitor) method.
      • getAllLocalContexts

        List<IBmLocalEditingContext> getAllLocalContexts()
        Gets all the active local contexts.
        Returns:
        a list of all the active contexts, never null.
      • isDisposed

        boolean isDisposed()
        Checks if the model is disposed.
        Returns:
        true if the model is disposed, false otherwise.
      • start

        void start()
        Starts the BM model.
      • close

        void close()
        Closes the BM model.
      • beginBatchSession

        Object beginBatchSession()
        Begins batch session.
        Returns:
        the handle object of the batch session, never null.
      • beginBatchSession

        Object beginBatchSession​(Object handle)
        Begins batch mode.
        Parameters:
        The - externally provided handle object. Can be null. In case if the descendant of the IBatchSessionController is supplied as a handle - enables managed batch mode.
        Returns:
        the batch mode handle object, never null.
      • endBatchSession

        void endBatchSession​(Object handle)
        Ends the batch session associated with the specified handle.
        Parameters:
        handle - The batch session handle. May not be null.
        See Also:
        #beginBatchMode()
      • executeInBatchSession

        <T> T executeInBatchSession​(Object handle,
                                    IBmTask<T> task)
        Executes the given task within the batch session associated with the specified handle.
        • If the task execution causes the transaction deadlock (throw BmDeadlockDetectedException), the transaction is rolled back, and the task executed again.
        • If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
        • If the task throws any exception other than BmDeadlockDetectedException it is re-thrown.
        Parameters:
        handle - The batch session handle. May not be null.
        task - The task. May not be null.
        Returns:
        the result returned by IBmTask.execute(IBmTransaction, IProgressMonitor) method.
      • registerProvider

        @Deprecated
        void registerProvider​(IBmProvider provider)
        Deprecated.
        The method has been added to support existing legacy solutions only.
        Registers the specified provider.
        Parameters:
        provider - The provider to register. May not be null.
      • getProvider

        @Deprecated
        IBmProvider getProvider​(String providerId)
        Deprecated.
        The method has been added to support existing legacy solutions only.
        Gets provider by ID.
        Parameters:
        providerId - The ID to get provider by. May not be null.
        Returns:
        the provider or null if the there is no provider with the specified ID.
      • commitAndSaveAll

        @Deprecated
        void commitAndSaveAll​(IBmTransaction transaction,
                              BmLongHashMap<String> updatedFqns)
        Deprecated.
        The method has been added to support existing legacy solutions only.
        Commits the specified transaction and saves all the editing contexts.
        Parameters:
        transaction - The transaction to commit. May not be null.
        updatedFqns - A map where keys are identifiers of the objects with updated FQNs and the values are updated FQNs. May not be null.