# Class SQLStoreProvider

Object
DataStoreProvider
SQLStoreProvider

public class SQLStoreProvider extends DataStoreProvider
Provider of `SQLStore` instances.

Since:
  1.0

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class DataStoreProvider

  `DataStoreProvider​.Prober<S>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ParameterDescriptor<Map<?,?>>`
  `QUERIES_PARAM`
  Description of the parameter providing the queries to include as resources in the `SimpleFeatureStore`.
  `static final ParameterDescriptor<DataSource>`
  `SOURCE_PARAM`
  Description of the "location" parameter.
  `static final ParameterDescriptor<GenericName[]>`
  `TABLES_PARAM`
  Description of the parameter providing the list of tables or views to include as resources in the `SimpleFeatureStore`.

  ### Fields inherited from class DataStoreProvider

  `CREATE, LOCATION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SQLStoreProvider()`
  Creates a new provider.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static GenericName`
  `createTableName(String catalog, String schemaPattern, String tablePattern)`
  Create a qualified table name.
  `Logger`
  `getLogger()`
  Returns the logger used by SQL stores.
  `ParameterDescriptorGroup`
  `getOpenParameters()`
  Returns a description of all parameters accepted by this provider for opening a connection to the database.
  `String`
  `getShortName()`
  Returns a generic name for this data store, used mostly in warnings or error messages.
  `DataStore`
  `open(StorageConnector connector)`
  Returns a `SQLStore` implementation associated with this provider.
  `DataStore`
  `open(ParameterValueGroup parameters)`
  Returns a data store implementation associated with this provider for the given parameters.
  `ProbeResult`
  `probeContent(StorageConnector connector)`
  Returns `ProbeResult​.SUPPORTED` if the given storage appears to be supported by `SQLStore`.

  ### Methods inherited from class DataStoreProvider

  `getFormat, getSupportedVersions, probeContent`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SOURCE_PARAM

    public static final ParameterDescriptor<DataSource> SOURCE_PARAM
    Description of the "location" parameter. This parameter is mandatory.
    Since:
      1.1

  - ### TABLES_PARAM

    public static final ParameterDescriptor<GenericName[]> TABLES_PARAM
    Description of the parameter providing the list of tables or views to include as resources in the `SimpleFeatureStore`. At least one of `TABLES_PARAM` or `QUERIES_PARAM` must be provided.
    Since:
      1.1

  - ### QUERIES_PARAM

    public static final ParameterDescriptor<Map<?,?>> QUERIES_PARAM
    Description of the parameter providing the queries to include as resources in the `SimpleFeatureStore`. Map keys are the resource names as `GenericName` or `String` instances. Values are SQL statements (as `String` instances) to execute when the associated resource is requested. At least one of `TABLES_PARAM` or `QUERIES_PARAM` must be provided.
    Since:
      1.1

- ## Constructor Details

  - ### SQLStoreProvider

    public SQLStoreProvider()
    Creates a new provider.

- ## Method Details

  - ### createTableName

    public static GenericName createTableName(String catalog, String schemaPattern, String tablePattern)
    Create a qualified table name. The returned `GenericName` can be any of the following:
    - `catalog​.schemaPattern​.tablePattern`
    - `schemaPattern​.tablePattern`
    - `tablePattern`
    The schema and table names (but not the catalog) can contain SQL wildcard characters: `'_'` matches any single character and `'%'` matches any sequence of characters.
    Parameters:
      `catalog` - name of a catalog as it is stored in the database, or `null` for any catalog.
      `schemaPattern` - pattern (with `'_'` and `'%'` wildcards) of a schema, or `null` for any.
      `tablePattern` - pattern (with `'_'` and `'%'` wildcards) of a table.
    Returns:
      the fully qualified name.

  - ### getShortName

    public String getShortName()
    Returns a generic name for this data store, used mostly in warnings or error messages.
    Specified by:
      `getShortName` in class `DataStoreProvider`
    Returns:
      a short name or abbreviation for the data format.
    See Also:
      - `DataStoreProvider​.getFormat()`

  - ### getOpenParameters

    public ParameterDescriptorGroup getOpenParameters()
    Returns a description of all parameters accepted by this provider for opening a connection to the database. The group contains `SOURCE_PARAM`, `TABLES_PARAM` and `QUERIES_PARAM`.
    Specified by:
      `getOpenParameters` in class `DataStoreProvider`
    Returns:
      description of available parameters for opening a connection to a database.
    See Also:
      - `DataStoreProvider​.LOCATION`
      - `DataStoreProvider​.CREATE`
      - `DataStoreProvider​.open(ParameterValueGroup)`
      - `DataStore​.getOpenParameters()`

  - ### probeContent

    public ProbeResult probeContent(StorageConnector connector) throws DataStoreException
    Returns `ProbeResult​.SUPPORTED` if the given storage appears to be supported by `SQLStore`. Returning `SUPPORTED` from this method 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 connection.
    Specified by:
      `probeContent` in class `DataStoreProvider`
    Parameters:
      `connector` - information about the storage (data source).
    Returns:
      `SUPPORTED` if the given storage seems to be usable by `SQLStore` instances.
    Throws:
      `DataStoreException` - if an SQL error occurred.

  - ### open

    public DataStore open(StorageConnector connector) throws DataStoreException
    Returns a `SQLStore` implementation associated with this provider. The store will provide resources for all tables and views in all schemas and catalogs.
    Specified by:
      `open` in class `DataStoreProvider`
    Parameters:
      `connector` - information about the storage (data source).
    Returns:
      a data store implementation associated with this provider for the given storage.
    Throws:
      `DataStoreException` - if an error occurred while creating the data store instance.
    See Also:
      - `DataStores​.open(Object)`

  - ### open

    public DataStore open(ParameterValueGroup parameters) throws DataStoreException
    Returns a data store implementation associated with this provider for the given parameters.
    Overrides:
      `open` in class `DataStoreProvider`
    Parameters:
      `parameters` - opening parameters as defined by `getOpenParameters()`.
    Returns:
      a data store implementation associated with this provider for the given parameters.
    Throws:
      `DataStoreException` - if an error occurred while creating the data store instance.
    See Also:
      - `DataStoreProvider​.LOCATION`
      - `DataStoreProvider​.CREATE`
      - `DataStoreProvider​.getOpenParameters()`

  - ### getLogger

    public Logger getLogger()
    Returns the logger used by SQL stores.
    Overrides:
      `getLogger` in class `DataStoreProvider`
    Returns:
      the logger to use as a fallback (when there are no listeners) for warning messages.
    See Also:
      - `StoreListeners​.getLogger()`