protected abstract void findBootModuleLayerAtomosContents()

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


        protected abstract void findBootModuleLayerAtomosContents(
            Set<AtomosContentBase> result);

        void findAtomosContentsByClassLoaderManifests(Set<AtomosContentBase> result)
        {
            try
            {
                ClassLoader cl = getClass().getClassLoader();
                Set<URL> parentManifests = new HashSet<>();
                if (cl.getParent() != null)
                {
                    Enumeration<URL> eParentManifests = cl.getParent().getResources(
                        JarFile.MANIFEST_NAME);
                    while (eParentManifests.hasMoreElements())
                    {
                        parentManifests.add(eParentManifests.nextElement());
                    }
                }
                Enumeration<URL> classpathManifests = cl.getResources(
                    JarFile.MANIFEST_NAME);
                while (classpathManifests.hasMoreElements())
                {
                    URL manifestURL = classpathManifests.nextElement();
                    if (parentManifests.contains(manifestURL))
                    {
                        // ignore parent manifests
                        continue;
                    }

                    Object content = getBundleContent(manifestURL);
                    if (content != null)
                    {
                        ManifestHolder holder = new ManifestHolder();

                        ConnectContent connectContent;
                        URL url;
                        if (content instanceof File)
                        {
                            connectContent = new ConnectContentFile((File) content, holder::getHeaders);
                            url = ((File) content).toURI().toURL();
                        }
                        else
                        {
                            connectContent = new ConnectContentJar(
                                    () -> ((JarFile) content), //
                                    (dontClose) -> {}, //
                                    holder::getHeaders);
                            url = new File(
                                    ((JarFile) content).getName()).toURI().toURL();
                        }

                        String location;
                        if (connectContent.getEntry(
                                "META-INF/services/org.osgi.framework.launch.FrameworkFactory").isPresent())
                        {
                            location = Constants.SYSTEM_BUNDLE_LOCATION;
                        }
                        else
                        {
                            location = content instanceof File
                                    ? ((File) content).getPath()
                                    : ((JarFile) content).getName();
                            if (!getName().isEmpty())
                            {
                                location = getName() + ":" + location;
                            }
                        }

                        Map<String, String> headers = getRawHeaders(connectContent);
                        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));

                            result.add(new AtomosContentClassPath(location, symbolicName,
                                    version, connectContent, url));
                        }
                    }
                }
            }
            catch (IOException e)
            {
                throw new IllegalStateException("Error finding class path bundles.", e);
            }
        }