Search in sources :

Example 1 with ConnectorInfo

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

the class ConnectorFactoryConnIdImpl method isThisBundleCompatible.

/**
	 * Test if bundle internal configuration and dependencies are OK
	 * @param bundleUrl
	 * 			tested bundle URL
	 * @return true if OK
	 */
private Boolean isThisBundleCompatible(URL bundleUrl) {
    if (null == bundleUrl)
        return false;
    try {
        ConnectorInfoManager localManager = ConnectorInfoManagerFactory.getInstance().getLocalManager(bundleUrl);
        List<ConnectorInfo> connectorInfos = localManager.getConnectorInfos();
        if (connectorInfos == null || connectorInfos.isEmpty()) {
            LOGGER.error("Strange error happened. ConnId is not accepting bundle {}. But no error is indicated.", bundleUrl);
            return false;
        } else {
            LOGGER.trace("Found {} compatible connectors in bundle {}", connectorInfos.size(), bundleUrl);
            return true;
        }
    } catch (Exception ex) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.error("Error instantiating ICF bundle using URL '{}': {}", new Object[] { bundleUrl, ex.getMessage(), ex });
        } else {
            LOGGER.error("Error instantiating ICF bundle using URL '{}': {}", new Object[] { bundleUrl, ex.getMessage() });
        }
        return false;
    }
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ConnIdUtil.processIcfException(com.evolveum.midpoint.provisioning.ucf.impl.connid.ConnIdUtil.processIcfException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) SystemException(com.evolveum.midpoint.util.exception.SystemException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) EncryptionException(com.evolveum.midpoint.prism.crypto.EncryptionException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Example 2 with ConnectorInfo

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

the class ConnIdIcConnectorService method getConnectorFacade.

private ConnectorFacade getConnectorFacade(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration) {
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    ConnectorInfo connIdInfo = configurationServiceConnId.getConnIdConnectorInfo(connectorInstance);
    Assert.notNull(connIdInfo, "ConnId connector info not found!");
    APIConfiguration config = connIdInfo.createDefaultAPIConfiguration();
    Assert.notNull(config.getConfigurationProperties(), "ConnId connector configuration properties not found!");
    config = ConnIdIcConvertUtil.convertIcConnectorConfiguration(connectorConfiguration, config);
    // Use the ConnectorFacadeFactory's newInstance() method to get a new
    // connector.
    ConnectorFacade conn = ConnectorFacadeFactory.getManagedInstance().newInstance(config);
    // Make sure we have set up the Configuration properly
    conn.validate();
    return conn;
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Example 3 with ConnectorInfo

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

the class ConnInstanceDataBinderImpl method getConnInstanceTO.

@Override
public ConnInstanceTO getConnInstanceTO(final ConnInstance connInstance) {
    ConnInstanceTO connInstanceTO = new ConnInstanceTO();
    Pair<URI, ConnectorInfo> info = connIdBundleManager.getConnectorInfo(connInstance);
    BeanUtils.copyProperties(connInstance, connInstanceTO, IGNORE_PROPERTIES);
    connInstanceTO.setAdminRealm(connInstance.getAdminRealm().getFullPath());
    connInstanceTO.setLocation(info.getLeft().toASCIIString());
    connInstanceTO.getConf().addAll(connInstance.getConf());
    // refresh stored properties in the given connInstance with direct information from underlying connector
    ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(info.getRight());
    properties.getPropertyNames().forEach(propName -> {
        ConnConfPropSchema schema = build(properties.getProperty(propName));
        Optional<ConnConfProperty> property = connInstanceTO.getConf(propName);
        if (!property.isPresent()) {
            property = Optional.of(new ConnConfProperty());
            connInstanceTO.getConf().add(property.get());
        }
        property.get().setSchema(schema);
    });
    Collections.sort(connInstanceTO.getConf());
    // pool configuration
    if (connInstance.getPoolConf() != null && (connInstance.getPoolConf().getMaxIdle() != null || connInstance.getPoolConf().getMaxObjects() != null || connInstance.getPoolConf().getMaxWait() != null || connInstance.getPoolConf().getMinEvictableIdleTimeMillis() != null || connInstance.getPoolConf().getMinIdle() != null)) {
        ConnPoolConfTO poolConf = new ConnPoolConfTO();
        BeanUtils.copyProperties(connInstance.getPoolConf(), poolConf);
        connInstanceTO.setPoolConf(poolConf);
    }
    return connInstanceTO;
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) ConnConfProperty(org.apache.syncope.common.lib.types.ConnConfProperty) ConfigurationProperties(org.identityconnectors.framework.api.ConfigurationProperties) ConnPoolConfTO(org.apache.syncope.common.lib.to.ConnPoolConfTO) URI(java.net.URI) ConnConfPropSchema(org.apache.syncope.common.lib.types.ConnConfPropSchema)

Example 4 with ConnectorInfo

use of org.identityconnectors.framework.api.ConnectorInfo 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 5 with ConnectorInfo

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

the class DirectoryScanningInfoManager method connectorFromURL.

Optional<ConnectorInfoManager> connectorFromURL(URI bundleUrl) {
    try {
        /*
             * We can not reuse one instance of ConnectorInfoManager, since it is immutable.
             * We need to create it per instance, since connector info construction is hidden
             * behind private methods.
             *
             * Fortunately ConnectorInfoManager does not hold any additional functionality
             * besides initialization of basic connector info and lookup in locally loaded connector
             * infos, thus we can have separate instance per bundle uri.
             *
             *
             */
        ConnectorInfoManager localManager = factory.getLocalManager(bundleUrl.toURL());
        List<ConnectorInfo> connectorInfos = localManager.getConnectorInfos();
        if (connectorInfos == null || connectorInfos.isEmpty()) {
            LOGGER.error("Strange error happened. ConnId is not accepting bundle {}. But no error is indicated.", bundleUrl);
            return Optional.empty();
        } else {
            LOGGER.trace("Found {} compatible connectors in bundle {}", connectorInfos.size(), bundleUrl);
            return Optional.of(localManager);
        }
    } catch (Exception ex) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.error("Error instantiating ICF bundle using URL '{}': {}", bundleUrl, ex.getMessage(), ex);
        } else {
            LOGGER.error("Error instantiating ICF bundle using URL '{}': {}", bundleUrl, ex.getMessage());
        }
        return Optional.empty();
    }
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager)

Aggregations

ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)12 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)6 APIConfiguration (org.identityconnectors.framework.api.APIConfiguration)5 ConnectorInfoManager (org.identityconnectors.framework.api.ConnectorInfoManager)4 ConnectorKey (org.identityconnectors.framework.api.ConnectorKey)4 ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)3 IcConnectorInfoImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorInfoImpl)2 IcConnectorKeyImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl)2 IOException (java.io.IOException)2 URI (java.net.URI)2 HashSet (java.util.HashSet)2 EncryptionException (com.evolveum.midpoint.prism.crypto.EncryptionException)1 ConnIdUtil.processIcfException (com.evolveum.midpoint.provisioning.ucf.impl.connid.ConnIdUtil.processIcfException)1 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 IcConnectorFacade (eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade)1 MalformedURLException (java.net.MalformedURLException)1 CertificateException (java.security.cert.CertificateException)1