use of com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance in project midpoint by Evolveum.
the class ConnectorManager method createConnectorInstance.
private ConnectorInstance createConnectorInstance(ConnectorSpec connectorSpec, OperationResult result) throws ObjectNotFoundException, SchemaException {
ConnectorType connectorBean = getConnector(connectorSpec, result);
ConnectorFactory connectorFactory = determineConnectorFactory(connectorBean);
ConnectorInstance connectorInstance;
try {
InternalMonitor.recordCount(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT);
connectorInstance = connectorFactory.createConnectorInstance(connectorBean, connectorSpec.getResource().getName().toString(), connectorSpec.toString());
// FIXME temporary -- remove when no longer needed (MID-5931)
if (connectorInstance instanceof AbstractManagedConnectorInstance) {
((AbstractManagedConnectorInstance) connectorInstance).setResourceOid(connectorSpec.getResource().getOid());
}
} catch (ObjectNotFoundException e) {
result.recordFatalError(e.getMessage(), e);
throw new ObjectNotFoundException(e.getMessage(), e);
}
// This log message should be INFO level. It happens only occasionally.
// If it happens often, it may be an
// indication of a problem. Therefore it is good for admin to see it.
LOGGER.info("Created new connector instance for {}: {} v{}", connectorSpec, connectorBean.getConnectorType(), connectorBean.getConnectorVersion());
return connectorInstance;
}
use of com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManagedConnectorInstance 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