com.holonplatform.jdbc

## Interface TenantDataSourceProvider

- Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface TenantDataSourceProvider

  Concrete tenant `DataSource` instance provider.

  This interface is used by `MultiTenantDataSource` to obtain the concrete `DataSource` to use with the current tenant id.

  Since:
    4.3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CONTEXT_KEY` Default `Context` resource reference

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Optional<TenantDataSourceProvider>` | `getCurrent()` Convenience method to obtain the current `TenantDataSourceProvider` made available as `Context` resource, using default `ClassLoader`.
    `DataSource` | `getDataSource(String tenantId)` Provides the concrete `DataSource` to use with given `tenantId`

- - ### Field Detail

    - #### CONTEXT_KEY

          static final String CONTEXT_KEY

      Default `Context` resource reference

  - ### Method Detail

    - #### getDataSource

          DataSource getDataSource(String tenantId)

      Provides the concrete `DataSource` to use with given `tenantId`
      Parameters:
        `tenantId` - Tenant id
      Returns:
        the DataSource reference

    - #### getCurrent

          static Optional<TenantDataSourceProvider> getCurrent()

      Convenience method to obtain the current `TenantDataSourceProvider` made available as `Context` resource, using default `ClassLoader`.

      See `Context.resource(String, Class)` for details about context resources availability conditions.

      Returns:
        Optional TenantDataSourceProvider, empty if not available as context resource

Copyright © 2017 The Holon Platform. All rights reserved.