Search in sources :

Example 1 with APIConfiguration

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

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

the class ConnIdConfigurationTransformer method transformConnectorConfiguration.

/**
 * Transforms midPoint XML configuration of the connector to the ICF
 * configuration.
 * <p/>
 * The "configuration" part of the XML resource definition will be used.
 * <p/>
 * The provided ICF APIConfiguration will be modified, some values may be
 * overwritten.
 *
 * @throws SchemaException
 * @throws ConfigurationException
 */
public APIConfiguration transformConnectorConfiguration(PrismContainerValue configuration) throws SchemaException, ConfigurationException {
    APIConfiguration apiConfig = cinfo.createDefaultAPIConfiguration();
    ConfigurationProperties configProps = apiConfig.getConfigurationProperties();
    // The namespace of all the configuration properties specific to the
    // connector instance will have a connector instance namespace. This
    // namespace can be found in the resource definition.
    String connectorConfNs = connectorType.getNamespace();
    PrismContainer configurationPropertiesContainer = configuration.findContainer(SchemaConstants.CONNECTOR_SCHEMA_CONFIGURATION_PROPERTIES_ELEMENT_QNAME);
    if (configurationPropertiesContainer == null) {
        // Also try this. This is an older way.
        configurationPropertiesContainer = configuration.findContainer(new QName(connectorConfNs, SchemaConstants.CONNECTOR_SCHEMA_CONFIGURATION_PROPERTIES_ELEMENT_LOCAL_NAME));
    }
    transformConnectorConfigurationProperties(configProps, configurationPropertiesContainer, connectorConfNs);
    PrismContainer connectorPoolContainer = configuration.findContainer(new QName(SchemaConstants.NS_ICF_CONFIGURATION, ConnectorFactoryConnIdImpl.CONNECTOR_SCHEMA_CONNECTOR_POOL_CONFIGURATION_XML_ELEMENT_NAME));
    ObjectPoolConfiguration connectorPoolConfiguration = apiConfig.getConnectorPoolConfiguration();
    transformConnectorPoolConfiguration(connectorPoolConfiguration, connectorPoolContainer);
    PrismProperty producerBufferSizeProperty = configuration.findProperty(new ItemName(SchemaConstants.NS_ICF_CONFIGURATION, ConnectorFactoryConnIdImpl.CONNECTOR_SCHEMA_PRODUCER_BUFFER_SIZE_XML_ELEMENT_NAME));
    if (producerBufferSizeProperty != null) {
        apiConfig.setProducerBufferSize(parseInt(producerBufferSizeProperty));
    }
    PrismContainer connectorTimeoutsContainer = configuration.findContainer(new QName(SchemaConstants.NS_ICF_CONFIGURATION, ConnectorFactoryConnIdImpl.CONNECTOR_SCHEMA_TIMEOUTS_XML_ELEMENT_NAME));
    transformConnectorTimeoutsConfiguration(apiConfig, connectorTimeoutsContainer);
    PrismContainer resultsHandlerConfigurationContainer = configuration.findContainer(new QName(SchemaConstants.NS_ICF_CONFIGURATION, ConnectorFactoryConnIdImpl.CONNECTOR_SCHEMA_RESULTS_HANDLER_CONFIGURATION_ELEMENT_LOCAL_NAME));
    ResultsHandlerConfiguration resultsHandlerConfiguration = apiConfig.getResultsHandlerConfiguration();
    transformResultsHandlerConfiguration(resultsHandlerConfiguration, resultsHandlerConfigurationContainer);
    return apiConfig;
}
Also used : PrismProperty(com.evolveum.midpoint.prism.PrismProperty) ObjectPoolConfiguration(org.identityconnectors.common.pooling.ObjectPoolConfiguration) ResultsHandlerConfiguration(org.identityconnectors.framework.api.ResultsHandlerConfiguration) QName(javax.xml.namespace.QName) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration) PrismContainer(com.evolveum.midpoint.prism.PrismContainer) ItemName(com.evolveum.midpoint.prism.path.ItemName) ConfigurationProperties(org.identityconnectors.framework.api.ConfigurationProperties) GuardedString(org.identityconnectors.common.security.GuardedString) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 3 with APIConfiguration

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

the class ConnIdIcConfigurationService method getConnectorConfiguration.

/**
 * Return find connector default configuration by connector info
 *
 * @param key
 * @return
 */
@Override
public IcConnectorConfiguration getConnectorConfiguration(IcConnectorInstance connectorInstance) {
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    ConnectorInfo i = null;
    if (connectorInstance.isRemote()) {
        i = getRemoteConnIdConnectorInfo(connectorInstance);
    } else {
        i = getConnIdConnectorInfo(connectorInstance);
    }
    if (i != null) {
        APIConfiguration apiConf = i.createDefaultAPIConfiguration();
        return ConnIdIcConvertUtil.convertConnIdConnectorConfiguration(apiConf);
    }
    return null;
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration)

Example 4 with APIConfiguration

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

the class ConnIdIcConfigurationService method getRemoteConnectorConfiguration.

@Override
public IcConnectorConfiguration getRemoteConnectorConfiguration(IcConnectorInstance connectorInstance) {
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorInstance.getConnectorServer(), "Connector server is required.");
    ConnectorInfo info = getRemoteConnIdConnectorInfo(connectorInstance);
    // 
    if (info != null) {
        APIConfiguration apiConfiguration = info.createDefaultAPIConfiguration();
        // TODO: same as local???
        return ConnIdIcConvertUtil.convertConnIdConnectorConfiguration(apiConfiguration);
    }
    // 
    return null;
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration)

Example 5 with APIConfiguration

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

the class DefaultIcConnectorFacadeFactory method getConnectorFacade.

/**
 * Basic factory method to obtain {@link ConnectorFacade} instance based on given configuration. It uses
 * {@link ConnectorFacadeFactory} internally.
 *
 * @param connectorInstance {@link IcConnectorInstance} to obtain connector info
 * @param connectorConfiguration {@link IcConnectorConfiguration} to create api configuration
 * @return New instance of {@link ConnectorFacade} created based on given arguments
 */
@Override
public ConnectorFacade getConnectorFacade(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration) {
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    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) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Aggregations

APIConfiguration (org.identityconnectors.framework.api.APIConfiguration)7 ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)5 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)3 ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)3 ConfigurationProperties (org.identityconnectors.framework.api.ConfigurationProperties)2 PrismContainer (com.evolveum.midpoint.prism.PrismContainer)1 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)1 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 IcConnectorFacade (eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade)1 QName (javax.xml.namespace.QName)1 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)1 ObjectPoolConfiguration (org.identityconnectors.common.pooling.ObjectPoolConfiguration)1 GuardedString (org.identityconnectors.common.security.GuardedString)1 ResultsHandlerConfiguration (org.identityconnectors.framework.api.ResultsHandlerConfiguration)1