Search in sources :

Example 1 with ConnectorKey

use of org.identityconnectors.framework.api.ConnectorKey in project midpoint by Evolveum.

the class ConnectorFactoryConnIdImpl method getConnectorInfo.

/**
	 * Get contect informations
	 * 
	 * @param connectorType
	 * @return
	 * @throws ObjectNotFoundException
	 */
private ConnectorInfo getConnectorInfo(ConnectorType connectorType) throws ObjectNotFoundException {
    if (!SchemaConstants.ICF_FRAMEWORK_URI.equals(connectorType.getFramework())) {
        throw new ObjectNotFoundException("Requested connector for framework " + connectorType.getFramework() + " cannot be found in framework " + SchemaConstants.ICF_FRAMEWORK_URI);
    }
    ConnectorKey key = getConnectorKey(connectorType);
    if (connectorType.getConnectorHost() == null && connectorType.getConnectorHostRef() == null) {
        // Local connector
        return getLocalConnectorInfoManager().findConnectorInfo(key);
    }
    ConnectorHostType host = connectorType.getConnectorHost();
    if (host == null) {
        throw new ObjectNotFoundException("Attempt to use remote connector without ConnectorHostType resolved (there is only ConnectorHostRef");
    }
    return getRemoteConnectorInfoManager(host).findConnectorInfo(key);
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 2 with ConnectorKey

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

the class ConnIdIcConfigurationService method getRemoteConnIdConnectorInfo.

private ConnectorInfo getRemoteConnIdConnectorInfo(IcConnectorInstance connectorInstance) {
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorInstance.getConnectorServer());
    ConnectorInfoManager remoteInfoManager = findRemoteConnectorManager(connectorInstance.getConnectorServer());
    for (ConnectorInfo info : remoteInfoManager.getConnectorInfos()) {
        ConnectorKey connectorKey = info.getConnectorKey();
        if (connectorKey == null) {
            continue;
        } else if (connectorKey.getConnectorName().equals(connectorInstance.getConnectorKey().getConnectorName())) {
            return info;
        }
    }
    return null;
}
Also used : ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager)

Example 3 with ConnectorKey

use of org.identityconnectors.framework.api.ConnectorKey in project syncope by apache.

the class ConnIdBundleManagerImpl method getConnectorInfo.

@Override
public Pair<URI, ConnectorInfo> getConnectorInfo(final ConnInstance connInstance) {
    // check ConnIdLocation
    URI uriLocation = null;
    try {
        uriLocation = URIUtils.buildForConnId(connInstance.getLocation());
    } catch (Exception e) {
        throw new IllegalArgumentException("Invalid ConnId location " + connInstance.getLocation(), e);
    }
    // create key for search all properties
    ConnectorKey key = new ConnectorKey(connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName());
    if (LOG.isDebugEnabled()) {
        LOG.debug("\nBundle name: " + key.getBundleName() + "\nBundle version: " + key.getBundleVersion() + "\nBundle class: " + key.getConnectorName());
    }
    // get the specified connector
    ConnectorInfo info = null;
    if (getConnManagers().containsKey(uriLocation)) {
        info = getConnManagers().get(uriLocation).findConnectorInfo(key);
    }
    if (info == null) {
        throw new NotFoundException("ConnectorInfo for location " + connInstance.getLocation() + " and key " + key);
    }
    return Pair.of(uriLocation, info);
}
Also used : ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) URI(java.net.URI) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException)

Example 4 with ConnectorKey

use of org.identityconnectors.framework.api.ConnectorKey in project syncope by apache.

the class ConnectorLogic method getBundles.

@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public List<ConnBundleTO> getBundles(final String lang) {
    if (StringUtils.isBlank(lang)) {
        CurrentLocale.set(Locale.ENGLISH);
    } else {
        CurrentLocale.set(new Locale(lang));
    }
    List<ConnBundleTO> connectorBundleTOs = new ArrayList<>();
    connIdBundleManager.getConnInfoManagers().forEach((uri, cim) -> {
        connectorBundleTOs.addAll(cim.getConnectorInfos().stream().map(bundle -> {
            ConnBundleTO connBundleTO = new ConnBundleTO();
            connBundleTO.setDisplayName(bundle.getConnectorDisplayName());
            connBundleTO.setLocation(uri.toString());
            ConnectorKey key = bundle.getConnectorKey();
            connBundleTO.setBundleName(key.getBundleName());
            connBundleTO.setConnectorName(key.getConnectorName());
            connBundleTO.setVersion(key.getBundleVersion());
            ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(bundle);
            connBundleTO.getProperties().addAll(properties.getPropertyNames().stream().map(propName -> binder.build(properties.getProperty(propName))).collect(Collectors.toList()));
            return connBundleTO;
        }).collect(Collectors.toList()));
    });
    return connectorBundleTOs;
}
Also used : Locale(java.util.Locale) CurrentLocale(org.identityconnectors.common.l10n.CurrentLocale) ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) ConnBundleTO(org.apache.syncope.common.lib.to.ConnBundleTO) ArrayList(java.util.ArrayList) ConfigurationProperties(org.identityconnectors.framework.api.ConfigurationProperties) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ConnectorKey

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

the class ConnIdIcConfigurationService method getAvailableLocalConnectors.

/**
 * Return available local connectors for this IC implementation
 *
 * @return
 */
@Override
public Set<IcConnectorInfo> getAvailableLocalConnectors() {
    LOG.info("Get Available local connectors - ConnId");
    Set<IcConnectorInfo> localConnectorInfos = new HashSet<>();
    List<ConnectorInfoManager> managers = findAllLocalConnectorManagers();
    for (ConnectorInfoManager manager : managers) {
        List<ConnectorInfo> infos = manager.getConnectorInfos();
        if (infos == null) {
            continue;
        }
        for (ConnectorInfo info : infos) {
            ConnectorKey key = info.getConnectorKey();
            if (key == null) {
                continue;
            }
            IcConnectorKeyImpl keyDto = new IcConnectorKeyImpl(getFramework(), key.getBundleName(), key.getBundleVersion(), key.getConnectorName());
            IcConnectorInfoImpl infoDto = new IcConnectorInfoImpl(info.getConnectorDisplayName(), info.getConnectorCategory(), keyDto);
            localConnectorInfos.add(infoDto);
        }
    }
    return localConnectorInfos;
}
Also used : IcConnectorKeyImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl) IcConnectorInfoImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorInfoImpl) ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager) HashSet(java.util.HashSet)

Aggregations

ConnectorKey (org.identityconnectors.framework.api.ConnectorKey)6 ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)4 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)3 IcConnectorInfoImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorInfoImpl)2 IcConnectorKeyImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl)2 HashSet (java.util.HashSet)2 ConnectorInfoManager (org.identityconnectors.framework.api.ConnectorInfoManager)2 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 ConnectorHostType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType)1 IOException (java.io.IOException)1 URI (java.net.URI)1 CertificateException (java.security.cert.CertificateException)1 ArrayList (java.util.ArrayList)1 Locale (java.util.Locale)1 ConnBundleTO (org.apache.syncope.common.lib.to.ConnBundleTO)1 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)1 CurrentLocale (org.identityconnectors.common.l10n.CurrentLocale)1 ConfigurationProperties (org.identityconnectors.framework.api.ConfigurationProperties)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 Transactional (org.springframework.transaction.annotation.Transactional)1