Interface IBmEngine


  • public interface IBmEngine

    Entry point for all interactions with the BM object storage engine.

    • Method Detail

      • getState

        EngineState getState()
        Gets the engine state.
        Returns:
        the engine state, never null.
      • start

        void start()
        Starts the engine, performing all startup sequence processing.
      • close

        void close()
        Closes the engine, performing all shutdown sequence processing. Once an engine is closed it cannot be started again.
      • compact

        void compact()
        Requests compacting the underlying stores. The request is ignored if compacting is unnecessary.
      • getId

        String getId()
        Gets the identifier of the engine.
        Returns:
        the identifier of the engine, never null.
      • beginReadOnlyTransaction

        IBmTransaction beginReadOnlyTransaction()
        Begins a read-only transaction.
        Returns:
        the created transaction instance, never null.
      • beginReadOnlyTransaction

        IBmTransaction beginReadOnlyTransaction​(boolean lightweight)
        Begins a read-only transaction. In contrast to its zero-argument counterpart this method allows to create a lightweight transaction.
        Parameters:
        lightweight - If true begins a lightweight transaction that purges its internal cache of read objects.
        Returns:
        the created transaction instance, never null.
      • beginReadWriteTransaction

        IBmTransaction beginReadWriteTransaction()
        Begins a read-write transaction.
        Returns:
        the created transaction instance, never null.
      • beginReadWriteTransaction

        IBmTransaction beginReadWriteTransaction​(boolean trackModifications)
        Begins a read-write transaction. In contrast to its zero-argument counterpart this method allows to say the transaction to track modifications. In this case the transaction commit result will contain information about the modified resources and so on.
        Parameters:
        trackModifications - The flag showing whether the modifications performed in this transaction must be tracked.
        Returns:
        the created transaction instance, never null.
      • beginReadWriteTransaction

        IBmTransaction beginReadWriteTransaction​(boolean trackModifications,
                                                 Object operationId,
                                                 Object serviceId)
        Begins a read-write transaction. In contrast to its one-argument counterpart this method allows to specify the operation and service ID that can later be used e.g. to classify events. In this case the transaction commit result will contain information about the modified resources and so on.
        Parameters:
        trackModifications - The flag showing whether the modifications performed in this transaction must be tracked.
        operationId - The ID of the operation executed in this transaction. May be null.
        serviceId - The ID of the service executing the operation. May be null.
        Returns:
        the created transaction instance, never null.
      • beginNonCommittableTransaction

        @Deprecated
        IBmTransaction beginNonCommittableTransaction()
        Deprecated.
        For internal use only, will be removed someday
        Begins a non-commitable read-write transaction. This method isn't the part of the public API and shouldn't be used by clients
        Returns:
        the created transaction instance, never null.
      • getCurrentTransaction

        IBmTransaction getCurrentTransaction()
        Get the current transaction associated with the calling thread (if any, last one started). Used as a temporary measure for legacy solutions which aren't propagate transactions via their respective API's.
        Returns:
        The current transaction (if any) being asscoiated with the calling thread, if any. null if no transaction is associated.
      • getObjectById

        IBmObject getObjectById​(long id)
        Gets object by ID.
        Parameters:
        id - The ID to get object by.
        Returns:
        the object with the specified ID if exists, otherwise null.
      • getTopObjectByFqn

        IBmObject getTopObjectByFqn​(String fqn)
        Gets top object by FQN.
        Parameters:
        fqn - The FQN to get object by. May not be null.
        Returns:
        the top object with the specified FQN if exists, otherwise null.
      • getTopObjectByResourceId

        IBmObject getTopObjectByResourceId​(int resourceId)
        Gets top object by resource ID.
        Parameters:
        resourceId - The resource ID to get object by.
        Returns:
        the top object belonging to the resource specified by ID if exists, otherwise null.
      • getTopObjectId

        long getTopObjectId​(long id)
        Gets top object ID by the specified object ID.
        Parameters:
        id - The object ID
        Returns:
        the ID of the top object
        Since:
        5.2.0
      • isTopObjectId

        boolean isTopObjectId​(long id)
        Checks if the specified ID belongs to a top object.
        Parameters:
        id - The ID to run the check against.
        Returns:
        true if the specified ID belongs to a top object, otherwise falsel
      • getObjectResourceId

        int getObjectResourceId​(long id)
        Get the ID of the resource the object with the given ID belongs to.
        Parameters:
        id - The object ID.
        Returns:
        the ID of the resource.
      • buildUriPath

        String buildUriPath​(IBmObject object)
        Builds URI path for the specified object.
        Parameters:
        object - The object to build URI path for. May not be null.
        Returns:
        the URI path or null.
      • collectStatistics

        BmStaticticsContainer collectStatistics()
        Collects statistics on the current state of the BM engine. Used by monitoring facilities.
        Returns:
        The statistical data container. Cannot be null.
      • getExternalResource

        @Deprecated
        org.eclipse.emf.ecore.resource.Resource getExternalResource​(org.eclipse.emf.common.util.URI uri)
        Deprecated.
        This method has been introduced only to support legacy solutions which for some reason use BM to resolve platform, BSL and other resources.
        Gets external resource by URI.
        Parameters:
        uri - The URI to get resource by. May not be null.
        Returns:
        the external resource with the specified URI if exists, otherwise null.
      • resolve

        @Deprecated
        org.eclipse.emf.ecore.EObject resolve​(org.eclipse.emf.common.util.URI uri,
                                              org.eclipse.emf.ecore.EClass targetEClass)
        Deprecated.
        This method has been introduced only to support legacy solutions which for some reason use BM to resolve platform, BSL and other resources.
        Resolves external object by URI.
        Parameters:
        uri - The URI to get object by. May not be null.
        targetEClass - The type of the target object. It does not participate in resolving process but if specified is used to create a proxy instance in case resolution fails. May be null.
        Returns:
        if object is resolved it is returnted. If object is not resolve and the second argument is specified a proxy is returned. Otherwise null is returned.
      • getExternalUriResolvers

        @Deprecated
        Collection<IBmExternalUriResolver> getExternalUriResolvers()
        Deprecated.
        BM holds a collection of external URI resolvers for internal use (particularly to perform seamless resolution of references to objects stored outside BM like platform objects, BSL, Moxel and so on) and not for providing the collection to BM users. However the current implementation of the BSL mechanism uses this method to gain access to the contributed instance of XtextBmLinkProvider. When this solution will be improved this method will be removed.
        Gets registered external URI resolvers.
        Returns:
        the collection of the registered external URI resolvers, never null.
      • getResourceSet

        @Deprecated
        IBmResourceSet getResourceSet()
        Deprecated.
        BM resource set has been introduced for internal use to provide partial EMF support and is not supposed to be used directly by clients.
        Gets BM resource set.
        Returns:
        the BM resources set, never null.
      • getBackReferences

        List<IBmCrossReference> getBackReferences​(IBmObject object)
        Gets a list of references to the specified object.
        Parameters:
        object - The object to get the list of references to. May not be null.
        Returns:
        the list of references, never null.
      • getEClassByIndex

        @Deprecated
        org.eclipse.emf.ecore.EClass getEClassByIndex​(int index)
        Deprecated.
        the EClass <=> int mapping has been introduced for internal use only.
        Gets EClass by its index.
        Parameters:
        index - The index to get EClass by.
        Returns:
        the EClass identified by the specified index if exists, otherwise null.
      • getEClassIndex

        @Deprecated
        int getEClassIndex​(org.eclipse.emf.ecore.EClass eClass)
        Deprecated.
        the EClass <=> int mapping has been introduced for internal use only.
        Gets index assigned to the specified EClass.
        Parameters:
        eClass - the EClass to get index for. May not be null.
        Returns:
        the index assigned to the EClass.
      • getProxyResourceSet

        @Deprecated
        org.eclipse.emf.ecore.resource.ResourceSet getProxyResourceSet​(boolean onlyBmResources)
        Deprecated.
        Gets a newly created copy of the BM resource set.
        Parameters:
        onlyBmResources - Flag showing whether the resource set includes only BM resources.
        Returns:
        the created resource set.
      • registerExternalUriResolver

        @Deprecated
        void registerExternalUriResolver​(IBmExternalUriResolver externalUriResolver)
        Deprecated.
        External URI resolvers should be registered at the moment of the engine creation. This method has been introduced to support the current implementation of BmBaseLinkProvider only.
        Registers the external URI resolver in the run-time.
        Parameters:
        externalUriResolver - The external URI resolver to register. May not be null.
      • unregisterExternalUriResolver

        @Deprecated
        void unregisterExternalUriResolver​(IBmExternalUriResolver externalUriResolver)
        Deprecated.
        External URI resolvers are not supposed to be unregistered at the run-time. This method has been introduced to support the current implementation of BmBaseLinkProvider only.
        Unregisters the external URI resolver in the run-time.
        Parameters:
        externalUriResolver - The external URI resolver to unregister. May not be null.
      • createOverlayEngine

        IBmEngine createOverlayEngine()
        Creates an overlay engine.
        Returns:
        the created overlay engine, never null.
      • reduceMemoryFootprint

        void reduceMemoryFootprint()
        Reduce (temporary) the usage of resources (memory, etc) by the engine as the part of the peak load support cycle