Poco::OSP

class BundleRepository

File Information

Library: OSP
Package: Bundle
Header: Poco/OSP/BundleRepository.h

Description

The bundle repository manages one or more directories in the file system containing bundles.

The BundleRepository uses the Logger "osp.core.BundleRepository" to log non-fatal errors.

Member Summary

Member Functions: installBundle, installBundleImpl, loadBundle, loadBundles, paths, removeBundle, tempBundleName

Types Aliases

BundleMap protected

using BundleMap = std::map < std::string, Bundle::Ptr >;

Constructors

BundleRepository

BundleRepository(
    const std::string & path,
    BundleLoader & loader,
    BundleFilter::Ptr pBundleFilter = 0
);

Creates the BundleRepository, using the given path and BundleLoader, and optional BundleFilter.

The path argument may contain a single path, or a list of paths, separated by the platform's path separator (':' on Unix platforms, ';' on Windows).

The first path given in a list is said to be the primary path. Other paths are secondary paths.

Paths may either reference a directory containing bundles, or a bundle file (or bundle directory with the extension ".bndl") directly.

Paths may contain Glob expressions (see Poco::Glob).

BundleRepository

BundleRepository(
    const std::vector < std::string > & paths,
    BundleLoader & loader,
    BundleFilter::Ptr pBundleFilter = 0
);

Creates the BundleRepository, using the given paths and BundleLoader, and optional BundleFilter.

The paths argument specifies a list of paths where bundles are searched.

The first path given in a list is said to be the primary path. Other paths are secondary paths.

Paths may either reference a directory containing bundles, or a bundle file (or bundle directory with the extension ".bndl") directly.

Paths may contain Glob expressions (see Poco::Glob).

Destructor

~BundleRepository

~BundleRepository();

Destroys the BundleRepository.

Member Functions

installBundle

Bundle::Ptr installBundle(
    std::istream & istr
);

Reads a bundle archive file from the given stream and installs it in the primary path.

The bundle's file name in the bundle repository will be "<symbolicName>_<version>.bndl".

Returns the newly installed bundle, which will be in INSTALLED state.

installBundle

Bundle::Ptr installBundle(
    const std::string & repositoryPath,
    std::istream & istr
);

Reads a bundle archive file from the given stream and installs it in the specified repositoryPath.

The repositoryPath must be one of the bundle repository paths specified in the constructor, otherwise the bundle won't be found the next time the application starts.

The directory referenced by repositoryPath must exist and must be writable, otherwise installing the bundle will fail.

The bundle's file name in the bundle repository will be "<symbolicName>_<version>.bndl".

Returns the newly installed bundle, which will be in INSTALLED state.

installBundle

Bundle::Ptr installBundle(
    std::istream & istr,
    const std::string & replaceBundle
);

Reads a bundle archive file from the given stream and installs it in the primary path.

If a bundle with the symbolic name given in replaceBundle exists, the bundle is stopped and uninstalled before the new bundle is installed.

The bundle's file name in the bundle repository will be "<symbolicName>_<version>.bndl".

Returns the newly installed bundle, which will be in INSTALLED state.

installBundle

Bundle::Ptr installBundle(
    const std::string & repositoryPath,
    std::istream & istr,
    const std::string & replaceBundle
);

Reads a bundle archive file from the given stream and installs it in the primary repositoryPath.

The repositoryPath must be one of the bundle repository paths specified in the constructor, otherwise the bundle won't be found the next time the application starts.

The directory referenced by repositoryPath must exist and must be writable, otherwise installing the bundle will fail.

If a bundle with the symbolic name given in replaceBundle exists, the bundle is stopped and uninstalled before the new bundle is installed.

The bundle's file name in the bundle repository will be "<symbolicName>_<version>.bndl".

Returns the newly installed bundle, which will be in INSTALLED state.

loadBundles

void loadBundles();

Loads all available bundles, using the BundleLoader.

If two or more versions of a bundle are found, the latest version of the bundle is loaded and a warning message is logged.

paths inline

const std::vector < std::string > & paths() const;

Returns a vector containing all configured repository paths.

installBundleImpl protected

Bundle::Ptr installBundleImpl(
    std::istream & istr,
    const std::string & replaceBundle,
    const std::string & path
);

Reads a bundle archive file from the given stream and installs it in the given path.

loadBundle protected

void loadBundle(
    const std::string & path,
    BundleMap & bundles
);

Loads a bundle from the given path.

loadBundles protected

void loadBundles(
    const std::string & path,
    BundleMap & bundles
);

Loads all availble bundles from the given path.

removeBundle protected

void removeBundle(
    const std::string & symbolicName
);

Removes the bundle, by first stopping (if necessary), and then uninstalling it.

tempBundleName protected

std::string tempBundleName() const;

Returns a temporary bundle name in the form "tmp.bundle-nnnn".

Securely control IoT edge devices from anywhere   Connect a Device