Skip to content

Commit

Permalink
Fix version reporting for built-in connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Nov 23, 2019
1 parent f6068d3 commit 95fb4ed
Showing 1 changed file with 6 additions and 5 deletions.
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2017-2018 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
Expand Down Expand Up @@ -108,7 +108,7 @@ private void discoverConnectorsIfNeeded() {
connectorMap.put(type, struct);
} catch (ClassNotFoundException e) {
LOGGER.error("Error loading connector class {}: {}", beanClassName, e.getMessage(), e);
} catch (ObjectNotFoundException | SchemaException e) {
} catch (SchemaException e) {
LOGGER.error("Error discovering the connector {}: {}", beanClassName, e.getMessage(), e);
}
}
Expand All @@ -117,29 +117,30 @@ private void discoverConnectorsIfNeeded() {
}
}

private ConnectorStruct createConnectorStruct(Class connectorClass, ManagedConnector annotation) throws ObjectNotFoundException, SchemaException {
private ConnectorStruct createConnectorStruct(Class connectorClass, ManagedConnector annotation) throws SchemaException {
ConnectorStruct struct = new ConnectorStruct();
//noinspection unchecked
struct.connectorClass = connectorClass;

ConnectorType connectorType = new ConnectorType();
String bundleName = connectorClass.getPackage().getName();
String type = annotation.type();
if (type == null || type.isEmpty()) {
if (type.isEmpty()) {
type = connectorClass.getSimpleName();
}
String version = annotation.version();
UcfUtil.addConnectorNames(connectorType, "Built-in", bundleName, type, version, null);
connectorType.setConnectorBundle(bundleName);
connectorType.setConnectorType(type);
connectorType.setVersion(version);
connectorType.setConnectorVersion(version);
connectorType.setFramework(SchemaConstants.UCF_FRAMEWORK_URI_BUILTIN);
String namespace = CONFIGURATION_NAMESPACE_PREFIX + bundleName + "/" + type;
connectorType.setNamespace(namespace);

struct.connectorObject = connectorType;

PrismSchema connectorSchema = generateConnectorConfigurationSchema(struct);
//noinspection ConstantConditions (probably can be null in the future)
if (connectorSchema != null) {
LOGGER.trace("Generated connector schema for {}: {} definitions",
connectorType, connectorSchema.getDefinitions().size());
Expand Down

0 comments on commit 95fb4ed

Please sign in to comment.