public static Element getConnectorXsdSchema(ConnectorType connector) { XmlSchemaType xmlSchemaType = connector.getSchema(); if (xmlSchemaType == null) { return null; } return ObjectTypeUtil.findXsdElement(xmlSchemaType); }
public static PrismSchema getConnectorSchema(ConnectorType connectorType, PrismContext prismContext) throws SchemaException { XmlSchemaType xmlSchema = connectorType.getSchema(); if (xmlSchema == null) { return null; } Element xsdElement = ObjectTypeUtil.findXsdElement(xmlSchema); if (xsdElement == null) { return null; } MutablePrismSchema connectorSchema = prismContext.schemaFactory().createPrismSchema(); connectorSchema.parseThis(xsdElement, true, connectorType.toString(), prismContext); return connectorSchema; }
public static void assertConnectorSchemaSanity(ConnectorType conn, PrismContext prismContext) throws SchemaException { XmlSchemaType xmlSchemaType = conn.getSchema(); assertNotNull("xmlSchemaType is null",xmlSchemaType); Element connectorXsdSchemaElement = ConnectorTypeUtil.getConnectorXsdSchema(conn); assertNotNull("No schema", connectorXsdSchemaElement); Element xsdElement = ObjectTypeUtil.findXsdElement(xmlSchemaType); assertNotNull("No xsd:schema element in xmlSchemaType",xsdElement); display("XSD schema of "+conn, DOMUtil.serializeDOMToString(xsdElement)); // Try to parse the schema PrismSchema schema = null; try { schema = PrismSchemaImpl.parse(xsdElement, true, "schema of "+conn, prismContext); } catch (SchemaException e) { throw new SchemaException("Error parsing schema of "+conn+": "+e.getMessage(),e); } assertConnectorSchemaSanity(schema, conn.toString(), SchemaConstants.ICF_FRAMEWORK_URI.equals(conn.getFramework())); }
LOGGER.trace("Connector {} not in the repository, adding", foundConnector); if (foundConnector.getSchema() == null) { LOGGER.warn("Connector {} haven't provided configuration schema", foundConnector);
XmlSchemaType xmlSchemaType = conn.getSchema(); assertNotNull("xmlSchemaType is null", xmlSchemaType); Element connectorXsdSchemaElement = ConnectorTypeUtil.getConnectorXsdSchema(conn);
if (object.canRepresent(ConnectorType.class)) { ConnectorType connector = (ConnectorType) object.asObjectable(); checkSchema(connector.getSchema(), "connector", result); result.computeStatus("Connector schema error"); result.recordSuccessIfUnknown();