Package org.apache.sis.internal.storage
Class URIDataStore.Provider
java.lang.Object
org.apache.sis.storage.DataStoreProvider
org.apache.sis.internal.storage.URIDataStore.Provider
- Direct Known Subclasses:
DocumentedStoreProvider
,PRJDataStore.Provider
,StoreProvider
,StoreProvider
- Enclosing class:
- URIDataStore
Provider for
URIDataStore
instances.- 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 TypeFieldDescriptionstatic final org.opengis.parameter.ParameterDescriptor<Boolean>
Description of the optional "create" parameter, which may be present in writable data store.static final org.opengis.parameter.ParameterDescriptor<Charset>
Description of the optional parameter for character encoding used by the data store.static final org.opengis.parameter.ParameterDescriptor<URI>
Description of the "location" parameter.private org.opengis.parameter.ParameterDescriptorGroup
The parameter descriptor to be returned bygetOpenParameters()
.Fields inherited from class org.apache.sis.storage.DataStoreProvider
CREATE, LOCATION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.opengis.parameter.ParameterDescriptorGroup
build
(ParameterBuilder builder) Invoked bygetOpenParameters()
the first time that a parameter descriptor needs to be created.static StorageConnector
connector
(DataStoreProvider provider, org.opengis.parameter.ParameterValueGroup parameters) Creates a storage connector initialized to the location declared in given parameters.static org.opengis.parameter.ParameterDescriptorGroup
descriptor
(String name) Convenience method creating a parameter descriptor containing onlyLOCATION_PARAM
.final org.opengis.parameter.ParameterDescriptorGroup
Returns a description of all parameters accepted by this provider for opening a data store.static boolean
isWritable
(StorageConnector connector) Returnstrue
if the open options containsStandardOpenOption.WRITE
or if the storage type is some kind of output stream.Methods inherited from class org.apache.sis.storage.DataStoreProvider
getFormat, getLogger, getShortName, getSupportedVersions, open, open, probeContent, probeContent
-
Field Details
-
LOCATION_PARAM
Description of the "location" parameter. -
CREATE_PARAM
Description of the optional "create" parameter, which may be present in writable data store. This parameter is not included in the descriptor created bybuild(ParameterBuilder)
default implementation. It is subclass responsibility to add it if desired, only if supported. -
ENCODING
Description of the optional parameter for character encoding used by the data store. This parameter is not included in the descriptor created bybuild(ParameterBuilder)
default implementation. It is subclass responsibility to add it if desired. -
openDescriptor
private volatile org.opengis.parameter.ParameterDescriptorGroup openDescriptorThe parameter descriptor to be returned bygetOpenParameters()
. Created when first needed.
-
-
Constructor Details
-
Provider
protected Provider()Creates a new provider.
-
-
Method Details
-
getOpenParameters
public final org.opengis.parameter.ParameterDescriptorGroup getOpenParameters()Returns a description of all parameters accepted by this provider for opening a data store. This method creates the descriptor only when first needed. Subclasses can override thebuild(ParameterBuilder)
method if they need to modify the descriptor to create.- Specified by:
getOpenParameters
in classDataStoreProvider
- Returns:
- description of the parameters required or accepted for opening a
DataStore
. - See Also:
-
build
Invoked bygetOpenParameters()
the first time that a parameter descriptor needs to be created. When invoked, the parameter group name is set to a name derived from theDataStoreProvider.getShortName()
value. The default implementation creates a group containing onlyLOCATION_PARAM
. Subclasses can override if they need to create a group with more parameters.- Parameters:
builder
- the builder to use for creating parameter descriptor. The group name is already set.- Returns:
- the parameters descriptor created from the given builder.
-
descriptor
Convenience method creating a parameter descriptor containing onlyLOCATION_PARAM
. This convenience method is used for public providers that cannot extend thisProvider
class because it is internal.- Parameters:
name
- short name of the data store format.- Returns:
- the descriptor for open parameters.
-
connector
public static StorageConnector connector(DataStoreProvider provider, org.opengis.parameter.ParameterValueGroup parameters) throws IllegalOpenParameterException Creates a storage connector initialized to the location declared in given parameters. This convenience method does not set any other parameters. In particular, reading (or ignoring) the "create" parameter is left to callers, because not all implementations may create data stores withStandardOpenOption
.- Parameters:
provider
- the provider for which to create a storage connector (for error messages).parameters
- the parameters to use for creating a storage connector.- Returns:
- the storage connector initialized to the location specified in the parameters.
- Throws:
IllegalOpenParameterException
- if no "location" parameter has been found.
-
isWritable
Returnstrue
if the open options containsStandardOpenOption.WRITE
or if the storage type is some kind of output stream.- Parameters:
connector
- the connector to use for opening a file.- Returns:
- whether the specified connector should open a writable data store.
- Throws:
DataStoreException
- if the storage object has already been used and cannot be reused.
-