use of org.apache.nifi.registry.flow.ControllerServiceAPI in project nifi by apache.
the class NiFiRegistryFlowMapper method mapControllerServiceApis.
private List<ControllerServiceAPI> mapControllerServiceApis(final ControllerServiceNode service) {
final Class<?> serviceClass = service.getControllerServiceImplementation().getClass();
final Set<Class<?>> serviceApiClasses = new HashSet<>();
// get all of it's interfaces to determine the controller service api's it implements
final List<Class<?>> interfaces = ClassUtils.getAllInterfaces(serviceClass);
for (final Class<?> i : interfaces) {
// add all controller services that's not ControllerService itself
if (ControllerService.class.isAssignableFrom(i) && !ControllerService.class.equals(i)) {
serviceApiClasses.add(i);
}
}
final List<ControllerServiceAPI> serviceApis = new ArrayList<>();
for (final Class<?> serviceApiClass : serviceApiClasses) {
final BundleCoordinate bundleCoordinate = ExtensionManager.getBundle(serviceApiClass.getClassLoader()).getBundleDetails().getCoordinate();
final ControllerServiceAPI serviceApi = new ControllerServiceAPI();
serviceApi.setType(serviceApiClass.getName());
serviceApi.setBundle(mapBundle(bundleCoordinate));
serviceApis.add(serviceApi);
}
return serviceApis;
}
Aggregations