use of com.evolveum.midpoint.prism.schema.SchemaDefinitionFactory 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;
}
}
Aggregations