Search in sources :

Example 1 with RepositoryAware

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;
}
Also used : AbstractManagedConnectorInstance(com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance) ConnectorInstance(com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) AbstractManagedConnectorInstance(com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance) RepositoryAware(com.evolveum.midpoint.repo.api.RepositoryAware)

Aggregations

ConnectorInstance (com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance)1 AbstractManagedConnectorInstance (com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance)1 RepositoryAware (com.evolveum.midpoint.repo.api.RepositoryAware)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1