use of eu.esdihumboldt.hale.common.schema.model.constraint.factory.OsgiClassResolver in project hale by halestudio.
the class HaleSchemaReaderJson method execute.
@Override
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException {
progress.begin("Load schema", ProgressIndicator.UNKNOWN);
try (InputStream in = getSource().getInput();
Reader reader = new InputStreamReader(in, getCharset())) {
Iterable<Schema> schemas = new JsonToSchema(null, new OsgiClassResolver(), reporter).parseSchemas(reader);
List<Schema> schemaList = StreamSupport.stream(schemas.spliterator(), false).collect(Collectors.toList());
if (!schemaList.isEmpty()) {
schema = HaleSchemaUtil.combineSchema(schemaList, reporter);
reporter.setSuccess(true);
} else {
reporter.setSuccess(false);
reporter.setSummary("No schema definition found");
}
} catch (Exception e) {
reporter.error(new IOMessageImpl(e.getMessage(), e));
reporter.setSuccess(false);
} finally {
progress.end();
}
return reporter;
}
use of eu.esdihumboldt.hale.common.schema.model.constraint.factory.OsgiClassResolver in project hale by halestudio.
the class AbstractCachedSchemaReader method loadFromCache.
@Override
protected Schema loadFromCache(Value cache, ProgressIndicator progress, IOReporter reporter) {
Schema schema = null;
progress.begin("Load schema from cached schema definition", ProgressIndicator.UNKNOWN);
try {
schema = XmlToSchema.parseSchema(cache.getDOMRepresentation(), new OsgiClassResolver(), reporter);
reporter.setSuccess(true);
} catch (Exception e) {
reporter.error(new IOMessageImpl(e.getMessage(), e));
reporter.setSuccess(false);
} finally {
progress.end();
}
return schema;
}
use of eu.esdihumboldt.hale.common.schema.model.constraint.factory.OsgiClassResolver in project hale by halestudio.
the class HaleSchemaReader method execute.
@Override
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException {
progress.begin("Load schema", ProgressIndicator.UNKNOWN);
try (InputStream in = getSource().getInput();
Reader reader = new InputStreamReader(in, getCharset())) {
schema = XmlToSchema.parseSchema(reader, new OsgiClassResolver(), reporter);
reporter.setSuccess(true);
} catch (Exception e) {
reporter.error(new IOMessageImpl(e.getMessage(), e));
reporter.setSuccess(false);
} finally {
progress.end();
}
return reporter;
}
Aggregations