com.holonplatform.jdbc

## Interface MultiTenantDataSource

- All Superinterfaces:
    AutoCloseable, Closeable, CommonDataSource, DataSource, Wrapper
  All Known Implementing Classes:
    DefaultMultiTenantDataSource

      public interface MultiTenantDataSource
      extends DataSource, Closeable

  `DataSource` with multi-tenancy support.

  This datasource act as a wrapper for standard `DataSource` interface and provides a specific DataSource implementation for the current tenant when a `Connection` is requested.

  Standard implementation relies on two strategy interfaces for internal operations:

  - A `TenantResolver` to obtain the current tenant id
  - A `TenantDataSourceProvider` to obtain the concrete `DataSource` associated with a tenant id
  Since:
    4.3.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `MultiTenantDataSource.Builder`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MultiTenantDataSource.Builder` | `builder()` Builder to create a MultiTenantDataSource
    `void` | `reset()` Reset tenant `DataSource`s internal cache.
    `void` | `reset(String tenantId)` Reset internal cached `DataSource` for given `tenantId`, if present.

    - ### Methods inherited from interface javax.sql.DataSource

      `getConnection, getConnection`

    - ### Methods inherited from interface javax.sql.CommonDataSource

      `getLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriter`

    - ### Methods inherited from interface java.sql.Wrapper

      `isWrapperFor, unwrap`

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Method Detail

    - #### reset

          void reset()

      Reset tenant `DataSource`s internal cache.

    - #### reset

          void reset(String tenantId)

      Reset internal cached `DataSource` for given `tenantId`, if present.
      Parameters:
        `tenantId` - Tenant id to reset

    - #### builder

          static MultiTenantDataSource.Builder builder()

      Builder to create a MultiTenantDataSource
      Returns:
        Builder

Copyright © 2019 The Holon Platform. All rights reserved.