private ConnectorStruct createConnectorStruct(Class connectorClass, ManagedConnector annotation) throws ObjectNotFoundException, SchemaException {
ConnectorStruct struct = new ConnectorStruct();
struct.connectorClass = connectorClass;
ConnectorType connectorType = new ConnectorType();
String bundleName = connectorClass.getPackage().getName();
String type = annotation.type();
if (type == null || 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.setFramework(SchemaConstants.UCF_FRAMEWORK_URI_BUILTIN);
String namespace = CONFIGURATION_NAMESPACE_PREFIX + bundleName + "/" + type;
connectorType.setNamespace(namespace);
struct.connectorObject = connectorType;
PrismSchema connectorSchema = generateConnectorConfigurationSchema(struct);
if (connectorSchema != null) {
LOGGER.trace("Generated connector schema for {}: {} definitions",
connectorType, connectorSchema.getDefinitions().size());
UcfUtil.setConnectorSchema(connectorType, connectorSchema);
struct.connectorConfigurationSchema = connectorSchema;
} else {
LOGGER.warn("No connector schema generated for {}", connectorType);
}
return struct;
}