Package org.apache.sling.tenant

# Interface TenantProvider

@ProviderType public interface TenantProvider
The `TenantProvider` defines the service interface which may be asked for `tenant instances`.

## Method Summary

Modifier and Type
Method
Description
`Tenant`
`getTenant(String tenantId)`
Returns the `Tenant` with the given `tenantId` or `null` if no such tenant exists.
`Iterator<Tenant>`
`getTenants()`
Returns an iterator of all `tenants` known to this provider.
`Iterator<Tenant>`
`getTenants(String tenantFilter)`
Returns an iterator of `tenants` matching the given `tenantFilter`.

## Method Details

### getTenant

Tenant getTenant(String tenantId)
Returns the `Tenant` with the given `tenantId` or `null` if no such tenant exists.

### getTenants

Iterator<Tenant> getTenants()
Returns an iterator of all `tenants` known to this provider. If no tenants are known the iterator is empty.

This method is equivalent to calling `getTenants(String)` with `null` or an empty string.

### getTenants

Iterator<Tenant> getTenants(String tenantFilter)
Returns an iterator of `tenants` matching the given `tenantFilter`.

The `tenantFilter` is a valid OSGi filter string as defined in Section 3.2.6, Filter Syntax, of the OSGi Core Specification, Release 4 or `null` to return all tenants.

Calling this method with an empty string or `null` is equivalent to calling the `getTenants()` method and returns all tenants.

If no tenants match the `tenantFilter` the iterator is empty. `null` is never returned.

Throws:
  `IllegalArgumentException` - if filter syntax is invalid. A more detailed exception may be wrapped by the exception.