diff options
author | gjoranv <gv@verizonmedia.com> | 2020-07-15 16:13:51 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-07-15 17:05:02 +0200 |
commit | 94119fc8757bc5b8bf45be79bc9dde7b81b8d73a (patch) | |
tree | 4011a3f880515a8e56ca6c76c27a4e72a4de0268 /container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java | |
parent | 893dda577f52157274357da58f93e9e8580f417f (diff) |
Rename bundle loader classes and fields for consistency.
* BundleManager -> ApplicationBundleLoader
* PlatformBundleInstaller -> PlatformBundleLoader
Diffstat (limited to 'container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java b/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java new file mode 100644 index 00000000000..76f0b959a58 --- /dev/null +++ b/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java @@ -0,0 +1,45 @@ +package com.yahoo.container.core.config; + +import com.yahoo.config.FileReference; +import com.yahoo.osgi.Osgi; +import org.osgi.framework.Bundle; + +import java.util.Collection; +import java.util.List; +import java.util.logging.Logger; + +/** + * Installs all platform bundles, using the {@link DiskBundleInstaller}. + * All platform bundles reside on disk, and they are never uninstalled. + * + * @author gjoranv + */ +public class PlatformBundleLoader { + private static final Logger log = Logger.getLogger(PlatformBundleLoader.class.getName()); + + private final Osgi osgi; + private final DiskBundleInstaller installer; + + public PlatformBundleLoader(Osgi osgi) { + this.osgi = osgi; + installer = new DiskBundleInstaller(); + } + + public void install(Collection<FileReference> bundlesToInstall) { + for (FileReference reference : bundlesToInstall) { + try { + installBundleFromDisk(reference); + } + catch(Exception e) { + throw new RuntimeException("Could not install bundle '" + reference + "'", e); + } + } + } + + private void installBundleFromDisk(FileReference reference) { + log.info("Installing bundle from disk with reference '" + reference.value() + "'"); + List<Bundle> bundles = installer.installBundles(reference, osgi); + log.fine("Installed " + bundles.size() + " bundles for file reference " + reference); + } + +} |