use of com.evolveum.midpoint.task.api.TaskManagerAware in project midpoint by Evolveum.
the class ConnectorFactoryBuiltinImpl method createConnectorInstance.
@Override
public ConnectorInstance createConnectorInstance(ConnectorType connectorType, String instanceName, String desc) throws ObjectNotFoundException {
ConnectorStruct struct = getConnectorStruct(connectorType);
Class<? extends ConnectorInstance> connectorClass = struct.connectorClass;
ConnectorInstance connectorInstance;
try {
connectorInstance = connectorClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
throw new ObjectNotFoundException("Cannot create instance of connector " + connectorClass + ": " + e.getMessage(), e);
}
if (connectorInstance instanceof AbstractManagedConnectorInstance) {
setupAbstractConnectorInstance((AbstractManagedConnectorInstance) connectorInstance, instanceName, connectorType, MidPointConstants.NS_RI, struct);
}
if (connectorInstance instanceof RepositoryAware) {
((RepositoryAware) connectorInstance).setRepositoryService(repositoryService);
}
if (connectorInstance instanceof CaseEventDispatcherAware) {
((CaseEventDispatcherAware) connectorInstance).setDispatcher(caseManager);
}
if (connectorInstance instanceof TaskManagerAware) {
((TaskManagerAware) connectorInstance).setTaskManager(taskManager);
}
if (connectorInstance instanceof SecurityContextManagerAware) {
((SecurityContextManagerAware) connectorInstance).setSecurityContextManager(securityContextManager);
}
if (connectorInstance instanceof UcfExpressionEvaluatorAware) {
((UcfExpressionEvaluatorAware) connectorInstance).setUcfExpressionEvaluator(ucfExpressionEvaluator);
}
if (connectorInstance instanceof TracerAware) {
((TracerAware) connectorInstance).setTracer(tracer);
}
if (connectorInstance instanceof RepositoryAware) {
((RepositoryAware) connectorInstance).setRepositoryService(repositoryService);
}
return connectorInstance;
}
Aggregations