private void scanBundleClassPath(Collection<String> resources, Bundle bundle) { BundleDescription description = new BundleDescription(bundle.getHeaders()); List<HeaderEntry> paths = description.getBundleClassPath(); if (paths.isEmpty()) { scanDirectory(resources, bundle, "/"); } else { for (HeaderEntry path : paths) { String name = path.getName(); if (name.equals(".") || name.equals("/")) { // scan root scanDirectory(resources, bundle, "/"); } else if (name.endsWith(".jar") || name.endsWith(".zip")) { // scan embedded jar/zip scanZip(resources, bundle, name); } else { // assume it's a directory scanDirectory(resources, bundle, "/" + name); } } } }
private boolean scanBundleClassPath(ResourceFinderCallback callback, Bundle bundle) throws Exception { BundleDescription desc = new BundleDescription(bundle.getHeaders()); List<HeaderEntry> paths = desc.getBundleClassPath(); boolean continueScanning = true; if (paths.isEmpty()) { continueScanning = scanDirectory(callback, bundle, prefix); } else { for (HeaderEntry path : paths) { String name = path.getName(); if (name.equals(".") || name.equals("/")) { // scan root continueScanning = scanDirectory(callback, bundle, prefix); } else if (name.endsWith(".jar") || name.endsWith(".zip")) { // scan embedded jar/zip continueScanning = scanZip(callback, bundle, name); } else { // assume it's a directory continueScanning = scanDirectory(callback, bundle, prefix.startsWith("/") ? name + prefix : name + "/" + prefix); } if (!continueScanning) { break; } } } return continueScanning; }