Interface IBmModelManager

All Superinterfaces:
IManagedService
All Known Implementing Classes:
BmModelManager

public interface IBmModelManager extends IManagedService
The BM model manager allows clients to create or get instances of BM model from the given objects: projects, model objects, model object URIs.

The manager configures BM model instances after creation with BM model providers, link providers, indexes, etc.

Clients are intended to activate manager before work and deactivate manager after all work is done and manager is no longer needed.

Restriction:
This interface is not intended to be extended by clients.
Restriction:
This interface is not intended to be implemented by clients.
  • Field Details

    • SERVICE_NAME

      static final String SERVICE_NAME
      Service name (using in recovery orchestrator)
      See Also:
    • SAVE_JOB_FAMILY

      static final Object SAVE_JOB_FAMILY
      Save job family.
  • Method Details

    • activate

      void activate()
      Start up BM manager work. The manager configures itself and all associated infrastructure.

      Clients are intended to invoke #shutdown() when manager work is no longer needed.

      Specified by:
      activate in interface IManagedService
    • deactivate

      void deactivate()
      Shut down BM manager work. The manager shutdowns itself and all associated infrastructure.
      Specified by:
      deactivate in interface IManagedService
    • getBmPlatform

      BmPlatform getBmPlatform()
      Gets the underlying BM platform.
      Returns:
      the underlying BM platform or null in case the model manager is not initialized yet.
    • getBmNamespace

      IBmNamespace getBmNamespace(org.eclipse.core.resources.IProject project)
      Gets the namespace storing the data of the specified project.
      Parameters:
      project - The project. May not be null.
      Returns:
      the namespace or null if the project context is not started yet.
    • getBmNamespace

      IBmNamespace getBmNamespace(IDtProject project)
      Gets the namespace storing the data of the specified project.
      Parameters:
      project - The project. May not be null.
      Returns:
      the namespace or null if the project context is not started yet.
    • getModel

      IBmModel getModel(org.eclipse.core.resources.IProject project)
      Returns IBmModel instance by given project.
      Can return null if there is no BM instance, associated with the given project.
      Parameters:
      project - the project (not null)
      Returns:
      IBmModel instance or null if given project doesn't associated with any BM model and cannot create one
    • getModel

      IBmModel getModel(IDtProject dtProject)
      Returns IBmModel instance by given project.
      Can return null if there is no BM instance, associated with the given project.
      Parameters:
      project - the project (not null)
      Returns:
      IBmModel instance or null if given project doesn't associated with any BM model and cannot create one
    • getModel

      IBmModel getModel(org.eclipse.emf.common.util.URI uri)
      Returns IBmModel which contains object with given URI.
      Can return null if there is no BM instances, that handles the object with the given URI.
      Parameters:
      uri - the object URI (not null)
      Returns:
      IBmModel which contains object with given URI or null if object is not handled by any IBmModel
    • getModel

      IBmModel getModel(org.eclipse.emf.ecore.EObject object)
      Returns IBmModel which contains the given model object.
      Can return null if there is no BM instances, that handles the given model object.
      Parameters:
      uri - the model object (not null)
      Returns:
      IBmModel which contains the given model object or null if object is not handled by any IBmModel
    • getProject

      org.eclipse.core.resources.IProject getProject(IBmModel bmModel)
      Returns project associated with given BM instance.
      Can return null if there is no projects, associated with the given BM instance.
      Parameters:
      bmModel - the IBmModel instance (not null)
      Returns:
      project associated with given big model instance
    • getDtProject

      IDtProject getDtProject(String engineId)
      Returns project associated with given BM engine.
      Can return null if there is no projects, associated with the given BM engine.
      Parameters:
      engineId - the identifier of the BM engine, (not null)
      Returns:
      project associated with given engine
    • getDtProject

      IDtProject getDtProject(IBmModel bmModel)
      Returns IDtProject project associated with given BM instance.
      Can return null if there is no projects, associated with the given BM instance.
      Parameters:
      bmModel - the IBmModel instance (not null)
      Returns:
      IDtProject project associated with given big model instance
    • resolve

      @Deprecated <T extends org.eclipse.emf.ecore.EObject> T resolve(T proxyOrObject, org.eclipse.emf.ecore.resource.Resource context, org.eclipse.emf.ecore.EObject objContext)
      Deprecated.
      this method can be deleted soon
      Resolves given proxy using the provide resource context for the resolving/starting point.
      Aware of BM infrastructure and standalone resources.
      Parameters:
      proxyOrObject - proxy to resolve.
      context - the context resource.
      objContext - the object context.
      Returns:
      The resolved object (if referenced object already exists and reachable) or proxy of the source type.
    • waitModelSynchronization

      void waitModelSynchronization(org.eclipse.core.resources.IProject project)
      Waits for project BM synchronization jobs.
    • isLocked

      boolean isLocked(org.eclipse.core.resources.IProject project)
      Checks if the given project's BM model is locked at the moment.
      Parameters:
      project - The project to check the locked state for. Cannot be null
      Returns:
      True if the corresponding BM is locked at the moment; false otherwise
    • unlockModel

      void unlockModel(org.eclipse.core.resources.IProject project)
      Releases previously defined lock for the given project's model
      Parameters:
      project - The project to unlock the BM model for. Cannot be null
    • lockModel

      void lockModel(org.eclipse.core.resources.IProject project)
      Raises the lock on the given model. The lock indicates that all data critical clients should cease their requests and wait until the lock is released.
      Parameters:
      project - The target project which BM should be locked. Cannot be null
    • addLifecycleListener

      @Deprecated void addLifecycleListener(IBmModel model, IBmLifecycleListener listener)
      Deprecated.
      Use DT lifecycle listeners and lifecycle aware services instead.
      Registers the given lifecycle listener.
      Parameters:
      listener - The lifecycle listener. May not be null.
    • removeLifecycleListener

      @Deprecated void removeLifecycleListener(IBmModel model, IBmLifecycleListener listener)
      Deprecated.
      Use DT lifecycle listeners and lifecycle aware services instead.
      Unregisters the given lifecycle listener.
      Parameters:
      listener - The lifecycle listener. May not be null.
    • getModelPackages

      Collection<org.eclipse.emf.ecore.EPackage> getModelPackages()
      Gets the collection of EMF packages supported by the model.
      Returns:
      the collection of EMF packages supported by the model, never null.
    • executeReadOnlyTask

      <T> T executeReadOnlyTask(IBmPlatformTask<T> task)
      Executes a IBmPlatformTask in a read-only mode
      Type Parameters:
      T - The type of the task's return valu
      Parameters:
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadOnlyTask

      <T> T executeReadOnlyTask(IDtProject dtProject, IBmSingleNamespaceTask<T> task)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace in a read-only mode
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      dtProject - The target IDtProject. May not be null
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadOnlyTask

      <T> T executeReadOnlyTask(org.eclipse.core.resources.IProject project, IBmSingleNamespaceTask<T> task)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace in a read-only mode
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      project - The target IProject. May not be null
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadOnlyTask

      <T> T executeReadOnlyTask(IBmNamespace namespace, IBmSingleNamespaceTask<T> task)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace in a read-only mode
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      namespace - The target IBmNamespace. May not be null
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadWriteTask

      <T> T executeReadWriteTask(Object taskId, Object serviceId, IBmPlatformTask<T> task)
      Executes a read-write task.
      Type Parameters:
      T - The type of the task's return value.
      Parameters:
      taskId - The ID of the task. May be null.
      serviceId - The ID of the service that requested the task execution. May be null.
      task - The task to execute. May not be null.
      Returns:
      the result returned by IBmPlatformTask.execute(IBmPlatformTransaction) method.
    • executeReadWriteTask

      <T> T executeReadWriteTask(Object taskId, Object serviceId, boolean disableEvents, IBmPlatformTask<T> task)
      Executes a read-write task.
      Type Parameters:
      T - The type of the task's return value.
      Parameters:
      taskId - The ID of the task. May be null.
      serviceId - The ID of the service that requested the task execution. May be null.
      disableEvents - The flag that disables sending of BM data change events
      task - The task to execute. May not be null.
      Returns:
      the result returned by IBmPlatformTask.execute(IBmPlatformTransaction) method.
    • executeReadWriteTask

      <T> T executeReadWriteTask(IDtProject dtProject, IBmSingleNamespaceTask<T> task)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      dtProject - The target IDtProject. May not be null
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadWriteTask

      <T> T executeReadWriteTask(org.eclipse.core.resources.IProject project, IBmSingleNamespaceTask<T> task)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      task - The task to run. May not be null
      dtProject - The target IProject. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadWriteTask

      <T> T executeReadWriteTask(IBmNamespace namespace, IBmSingleNamespaceTask<T> task)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      namespace - The target IBmNamespace. May not be null
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • executeReadWriteTask

      <T> T executeReadWriteTask(IBmNamespace namespace, IBmSingleNamespaceTask<T> task, boolean disableEvents)
      Executes a IBmSingleNamespaceTask which is bound to a single namespace
      Type Parameters:
      T - The type of the task's return value
      Parameters:
      namespace - The target IBmNamespace. May not be null
      task - The task to run. May not be null
      Returns:
      The result of the task execution. May not be null
    • createLocalEditingContext

      IBmPlatformLocalEditingContext createLocalEditingContext(String name)
      Creates a local platform context.
      Parameters:
      name - The name of the context. May not be null.
      Returns:
      a newly created local context instance, never null.
    • getGlobalEditingContext

      IBmPlatformGlobalEditingContext getGlobalEditingContext()
      Gets platform global editing context instance
      Returns:
      The global editing context of the platform. May not be 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, IBmPlatformTask<T> task)
      Executes task in a batch session.
      Type Parameters:
      T - The type of the task's return value.
      Parameters:
      handle - The batch session handle. May not be null.
      task - The task to execute. May not be null.
      Returns:
      the result returned by IBmPlatformTask.execute(IBmPlatformTransaction) method.
    • executeAsynchronously

      <T> Future<T> executeAsynchronously(org.eclipse.core.resources.IProject project, IBmSingleNamespaceTask<T> task)
      Executes the given task in a separate thread (comparing to the calling thread). This method could be used to ensure the data modification will be performed independently of a BM transaction that may be started in the calling thread already. Please note that this operation is not a performance-effective one, so it should be used only in case if some process flow conflicts with other threads IBmTransaction locks and cannot be redesigned at the moment to a normal orchestrated form
      Parameters:
      project - A target project. May not be null
      task - A task to run. May not be null
      Returns:
      A future that provides access to a result of an operation. Never null
    • executeAsynchronously

      <T> Future<T> executeAsynchronously(IDtProject project, IBmSingleNamespaceTask<T> task)
      Executes the given task in a separate thread (comparing to the calling thread). This method could be used to ensure the data modification will be performed independently of a BM transaction that may be started in the calling thread already. Please note that this operation is not a performance-effective one, so it should be used only in case if some process flow conflicts with other threads IBmTransaction locks and cannot be redesigned at the moment to a normal orchestrated form
      Parameters:
      project - A target DT project. May not be null
      task - A task to run. May not be null
      Returns:
      A future that provides access to a result of an operation. Never null
    • addSyncEventListener

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

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

      void addAsyncEventListener(IBmNamespace namespace, IBmAsyncEventListener listener, BmEventFilter... filters)
      Adds the specified asynchronous event listener. The listener is notified in case the event matches at least one of the specified filters or no filter is specified.
      Parameters:
      namespace - The namespace to add the listener to. May not be null.
      listener - The listener to add. May not be null.
      filters - The filters. May be null.
    • removeAsyncEventListener

      void removeAsyncEventListener(IBmNamespace namespace, IBmAsyncEventListener listener)
      Removes the specified asynchronous event listener.
      Parameters:
      namespace - The namespace to remove the listener from. May not be null.
      listener - The listener to remove. May not be null.
    • waitAllEnqueuedEventsSent

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

      boolean forceExport(IDtProject project, String fqn)
      Forces export of the object with the specified FQN. This method is supposed to be called within an exclusive workspace operation.
      Parameters:
      project - The project the object belongs to. May not be null.
      fqn - The FQN of the object. May not be null.
      Returns:
      true in case export was performed, false if there was nothing to export, i.e. there was nothing to export.
    • forceExport

      boolean forceExport(IDtProject project, List<String> fqns)
      Forces export of the objects with the specified FQNs. The save process is parallelized.
      Parameters:
      project - The project the object belongs to. May not be null.
      fqns - The FQN of the objects. May not be null.
      Returns:
      true in case export was performed, false if there was nothing to export, i.e. there was nothing to export.
    • registerLifecycleParticipant

      void registerLifecycleParticipant(IBmModelManager.BmModelManagerLifecycleParticipant participant)
      Registers lifecycle participant. To be sure that registered participant will participate during each supported lifecycle phase of IBmModelManager the participant should be registered during the LifecyclePhase.LINKING phase of service lifecycle
      Parameters:
      participant - The participant to register. Cannot be null