/** * 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 }
/** * 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"); }
/** * 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); } } }
@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); }
@Override public void removeData(Data data) throws DataStoreException { for (int i=0,n=datas.size();i<n;i++) { if (datas.get(i).equals(data)) { datas.remove(i); return; } } throw new DataStoreException("Data not found in asset list"); }
/** * 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 s = source; source = null; // Cleared first in case of failure. objects.clear(); if (s != null) try { s.close(); } catch (IOException e) { throw new DataStoreException(e); } } }
/** * @param params * @see #checkIdentifier(org.opengis.parameter.ParameterValueGroup) * @throws DataStoreException if identifier is not valid */ protected void ensureCanProcess(final ParameterValueGroup params) throws DataStoreException{ final boolean valid = canProcess(params); if(!valid){ throw new DataStoreException("Parameter values not supported by this factory."); } }
/** * Closes this netCDF store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing the netCDF file. */ @Override public synchronized void close() throws DataStoreException { metadata = null; try { decoder.close(); } catch (IOException e) { throw new DataStoreException(e); } }
/** * Closes this netCDF store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing the netCDF file. */ @Override public synchronized void close() throws DataStoreException { metadata = null; try { decoder.close(); } catch (IOException e) { throw new DataStoreException(e); } }
/** * 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 { object = null; final Closeable in = input(source); source = null; // Cleared first in case of failure. if (in != null) try { in.close(); } catch (IOException e) { throw new DataStoreException(e); } } }
/** * Closes this GeoTIFF store and releases any underlying resources. * * @throws DataStoreException if an error occurred while closing the GeoTIFF file. */ @Override public synchronized void close() throws DataStoreException { final Reader r = reader; reader = null; if (r != null) try { r.close(); } catch (IOException e) { throw new DataStoreException(e); } }
/** * 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 { object = null; final Closeable in = input(source); source = null; // Cleared first in case of failure. if (in != null) try { in.close(); } catch (IOException e) { throw new DataStoreException(e); } } }
/** * Returns the database model, analyzing the database schema when first needed. */ private synchronized Database model() throws DataStoreException { if (model == null) { try (Connection c = source.getConnection()) { model = new Database(this, c, source, tableNames, listeners); } catch (SQLException e) { throw new DataStoreException(Exceptions.unwrap(e)); } } return model; }
/** * If this decoder can handle the file content as features, returns handlers for them. * * @return {@inheritDoc} * @throws IOException if an I/O operation was necessary but failed. * @throws DataStoreException if a logical error occurred. */ @Override public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException { if ("trajectory".equalsIgnoreCase(stringValue(CF.FEATURE_TYPE))) try { return FeaturesInfo.create(this); } catch (IllegalArgumentException e) { throw new DataStoreException(e.getLocalizedMessage(), e); } return new FeaturesInfo[0]; }
/** * Returns the exception to throw when an I/O error occurred. */ private DataStoreException errorIO(final IOException e) { return new DataStoreException(errors().getString(Errors.Keys.CanNotRead_1, reader.input.filename), e); }
/** * Returns the resources (features or coverages) in this netCDF file. * * @return children resources that are components of this netCDF. * @throws DataStoreException if an error occurred while fetching the components. * * @since 0.8 */ @Override @SuppressWarnings("ReturnOfCollectionOrArrayField") public synchronized Collection<Resource> components() throws DataStoreException { if (components == null) try { components = UnmodifiableArrayList.<Resource>wrap(decoder.getDiscreteSampling()); } catch (IOException e) { throw new DataStoreException(e); } return components; }
/** * If this decoder can handle the file content as features, returns handlers for them. * * @return {@inheritDoc} * @throws IOException if an I/O operation was necessary but failed. * @throws DataStoreException if a logical error occurred. */ @Override public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException { if ("trajectory".equalsIgnoreCase(stringValue(CF.FEATURE_TYPE))) try { return FeaturesInfo.create(this); } catch (IllegalArgumentException | ArithmeticException e) { // Illegal argument is not a problem with content, but rather with configuration. throw new DataStoreException(e.getLocalizedMessage(), e); } return new FeaturesInfo[0]; }
/** * Returns a data store implementation associated with this provider. * * @param connector information about the storage (URL, path, <i>etc</i>). * @return a data store implementation associated with this provider for the given storage. * @throws DataStoreException if an error occurred while creating the data store instance. */ @Override public DataStore open(final StorageConnector connector) throws DataStoreException { try { return new Store(this, connector); } catch (IOException e) { throw new DataStoreException(Resources.format(Resources.Keys.CanNotReadDirectory_1, connector.getStorageName()), e); } }
public static DataStore open(DataStoreFactory factory, Map<String, ? extends Serializable> params) throws DataStoreException { final ParameterValueGroup prm; try { prm = Parameters.toParameter( forceIdentifier(factory, params), factory.getOpenParameters()); } catch (IllegalArgumentException ex) { throw new DataStoreException(ex); } return open(prm); }
/** * @see DataStoreFactory#create(org.opengis.parameter.ParameterValueGroup) */ public static DataStore create(DataStoreFactory factory, Map<String, ? extends Serializable> params) throws DataStoreException { final ParameterValueGroup prm; try { prm = Parameters.toParameter(DataStores.forceIdentifier(factory, params), factory.getOpenParameters()); } catch(IllegalArgumentException ex) { throw new DataStoreException(ex); } return factory.create(prm); }