Search in sources :

Example 1 with GlobalDynamicNamespacePrefixMapper

use of com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper in project midpoint by Evolveum.

the class PrismInternalTestUtil method constructPrismContext.

public static PrismContextImpl constructPrismContext(File extraSchema) throws SchemaException, FileNotFoundException {
    SchemaRegistryImpl schemaRegistry = new SchemaRegistryImpl();
    schemaRegistry.setCatalogResourceName(TEST_CATALOG_RESOURCE_NAME);
    DynamicNamespacePrefixMapper prefixMapper = new GlobalDynamicNamespacePrefixMapper();
    // Set default namespace?
    schemaRegistry.setNamespacePrefixMapper(prefixMapper);
    schemaRegistry.registerPrismDefaultSchemaResource("xml/ns/test/foo-1.xsd", "foo", ObjectFactory.class.getPackage());
    schemaRegistry.registerPrismSchemaResource("xml/ns/test/foo-types-1.xsd", "foot", null);
    schemaRegistry.registerPrismSchemaResource("xml/ns/public/types-3.xsd", "t", com.evolveum.prism.xml.ns._public.types_3.ObjectFactory.class.getPackage());
    schemaRegistry.registerPrismSchemaResource("xml/ns/public/query-3.xsd", "q", com.evolveum.prism.xml.ns._public.query_3.ObjectFactory.class.getPackage());
    schemaRegistry.registerPrismSchemasFromDirectory(SCHEMA_DIR);
    if (extraSchema != null) {
        schemaRegistry.registerPrismSchemaFile(extraSchema);
    }
    prefixMapper.registerPrefix(XMLConstants.W3C_XML_SCHEMA_NS_URI, DOMUtil.NS_W3C_XML_SCHEMA_PREFIX, false);
    prefixMapper.registerPrefix(PrismConstants.NS_ANNOTATION, PrismConstants.PREFIX_NS_ANNOTATION, false);
    prefixMapper.registerPrefix(PrismInternalTestUtil.NS_WEAPONS, PrismInternalTestUtil.NS_WEAPONS_PREFIX, false);
    return PrismContextImpl.create(schemaRegistry);
}
Also used : ObjectFactory(com.evolveum.midpoint.prism.foo.ObjectFactory) SchemaRegistryImpl(com.evolveum.midpoint.prism.schema.SchemaRegistryImpl) GlobalDynamicNamespacePrefixMapper(com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper) GlobalDynamicNamespacePrefixMapper(com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper) DynamicNamespacePrefixMapper(com.evolveum.midpoint.prism.xml.DynamicNamespacePrefixMapper)

Example 2 with GlobalDynamicNamespacePrefixMapper

use of com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper in project midpoint by Evolveum.

the class SchemaDocMojo method createSchemaRegistry.

@NotNull
private SchemaRegistryImpl createSchemaRegistry() throws SchemaException {
    SchemaRegistryImpl schemaRegistry = new SchemaRegistryImpl();
    schemaRegistry.setNamespacePrefixMapper(new GlobalDynamicNamespacePrefixMapper());
    return schemaRegistry;
}
Also used : SchemaRegistryImpl(com.evolveum.midpoint.prism.schema.SchemaRegistryImpl) GlobalDynamicNamespacePrefixMapper(com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with GlobalDynamicNamespacePrefixMapper

use of com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper in project midpoint by Evolveum.

the class MidPointPrismContextFactory method createSchemaRegistry.

@NotNull
private SchemaRegistryImpl createSchemaRegistry() throws SchemaException, FileNotFoundException {
    SchemaRegistryImpl schemaRegistry = new SchemaRegistryImpl();
    schemaRegistry.setDefaultNamespace(SchemaConstantsGenerated.NS_COMMON);
    schemaRegistry.setNamespacePrefixMapper(new GlobalDynamicNamespacePrefixMapper());
    registerBuiltinSchemas(schemaRegistry);
    registerExtensionSchemas(schemaRegistry);
    return schemaRegistry;
}
Also used : SchemaRegistryImpl(com.evolveum.midpoint.prism.schema.SchemaRegistryImpl) GlobalDynamicNamespacePrefixMapper(com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SchemaRegistryImpl (com.evolveum.midpoint.prism.schema.SchemaRegistryImpl)3 GlobalDynamicNamespacePrefixMapper (com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper)3 NotNull (org.jetbrains.annotations.NotNull)2 ObjectFactory (com.evolveum.midpoint.prism.foo.ObjectFactory)1 DynamicNamespacePrefixMapper (com.evolveum.midpoint.prism.xml.DynamicNamespacePrefixMapper)1