Search in sources :

Example 6 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 7 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 8 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)

Example 9 with ConnectorInfo

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

Example 10 with ConnectorInfo

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

the class ConnIdIcConfigurationService method getConnectorFacade.

private ConnectorFacade getConnectorFacade(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration) {
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    if (connectorInstance.isRemote()) {
        Assert.notNull(connectorInstance.getConnectorServer());
    }
    ConnectorInfo connIdInfo = this.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) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Aggregations

ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)11 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)6 APIConfiguration (org.identityconnectors.framework.api.APIConfiguration)4 ConnectorInfoManager (org.identityconnectors.framework.api.ConnectorInfoManager)4 ConnectorKey (org.identityconnectors.framework.api.ConnectorKey)4 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 ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)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