Search in sources :

Example 1 with ConnectorSchema

use of com.evolveum.midpoint.schema.processor.ConnectorSchema in project midpoint by Evolveum.

the class RefinedConnectorSchemaImpl method getConnectorSchema.

public static ConnectorSchema getConnectorSchema(PrismObject<ConnectorType> connector, PrismContext prismContext) throws SchemaException {
    Element connectorXsdSchema = ConnectorTypeUtil.getConnectorXsdSchema(connector);
    if (connectorXsdSchema == null) {
        return null;
    }
    Object userDataEntry = connector.getUserData(USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA);
    if (userDataEntry != null) {
        if (userDataEntry instanceof ConnectorSchema) {
            return (ConnectorSchema) userDataEntry;
        } else {
            throw new IllegalStateException("Expected ConnectorSchema under user data key " + USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA + "in " + connector + ", but got " + userDataEntry.getClass());
        }
    } else {
        //InternalMonitor.recordConnectorSchemaParse();
        ConnectorSchemaImpl parsedSchema = ConnectorSchemaImpl.parse(connectorXsdSchema, "connector schema of " + connector, prismContext);
        if (parsedSchema == null) {
            throw new IllegalStateException("Parsed schema is null: most likely an internall error");
        }
        parsedSchema.setUsualNamespacePrefix(ConnectorSchemaImpl.retrieveUsualNamespacePrefix(connector.asObjectable()));
        connector.setUserData(USER_DATA_KEY_PARSED_CONNECTOR_SCHEMA, parsedSchema);
        return parsedSchema;
    }
}
Also used : ConnectorSchema(com.evolveum.midpoint.schema.processor.ConnectorSchema) Element(org.w3c.dom.Element) ConnectorSchemaImpl(com.evolveum.midpoint.schema.processor.ConnectorSchemaImpl) PrismObject(com.evolveum.midpoint.prism.PrismObject)

Aggregations

PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ConnectorSchema (com.evolveum.midpoint.schema.processor.ConnectorSchema)1 ConnectorSchemaImpl (com.evolveum.midpoint.schema.processor.ConnectorSchemaImpl)1 Element (org.w3c.dom.Element)1