/** * DOCUMENT ME! * * @param query DOCUMENT ME! * @return DOCUMENT ME! * @throws IOException DOCUMENT ME! * @throws DataSourceException DOCUMENT ME! */ public int lockFeatures(Query query) throws IOException { if (source instanceof FeatureLocking) { return ((FeatureLocking<SimpleFeatureType, SimpleFeature>) source).lockFeatures(query); } else { throw new DataSourceException("FeatureTypeConfig does not supports locking"); } }
/** * If a definition query has been configured for the FeatureTypeInfo, makes and return a new * Filter that contains both the query's filter and the layer's definition one, by logic AND'ing * them. * * @param filter Origional user supplied Filter * @return Filter adjusted to the limitations of definitionQuery * @throws DataSourceException If the filter could not meet the limitations of definitionQuery */ protected Filter makeDefinitionFilter(Filter filter) throws DataSourceException { Filter newFilter = filter; try { if (definitionQuery != Filter.INCLUDE) { newFilter = ff.and(definitionQuery, filter); } } catch (Exception ex) { throw new DataSourceException("Can't create the definition filter", ex); } return newFilter; }
/** * Transforms the original feature type into a destination one according to the renaming rules. * For the moment, it's just a feature type name replacement * * @param original * @throws IOException */ protected SimpleFeatureType transformFeatureType(SimpleFeatureType original) throws IOException { String transfomedName = transformFeatureTypeName(original.getTypeName()); if (transfomedName.equals(original.getTypeName())) return original; try { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.init(original); b.setName(transfomedName); return b.buildFeatureType(); } catch (Exception e) { throw new DataSourceException("Could not build the renamed feature type.", e); } }
destinationToSourceTransform = CRS.findMathTransform(crs, this.crs, true); } catch (FactoryException e) { throw new DataSourceException("Unable to inspect request CRS", e);
/** * Retrieves the next row, or throws a DataSourceException if not more rows are available. * * @throws IOException */ public void next() throws IOException { if (this.currentRow == null) { throw new DataSourceException("There are no more rows"); } this.hasNextAlreadyCalled = false; }
throw new DataSourceException( "Could not restrict the query to the definition criteria: " + ex.getMessage(), ex);
@Override public void close() throws IOException { if (this.inputStream != null) { try { this.parser.setInput(null); this.parser = null; this.inputStream.close(); this.inputStream = null; } catch (XmlPullParserException e) { throw new DataSourceException(e); } } }
/** */ public String readFID() throws IOException { if (this.currentFid == -1) { throw new DataSourceException("The feature id was not fetched"); } this.fidPrefix.setLength(this.fidPrefixLen); this.fidPrefix.append(this.currentFid); return this.fidPrefix.toString(); }
return reprojectedQuery; } catch (Exception e) { throw new DataSourceException("Had troubles handling filter reprojection...", e);
throw new DataSourceException(e);
/** @see org.geotools.data.jdbc.attributeio.AttributeIO#read(java.sql.ResultSet, int) */ private Geometry readFromBytes(ResultSet rs, int columnIndex) throws IOException { try { return wkb2Geometry(rs.getBytes(columnIndex)); } catch (SQLException e) { throw new DataSourceException("SQL exception occurred while reading the geometry.", e); } }
/** @see org.geotools.data.jdbc.attributeio.AttributeIO#read(java.sql.ResultSet, int) */ private Geometry readFromBlob(ResultSet rs, int columnIndex) throws IOException { try { return doReadFromBlob(rs.getBlob(columnIndex)); } catch (SQLException e) { throw new DataSourceException("SQL exception occurred while reading the geometry.", e); } }
public SimpleFeature next() throws IOException, IllegalAttributeException, NoSuchElementException { if (iterator == null) { throw new IOException("Feature Reader has been closed"); } try { return SimpleFeatureBuilder.copy((SimpleFeature) iterator.next()); } catch (NoSuchElementException end) { throw new DataSourceException("There are no more Features", end); } }
schema = FeatureTypes.transform(schema, resultCRS); } catch (Exception e) { throw new DataSourceException("Problem forcing CRS onto feature type", e); info.getProjectionPolicy().getCode()); } catch (Exception e) { throw new DataSourceException("Creation of a versioning wrapper failed", e);
/** @see org.geotools.data.jdbc.attributeio.AttributeIO#read(java.sql.ResultSet, int) */ public Geometry read(ResultSet rs, int columnIndex) throws IOException { try { switch (rs.getMetaData().getColumnType(columnIndex)) { case Types.BLOB: return readFromBlob(rs, columnIndex); default: return readFromBytes(rs, columnIndex); } } catch (SQLException e) { throw new DataSourceException("SQL exception occurred while reading the geometry.", e); } }
/** @see org.geotools.data.jdbc.attributeio.AttributeIO#read(java.sql.ResultSet, int) */ public Object read(ResultSet rs, int columnIndex) throws IOException { try { byte bytes[] = rs.getBytes(columnIndex); if (bytes == null) // ie. its a null column -> return a null geometry! return null; return wkb2Geometry(Base64.decode(bytes)); } catch (SQLException e) { throw new DataSourceException("SQL exception occurred while reading the geometry.", e); } }
/** @see org.geotools.data.jdbc.attributeio.AttributeIO#read(java.sql.ResultSet, int) */ public Object read(ResultSet rs, String columnName) throws IOException { try { byte bytes[] = rs.getBytes(columnName); if (bytes == null) // ie. its a null column -> return a null geometry! return null; return wkb2Geometry(Base64.decode(bytes)); } catch (SQLException e) { throw new DataSourceException("SQL exception occurred while reading the geometry.", e); } }
private ListStoredQueriesResponseType parseStoredQueries( Document document, Configuration wfsConfig) throws DataSourceException { DOMParser parser = new DOMParser(wfsConfig, document); final Object parsed; try { parsed = parser.parse(); } catch (Exception e) { throw new DataSourceException("Exception parsing ListStoredQueriesResponse", e); } return (ListStoredQueriesResponseType) parsed; }
@Override protected SimpleFeatureType buildFeatureType() throws IOException { String typeName = getEntry().getTypeName(); String namespace = getEntry().getName().getNamespaceURI(); String typeSpec = property("_"); try { return DataUtilities.createType(namespace, typeName, typeSpec); } catch (SchemaException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); throw new DataSourceException(typeName + " schema not available", e); } }
public SimpleFeatureCollection getFeatures(Query query) throws IOException { String schemaName = wrapped.getSchema().getName().getLocalPart(); if (query.getTypeName() != null && !schemaName.equals(query.getTypeName())) { throw new DataSourceException( "Typename mismatch, query asks for '" + query.getTypeName() + " but this feature source provides '" + schemaName + "'"); } return getFeatureCollection(query, getEnvelope(query.getFilter())); }