public class TenantProviderImpl extends Object implements TenantProvider, TenantManager
| Modifier and Type | Class and Description |
|---|---|
static interface |
TenantProviderImpl.Configuration |
| Constructor and Description |
|---|
TenantProviderImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(org.osgi.framework.BundleContext bundleContext,
TenantProviderImpl.Configuration configuration) |
Tenant |
create(String tenantId,
Map<String,Object> properties)
Creates a new tenant with the given tenant ID and the initial set of
properties.
|
protected void |
deactivate() |
Tenant |
getTenant(String tenantId)
|
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. |
void |
remove(Tenant tenant)
Removes the given tenant.
|
void |
removeProperties(Tenant tenant,
String... propertyNames)
Removes one or more properties from the tenant.
|
void |
setProperties(Tenant tenant,
Map<String,Object> properties)
Sets or removes multiple properties on the tenant.
|
void |
setProperty(Tenant tenant,
String name,
Object value)
Sets a single property of the tenant to a new value or removes the
property if the value is
null. |
protected void activate(org.osgi.framework.BundleContext bundleContext,
TenantProviderImpl.Configuration configuration)
protected void deactivate()
public Tenant getTenant(String tenantId)
TenantProvidergetTenant in interface TenantProviderpublic Iterator<Tenant> getTenants()
TenantProvidertenants known to this provider.
If no tenants are known the iterator is empty.
This method is equivalent to calling TenantProvider.getTenants(String) with
null or an empty string.
getTenants in interface TenantProviderpublic Iterator<Tenant> getTenants(String tenantFilter)
TenantProvidertenants 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 TenantProvider.getTenants() method and returns all tenants.
If no tenants match the tenantFilter the iterator is empty.
null is never returned.
getTenants in interface TenantProviderpublic Tenant create(String tenantId, Map<String,Object> properties)
TenantManager
After creating the tenant, the
TenantManagerHook.setup(Tenant)
method is called to allow customizers to configure additional properties.
Before returning the newly created tenant object the data is persisted.
create in interface TenantManagertenantId - The name of the new tenant. This name must not be
null or an empty string. It must also not be the same
name as that of an existing tenant.properties - An optional map of initial properties. This may be
null to not preset any properties. It is recommended,
though, that this map contain at least the
Tenant.PROP_NAME and Tenant.PROP_DESCRIPTION
properties.Tenant instance or null if a tenant
with the id already exists.public void remove(Tenant tenant)
TenantManager
Before returning the
TenantManagerHook.remove(Tenant)
method is called to allow customizers to implement further cleanup upon
tenant removal.
remove in interface TenantManagertenant - The tenant to remove.public void setProperty(Tenant tenant, String name, Object value)
TenantManagernull.
Before returning the
TenantManagerHook.change(Tenant)
method is called to allow customizers to configure additional properties.
setProperty in interface TenantManagertenant - The tenant whose property is to be set or remove.name - The name of the property to set or remove.value - The new value of the property. If this value is null
the property is actually removed.public void setProperties(Tenant tenant, Map<String,Object> properties)
TenantManager
Before returning the
TenantManagerHook.change(Tenant)
method is called to allow customizers to configure additional properties.
setProperties in interface TenantManagertenant - The tenant whose properties are to be modified.properties - The map of properties to set or remove. A property
whose value is null is removed from the tenant.public void removeProperties(Tenant tenant, String... propertyNames)
TenantManager
Before returning the
TenantManagerHook.change(Tenant)
method is called to allow customizers to configure additional properties
unless the properties parameter is null or empty.
removeProperties in interface TenantManagertenant - The tenant from which to remove properties.propertyNames - The list of properties to be removed. If this is
null or empty, nothing happens and the
TenantCustomizer is not
called.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.