tigase.db

## Interface DataSource

- All Superinterfaces:
    Repository
  All Known Subinterfaces:
    DataRepository, DataSourcePool<T>
  All Known Implementing Classes:
    DataRepoPool, DataRepositoryImpl, DataRepositoryPool, DummyRepository, SchemaManager.DataSourceInfo, XMLDataSource

      public interface DataSource
      extends Repository

  Interface implemented by every class providing access to data storage, ie. databases, files, key-value stores.
  Created by andrzej on 09.03.2016.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface tigase.db.Repository

      `Repository.Meta, Repository.SchemaId`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Logger` | `log`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default boolean` | `automaticSchemaManagement()`
    `default void` | `checkConnectivity(Duration watchdogTime)` This method is called by data source bean watchdog mechanism to ensure that there is proper connectivity to underlying data storage.
    `default boolean` | `checkSchemaVersion(DataSourceAware<? extends DataSource> datasource, boolean shutdownServer)` Method checks version of the particular DataSource stored in the defined source.
    `String` | `getResourceUri()` Returns a DB connection string or DB connection URI.
    `Optional<Version>` | `getSchemaVersion(String component)` Method obtains version of the schema for particular component stored in the database.
    `void` | `initialize(String resource_uri)` The method is called to initialize the data repository.

    - ### Methods inherited from interface tigase.db.Repository

      `initRepository`

- - ### Field Detail

    - #### log

          static final Logger log

  - ### Method Detail

    - #### checkConnectivity

          default void checkConnectivity(Duration watchdogTime)

      This method is called by data source bean watchdog mechanism to ensure that there is proper connectivity to underlying data storage.
      Parameters:
        `watchdogTime` - time which should pass between checks

    - #### checkSchemaVersion

          default boolean checkSchemaVersion(DataSourceAware<? extends DataSource> datasource,
                                             boolean shutdownServer)

      Method checks version of the particular DataSource stored in the defined source.
      Parameters:
        `datasource` - implementation of `DataSourceAware` interface
        `shutdownServer` - specifies whether server should be shutdown automatically if the version in the database doesn't match required version.
      Returns:
        a `false` when the version doesn't match or there is no version information in the repository. if `shutdownServer` is set to `true` and the component version is final it would force shutting down of the server, otherwise (for non-final version) only a warning would be printed.

    - #### automaticSchemaManagement

          default boolean automaticSchemaManagement()

    - #### getSchemaVersion

          Optional<Version> getSchemaVersion(String component)

      Method obtains version of the schema for particular component stored in the database.
      Parameters:
        `component` - name of the component for which we want to get the schema version
      Returns:
        an optional value of the version.

    - #### getResourceUri

          String getResourceUri()

      Returns a DB connection string or DB connection URI.
      Returns:
        a `String` value representing database connection string.

    - #### initialize

          void initialize(String resource_uri)
                   throws RepositoryException

      The method is called to initialize the data repository.
      Parameters:
        `resource_uri` - value in most cases representing the database connection string.
      Throws:
        `RepositoryException` - if there was an error during initialization of data source. Some implementations, though, perform so called lazy initialization so even though there is a problem with the underlying data source it may not be signaled through this method call.

Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.