private static OSGi runWhiteboard()

in jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CxfJaxrsBundleActivator.java [246:293]


    private static OSGi<?> runWhiteboard(
        BundleContext bundleContext, Dictionary<String, ?> configuration) {

        OSGi<List<String>> endpoints =
            serviceReferences(endpointFilter(configuration::get)
            ).map(
                r -> Arrays.asList(
                    canonicalize(r.getProperty(HTTP_SERVICE_ENDPOINT)))
            );

        return
            once(
                serviceReferences(
                    endpointFilter(configuration::get),
                    __ -> false //never reload
                ).then(
                    just(createWhiteboard(configuration)).
                    effects(
                        ifInfoEnabled(
                            _log,
                            () -> "created whiteboard from configuration: " +
                                configuration),
                        ifInfoEnabled(
                            _log,
                            () -> "destroyed whiteboard from configuration: " +
                                configuration)
                    )
                .flatMap(
                    whiteboard ->
                        all(
                            effects(
                                () -> whiteboard.start(bundleContext),
                                whiteboard::stop),
                            ignore(
                                endpoints.effects(
                                    whiteboard::addHttpEndpoints,
                                    whiteboard::removeHttpEndpoints)
                            ).
                            effects(
                                debugTracking(
                                    _log,
                                    () -> "endpoint for whiteboard: " +
                                        whiteboard)
                            )
                        )
                ))
            );
    }