Class BmPlatform


  • public abstract class BmPlatform
    extends Object
    Entry point for all interactions with the BM object storage platform.
    • Field Detail

      • DATA_FORMAT_VERSION

        public static final int DATA_FORMAT_VERSION
        Data format version
        See Also:
        Constant Field Values
    • Constructor Detail

      • BmPlatform

        public BmPlatform()
    • Method Detail

      • createPlatform

        public static BmPlatform createPlatform​(BmPlatformConfiguration configuration)
        Creates a platform with the given configuration. In case existing platform files are found they are loaded, otherwise the initialization occurs.
        Parameters:
        configuration - The platform configuration. May not be null.
        Returns:
        a ready-to-use platform. Never null.
      • stop

        public abstract void stop()
        Stops the platform.
      • getNamespaceDataStore

        public abstract IBmNamespaceDataStore getNamespaceDataStore​(String name)
        Gets namespace data store by name.
        Parameters:
        name - The name to get store by. May not be null.
        Returns:
        the store with the specified name or null if not found.
      • createNamespaceDataStore

        public abstract IBmNamespaceDataStore createNamespaceDataStore​(String name)
        Creates a namespace data store.

        In case a store of any kind with the specified name already exists an exception is thrown.

        Parameters:
        name - The name of the store. May not be null.
        Returns:
        the handle of the store. Never null.
      • connectExternalNamespaceDataStore

        public abstract IBmNamespaceDataStore connectExternalNamespaceDataStore​(String name,
                                                                                Path path)
        Connects an external namespace data store.

        In case a store of any kind with the specified name already exists an exception is thrown.

        Parameters:
        name - The name of the store. May not be null.
        path - The external data store path. May not be null.
        Returns:
        the handle of the store. Never null.
      • disconnectExternalNamespaceDataStore

        public abstract void disconnectExternalNamespaceDataStore​(IBmNamespaceDataStore store)
        Disconnects an external namespace data store. If there are copies created from the store an exception is thrown.
        Parameters:
        store - The external store to disconnect. May not be null.
      • createNamespaceDataStoreReadOnlyCopy

        public abstract IBmNamespaceDataStore createNamespaceDataStoreReadOnlyCopy​(String name,
                                                                                   IBmNamespaceDataStore originalStore)
        Creates a copy of the specified store that is intended for read access only. Right after its creation the store contains exactly the same data as the original store, but any changes to the original store are not seen in the copy.

        In case a store of any kind with the specified name already exists an exception is thrown.

        Parameters:
        name - The name of the store to create. May not be null.
        originalStore - The original store. May not be null.
        Returns:
        the handle of the store. Never null.
      • createNamespaceDataStoreReadWriteCopy

        public abstract IBmNamespaceDataStore createNamespaceDataStoreReadWriteCopy​(String name,
                                                                                    IBmNamespaceDataStore originalStore)
        Creates a copy of the specified store that is intended for both read and write access. Right after its creation the store contains exactly the same data as the original store, but any changes to the original store are not seen in the copy and vice versa.

        In case a store of any kind with the specified name already exists an exception is thrown.

        Parameters:
        name - The name of the store to create. May not be null.
        originalStore - The original store. May not be null.
        Returns:
        the handle of the store. Never null.
      • forbidNamespaceDataStoreWriteAccess

        public abstract void forbidNamespaceDataStoreWriteAccess​(IBmNamespaceDataStore store)
        Forbids write access to the specified store.
        Parameters:
        store - The store to forbid write access to. May not be null.
      • exportNamespaceDataStore

        public abstract void exportNamespaceDataStore​(IBmNamespaceDataStore store,
                                                      Path destinationPath)
        Export a namespace data store.
        Parameters:
        store - The store to export. May not be null.
        destinationPath - The destination path. May not be null.
      • saveNamespaceDataStoreSnapshot

        @Deprecated(since="8.0.0")
        public abstract void saveNamespaceDataStoreSnapshot​(IBmNamespaceDataStore store,
                                                            OutputStream out)
        Deprecated.
        The method has been introduced to simplify migration of some legacy solutions to the new BM API.
        Saves namespace data store snapshot.
        Parameters:
        store - The store. May not be null.
        out - The output stream to write snapshot to. May not be null.
      • applyNamespaceDataStoreSnapshot

        @Deprecated(since="8.0.0")
        public abstract void applyNamespaceDataStoreSnapshot​(IBmNamespaceDataStore store,
                                                             InputStream in)
        Deprecated.
        The method has been introduced to simplify migration of some legacy solutions to the new BM API.
        Applies namespace data store snapshot.
        Parameters:
        store - The store. May not be null.
        in - The input stream to read snapshot from. May not be null.
      • createNamespaceDataStoreFromSnapshot

        @Deprecated(since="8.0.0")
        public abstract IBmNamespaceDataStore createNamespaceDataStoreFromSnapshot​(String name,
                                                                                   InputStream in)
        Deprecated.
        The method has been introduced to simplify migration of some legacy solutions to the new BM API.
        Creates namespace data store from snapshot.
        Parameters:
        name - The name of the store. May not be null.
        in - The input stream to read snapshot from. May not be null.
      • deleteNamespaceDataStore

        public abstract void deleteNamespaceDataStore​(IBmNamespaceDataStore store)
        Deletes a store of any kind except external stores.
        Parameters:
        store - The store to delete. May not be null.
      • createNamespace

        public abstract IBmNamespace createNamespace​(String name,
                                                     BmNamespaceConfiguration configuration)
        Creates a namespace.

        In case a namespace with the specified name already exists an exception is thrown.

        Parameters:
        name - The name of the namespace. May not be null.
        configuration - The configuration of the namespace. May not be null.
        Returns:
        the created namespace handle, never null.
      • assignStore

        public abstract void assignStore​(IBmNamespace namespace,
                                         IBmNamespaceDataStore store)
        Assigns a store to a namespace.
        Parameters:
        namespace - The namespace. May not be null.
        store - The store. May not be null.
      • unassignStore

        public abstract void unassignStore​(IBmNamespace namespace)
        Unassigns a store from a namespace.
        Parameters:
        namespace - The namespace. May not be null.
      • activateNamespace

        public abstract void activateNamespace​(IBmNamespace namespace)
        Activates the specified namespace. Fails with an exception if the namespace is already active. By default all namespaces are active.
        Parameters:
        namespace - The namespace to activate. May not be null.
      • deactivateNamespace

        public abstract void deactivateNamespace​(IBmNamespace namespace)
        Deactivates the specified namespace. Fails with an exception if the namespace is already deactivated. All read and write request to a deactivated namespace will fail with an exception.
        Parameters:
        namespace - The namespace to deactivate. May not be null.
      • deleteNamespace

        public abstract void deleteNamespace​(IBmNamespace namespace)
        Deletes the specified namespace. Fails with an exception if the namespace is deactivated.
        Parameters:
        namespace - The namespace to delete. May not be null.
      • getNamespace

        public abstract IBmNamespace getNamespace​(String name)
        Gets a namespace by name.
        Parameters:
        name - The name of the namespace. May not be null.
        Returns:
        the handle of the requested namespace or null in case it is not found.
      • getAllNamespaces

        public abstract Collection<IBmNamespace> getAllNamespaces()
        Gets all namespaces.
        Returns:
        a collection containing all the platform's namespaces. Never null.
      • getAllNamespaceDataStores

        public abstract Collection<IBmNamespaceDataStore> getAllNamespaceDataStores()
        Gets all namespace data stores.
        Returns:
        a collection containing all the platform's namespace data stores. Never null.
      • addMonitoringEventListener

        public abstract void addMonitoringEventListener​(IBmMonitoringEventListener listener)
        Adds a monitoring event listener.
        Parameters:
        listener - The listener to add. May not be null.
      • removeMonitoringEventListener

        public abstract void removeMonitoringEventListener​(IBmMonitoringEventListener listener)
        Removes a monitoring event listener.
        Parameters:
        listener - The listener to remove. May not be null.
      • beginReadOnlyTransaction

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

        public abstract IBmPlatformTransaction beginReadOnlyTransaction​(boolean lightweight)
        Begins a read-only transaction. In contrast to its zero-argument counterpart this method allows to create a lightweight transaction. Lightweight transactions are able to evict their internal data to avoid excessive memory usage.
        Parameters:
        lightweight - The flag indicating whether a lighweight transaction must be created.
        Returns:
        the created transaction instance, never null.
      • beginReadWriteTransaction

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

        public abstract IBmPlatformTransaction 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 indicating whether the modifications performed in this transaction must be tracked.
        Returns:
        the created transaction instance, never null.
      • beginReadWriteTransaction

        public abstract IBmPlatformTransaction 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 indicating 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.
      • beginReadWriteTransaction

        public abstract IBmPlatformTransaction beginReadWriteTransaction​(boolean trackModifications,
                                                                         boolean disableEvents,
                                                                         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 indicating whether the modifications performed in this transaction must be tracked.
        disableEvents - The flag that disables sending of modification events during the commit of the transaction
        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
        public abstract IBmPlatformTransaction beginNonCommittableTransaction()
        Deprecated.
        For internal use only, will be removed someday.
        Begins a non-commitable read-write transaction. This method is not a part of the public API and should not be used by clients.
        Returns:
        the created transaction instance, never null.
      • getCurrentTransaction

        public abstract IBmPlatformTransaction getCurrentTransaction()
        Gets the transaction currently open in the calling thread.
        Returns:
        the transaction or null if no transaction is open in the thread.
      • reduceMemoryFootprint

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

        public abstract long getApproximateStoreSize​(IBmNamespaceDataStore store)
        Gets approximate size of the specified store which can be used by resource management and monitoring machinery.
        Parameters:
        store - The store to get approximate size of. May not be null.
        Returns:
        approximate size of the store in bytes.