use of com.evolveum.midpoint.repo.api.RepositoryAware in project midpoint by Evolveum.
the class ConnectorFactoryBuiltinImpl method createConnectorInstance.
@Override
public ConnectorInstance createConnectorInstance(ConnectorType connectorType, String namespace, String desc) throws ObjectNotFoundException, SchemaException {
String type = connectorType.getConnectorType();
ConnectorStruct struct = connectorMap.get(type);
Class<? extends ConnectorInstance> connectorClass = struct.connectorClass;
ConnectorInstance connectorInstance;
try {
connectorInstance = connectorClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new ObjectNotFoundException("Cannot create instance of connector " + connectorClass + ": " + e.getMessage(), e);
}
if (connectorInstance instanceof AbstractManagedConnectorInstance) {
setupAbstractConnectorInstance((AbstractManagedConnectorInstance) connectorInstance, connectorType, namespace, desc, struct);
}
if (connectorInstance instanceof RepositoryAware) {
((RepositoryAware) connectorInstance).setRepositoryService(repositoryService);
}
return connectorInstance;
}
Aggregations