use of com.evolveum.midpoint.provisioning.ucf.api.ManagedConnector in project midpoint by Evolveum.
the class ConnectorFactoryBuiltinImpl method discoverConnectors.
private void discoverConnectors() {
connectorMap = new HashMap<>();
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
scanner.addIncludeFilter(new AnnotationTypeFilter(ManagedConnector.class));
LOGGER.trace("Scanning package {}", SCAN_PACKAGE);
for (BeanDefinition bd : scanner.findCandidateComponents(SCAN_PACKAGE)) {
LOGGER.debug("Found connector class {}", bd);
String beanClassName = bd.getBeanClassName();
try {
Class connectorClass = Class.forName(beanClassName);
ManagedConnector annotation = (ManagedConnector) connectorClass.getAnnotation(ManagedConnector.class);
String type = annotation.type();
LOGGER.debug("Found connector {} class {}", type, connectorClass);
ConnectorStruct struct = createConnectorStruct(connectorClass, annotation);
connectorMap.put(type, struct);
} catch (ClassNotFoundException e) {
LOGGER.error("Error loading connector class {}: {}", beanClassName, e.getMessage(), e);
} catch (ObjectNotFoundException | SchemaException e) {
LOGGER.error("Error discovering the connector {}: {}", beanClassName, e.getMessage(), e);
}
}
LOGGER.trace("Scan done");
}
Aggregations