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;
}
}
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;
}
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;
}
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);
}
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();
}
}
Aggregations