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