diff options
author | gjoranv <gv@verizonmedia.com> | 2020-07-20 00:03:30 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-07-20 00:03:30 +0200 |
commit | b4dfbb30bb4492bf3c6adf9373a8f20d35146886 (patch) | |
tree | edd3f47f487d9721a044fb1494bad7762ff8adb6 /container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java | |
parent | 5deab715167cc3ffbd9ab76726bb6cb7f50397ec (diff) |
Let ApplicationBundleLoader take its installer as a ctor argument
Diffstat (limited to 'container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java b/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java index 69d7d44773e..f87dd3f42d2 100644 --- a/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java +++ b/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java @@ -2,8 +2,6 @@ package com.yahoo.container.core.config; import com.yahoo.config.FileReference; -import com.yahoo.container.Container; -import com.yahoo.filedistribution.fileacquirer.FileAcquirer; import com.yahoo.osgi.Osgi; import org.osgi.framework.Bundle; @@ -35,13 +33,11 @@ public class ApplicationBundleLoader { private final Map<FileReference, Bundle> reference2Bundle = new LinkedHashMap<>(); private final Osgi osgi; + private final FileAcquirerBundleInstaller bundleInstaller; - // TODO: Take the bundle installer as a ctor argument instead. It's safe because the - // file acquirer in the Container singleton is set up before this is created. - private FileAcquirerBundleInstaller customBundleInstaller = null; - - public ApplicationBundleLoader(Osgi osgi) { + public ApplicationBundleLoader(Osgi osgi, FileAcquirerBundleInstaller bundleInstaller) { this.osgi = osgi; + this.bundleInstaller = bundleInstaller; } /** @@ -70,7 +66,6 @@ public class ApplicationBundleLoader { return obsoleteReferences; } - /** * Returns the bundles that will not be retained by the new application generation. */ @@ -89,12 +84,8 @@ public class ApplicationBundleLoader { bundlesToInstall.removeAll(reference2Bundle.keySet()); if (!bundlesToInstall.isEmpty()) { - FileAcquirer fileAcquirer = Container.get().getFileAcquirer(); - boolean hasFileDistribution = (fileAcquirer != null); - if (hasFileDistribution) { - installWithFileDistribution(bundlesToInstall, new FileAcquirerBundleInstaller(fileAcquirer)); - } else if (customBundleInstaller != null) { - installWithFileDistribution(bundlesToInstall, customBundleInstaller); + if (bundleInstaller.hasFileDistribution()) { + installWithFileDistribution(bundlesToInstall, bundleInstaller); } else { log.warning("Can't retrieve bundles since file distribution is disabled."); } @@ -134,11 +125,6 @@ public class ApplicationBundleLoader { } // Only for testing - void useCustomBundleInstaller(FileAcquirerBundleInstaller bundleInstaller) { - customBundleInstaller = bundleInstaller; - } - - // Only for testing List<FileReference> getActiveFileReferences() { return new ArrayList<>(reference2Bundle.keySet()); } |