this.nullEscalation = nullEscalation; this.nsBindings = new NamespaceBindings(); for ( String prefix : fs.getNamespaceContext().keySet() ) { String ns = fs.getNamespaceContext().get( prefix ); nsBindings.addNamespace( prefix, ns );
private byte[] encodeFeatureBlob( final Feature feature, ICRS crs ) throws FactoryConfigurationError, SQLException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { final BlobCodec codec = fs.getSchema().getBlobMapping().getCodec(); codec.encode( feature, fs.getNamespaceContext(), bos, crs ); } catch ( Exception e ) { String msg = "Error encoding feature for BLOB: " + e.getMessage(); LOG.error( msg ); LOG.trace( "Stack trace:", e ); throw new SQLException( msg, e ); } byte[] bytes = bos.toByteArray(); return bytes; }
LOG.debug( "Recreating object '" + id + "' from bytea." ); BlobCodec codec = blobMapping.getCodec(); geomOrFeature = codec.decode( rs.getBinaryStream( 1 ), getNamespaceContext(), getSchema(), blobMapping.getCRS(), resolver ); if ( getCache() != null ) {
@Override public Feature buildFeature( ResultSet rs ) throws SQLException { Feature feature = null; try { String gmlId = rs.getString( 1 ); if ( fs.getCache() != null ) { feature = (Feature) fs.getCache().get( gmlId ); } if ( feature == null ) { LOG.debug( "Recreating object '" + gmlId + "' from db (BLOB/hybrid mode)." ); feature = (Feature) codec.decode( rs.getBinaryStream( 2 ), fs.getNamespaceContext(), fs.getSchema(), crs, fs.getResolver() ); if ( fs.getCache() != null ) { fs.getCache().add( feature ); } } else { LOG.debug( "Cache hit." ); } fs.checkIfFeatureTypIsRequested( typeNames, feature.getType() ); } catch ( Exception e ) { String msg = "Cannot recreate feature from result set: " + e.getMessage(); throw new SQLException( msg, e ); } return feature; }