private void findAtomosLibIndexedContent()

in atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java [849:911]


        private void findAtomosLibIndexedContent(Set<AtomosContentBase> bootBundles,
            File atomosLibDir)
        {
            for (File f : atomosLibDir.listFiles())
            {
                if (f.isFile())
                {
                    try (JarFile jar = new JarFile(f))
                    {
                            ManifestHolder holder = new ManifestHolder();

                            ConnectContent connectContent = new ConnectContentCloseableJar(
                                f.getName(), () -> atomosLibDir, holder::getHeaders);
                            connectContent.open();
                            String location;
                            try
                            {
                                if (connectContent.getEntry(
                                    "META-INF/services/org.osgi.framework.launch.FrameworkFactory").isPresent())
                                {
                                    location = Constants.SYSTEM_BUNDLE_LOCATION;
                                }
                                else
                                {
                                    location = f.getName();
                                    if (!getName().isEmpty())
                                    {
                                        location = getName() + ":" + location;
                                    }
                                }
                            }
                            finally
                            {
                                connectContent.close();
                            }
                            Map<String, String> headers = toMap(jar.getManifest());
                            headers = applyHeaderProvider(holder, location, headers);

                            String symbolicName = headers.get(
                                    Constants.BUNDLE_SYMBOLICNAME);
                            if (symbolicName != null)
                            {
                                int semiColon = symbolicName.indexOf(';');
                                if (semiColon != -1)
                                {
                                    symbolicName = symbolicName.substring(0, semiColon);
                                }
                                symbolicName = symbolicName.trim();

                                Version version = Version.parseVersion(
                                    headers.get(Constants.BUNDLE_VERSION));
                                AtomosContentBase bundle = new AtomosContentIndexed(location,
                                    symbolicName, version, connectContent);
                                bootBundles.add(bundle);
                            }
                    }
                    catch (IOException e)
                    {
                        // ignore and continue
                    }
                }
            }
        }