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

public abstract static class URIDataStore.Provider extends DataStoreProvider
Provider for URIDataStore instances.
Since:
0.8
Version:
1.2
  • Field Details

    • LOCATION_PARAM

      public static final org.opengis.parameter.ParameterDescriptor<URI> LOCATION_PARAM
      Description of the "location" parameter.
    • CREATE_PARAM

      public static final org.opengis.parameter.ParameterDescriptor<Boolean> 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 by build(ParameterBuilder) default implementation. It is subclass responsibility to add it if desired, only if supported.
    • ENCODING

      public static final org.opengis.parameter.ParameterDescriptor<Charset> ENCODING
      Description of the optional parameter for character encoding used by the data store. This parameter is not included in the descriptor created by build(ParameterBuilder) default implementation. It is subclass responsibility to add it if desired.
    • openDescriptor

      private volatile org.opengis.parameter.ParameterDescriptorGroup openDescriptor
      The parameter descriptor to be returned by getOpenParameters(). 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 the build(ParameterBuilder) method if they need to modify the descriptor to create.
      Specified by:
      getOpenParameters in class DataStoreProvider
      Returns:
      description of the parameters required or accepted for opening a DataStore.
      See Also:
    • build

      protected org.opengis.parameter.ParameterDescriptorGroup build(ParameterBuilder builder)
      Invoked by getOpenParameters() the first time that a parameter descriptor needs to be created. When invoked, the parameter group name is set to a name derived from the DataStoreProvider.getShortName() value. The default implementation creates a group containing only LOCATION_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

      public static org.opengis.parameter.ParameterDescriptorGroup descriptor(String name)
      Convenience method creating a parameter descriptor containing only LOCATION_PARAM. This convenience method is used for public providers that cannot extend this Provider 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 with StandardOpenOption.
      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

      public static boolean isWritable(StorageConnector connector) throws DataStoreException
      Returns true if the open options contains StandardOpenOption.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.