Search in sources :

Example 6 with IcConnectorInfo

use of eu.bcvsolutions.idm.ic.api.IcConnectorInfo in project CzechIdMng by bcvsolutions.

the class CzechIdMIcConvertUtil method convertConnectorClass.

public static IcConnectorInfo convertConnectorClass(IcConnectorClass connectorAnnotation, Class<? extends IcConnector> clazz) {
    IcConnectorKey key = new IcConnectorKeyImpl(connectorAnnotation.framework(), clazz.getName(), connectorAnnotation.version(), connectorAnnotation.name());
    IcConnectorInfo info = new IcConnectorInfoImpl(MessageFormat.format("{0} {1}", connectorAnnotation.displayName(), connectorAnnotation.version()), connectorAnnotation.framework(), key);
    return info;
}
Also used : IcConnectorKeyImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl) IcConnectorInfoImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorInfoImpl) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) IcConnectorKey(eu.bcvsolutions.idm.ic.api.IcConnectorKey)

Example 7 with IcConnectorInfo

use of eu.bcvsolutions.idm.ic.api.IcConnectorInfo in project CzechIdMng by bcvsolutions.

the class CzechIdMIcConfigurationService method getAvailableLocalConnectors.

/**
 * Return available local connectors for this IC implementation
 *
 * @return
 */
@SuppressWarnings("unchecked")
@Override
public Set<IcConnectorInfo> getAvailableLocalConnectors() {
    if (connectorInfos == null) {
        connectorInfos = new HashSet<>();
        connectorsConfigurations = new HashMap<>();
        connectorsClass = new HashMap<>();
        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(IcConnectorClass.class));
        });
        LOG.info(MessageFormat.format("Found annotated classes with IcConnectorClass [{0}]", annotated));
        for (Class<?> clazz : annotated) {
            IcConnectorClass connectorAnnotation = clazz.getAnnotation(IcConnectorClass.class);
            if (!this.getFramework().equals(connectorAnnotation.framework())) {
                continue;
            }
            if (!IcConnector.class.isAssignableFrom(clazz)) {
                throw new IcException(MessageFormat.format("Cannot create instance of CzechIdM connector [{0}]! Connector class must be child of [{0}]!", IcConnector.class.getSimpleName()));
            }
            IcConnectorInfo info = CzechIdMIcConvertUtil.convertConnectorClass(connectorAnnotation, (Class<? extends IcConnector>) clazz);
            Class<? extends ConfigurationClass> configurationClass = connectorAnnotation.configurationClass();
            connectorInfos.add(info);
            IcConnectorConfiguration configuration = initDefaultConfiguration(configurationClass);
            // Put default configuration to cache
            connectorsConfigurations.put(info.getConnectorKey().getFullName(), configuration);
            // Put connector class to cache
            connectorsClass.put(info.getConnectorKey().getFullName(), ((Class<? extends IcConnector>) clazz));
        }
        LOG.info(MessageFormat.format("Found all local connector connectorInfos [{0}]", connectorInfos.toString()));
    }
    return connectorInfos;
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) ArrayList(java.util.ArrayList) IcException(eu.bcvsolutions.idm.ic.exception.IcException) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) IcConnectorClass(eu.bcvsolutions.idm.ic.api.annotation.IcConnectorClass) ConfigurationClass(eu.bcvsolutions.idm.core.api.domain.ConfigurationClass) IcConnectorClass(eu.bcvsolutions.idm.ic.api.annotation.IcConnectorClass) IcConnector(eu.bcvsolutions.idm.ic.api.IcConnector) Reflections(org.reflections.Reflections)

Aggregations

IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)7 IcConnectorClass (eu.bcvsolutions.idm.ic.api.annotation.IcConnectorClass)3 IcException (eu.bcvsolutions.idm.ic.exception.IcException)3 IcConnectorInfoImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorInfoImpl)3 IcConnectorKeyImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl)3 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)2 IcConnector (eu.bcvsolutions.idm.ic.api.IcConnector)2 HashSet (java.util.HashSet)2 ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)2 ConnectorKey (org.identityconnectors.framework.api.ConnectorKey)2 SysConnectorKeyDto (eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto)1 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)1 ConfigurationClass (eu.bcvsolutions.idm.core.api.domain.ConfigurationClass)1 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)1 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)1 IcConnectorConfiguration (eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration)1 IcConnectorInstance (eu.bcvsolutions.idm.ic.api.IcConnectorInstance)1 IcConnectorKey (eu.bcvsolutions.idm.ic.api.IcConnectorKey)1 IcConnectorConfigurationCzechIdMImpl (eu.bcvsolutions.idm.ic.czechidm.domain.IcConnectorConfigurationCzechIdMImpl)1 IcConnectorInstanceImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorInstanceImpl)1