void printBundleInfoTableRow()

in src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderWebConsolePlugin.java [108:144]


    void printBundleInfoTableRow(PrintWriter pw, final ServletRequest req, Session session, Bundle bundle, boolean isEven) throws RepositoryException {
        Map<String, Object> contentInfoMap = bundleHelper.getBundleContentInfo(session, bundle, false);
        // release lock as early as possible
        bundleHelper.unlockBundleContentInfo(session, bundle, false, null);
        
        String[] uninstallPaths = (String[])contentInfoMap.get(BundleContentLoaderListener.PROPERTY_UNINSTALL_PATHS);
        final String uninstallPathsString;
        if (uninstallPaths == null) {
            uninstallPathsString = "-";
        } else {
            uninstallPathsString = Arrays.stream(uninstallPaths).map(ResponseUtil::escapeXml).collect(Collectors.joining("<br/>"));
        }
        Object loadedDate = contentInfoMap.get(BundleContentLoaderListener.PROPERTY_CONTENT_LOADED_AT);
        final String loadedDetails;
        if (!(loadedDate instanceof Calendar)) {
            loadedDetails = "?";
        } else {
            Calendar calendar = Calendar.class.cast(loadedDate);
            String formatterDate = DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(calendar.getTimeZone().toZoneId()).withLocale(req.getLocale())
                    .format(calendar.toInstant());
            String loadedBy = String.valueOf(contentInfoMap.get(BundleContentLoaderListener.PROPERTY_CONTENT_LOADED_BY));
            loadedDetails = String.format("%s<br/>by Sling ID %s", formatterDate, ResponseUtil.escapeXml(loadedBy));
        }
        // https://felix.apache.org/documentation/subprojects/apache-felix-web-console/extending-the-apache-felix-web-console/providing-web-console-plugins.html
        String bundleLink = req.getAttribute("felix.webconsole.appRoot") + "/bundles/" + bundle.getBundleId();
        String pathEntriesString = StreamSupport.stream(Spliterators.spliteratorUnknownSize(PathEntry.getContentPaths(bundle), Spliterator.ORDERED), false)
                .map(ContentLoaderWebConsolePlugin::printPathEntryTable).collect(Collectors.joining("\n"));
        String trClass = (isEven ? "even" : "odd") + " ui-state-default";
        pw.printf("<tr class='%s'><td><a href=\"%s\">%s (%d)</a></td><td>%s</td><td>%s<br/><br/>(%s)</td><td>%s</td></tr>",
                trClass,
                bundleLink,
                ResponseUtil.escapeXml(bundle.getSymbolicName()), bundle.getBundleId(),
                pathEntriesString,
                PropertiesUtil.toBoolean(contentInfoMap.get(BundleContentLoaderListener.PROPERTY_CONTENT_LOADED), false),
                loadedDetails,
                uninstallPathsString);
    }