Class AbstractProvider
java.lang.Object
org.apache.sis.storage.DataStoreProvider
org.apache.sis.internal.storage.URIDataStore.Provider
org.apache.sis.internal.storage.DocumentedStoreProvider
org.apache.sis.internal.storage.xml.AbstractProvider
- Direct Known Subclasses:
StaxDataStoreProvider,StoreProvider
Base class for providers of
DataStore implementations for XML files.
This base class does not assume that the data store will use any particular framework
(JAXB, StAX, etc).- Since:
- 0.8
- Version:
- 1.2
- Author:
- Martin Desruisseaux (Geomatys)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.storage.DataStoreProvider
DataStoreProvider.Prober<S> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe "application/xml" MIME type, used only ifprobeContent(StorageConnector)cannot determine a more accurate type.The mapping from XML namespaces to MIME types.The mapping from root elements to MIME types.Fields inherited from class org.apache.sis.internal.storage.URIDataStore.Provider
CREATE_PARAM, ENCODING, LOCATION_PARAMFields inherited from class org.apache.sis.storage.DataStoreProvider
CREATE, LOCATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprobeContent(StorageConnector connector) Returns the MIME type if the given storage appears to be supported by the data store.Methods inherited from class org.apache.sis.internal.storage.DocumentedStoreProvider
getFormat, getFormat, getShortNameMethods inherited from class org.apache.sis.internal.storage.URIDataStore.Provider
build, connector, descriptor, getOpenParameters, isWritableMethods inherited from class org.apache.sis.storage.DataStoreProvider
getLogger, getSupportedVersions, open, open, probeContent
-
Field Details
-
MIME_TYPE
The "application/xml" MIME type, used only ifprobeContent(StorageConnector)cannot determine a more accurate type.- See Also:
-
mimeForNameSpaces
The mapping from XML namespaces to MIME types. This map shall be populated by subclasses at construction time, then never modified anymore since we do not synchronize it.Example public MyDataStore() { mimeForNameSpaces.put("http://www.opengis.net/gml/3.2", "application/gml+xml"); mimeForNameSpaces.put("http://www.isotc211.org/2005/gmd", "application/vnd.iso.19139+xml"); mimeForNameSpaces.put("http://www.opengis.net/cat/csw/2.0.2", "application/vnd.ogc.csw_xml"); } -
mimeForRootElements
The mapping from root elements to MIME types. Used only if the root element is in the default namespace and contains noxmlnsattributes for that namespace.Example public MyDataStore() { mimeForRootElements.put("MD_Metadata", "application/vnd.iso.19139+xml"); }
-
-
Constructor Details
-
AbstractProvider
Creates a new provider. Subclasses shall populate themimeForNameSpacesmap with a mapping from their namespace to the MIME type to declare.- Parameters:
name- the primary key to use for searching in theMD_Formattable, ornullif none.
-
-
Method Details
-
probeContent
Returns the MIME type if the given storage appears to be supported by the data store. A supported status does not guarantee that reading or writing will succeed, only that there appears to be a reasonable chance of success based on a brief inspection of the file header.- Specified by:
probeContentin classDataStoreProvider- Parameters:
connector- information about the storage (URL, stream, JDBC connection, etc).- Returns:
- a supported status with the MIME type if the given storage seems to be readable as a XML file.
- Throws:
DataStoreException- if an I/O error occurred.
-