Search in sources :

Example 86 with RecordDefinition

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;
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 87 with 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();
}
Also used : StringWriter(java.io.StringWriter) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 88 with RecordDefinition

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;
    }
}
Also used : RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 89 with 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;
}
Also used : OsnSerializer(com.revolsys.record.io.format.saif.util.OsnSerializer) IOException(java.io.IOException) File(java.io.File) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 90 with RecordDefinition

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);
    }
}
Also used : RecordDefinitionImpl(com.revolsys.record.schema.RecordDefinitionImpl) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

RecordDefinition (com.revolsys.record.schema.RecordDefinition)189 FieldDefinition (com.revolsys.record.schema.FieldDefinition)38 Record (com.revolsys.record.Record)34 Geometry (com.revolsys.geometry.model.Geometry)20 CodeTable (com.revolsys.record.code.CodeTable)19 Query (com.revolsys.record.query.Query)18 LineString (com.revolsys.geometry.model.LineString)17 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)16 PathName (com.revolsys.io.PathName)13 ArrayList (java.util.ArrayList)12 DataType (com.revolsys.datatype.DataType)11 Identifier (com.revolsys.identifier.Identifier)11 RecordReader (com.revolsys.record.io.RecordReader)11 RecordStore (com.revolsys.record.schema.RecordStore)11 HashMap (java.util.HashMap)9 VectorOfWString (com.revolsys.gis.esri.gdb.file.capi.swig.VectorOfWString)8 ArrayRecord (com.revolsys.record.ArrayRecord)8 RecordDefinitionImpl (com.revolsys.record.schema.RecordDefinitionImpl)6 Table (com.revolsys.gis.esri.gdb.file.capi.swig.Table)5 RecordWriter (com.revolsys.record.io.RecordWriter)5