Class Store
java.lang.Object
org.apache.sis.storage.DataStore
org.apache.sis.internal.storage.URIDataStore
org.apache.sis.internal.storage.xml.stream.StaxDataStore
org.apache.sis.internal.storage.gpx.Store
- All Implemented Interfaces:
AutoCloseable,ResourceOnFileSystem,StoreResource,DataSet,FeatureSet,Resource,Localized
- Direct Known Subclasses:
WritableStore
A data store backed by GPX files.
This store does not cache the feature instances.
Any new request for features will re-read from the file.
- Since:
- 0.8
- Version:
- 1.3
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.internal.storage.URIDataStore
URIDataStore.Provider -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.opengis.metadata.MetadataThe metadata, ornullif not yet parsed.private ReaderIf a reader has been created for parsing the metadata and has not yet been used for iterating over the features, that reader.(package private) final TypesTheFeatureTypefor routes, tracks, way points, etc.(package private) VersionVersion of the GPX file, ornullif unknown.Fields inherited from class org.apache.sis.internal.storage.xml.stream.StaxDataStore
encoding, locale, timezoneFields inherited from class org.apache.sis.internal.storage.URIDataStore
location -
Constructor Summary
ConstructorsConstructorDescriptionStore(StoreProvider provider, StorageConnector connector) Creates a new GPX store from the given file, URL or stream object. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this data store and releases any underlying resources.(package private) final voidCloses only the reader, without closing this store.final Stream<AbstractFeature>features(boolean parallel) Returns the stream of features.Optional<org.opengis.geometry.Envelope>Returns the spatiotemporal envelope of this resource.getFeatureType(String name) Deprecated.We are not sure yet if we will keep this method.(package private) final org.opengis.metadata.distribution.FormatReturns a more complete description of the GPX format.org.opengis.metadata.MetadataReturns information about the dataset as a whole.getType()Returns the base type of all GPX types.Returns the GPX file version.voidsetVersion(Version version) Sets the version of the file to write.Methods inherited from class org.apache.sis.internal.storage.xml.stream.StaxDataStore
getFormatName, getProviderMethods inherited from class org.apache.sis.internal.storage.URIDataStore
addTitleOrIdentifier, getComponentFiles, getIdentifier, getOpenParameters, getOriginator, getSpecifiedPath, location, parametersMethods inherited from class org.apache.sis.storage.DataStore
addListener, findResource, getDisplayName, getLocale, getNativeMetadata, removeListener, setLocale, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sis.storage.FeatureSet
subsetMethods inherited from interface org.apache.sis.storage.Resource
addListener, getIdentifier, removeListener
-
Field Details
-
version
Version versionVersion of the GPX file, ornullif unknown. -
metadata
private org.opengis.metadata.Metadata metadataThe metadata, ornullif not yet parsed. -
reader
If a reader has been created for parsing the metadata and has not yet been used for iterating over the features, that reader. Otherwisenull. Used for continuing XML parsing after metadata header instead of closing and reopening the file. -
types
TheFeatureTypefor routes, tracks, way points, etc. Currently alwaysTypes.DEFAULT, but we use a field for keepingReaderandWriterready to handle profiles or extensions.
-
-
Constructor Details
-
Store
Creates a new GPX store from the given file, URL or stream object. This constructor invokesStorageConnector.closeAllExcept(Object), keeping open only the needed resource.- Parameters:
provider- the provider of this data store, ornullif unspecified.connector- information about the storage (URL, stream, etc).- Throws:
DataStoreException- if an error occurred while opening the GPX file.
-
-
Method Details
-
getFormat
final org.opengis.metadata.distribution.Format getFormat()Returns a more complete description of the GPX format. The format will be part of the metadata returned bygetMetadata(). -
getVersion
Returns the GPX file version.- Returns:
- the GPX file version, or
nullif none. - Throws:
DataStoreException- if an error occurred while reading the metadata.
-
setVersion
Sets the version of the file to write.- Parameters:
version- the target GPX file format.- Throws:
DataStoreException- if an error occurred while setting the format.
-
getMetadata
Returns information about the dataset as a whole.- Specified by:
getMetadatain interfaceResource- Specified by:
getMetadatain classDataStore- Returns:
- information about the dataset, or
nullif none. - Throws:
DataStoreException- if an error occurred while reading the metadata.- See Also:
-
getEnvelope
Returns the spatiotemporal envelope of this resource.- Specified by:
getEnvelopein interfaceDataSet- Returns:
- the spatiotemporal resource extent.
- Throws:
DataStoreException- if an error occurred while reading or computing the envelope.
-
getType
Returns the base type of all GPX types.- Specified by:
getTypein interfaceFeatureSet- Returns:
- base type of all GPX types.
-
getFeatureType
Deprecated.We are not sure yet if we will keep this method. Decision is pending acquisition of more experience with the API proposed byFeatureSet.Returns the feature type for the given name. Thenameargument should be the result of callingGenericName.toString()on the name of one of the feature types in this data store.- Parameters:
name- the name or alias of the feature type to get.- Returns:
- the feature type of the given name or alias (never
null). - Throws:
IllegalNameException- if the given name was not found or is ambiguous.
-
features
Returns the stream of features. This store does not cache the features. Any new iteration over features will re-read from the file. The XML file is kept open until the feature stream is closed; callers should not modify the file while an iteration is in progress.- Specified by:
featuresin interfaceFeatureSet- Parameters:
parallel- ignored in current implementation.- Returns:
- a stream over all features in the XML file.
- Throws:
DataStoreException- if an error occurred while creating the feature stream.
-
closeReader
Closes only the reader, without closing this store. This method may be invoked before write operation.- Throws:
Exception
-
close
Closes this data store and releases any underlying resources.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classStaxDataStore- Throws:
DataStoreException- if an error occurred while closing this data store.- See Also:
-