@Override public FeatureStoreTransaction acquireTransaction() throws FeatureStoreException { throw new FeatureStoreException( "The shape datastore is currently not transactional." ); }
@Override public LockManager getLockManager() throws FeatureStoreException { throw new FeatureStoreException( "The shape datastore is currently not transactional." ); }
@Override public GMLObject getObjectById( String id ) throws FeatureStoreException { // TODO throw new FeatureStoreException( "This feature is currently not implemented for the shape datastore." ); }
public FeatureStoreTransaction acquireTransaction() throws FeatureStoreException { throw new FeatureStoreException( "Transactions are not implemented for the simple SQL datastore." ); }
public LockManager getLockManager() throws FeatureStoreException { throw new FeatureStoreException( "Transactions are not implemented for the simple SQL datastore." ); }
public GMLObject getObjectById( String id ) throws FeatureStoreException { throw new FeatureStoreException( "Getting objects by id is not implemented for the simple SQL datastore." ); }
private ColumnMetadataOld getColumn( TableName qTable, SQLIdentifier columnName ) throws SQLException, FeatureStoreException { ColumnMetadataOld md = getColumns( qTable ).get( columnName ); if ( md == null ) { throw new FeatureStoreException( "Table '" + qTable + "' does not have a column with name '" + columnName + "'" ); } return md; }
private Object checkFIDParticle( SQLIdentifier column ) throws FeatureStoreException { Object value = get( column ); if ( value == null ) { throw new FeatureStoreException( "FIDMapping error: No value for feature id column '" + column + "'." ); } return value; }
@Override public void rollback() throws FeatureStoreException { LOG.debug( "Performing rollback of transaction." ); try { conn.rollback(); } catch ( SQLException e ) { LOG.debug( e.getMessage(), e ); throw new FeatureStoreException( "Unable to rollback SQL transaction: " + e.getMessage() ); } finally { fs.closeAndDetachTransactionConnection(); } }
@Override public void commit() throws FeatureStoreException { LOG.debug( "Committing transaction." ); try { conn.commit(); updateBBoxCache(); } catch ( Throwable t ) { LOG.debug( t.getMessage(), t ); throw new FeatureStoreException( "Unable to commit SQL transaction: " + t.getMessage() ); } finally { fs.closeAndDetachTransactionConnection(); } }
private ColumnMetadata getColumn( TableName qTable, SQLIdentifier columnName ) throws SQLException, FeatureStoreException { ColumnMetadata md = getColumnMetadataFromDb( qTable ).get( columnName ); if ( md == null ) md = getUnescapedColumnMetadata( qTable, columnName ); if ( md == null ) { throw new FeatureStoreException( "Table '" + qTable + "' does not have a column with name '" + columnName + "'" ); } return md; }
@Override public FeatureStoreTransaction acquireTransaction() throws FeatureStoreException { SQLFeatureStoreTransaction ta = null; try { final Connection conn = getConnection(); conn.setAutoCommit( false ); ta = new SQLFeatureStoreTransaction( this, conn, getSchema(), inspectors ); transaction.set( ta ); } catch ( SQLException e ) { throw new FeatureStoreException( "Unable to acquire JDBC connection for transaction: " + e.getMessage(), e ); } return ta; }
private void checkForDuplicateIds( final Feature feature ) throws FeatureStoreException { final IdChecker idChecker = new IdChecker(); try { new GMLObjectWalker( idChecker ).traverse( feature ); } catch ( final Exception e ) { throw new FeatureStoreException( e.getMessage() ); } }
@Override public Envelope calcEnvelope( QName ftName ) throws FeatureStoreException { Envelope env = null; Connection conn = null; try { conn = getConnection(); env = calcEnvelope( ftName, conn ); } catch ( SQLException e ) { throw new FeatureStoreException( e.getMessage() ); } finally { release( null, null, conn ); } return env; }
@Override void performInsert( Connection conn, boolean propagateAutoGenColumns ) throws SQLException, FeatureStoreException { super.performInsert( conn, propagateAutoGenColumns ); newId = buildNewFid(); if ( newId == null ) { String msg = "Internal/configuration error. Feature id must be assignable after feature row INSERT."; throw new FeatureStoreException( msg ); } // clear everything, but keep key columns (values may still be needed by referencing rows) Map<SQLIdentifier, Object> keyColumnToValue = new HashMap<SQLIdentifier, Object>(); Set<SQLIdentifier> genColumns = mgr.getKeyColumns( table ); if ( genColumns != null ) { for ( SQLIdentifier genColumn : genColumns ) { keyColumnToValue.put( genColumn, get( genColumn ) ); } } columnToLiteral.clear(); columnToObject.clear(); columnToObject.putAll( keyColumnToValue ); }
@Override public void commit() throws FeatureStoreException { try { sf.rebuildIndexes(); } catch ( UnknownCRSException e ) { throw new FeatureStoreException( e.getMessage() ); } fs.releaseTransaction( this, sf ); }
@Override public String performReplace( Feature replacement, Filter filter, Lock lock, IDGenMode idGenMode ) throws FeatureStoreException { if ( filter instanceof IdFilter ) { performDelete( (IdFilter) filter, lock ); } else { performDelete( replacement.getName(), (OperatorFilter) filter, lock ); } GenericFeatureCollection col = new GenericFeatureCollection(); col.add( replacement ); List<String> ids = performInsert( col, USE_EXISTING ); if ( ids.isEmpty() || ids.size() > 1 ) { throw new FeatureStoreException( "Unable to determine new feature id." ); } return ids.get( 0 ); }
@Override public String performReplace( final Feature replacement, final Filter filter, final Lock lock, final IDGenMode idGenMode ) throws FeatureStoreException { if ( filter instanceof IdFilter ) { performDelete( (IdFilter) filter, lock ); } else { performDelete( replacement.getName(), (OperatorFilter) filter, lock ); } final GenericFeatureCollection col = new GenericFeatureCollection(); col.add( replacement ); final List<String> ids = performInsert( col, USE_EXISTING ); if ( ids.isEmpty() || ids.size() > 1 ) { throw new FeatureStoreException( "Unable to determine new feature id." ); } return ids.get( 0 ); }
private IdFilter getIdFilter( QName ftName, OperatorFilter filter ) throws FeatureStoreException { Set<String> ids = new HashSet<String>(); Query query = new Query( ftName, filter, -1, -1, -1 ); FeatureInputStream rs = null; try { rs = fs.query( query ); for ( Feature feature : rs ) { ids.add( feature.getId() ); } } catch ( FilterEvaluationException e ) { throw new FeatureStoreException( e ); } finally { if ( rs != null ) { rs.close(); } } return new IdFilter( ids ); }
/** * Creates a new {@link StoredFeatures} instance. * * @param schema * application schema, must not be <code>null</code> * @param storageCRS * target CRS for stored geometries, can be <code>null</code> (no CRS normalization) * @param former * stored features to copy from, can be <code>null</code> (new instance will be empty) * @throws FeatureStoreException */ StoredFeatures( AppSchema schema, ICRS storageCRS, StoredFeatures former ) throws FeatureStoreException { this.schema = schema; this.storageCRS = storageCRS; initFtToFeaturesMap( schema, former ); try { rebuildIndexes(); } catch ( UnknownCRSException e ) { throw new FeatureStoreException( e.getMessage(), e ); } }