public Feature getRunningFeature()

in src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java [180:207]


    public Feature getRunningFeature() {
        Feature targetFeature = new Feature(newId(RUNNING_CLASSIFIER));

        // collect all bundles

        Bundle[] bundles = bundleContext.getBundles();
        if (bundles != null) {
            Bundle2ArtifactMapper mapper = new Bundle2ArtifactMapper(targetFeature, bvm);

            Stream.of(bundles).map(mapper).filter(bundle -> bundle != null).forEach(mapper);
        }

        // collect all configurations

        try {
            Configuration[] configurations = configurationAdmin.listConfigurations(null);
            if (configurations != null && configurations.length > 0) {
                OSGiConfiguration2FeatureConfigurationMapper mapper = new OSGiConfiguration2FeatureConfigurationMapper(targetFeature);

                Stream.of(configurations).map(mapper).forEach(mapper);
            }
        } catch (Exception e) {
            // that should not happen
            throw new RuntimeException("Something went wrong while iterating over all available Configurations", e);
        }

        return targetFeature;
    }