use of eu.esdihumboldt.hale.common.core.io.report.IOReport in project hale by halestudio.
the class GenerateDuplicates method writeAlignment.
private void writeAlignment() throws Exception {
System.out.println("Writing alignment to " + context.getOut().getAbsolutePath());
// create alignment writer
IContentType contentType = HalePlatform.getContentTypeManager().getContentType(ALIGNMENT_CONTENT_TYPE);
IOProviderDescriptor factory = HaleIO.findIOProviderFactory(AlignmentWriter.class, contentType, null);
AlignmentWriter writer = (AlignmentWriter) factory.createExtensionObject();
// configure alignment writer
writer.setSourceSchema(sourceSchema);
writer.setTargetSchema(targetSchema);
writer.setTarget(new FileIOSupplier(context.getOut()));
writer.setAlignment(alignment);
IOReport report = writer.execute(new NullProgressIndicator());
if (!report.isSuccess() || !report.getErrors().isEmpty()) {
throw new IllegalStateException("Errors while writing the alignment.");
} else {
System.out.println("Completed successfully.");
}
}
use of eu.esdihumboldt.hale.common.core.io.report.IOReport in project hale by halestudio.
the class CityGMLPropagate method writeAlignment.
private void writeAlignment() throws Exception {
System.out.println("Writing alignment to " + context.getOut().getAbsolutePath());
// create alignment writer
IContentType contentType = HalePlatform.getContentTypeManager().getContentType(ALIGNMENT_CONTENT_TYPE);
IOProviderDescriptor factory = HaleIO.findIOProviderFactory(AlignmentWriter.class, contentType, null);
AlignmentWriter writer = (AlignmentWriter) factory.createExtensionObject();
// configure alignment writer
writer.setSourceSchema(sourceSchema);
writer.setTargetSchema(targetSchema);
writer.setTarget(new FileIOSupplier(context.getOut()));
writer.setAlignment(alignment);
IOReport report = writer.execute(new NullProgressIndicator());
if (!report.isSuccess() || !report.getErrors().isEmpty()) {
throw new IllegalStateException("Errors while writing the alignment.");
} else {
System.out.println("Completed successfully.");
}
}
use of eu.esdihumboldt.hale.common.core.io.report.IOReport in project hale by halestudio.
the class CityGMLPropagate method loadCityGML.
private void loadCityGML() throws IOProviderConfigurationException, IOException {
System.out.println("Loading schema...");
LocatableInputSupplier<? extends InputStream> schemaIn = new DefaultInputSupplier(context.getSourceSchema());
SchemaReader schemaReader = HaleIO.findIOProvider(SchemaReader.class, schemaIn, context.getSourceSchema().getPath());
schemaReader.setSource(schemaIn);
IOReport report = schemaReader.execute(new NullProgressIndicator());
if (!report.isSuccess() || !report.getErrors().isEmpty()) {
throw new IllegalStateException("Failed to load schema");
}
cityGMLSource = schemaReader.getSchema();
}
use of eu.esdihumboldt.hale.common.core.io.report.IOReport in project hale by halestudio.
the class SkosCodeListTest method readCodeList_WithLanguage.
private CodeList readCodeList_WithLanguage(URI source, final String language) throws Exception {
SkosCodeListReader reader = new SkosCodeListReader() {
/**
* @see eu.esdihumboldt.hale.io.codelist.skos.reader.SkosCodeListReader#getLangauge()
*/
@Override
public String getLangauge() {
return language;
}
};
reader.setSource(new DefaultInputSupplier(source));
IOReport report = reader.execute(new LogProgressIndicator());
assertTrue(report.isSuccess());
return reader.getCodeList();
}
use of eu.esdihumboldt.hale.common.core.io.report.IOReport in project hale by halestudio.
the class CSVInstanceReaderTest method readCSVInstances.
private InstanceCollection readCSVInstances(String sourceLocation, String typeName, boolean skipFirst, Schema sourceSchema, String seperator, String quote, String escape, String decimal) throws Exception {
InstanceReader instanceReader = new CSVInstanceReader();
instanceReader.setSource(new DefaultInputSupplier(getClass().getResource(sourceLocation).toURI()));
instanceReader.setParameter(CommonSchemaConstants.PARAM_TYPENAME, Value.of(typeName));
instanceReader.setParameter(CommonSchemaConstants.PARAM_SKIP_FIRST_LINE, Value.of(skipFirst));
instanceReader.setParameter(CSVSchemaReader.PARAM_SEPARATOR, Value.of(seperator));
instanceReader.setParameter(CSVSchemaReader.PARAM_QUOTE, Value.of(quote));
instanceReader.setParameter(CSVSchemaReader.PARAM_ESCAPE, Value.of(escape));
instanceReader.setParameter(CSVSchemaReader.PARAM_DECIMAL, Value.of(decimal));
instanceReader.setSourceSchema(sourceSchema);
// Test instances
IOReport report = instanceReader.execute(null);
assertTrue("Data import was not successfull.", report.isSuccess());
return instanceReader.getInstances();
}
Aggregations