use of com.revolsys.record.schema.RecordDefinitionFactoryImpl in project com.revolsys.open by revolsys.
the class SaifReader method open.
/**
* Open a SAIF archive, extracting compressed archives to a temporary
* directory.
*/
@Override
public void open() {
if (!this.opened) {
this.opened = true;
try {
if (log.isDebugEnabled()) {
log.debug("Opening SAIF archive '" + this.file.getCanonicalPath() + "'");
}
if (this.file.isDirectory()) {
this.saifArchiveDirectory = this.file;
} else if (!this.file.exists()) {
throw new IllegalArgumentException("SAIF file " + this.file + " does not exist");
} else {
this.zipFile = new ZipFile(this.file);
}
if (log.isDebugEnabled()) {
log.debug(" Finished opening archive");
}
loadSchema();
loadExportedObjects();
loadSrid();
final GeometryFactory geometryFactory = GeometryFactory.fixed3d(this.srid, 1.0, 1.0, 1.0);
for (final RecordDefinition recordDefinition : ((RecordDefinitionFactoryImpl) this.recordDefinitionFactory).getRecordDefinitions()) {
final FieldDefinition geometryField = recordDefinition.getGeometryField();
if (geometryField != null) {
geometryField.setProperty(FieldProperties.GEOMETRY_FACTORY, geometryFactory);
}
}
} catch (final IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
}
use of com.revolsys.record.schema.RecordDefinitionFactoryImpl in project com.revolsys.open by revolsys.
the class SaifSchemaReader method loadSchema.
private RecordDefinitionFactory loadSchema(final CsnIterator iterator) throws IOException {
if (this.schema == null) {
this.schema = new RecordDefinitionFactoryImpl();
this.schema.addRecordDefinition(new RecordDefinitionImpl(PathName.newPathName("/AggregateType")));
this.schema.addRecordDefinition(new RecordDefinitionImpl(PathName.newPathName("/PrimitiveType")));
addExportedObjects();
}
while (iterator.next() != CsnIterator.END_DOCUMENT) {
this.currentSuperClasses.clear();
this.currentClass = null;
final Object definition = getDefinition(iterator);
if (definition instanceof RecordDefinition) {
final RecordDefinitionImpl recordDefinition = (RecordDefinitionImpl) definition;
setRecordDefinitionProperties(recordDefinition);
recordDefinition.setRecordDefinitionFactory(this.schema);
this.schema.addRecordDefinition(recordDefinition);
}
}
return this.schema;
}
Aggregations