in integrations/rest-management/rest-management/src/main/java/org/apache/aries/jax/rs/rest/management/internal/RestManagementActivator.java [67:177]
public void start(BundleContext bundleContext) throws Exception {
result = all(
ignore(
just(
new RestManagementApplication(bundleContext)
).flatMap(application ->
register(
Application.class,
() -> application,
() -> {
HashMap<String, Object> map = new HashMap<>();
map.put(JAX_RS_NAME, RestManagementApplication.class.getSimpleName());
map.put(
JaxrsWhiteboardConstants.JAX_RS_APPLICATION_BASE, RMS_BASE);
return map;
}
).then(
dynamic(
serviceReferences(
RestApiExtension.class,
"(&(org.osgi.rest.name=*)(org.osgi.rest.uri.path=*))"
),
application::addExtension,
application::removeExtension
)
)
)
),
ignore(
service(
serviceReferences(ClientBuilder.class)
).flatMap(
clientBuilder -> register(
RestClientFactory.class,
new RestClientFactoryImpl(clientBuilder),
null
)
)
),
ignore(
register(
javax.ws.rs.core.Feature.class,
new PrototypeWrapper<>(
(b, r) -> new RestManagementFeature()
),
() -> {
HashMap<String, Object> map = new HashMap<>();
map.put(JAX_RS_NAME, RestManagementFeature.class.getSimpleName());
map.put(
JAX_RS_APPLICATION_SELECT,
String.format(
"(%s=%s)", JAX_RS_NAME,
RestManagementApplication.class.getSimpleName()));
map.put(JAX_RS_EXTENSION, true);
return map;
}
)
),
ignore(
register(
OpenAPI.class,
() -> {
OpenAPI openAPI = new OpenAPI();
openAPI.info(
new Info().title(
"Apache Aries OSGi Rest Management Service"
).description(
"A REST API to manage an OSGi Framework"
).license(
new License().name(
"Apache 2.0"
).url(
"https://www.apache.org/licenses/LICENSE-2.0.html"
)
).version(
SPECIFICATION_VERSION
).contact(
new Contact().email(
"dev@aries.apache.org"
)
)
).externalDocs(
new ExternalDocumentation().description(
"OSGi Compendium Chapter 137 - REST Management Service Specification"
).url(
"https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.rest.html"
)
);
return openAPI;
},
() -> {
HashMap<String, Object> map = new HashMap<>();
map.put(
JAX_RS_APPLICATION_SELECT,
String.format(
"(%s=%s)", JAX_RS_NAME,
RestManagementApplication.class.getSimpleName()));
return map;
}
)
)
).run(bundleContext);
}