Search in sources :

Example 6 with Table

use of com.revolsys.gis.esri.gdb.file.capi.swig.Table in project com.revolsys.open by revolsys.

the class FileGdbWriter method insertRecord.

private void insertRecord(final Record record) {
    final Table table = getTable(record);
    this.recordStore.insertRecord(table, record);
}
Also used : Table(com.revolsys.gis.esri.gdb.file.capi.swig.Table)

Example 7 with Table

use of com.revolsys.gis.esri.gdb.file.capi.swig.Table in project com.revolsys.open by revolsys.

the class FileGdbRecordStore method closeTables.

private void closeTables() {
    synchronized (this.apiSync) {
        if (!this.tableByCatalogPath.isEmpty()) {
            final Geodatabase geodatabase = getGeodatabase();
            if (geodatabase != null) {
                try {
                    for (final Table table : this.tableByCatalogPath.values()) {
                        try {
                            table.setLoadOnlyMode(false);
                            table.freeWriteLock();
                            geodatabase.closeTable(table);
                        } catch (final Throwable e) {
                        } finally {
                            try {
                                table.delete();
                            } catch (final Throwable t) {
                            }
                        }
                    }
                    this.tableByCatalogPath.clear();
                    this.tableReferenceCountsByCatalogPath.clear();
                    this.tableWriteLockCountsByCatalogPath.clear();
                } finally {
                    releaseGeodatabase();
                }
            }
        }
    }
}
Also used : Geodatabase(com.revolsys.gis.esri.gdb.file.capi.swig.Geodatabase) CodeTable(com.revolsys.record.code.CodeTable) DETable(com.revolsys.record.io.format.esri.gdb.xml.model.DETable) Table(com.revolsys.gis.esri.gdb.file.capi.swig.Table) FileGdbDomainCodeTable(com.revolsys.gis.esri.gdb.file.capi.FileGdbDomainCodeTable)

Example 8 with Table

use of com.revolsys.gis.esri.gdb.file.capi.swig.Table in project com.revolsys.open by revolsys.

the class FileGdbRecordStore method updateRecord.

@Override
public void updateRecord(final Record record) {
    if (record == null) {
    } else {
        final RecordDefinition recordDefinition = record.getRecordDefinition();
        final Table table = getTableWithWriteLock(recordDefinition);
        try {
            updateRecord(table, record);
        } finally {
            releaseTableAndWriteLock(recordDefinition);
        }
    }
}
Also used : CodeTable(com.revolsys.record.code.CodeTable) DETable(com.revolsys.record.io.format.esri.gdb.xml.model.DETable) Table(com.revolsys.gis.esri.gdb.file.capi.swig.Table) FileGdbDomainCodeTable(com.revolsys.gis.esri.gdb.file.capi.FileGdbDomainCodeTable) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 9 with Table

use of com.revolsys.gis.esri.gdb.file.capi.swig.Table in project com.revolsys.open by revolsys.

the class FileGdbRecordStore method getTable.

protected Table getTable(final RecordDefinition recordDefinition) {
    synchronized (this.apiSync) {
        synchronized (API_SYNC) {
            final RecordDefinition fgdbRecordDefinition = getRecordDefinition(recordDefinition);
            if (!isExists() || fgdbRecordDefinition == null) {
                return null;
            } else {
                try {
                    final Geodatabase geodatabase = getGeodatabase();
                    if (geodatabase == null) {
                        return null;
                    } else {
                        final String catalogPath = getCatalogPath(fgdbRecordDefinition);
                        try {
                            Table table = this.tableByCatalogPath.get(catalogPath);
                            if (table == null) {
                                table = this.geodatabase.openTable(catalogPath);
                                if (table != null) {
                                    if (this.tableByCatalogPath.isEmpty()) {
                                        this.geodatabaseReferenceCount++;
                                    }
                                    Maps.addCount(this.tableReferenceCountsByCatalogPath, catalogPath);
                                    this.tableByCatalogPath.put(catalogPath, table);
                                }
                            } else {
                                Maps.addCount(this.tableReferenceCountsByCatalogPath, catalogPath);
                            }
                            return table;
                        } catch (final RuntimeException e) {
                            throw new RuntimeException("Unable to open table " + catalogPath, e);
                        }
                    }
                } finally {
                    releaseGeodatabase();
                }
            }
        }
    }
}
Also used : Geodatabase(com.revolsys.gis.esri.gdb.file.capi.swig.Geodatabase) CodeTable(com.revolsys.record.code.CodeTable) DETable(com.revolsys.record.io.format.esri.gdb.xml.model.DETable) Table(com.revolsys.gis.esri.gdb.file.capi.swig.Table) FileGdbDomainCodeTable(com.revolsys.gis.esri.gdb.file.capi.FileGdbDomainCodeTable) VectorOfWString(com.revolsys.gis.esri.gdb.file.capi.swig.VectorOfWString) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 10 with Table

use of com.revolsys.gis.esri.gdb.file.capi.swig.Table in project com.revolsys.open by revolsys.

the class FileGdbRecordStore method insertRecord.

@Override
public void insertRecord(final Record record) {
    if (record == null) {
    } else {
        final RecordDefinition recordDefinition = record.getRecordDefinition();
        final Table table = getTableWithWriteLock(recordDefinition);
        try {
            insertRecord(table, record);
        } finally {
            releaseTableAndWriteLock(recordDefinition);
        }
    }
}
Also used : CodeTable(com.revolsys.record.code.CodeTable) DETable(com.revolsys.record.io.format.esri.gdb.xml.model.DETable) Table(com.revolsys.gis.esri.gdb.file.capi.swig.Table) FileGdbDomainCodeTable(com.revolsys.gis.esri.gdb.file.capi.FileGdbDomainCodeTable) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

Table (com.revolsys.gis.esri.gdb.file.capi.swig.Table)14 FileGdbDomainCodeTable (com.revolsys.gis.esri.gdb.file.capi.FileGdbDomainCodeTable)10 CodeTable (com.revolsys.record.code.CodeTable)10 DETable (com.revolsys.record.io.format.esri.gdb.xml.model.DETable)10 Geodatabase (com.revolsys.gis.esri.gdb.file.capi.swig.Geodatabase)6 RecordDefinition (com.revolsys.record.schema.RecordDefinition)5 VectorOfWString (com.revolsys.gis.esri.gdb.file.capi.swig.VectorOfWString)4 ObjectException (com.revolsys.beans.ObjectException)2 ObjectPropertyException (com.revolsys.beans.ObjectPropertyException)2 PathName (com.revolsys.io.PathName)1 DEFeatureClass (com.revolsys.record.io.format.esri.gdb.xml.model.DEFeatureClass)1 Field (com.revolsys.record.io.format.esri.gdb.xml.model.Field)1 SpatialReference (com.revolsys.record.io.format.esri.gdb.xml.model.SpatialReference)1 RecordDefinitionImpl (com.revolsys.record.schema.RecordDefinitionImpl)1 RecordStoreSchema (com.revolsys.record.schema.RecordStoreSchema)1