Search in sources :

Example 1 with SecurityContextManagerAware

use of com.evolveum.midpoint.security.api.SecurityContextManagerAware 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;
}
Also used : CaseEventDispatcherAware(com.evolveum.midpoint.casemgmt.api.CaseEventDispatcherAware) AbstractManagedConnectorInstance(com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance) TaskManagerAware(com.evolveum.midpoint.task.api.TaskManagerAware) InvocationTargetException(java.lang.reflect.InvocationTargetException) AbstractManagedConnectorInstance(com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance) SecurityContextManagerAware(com.evolveum.midpoint.security.api.SecurityContextManagerAware) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) RepositoryAware(com.evolveum.midpoint.repo.api.RepositoryAware)

Aggregations

CaseEventDispatcherAware (com.evolveum.midpoint.casemgmt.api.CaseEventDispatcherAware)1 AbstractManagedConnectorInstance (com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance)1 RepositoryAware (com.evolveum.midpoint.repo.api.RepositoryAware)1 SecurityContextManagerAware (com.evolveum.midpoint.security.api.SecurityContextManagerAware)1 TaskManagerAware (com.evolveum.midpoint.task.api.TaskManagerAware)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1