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