@Override public URL getLocalizationEntry(String path) { URL result = null; // #Bug1867 - Finding Localization Entries for Fragments // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1867 boolean fallbackToFragment = true; // If the bundle is a resolved fragment, then the search for localization data must // delegate to the attached host bundle with the highest version. if (getWiring() != null) { HostBundleRevision highest = null; for (HostBundleRevision hostrev : getAttachedHosts()) { if (highest == null) highest = hostrev; if (highest.getVersion().compareTo(hostrev.getVersion()) < 0) highest = hostrev; } if (highest == null) throw FrameworkMessages.MESSAGES.illegalStateCannotObtainAttachedHost(this); boolean hostUninstalled = highest.getBundleState().isUninstalled(); result = (hostUninstalled ? getEntry(path) : highest.getLocalizationEntry(path)); // In contrary to the spec the TCK ManifestLocalizationTests.testGetHeaders010() // expects to find the localization files in the fragment if they were not found // in the attached host if (result != null || fallbackToFragment == false) return result; } // If the fragment is not resolved, then the framework must search the fragment's JAR for the // localization entry. result = getEntry(path); return result; }
FallbackLoader( HostBundleRevision hostRev, ModuleIdentifier identifier, Set<String> importedPaths) { if (hostRev == null) throw new IllegalArgumentException("Null hostRev"); if (identifier == null) throw new IllegalArgumentException("Null identifier"); if (importedPaths == null) throw new IllegalArgumentException("Null importedPaths"); this.identifier = identifier; this.importedPaths = importedPaths; this.hostRev = hostRev; this.hostBundle = hostRev.getBundleState(); this.bundleManager = hostBundle.getBundleManager(); this.moduleManager = hostBundle.getFrameworkState().getModuleManagerPlugin(); }