Search in sources :

Example 1 with PrismContextImpl

use of com.evolveum.midpoint.prism.PrismContextImpl in project midpoint by Evolveum.

the class MidPointPrismContextFactory method createEmptyPrismContext.

public PrismContext createEmptyPrismContext() throws SchemaException, FileNotFoundException {
    SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
    PrismContextImpl context = PrismContextImpl.createEmptyContext(schemaRegistry);
    context.setDefinitionFactory(createDefinitionFactory());
    context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
    return context;
}
Also used : PrismContextImpl(com.evolveum.midpoint.prism.PrismContextImpl) SchemaRegistryImpl(com.evolveum.midpoint.prism.schema.SchemaRegistryImpl)

Example 2 with PrismContextImpl

use of com.evolveum.midpoint.prism.PrismContextImpl in project midpoint by Evolveum.

the class SchemaDocMojo method createInitializedPrismContext.

private PrismContext createInitializedPrismContext() throws MojoFailureException {
    try {
        SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
        for (File schemaFile : schemaFiles) {
            getLog().info("SchemaDoc: registering schema file: " + schemaFile);
            if (!schemaFile.exists()) {
                throw new MojoFailureException("Schema file " + schemaFile + " does not exist");
            }
            schemaRegistry.registerPrismSchemaFile(schemaFile);
        }
        if (catalogFiles != null && catalogFiles.length > 0) {
            for (File catalogFile : catalogFiles) {
                getLog().info("SchemaDoc: using catalog file: " + catalogFile);
                if (!catalogFile.exists()) {
                    throw new IOException("Catalog file '" + catalogFile + "' does not exist.");
                }
            }
            schemaRegistry.setCatalogFiles(catalogFiles);
        }
        PrismContextImpl context = PrismContextImpl.create(schemaRegistry);
        context.setDefinitionFactory(new SchemaDefinitionFactory());
        context.initialize();
        return context;
    } catch (SchemaException e) {
        handleFailure(e);
        // never reached
        return null;
    } catch (FileNotFoundException e) {
        handleFailure(e);
        // never reached
        return null;
    } catch (SAXException e) {
        handleFailure(e);
        // never reached
        return null;
    } catch (IOException e) {
        handleFailure(e);
        // never reached
        return null;
    }
}
Also used : SchemaDefinitionFactory(com.evolveum.midpoint.prism.schema.SchemaDefinitionFactory) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) MojoFailureException(org.apache.maven.plugin.MojoFailureException) PrismContextImpl(com.evolveum.midpoint.prism.PrismContextImpl) SchemaRegistryImpl(com.evolveum.midpoint.prism.schema.SchemaRegistryImpl) SAXException(org.xml.sax.SAXException)

Example 3 with PrismContextImpl

use of com.evolveum.midpoint.prism.PrismContextImpl in project midpoint by Evolveum.

the class MidPointPrismContextFactory method createPrismContext.

@Override
public PrismContext createPrismContext() throws SchemaException, FileNotFoundException {
    SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
    PrismContextImpl context = PrismContextImpl.create(schemaRegistry);
    context.setDefinitionFactory(createDefinitionFactory());
    context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
    if (InternalsConfig.isPrismMonitoring()) {
        context.setMonitor(new InternalMonitor());
    }
    return context;
}
Also used : InternalMonitor(com.evolveum.midpoint.schema.internals.InternalMonitor) PrismContextImpl(com.evolveum.midpoint.prism.PrismContextImpl) SchemaRegistryImpl(com.evolveum.midpoint.prism.schema.SchemaRegistryImpl)

Aggregations

PrismContextImpl (com.evolveum.midpoint.prism.PrismContextImpl)3 SchemaRegistryImpl (com.evolveum.midpoint.prism.schema.SchemaRegistryImpl)3 SchemaDefinitionFactory (com.evolveum.midpoint.prism.schema.SchemaDefinitionFactory)1 InternalMonitor (com.evolveum.midpoint.schema.internals.InternalMonitor)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 SAXException (org.xml.sax.SAXException)1