use of io.quarkus.arc.impl.ArcContainerImpl in project quarkus by quarkusio.
the class ArcDevRecorder method createRemovedBeansHandler.
public Handler<RoutingContext> createRemovedBeansHandler(List<String[]> removedInterceptorsDecorators) {
return new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext ctx) {
ArcContainerImpl container = ArcContainerImpl.instance();
ctx.response().putHeader("Content-Type", "application/json");
JsonArrayBuilder removed = Json.array();
for (RemovedBean removedBean : container.getRemovedBeans()) {
JsonObjectBuilder bean = Json.object();
bean.put("kind", removedBean.getKind().toString());
bean.put("description", removedBean.getDescription());
JsonArrayBuilder types = Json.array();
for (Type beanType : removedBean.getTypes()) {
types.add(beanType instanceof Class ? ((Class<?>) beanType).getName() : beanType.toString());
}
// java.lang.Object is always skipped
types.add(Object.class.getName());
bean.put("types", types);
JsonArrayBuilder qualifiers = Json.array();
for (Annotation qualifier : removedBean.getQualifiers()) {
if (qualifier.annotationType().equals(Any.class) || qualifier.annotationType().equals(Default.class)) {
qualifiers.add("@" + qualifier.annotationType().getSimpleName());
} else {
qualifiers.add(qualifier.toString());
}
}
bean.put("qualifiers", qualifiers);
removed.add(bean);
}
for (String[] interceptorDecorator : removedInterceptorsDecorators) {
JsonObjectBuilder bean = Json.object();
bean.put("kind", interceptorDecorator[0]);
bean.put("description", interceptorDecorator[1]);
removed.add(bean);
}
ctx.response().end(removed.build());
}
};
}
use of io.quarkus.arc.impl.ArcContainerImpl in project quarkus by quarkusio.
the class ArcDevRecorder method createSummaryHandler.
public Handler<RoutingContext> createSummaryHandler(Map<String, String> configProperties, String rootPath, int removedInterceptorsDecorators) {
return new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext ctx) {
ctx.response().putHeader("Content-Type", "application/json");
ArcContainerImpl container = ArcContainerImpl.instance();
JsonObjectBuilder summary = Json.object();
summary.put("beans", container.getBeans().size());
summary.put("removedBeans", container.getRemovedBeans().size() + removedInterceptorsDecorators);
summary.put("observers", container.getObservers().size());
summary.put("interceptors", container.getInterceptors().size());
JsonArrayBuilder scopes = Json.array();
container.getScopes().stream().map(Class::getName).forEach(scopes::add);
summary.put("scopes", scopes);
JsonObjectBuilder config = Json.object();
for (Entry<String, String> entry : configProperties.entrySet()) {
if (entry.getValue().equals("true") || entry.getValue().equals("false")) {
config.put(entry.getKey(), Boolean.parseBoolean(entry.getValue()));
} else {
config.put(entry.getKey(), entry.getValue());
}
}
summary.put("config", config);
JsonObjectBuilder links = Json.object();
links.put("beans", rootPath + "arc/beans");
links.put("observers", rootPath + "arc/observers");
links.put("removed-beans", rootPath + "arc/removed-beans");
summary.put("links", links);
ctx.response().end(summary.build());
}
};
}
Aggregations