public void doJar()

in atomosfeaturelauncherconfig/src/main/java/org/apache/sling/feature/launcher/atomos/config/IndexPlugin.java [117:189]


    public void doJar(JarFile jar, Context context, URLClassLoader classLoader) {
        long id = counter.getAndIncrement();

        IndexInfoImpl info = new IndexInfoImpl();

        try {
            Manifest mf = jar.getManifest();
            Attributes attributes = mf == null ? null : mf.getMainAttributes();
            if (attributes != null) {
                info.setBsn(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME));
                info.setVersion(attributes.getValue(Constants.BUNDLE_VERSION));
            }
        } catch (IOException e1) {

            e1.printStackTrace();
            return;
        }

        info.setId(Long.toString(id));

        if (info.getBundleSymbolicName() == null) {
            return;
        }
        if (info.getVersion() == null) {
            info.setVersion("0.0");
        }
        List<String> files = jar.stream().peek(j -> {
            try {
                if (Boolean.FALSE == uniquePaths.get(j.getName())) {
                    String fileName = ATOMOS_BUNDLES_BASE_PATH + id + "/" + j.getName();
                    if (isJarType()) {
                        final JarEntry entry = new JarEntry(fileName);
                        if (j.getCreationTime() != null) {
                            entry.setCreationTime(j.getCreationTime());
                        }
                        if (j.getComment() != null) {
                            entry.setComment(j.getComment());
                        }
                        jos.putNextEntry(entry);
                        jos.write(jar.getInputStream(j).readAllBytes());
                    } else {
                        Path path = config.indexOutputDirectory().resolve(fileName);
                        Files.createDirectories(path.getParent());
                        Files.write(path, jar.getInputStream(j).readAllBytes());
                        BasicFileAttributeView attrs = Files.getFileAttributeView(path,
                                BasicFileAttributeView.class);
                        FileTime time = j.getCreationTime();
                        attrs.setTimes(time, time, time);
                    }
                }
            } catch (final IOException e) {
                throw new UncheckedIOException(e);
            }

        }).map(JarEntry::getName).collect(Collectors.toList());
        try {
            String fileName = ATOMOS_BUNDLES_BASE_PATH + id + "/META-INF/atomos/file.location";
            if (isJarType()) {
                final JarEntry entry = new JarEntry(fileName);
                jos.putNextEntry(entry);
                jos.write(jar.getName().getBytes("UTF-8"));
            } else {
                Path path = config.indexOutputDirectory().resolve(fileName);
                Files.createDirectories(path.getParent());
                Files.write(path, jar.getName().getBytes("UTF-8"));
            }
        } catch (IOException ex) {
            throw new UncheckedIOException(ex);
        }
        files.add("META-INF/atomos/file.location");
        info.setFiles(files);
        indexInfos.add(info);
    }