use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class DiscoverConnectorsExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType expression, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException, SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, SecurityViolationException, ExpressionEvaluationException {
boolean rebind = expressionHelper.getArgumentAsBoolean(expression.getParameter(), PARAM_REBIND_RESOURCES, input, context, false, PARAM_REBIND_RESOURCES, globalResult);
PipelineData output = PipelineData.createEmpty();
for (PipelineItem item : input.getData()) {
PrismValue value = item.getValue();
OperationResult result = operationsHelper.createActionResult(item, this, globalResult);
context.checkTaskStop();
if (value instanceof PrismObjectValue && ((PrismObjectValue) value).asObjectable() instanceof ConnectorHostType) {
PrismObject<ConnectorHostType> connectorHostTypePrismObject = ((PrismObjectValue) value).asPrismObject();
Set<ConnectorType> newConnectors;
Operation op = operationsHelper.recordStart(context, connectorHostTypePrismObject.asObjectable());
Throwable exception = null;
try {
newConnectors = modelService.discoverConnectors(connectorHostTypePrismObject.asObjectable(), context.getTask(), result);
operationsHelper.recordEnd(context, op, null, result);
} catch (CommunicationException | SecurityViolationException | SchemaException | ConfigurationException | ObjectNotFoundException | ExpressionEvaluationException | RuntimeException e) {
operationsHelper.recordEnd(context, op, e, result);
exception = processActionException(e, NAME, value, context);
newConnectors = Collections.emptySet();
}
context.println((exception != null ? "Attempted to discover " : "Discovered " + newConnectors.size()) + " new connector(s) from " + connectorHostTypePrismObject + exceptionSuffix(exception));
for (ConnectorType connectorType : newConnectors) {
output.addValue(connectorType.asPrismObject().getValue(), item.getResult(), item.getVariables());
}
try {
if (rebind) {
rebindConnectors(newConnectors, context, result);
}
} catch (ScriptExecutionException e) {
// noinspection ThrowableNotThrown
// TODO better message
processActionException(e, NAME, value, context);
}
} else {
// noinspection ThrowableNotThrown
processActionException(new ScriptExecutionException("Input item is not a PrismObject<ConnectorHost>"), NAME, value, context);
}
operationsHelper.trimAndCloneResult(result, item.getResult());
}
// TODO configurable output (either connector hosts or discovered connectors)
return output;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class ConnectorFactoryConnIdImpl method listRemoteConnectors.
private Set<ConnectorType> listRemoteConnectors(ConnectorHostType host) {
ConnectorInfoManager remoteConnectorInfoManager = getRemoteConnectorInfoManager(host);
Set<ConnectorType> connectorTypes = new HashSet<>();
List<ConnectorInfo> connectorInfos = remoteConnectorInfoManager.getConnectorInfos();
for (ConnectorInfo connectorInfo : connectorInfos) {
try {
ConnectorType connectorType = convertToConnectorType(connectorInfo, host);
connectorTypes.add(connectorType);
} catch (SchemaException e) {
LOGGER.error("Schema error while initializing ConnId connector {}: {}", getConnectorDesc(connectorInfo), e.getMessage(), e);
}
}
return connectorTypes;
}
Aggregations