use of com.revolsys.record.io.format.esri.gdb.xml.model.DEFeatureDataset in project com.revolsys.open by revolsys.
the class FileGdbRecordStore method newSchema.
private RecordStoreSchema newSchema(final PathName schemaPath, final SpatialReference spatialReference) {
synchronized (this.apiSync) {
synchronized (API_SYNC) {
final Geodatabase geodatabase = getGeodatabase();
if (geodatabase == null) {
return null;
} else {
try {
String parentCatalogPath = "\\";
RecordStoreSchema schema = getRootSchema();
for (final PathName childSchemaPath : schemaPath.getPaths()) {
if (childSchemaPath.length() > 1) {
RecordStoreSchema childSchema = schema.getSchema(childSchemaPath);
final String childCatalogPath = toCatalogPath(childSchemaPath);
if (!hasChildDataset(getGeodatabase(), parentCatalogPath, "Feature Dataset", childCatalogPath)) {
if (spatialReference != null) {
final DEFeatureDataset dataset = EsriXmlRecordDefinitionUtil.newDEFeatureDataset(childCatalogPath, spatialReference);
final String datasetDefinition = EsriGdbXmlSerializer.toString(dataset);
try {
geodatabase.createFeatureDataset(datasetDefinition);
} catch (final Throwable t) {
Logs.debug(this, datasetDefinition);
throw new RuntimeException("Unable to create feature dataset " + childCatalogPath, t);
}
}
}
if (childSchema == null) {
childSchema = newFeatureDatasetSchema(schema, childSchemaPath);
schema.addElement(childSchema);
}
schema = childSchema;
parentCatalogPath = childCatalogPath;
}
}
return schema;
} finally {
releaseGeodatabase();
}
}
}
}
}
Aggregations