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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.storage.DataStoreProvider
DataStoreProvider.Prober<S>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]
The expected XML header.static final String
The "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.private static final int
The read-ahead limit when reading the XML document from aReader
.Fields inherited from class org.apache.sis.internal.storage.URIDataStore.Provider
CREATE_PARAM, ENCODING, LOCATION_PARAM
Fields 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, getShortName
Methods inherited from class org.apache.sis.internal.storage.URIDataStore.Provider
build, connector, descriptor, getOpenParameters, isWritable
Methods 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:
-
READ_AHEAD_LIMIT
private static final int READ_AHEAD_LIMITThe read-ahead limit when reading the XML document from aReader
.- See Also:
-
HEADER
private static final byte[] HEADERThe expected XML header. According XML specification, this declaration is required to appear at the document beginning (no space allowed before the declaration). -
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 noxmlns
attributes 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 themimeForNameSpaces
map with a mapping from their namespace to the MIME type to declare.- Parameters:
name
- the primary key to use for searching in theMD_Format
table, ornull
if 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:
probeContent
in 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.
-