Search in sources :

Example 1 with ConnectorFacade

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

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

Example 3 with ConnectorFacade

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

the class ConnIdIcConnectorService method readObject.

@Override
public IcConnectorObject readObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcUidAttribute uid) {
    Assert.notNull(connectorInstance, "Connector instance is required.");
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    Assert.notNull(uid, "Uid is required.");
    LOG.debug("Read object - ConnId (Uid= {} {})", uid, connectorInstance.getConnectorKey().toString());
    ConnectorFacade conn = facadeFactory.getConnectorFacade(connectorInstance, connectorConfiguration);
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    ConnectorObject connObject = conn.getObject(objectClassConnId, ConnIdIcConvertUtil.convertIcUid(uid), new OperationOptions(connectorConfiguration.getSystemOperationOptions()));
    LOG.debug("Readed object - ConnId ({}) Uid= {}", connObject, uid);
    return ConnIdIcConvertUtil.convertConnIdConnectorObject(connObject);
}
Also used : OperationOptions(org.identityconnectors.framework.common.objects.OperationOptions) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) ConnectorObject(org.identityconnectors.framework.common.objects.ConnectorObject) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Example 4 with ConnectorFacade

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

the class ConnIdIcConnectorService method synchronization.

@Override
public IcSyncToken synchronization(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcSyncToken token, IcSyncResultsHandler handler) {
    Assert.notNull(connectorInstance, "Connector instance is required.");
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    Assert.notNull(objectClass, "Object class is required.");
    Assert.notNull(handler, "Handler is required.");
    LOG.debug("Start synchronization for connector {} and objectClass {} - ConnId", connectorInstance.getConnectorKey().toString(), objectClass.getDisplayName());
    ConnectorFacade conn = facadeFactory.getConnectorFacade(connectorInstance, connectorConfiguration);
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    SyncToken syncToken = ConnIdIcConvertUtil.convertIcSyncToken(token);
    SyncResultsHandler handlerConnId = new SyncResultsHandler() {

        @Override
        public boolean handle(SyncDelta delta) {
            return handler.handle(ConnIdIcConvertUtil.convertConnIdSyncDelta(delta));
        }
    };
    SyncToken resultToken = conn.sync(objectClassConnId, syncToken, handlerConnId, new OperationOptions(connectorConfiguration.getSystemOperationOptions()));
    return ConnIdIcConvertUtil.convertConnIdSyncToken(resultToken);
}
Also used : OperationOptions(org.identityconnectors.framework.common.objects.OperationOptions) SyncToken(org.identityconnectors.framework.common.objects.SyncToken) IcSyncToken(eu.bcvsolutions.idm.ic.api.IcSyncToken) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) SyncDelta(org.identityconnectors.framework.common.objects.SyncDelta) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) IcSyncResultsHandler(eu.bcvsolutions.idm.ic.api.IcSyncResultsHandler) SyncResultsHandler(org.identityconnectors.framework.common.objects.SyncResultsHandler)

Example 5 with ConnectorFacade

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

the class ConnIdIcConnectorService method createObject.

@Override
public IcUidAttribute createObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, List<IcAttribute> attributes) {
    Assert.notNull(connectorInstance, "Connector instance is required.");
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    Assert.notNull(attributes, "Attributes are required.");
    LOG.debug("Create object - ConnId ({} {})", connectorInstance.getConnectorKey().toString(), attributes.toString());
    ConnectorFacade conn = facadeFactory.getConnectorFacade(connectorInstance, connectorConfiguration);
    Set<Attribute> connIdAttributes = new HashSet<>(attributes.size());
    for (IcAttribute icAttribute : attributes) {
        connIdAttributes.add(ConnIdIcConvertUtil.convertIcAttribute(icAttribute));
    }
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    Uid uid = conn.create(objectClassConnId, connIdAttributes, new OperationOptions(connectorConfiguration.getSystemOperationOptions()));
    LOG.debug("Created object - ConnId ({} {}) Uid= {}", connectorInstance.getConnectorKey().toString(), attributes.toString(), uid);
    return ConnIdIcConvertUtil.convertConnIdUid(uid);
}
Also used : OperationOptions(org.identityconnectors.framework.common.objects.OperationOptions) Uid(org.identityconnectors.framework.common.objects.Uid) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) Attribute(org.identityconnectors.framework.common.objects.Attribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) HashSet(java.util.HashSet)

Aggregations

ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)12 IcConnectorFacade (eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade)8 IcObjectClass (eu.bcvsolutions.idm.ic.api.IcObjectClass)7 ObjectClass (org.identityconnectors.framework.common.objects.ObjectClass)7 OperationOptions (org.identityconnectors.framework.common.objects.OperationOptions)7 IcUidAttribute (eu.bcvsolutions.idm.ic.api.IcUidAttribute)3 APIConfiguration (org.identityconnectors.framework.api.APIConfiguration)3 ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)3 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)2 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)2 HashSet (java.util.HashSet)2 Attribute (org.identityconnectors.framework.common.objects.Attribute)2 ConnectorObject (org.identityconnectors.framework.common.objects.ConnectorObject)2 Uid (org.identityconnectors.framework.common.objects.Uid)2 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 AsynchronousOperationResult (com.evolveum.midpoint.schema.result.AsynchronousOperationResult)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)1 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)1 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)1