use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class PointReader method newRecordDefinition.
default RecordDefinition newRecordDefinition(final String name) {
final GeometryFactory geometryFactory = getGeometryFactory();
final RecordDefinition recordDefinition = //
new RecordDefinitionBuilder(name).addField("POINT", //
DataTypes.POINT).setGeometryFactory(//
geometryFactory).getRecordDefinition();
return recordDefinition;
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class Json method toString.
public static final String toString(final Record object) {
final RecordDefinition recordDefinition = object.getRecordDefinition();
final StringWriter writer = new StringWriter();
final JsonRecordWriter recordWriter = new JsonRecordWriter(recordDefinition, writer);
recordWriter.setProperty(IoConstants.SINGLE_OBJECT_PROPERTY, Boolean.TRUE);
recordWriter.write(object);
recordWriter.close();
return writer.toString();
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class MoepRecordDefinitionFactory method getRecordDefinition.
@Override
public RecordDefinition getRecordDefinition(final String typePath) {
synchronized (RECORD_DEFINITION_CACHE) {
RecordDefinition recordDefinition = RECORD_DEFINITION_CACHE.get(typePath);
if (recordDefinition == null) {
recordDefinition = MoepConstants.newRecordDefinition(typePath);
RECORD_DEFINITION_CACHE.put(typePath, recordDefinition);
}
return recordDefinition;
}
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class SaifWriter method getSerializer.
private OsnSerializer getSerializer(final String typePath) throws IOException {
OsnSerializer serializer = this.serializers.get(typePath);
if (serializer == null) {
initialize();
try {
final RecordDefinition compositeType = getCompositeType(typePath);
if (compositeType != null) {
final String objectSubsetName = getObjectSubsetName(typePath);
if (this.maxSubsetSize != Long.MAX_VALUE) {
FileUtil.deleteFiles(this.tempDirectory, ObjectSetUtil.getObjectSubsetPrefix(objectSubsetName) + "...osn");
serializer = newSerializer(typePath, new File(this.tempDirectory, objectSubsetName), this.maxSubsetSize);
} else {
serializer = newSerializer(typePath, new File(this.tempDirectory, objectSubsetName), Long.MAX_VALUE);
}
if (compositeType.isInstanceOf(this.annotatedSpatialDataSetType)) {
serializer.startObject(compositeType.getPath());
serializer.fieldName("objectIdentifier");
final String objectIdentifier = getObjectIdentifier(typePath);
serializer.attributeValue(objectIdentifier);
serializer.endLine();
serializer.serializeIndent();
serializer.fieldName("annotationComponents");
serializer.startCollection("Set");
} else if (compositeType.isInstanceOf(this.spatialDataSetType)) {
serializer.startObject(compositeType.getPath());
serializer.fieldName("objectIdentifier");
final String objectIdentifier = getObjectIdentifier(typePath);
serializer.attributeValue(objectIdentifier);
serializer.endLine();
serializer.serializeIndent();
serializer.fieldName("geoComponents");
serializer.startCollection("Set");
}
addExport(typePath, compositeType.getPath(), objectSubsetName);
this.serializers.put(typePath, serializer);
} else if (typePath.equals("/ImportedObjects")) {
serializer = newSerializer("/ImportedObject", new File(this.tempDirectory, "imports.dir"), Long.MAX_VALUE);
this.serializers.put(typePath, serializer);
} else if (PathUtil.getName(typePath).endsWith("InternallyReferencedObjects")) {
serializer = newSerializer("/InternallyReferencedObject", new File(this.tempDirectory, "internal.dir"), Long.MAX_VALUE);
this.serializers.put(typePath, serializer);
} else if (PathUtil.getName(typePath).endsWith("GlobalMetadata")) {
serializer = newSerializer(GLOBAL_METADATA, new File(this.tempDirectory, "globmeta.osn"), Long.MAX_VALUE);
addExport(typePath, typePath, "globmeta.osn");
this.serializers.put(typePath, serializer);
}
} catch (final IOException e) {
log.error("Unable to create serializer: " + e.getMessage(), e);
}
}
return serializer;
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class SaifSchemaReader method subclass.
public void subclass(final RecordDefinition type, final CsnIterator iterator) throws IOException {
if (iterator.next() == CsnIterator.CLASS_NAME) {
final String className = iterator.getPathValue();
this.currentClass = new RecordDefinitionImpl(PathName.newPathName(className));
for (final RecordDefinition superClassDef : this.currentSuperClasses) {
addSuperClass(this.currentClass, superClassDef);
}
// currentClass.setName(className);
this.schema.addRecordDefinition(this.currentClass);
}
}
Aggregations