use of org.apache.camel.spi.RoutesLoader in project camel-k-runtime by apache.
the class LoaderSupport method inspectSource.
public static JsonObject inspectSource(CamelContext context, String location, byte[] code) throws Exception {
final Runtime runtime = Runtime.on(context);
final RoutesLoader loader = context.adapt(ExtendedCamelContext.class).getRoutesLoader();
final Collection<RoutesBuilder> builders = loader.findRoutesBuilders(ResourceHelper.fromBytes(location, code));
for (RoutesBuilder builder : builders) {
runtime.addRoutes(builder);
}
return Json.createObjectBuilder().add("components", extractComponents(context)).add("routes", extractRoutes(context)).add("endpoints", extractEndpoints(context)).build();
}
Aggregations