Poco::OSP

class BundleRepository

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, loadBundle, loadBundles, removeBundle, tempBundleName

Types

BundleMap protected

typedef std::map < std::string, Bundle::Ptr > BundleMap;

Constructors

BundleRepository

BundleRepository(
    const std::string & path,
    BundleLoader & loader
);

Creates the BundleRepository, using the given path and BundleLoader.

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.

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(
    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.

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.

installBundle protected

Bundle::Ptr installBundle(
    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".