Search in sources :

Example 1 with PrismContextImpl

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

the class MidPointPrismContextFactory method createEmptyPrismContext.

public PrismContext createEmptyPrismContext() throws SchemaException, IOException {
    SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
    PrismContextImpl context = PrismContextImpl.createEmptyContext(schemaRegistry);
    context.setDefinitionFactory(createDefinitionFactory());
    context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
    context.setObjectsElementName(SchemaConstants.C_OBJECTS);
    context.setDefaultReferenceTypeName(ObjectReferenceType.COMPLEX_TYPE);
    context.setExtensionContainerTypeName(ExtensionType.COMPLEX_TYPE);
    return context;
}
Also used : PrismContextImpl(com.evolveum.midpoint.prism.impl.PrismContextImpl) SchemaRegistryImpl(com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl)

Example 2 with PrismContextImpl

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

the class MidPointPrismContextFactory method createPrismContext.

@Override
public PrismContext createPrismContext() throws SchemaException, IOException {
    SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
    PrismContextImpl context = PrismContextImpl.create(schemaRegistry);
    context.setDefinitionFactory(createDefinitionFactory());
    context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
    context.setObjectsElementName(SchemaConstants.C_OBJECTS);
    context.setDefaultReferenceTypeName(ObjectReferenceType.COMPLEX_TYPE);
    context.setExtensionContainerTypeName(ExtensionType.COMPLEX_TYPE);
    if (InternalsConfig.isPrismMonitoring()) {
        context.setMonitor(new InternalMonitor());
    }
    context.setParsingMigrator(new MidpointParsingMigrator());
    context.setValueMetadataFactory(new MidpointValueMetadataFactory(context));
    context.setProvenanceEquivalenceStrategy(MidpointProvenanceEquivalenceStrategy.INSTANCE);
    context.registerQueryExpressionFactory(new PrismQueryExpressionSupport());
    return context;
}
Also used : InternalMonitor(com.evolveum.midpoint.schema.internals.InternalMonitor) MidpointValueMetadataFactory(com.evolveum.midpoint.schema.metadata.MidpointValueMetadataFactory) PrismContextImpl(com.evolveum.midpoint.prism.impl.PrismContextImpl) SchemaRegistryImpl(com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl)

Example 3 with PrismContextImpl

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

the class TestParseResource method testParseResourceDom.

// todo eliminate dependency on prism-impl
@Test
public void testParseResourceDom() throws Exception {
    if (!"xml".equals(language)) {
        return;
    }
    // GIVEN
    PrismContext prismContext = getPrismContext();
    // WHEN
    DomLexicalProcessor parserDom = ((PrismContextImpl) prismContext).getParserDom();
    RootXNode xnode = parserDom.read(new ParserFileSource(getFile(TestConstants.RESOURCE_FILE_BASENAME)), createDefaultParsingContext());
    PrismObject<ResourceType> resource = prismContext.parserFor(xnode).parse();
    // THEN
    System.out.println("Parsed resource:");
    System.out.println(resource.debugDump());
    assertResource(resource, true, true, false);
}
Also used : DomLexicalProcessor(com.evolveum.midpoint.prism.impl.lex.dom.DomLexicalProcessor) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) PrismContextImpl(com.evolveum.midpoint.prism.impl.PrismContextImpl) Test(org.testng.annotations.Test)

Aggregations

PrismContextImpl (com.evolveum.midpoint.prism.impl.PrismContextImpl)3 SchemaRegistryImpl (com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl)2 DomLexicalProcessor (com.evolveum.midpoint.prism.impl.lex.dom.DomLexicalProcessor)1 RootXNode (com.evolveum.midpoint.prism.xnode.RootXNode)1 InternalMonitor (com.evolveum.midpoint.schema.internals.InternalMonitor)1 MidpointValueMetadataFactory (com.evolveum.midpoint.schema.metadata.MidpointValueMetadataFactory)1 Test (org.testng.annotations.Test)1