Search in sources :

Example 1 with ConnectorInfoManagerFactory

use of org.identityconnectors.framework.api.ConnectorInfoManagerFactory in project CzechIdMng by bcvsolutions.

the class ConnIdIcConfigurationService method findAllLocalConnectorManagers.

private List<ConnectorInfoManager> findAllLocalConnectorManagers() {
    if (managers == null) {
        managers = new ArrayList<>();
        List<Class<?>> annotated = new ArrayList<>();
        // Find all class with annotation IcConnectorClass under specific
        // packages
        localConnectorsPackages.forEach(packageWithConnectors -> {
            Reflections reflections = new Reflections(packageWithConnectors);
            annotated.addAll(reflections.getTypesAnnotatedWith(ConnectorClass.class));
        });
        LOG.info(MessageFormat.format("Found annotated classes with IcConnectorClass [{0}]", annotated));
        for (Class<?> clazz : annotated) {
            URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
            ConnectorInfoManagerFactory fact = ConnectorInfoManagerFactory.getInstance();
            ConnectorInfoManager manager = fact.getLocalManager(url);
            managers.add(manager);
        }
        LOG.info(MessageFormat.format("Found all local connector managers [{0}]", managers.toString()));
    }
    return managers;
}
Also used : ConnectorInfoManagerFactory(org.identityconnectors.framework.api.ConnectorInfoManagerFactory) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager) ConnectorClass(org.identityconnectors.framework.spi.ConnectorClass) ArrayList(java.util.ArrayList) ConnectorClass(org.identityconnectors.framework.spi.ConnectorClass) URL(java.net.URL) Reflections(org.reflections.Reflections)

Aggregations

URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 ConnectorInfoManager (org.identityconnectors.framework.api.ConnectorInfoManager)1 ConnectorInfoManagerFactory (org.identityconnectors.framework.api.ConnectorInfoManagerFactory)1 ConnectorClass (org.identityconnectors.framework.spi.ConnectorClass)1 Reflections (org.reflections.Reflections)1