/** * Loads a subset of the grid coverage represented by this resource. * * @param domain desired grid extent and resolution, or {@code null} for reading the whole domain. * @param range 0-based index of sample dimensions to read, or an empty sequence for reading all ranges. * @return the grid coverage for the specified domain and range. * @throws DataStoreException if an error occurred while reading the grid coverage data. */ @Override public GridCoverage read(final GridGeometry domain, final int... range) throws DataStoreException { throw new DataStoreException("Not yet implemented."); // TODO }
/** * Returns a stream of all features contained in this dataset. * * @param parallel {@code true} for a parallel stream (if supported), or {@code false} for a sequential stream. * @return all features contained in this dataset. * @throws DataStoreException if an error occurred while creating the stream. */ @Override public Stream<AbstractFeature> features(final boolean parallel) throws DataStoreException { DataStoreException ex; Connection connection = null; try { connection = source.getConnection(); final Features iter = features(connection, new ArrayList<>(), null); return StreamSupport.stream(iter, parallel).onClose(iter); } catch (SQLException cause) { ex = new DataStoreException(Exceptions.unwrap(cause)); } if (connection != null) try { connection.close(); } catch (SQLException e) { ex.addSuppressed(e); } throw ex; }
/** * Closes this data store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing this data store. */ @Override public synchronized void close() throws DataStoreException { final Reader r = reader; reader = null; if (r != null) try { r.close(); } catch (Exception e) { final DataStoreException ds = new DataStoreException(e); try { super.close(); } catch (DataStoreException s) { ds.addSuppressed(s.getCause()); } throw ds; } super.close(); } }
throw new DataStoreContentException(getLocale(), "WKT", getDisplayName(), in).initCause(e); } catch (IOException e) { throw new DataStoreException(getLocale(), "WKT", getDisplayName(), in).initCause(e);
/** * Closes all children resources. */ @Override public synchronized void close() throws DataStoreException { final Collection<Resource> resources = components; if (resources != null) { components = null; // Clear first in case of failure. DataStoreException failure = null; for (final Resource r : resources) { if (r instanceof DataStore) try { ((DataStore) r).close(); } catch (DataStoreException ex) { if (failure == null) { failure = ex; } else { failure.addSuppressed(ex); } } } if (failure != null) { throw failure; } } } }
/** * Probes the given file by delegating to {@link DataStores#probeContentType(Object)}. * * @param path the path to the file to probe. * @return the content type or {@code null} if the file type is not recognized. * @throws IOException if an I/O error occurs while reading the file. * * @see java.nio.file.Files#probeContentType(Path) */ @Override public String probeContentType(final Path path) throws IOException { try { return DataStores.probeContentType(path); } catch (DataStoreException e) { final Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e); } } }
throw malformedHeader().initCause(cause);
throw new DataStoreContentException(getLocale(), "WKT", getDisplayName(), in).initCause(e); } catch (IOException e) { throw new DataStoreException(getLocale(), "WKT", getDisplayName(), in).initCause(e);
/** * Closes all children resources. */ @Override public synchronized void close() throws DataStoreException { final Collection<Resource> resources = components; if (resources != null) { components = null; // Clear first in case of failure. DataStoreException failure = null; for (final Resource r : resources) { if (r instanceof DataStore) try { ((DataStore) r).close(); } catch (DataStoreException ex) { if (failure == null) { failure = ex; } else { failure.addSuppressed(ex); } } } if (failure != null) { throw failure; } } } }
/** * Probes the given file by delegating to {@link DataStores#probeContentType(Object)}. * * @param path the path to the file to probe. * @return the content type or {@code null} if the file type is not recognized. * @throws IOException if an I/O error occurs while reading the file. * * @see java.nio.file.Files#probeContentType(Path) */ @Override public String probeContentType(final Path path) throws IOException { try { return DataStores.probeContentType(path); } catch (DataStoreException e) { final Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e); } } }
/** * Create a new storage location. * This method is intended to create from scratch a new storage location. * <br/> * If the purpose is to open an already existing storage use the open method : * @see DataStoreFactory#open(org.opengis.parameter.ParameterValueGroup) * * @param params * @return FeatureStore created store * @throws DataStoreException if parameters are incorrect or creation failed. */ public DataStore create(ParameterValueGroup params) throws DataStoreException { throw new DataStoreException("Store creation not supported"); }
throw e; } catch (Exception e) { throw new DataStoreException(e); } catch (Exception e) { if (failure == null) { failure = (e instanceof DataStoreException) ? (DataStoreException) e : new DataStoreException(e); } else { failure.addSuppressed(e);
throw new DataStoreException(getLocale(), StoreProvider.NAME, super.getDisplayName(), source).initCause(e); } catch (FactoryException e) { throw new DataStoreReferencingException(getLocale(), StoreProvider.NAME, super.getDisplayName(), source).initCause(e);
keepOpen = path; } catch (IOException | DataStoreException s) { e.addSuppressed(s);
/** * Closes this data store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing this data store. */ @Override public synchronized void close() throws DataStoreException { final BufferedReader s = source; source = null; // Cleared first in case of failure. if (s != null) try { s.close(); } catch (IOException e) { throw new DataStoreException(e); } } }
throw e; } catch (Exception e) { throw new DataStoreException(e); } catch (Exception e) { if (failure == null) { failure = (e instanceof DataStoreException) ? (DataStoreException) e : new DataStoreException(e); } else { failure.addSuppressed(e);
throw new DataStoreException(getLocale(), StoreProvider.NAME, super.getDisplayName(), source).initCause(e); } catch (FactoryException e) { throw new DataStoreReferencingException(getLocale(), StoreProvider.NAME, super.getDisplayName(), source).initCause(e);
@Override public <T> T load(Class<T> expectedType) throws DataStoreException { if (expectedType != null && !expectedType.isInstance(instance)) { throw new DataStoreException("Data object can not be mapped to type "+expectedType); } return expectedType.cast(instance); }
connector.closeAllExcept(null); } catch (DataStoreException s) { ex.addSuppressed(s); } catch (DirectoryIteratorException | UncheckedIOException ex) { throw new DataStoreException(canNotRead(), ex.getCause()); } catch (IOException ex) { throw new DataStoreException(canNotRead(), ex); } catch (BackingStoreException ex) { throw ex.unwrapOrRethrow(DataStoreException.class);
/** * Closes this data store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing this data store. */ @Override public synchronized void close() throws DataStoreException { final BufferedReader s = source; source = null; // Cleared first in case of failure. if (s != null) try { s.close(); } catch (IOException e) { throw new DataStoreException(e); } } }