Library: OSP
Package: Bundle
Header: Poco/OSP/BundleRepository.h
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 Functions: installBundle, loadBundle, loadBundles, removeBundle, tempBundleName
typedef std::map < std::string, Bundle::Ptr > BundleMap;
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.
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();
Destroys the BundleRepository.
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.
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.
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.
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.
void loadBundle(
const std::string & path,
BundleMap & bundles
);
Loads a bundle from the given path.
void loadBundles(
const std::string & path,
BundleMap & bundles
);
Loads all availble bundles from the given path.
void removeBundle(
const std::string & symbolicName
);
Removes the bundle, by first stopping (if necessary), and then uninstalling it.
std::string tempBundleName() const;
Returns a temporary bundle name in the form "tmp.bundle-nnnn".