org.apache.sling.tenant.TenantProvider Maven / Gradle / Ivy
Show all versions of aem-sdk-api Show documentation
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sling.tenant;
import java.util.Iterator;
import org.osgi.annotation.versioning.ProviderType;
/**
* The TenantProvider
defines the service interface
* which may be asked for {@link Tenant tenant instances}.
*/
@ProviderType
public interface TenantProvider {
/**
* Returns the {@link Tenant} with the given tenantId
or
* null
if no such tenant exists.
*/
Tenant getTenant(String tenantId);
/**
* Returns an iterator of all {@link Tenant tenants} known to this provider.
* If no tenants are known the iterator is empty.
*
* This method is equivalent to calling {@link #getTenants(String)} with
* {@code null} or an empty string.
*/
Iterator getTenants();
/**
* Returns an iterator of {@link Tenant 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 {@code null} to return all tenants.
*
* Calling this method with an empty string or {@code null} is equivalent to
* calling the {@link #getTenants()} method and returns all tenants.
*
* If no tenants match the tenantFilter
the iterator is empty.
* {@code null} is never returned.
*
* @throws IllegalArgumentException if filter syntax is invalid. A more
* detailed exception may be wrapped by the exception.
*/
Iterator getTenants(String tenantFilter);
}