@FieldsAreNonnullByDefault @ReturnValuesAreNonnullByDefault @ParametersAreNonnullByDefault
See: Description
| Interface | Description |
|---|---|
| ProvisioningTenantContextSetter<T extends TenantContext> |
Allows us to set the incoming at a provisioning time
TenantContext as a current
TenantContext. |
| TenantIdSetter |
The companion of the
TenantContextProvider API. |
| Class | Description |
|---|---|
| AbstractServiceTenantContextProvider<T extends TenantContext> |
The base class from which the products remote TenantContext Service implementations will inherit.
|
| AbstractTenantContextProvider<T extends TenantContext> |
The AbstractTenantContextProvider allows us to create product specific LocalTenantContextProvider(s)
or ServiceTenantContextProvider(s) based on the abstract
AbstractTenantContextProvider.fetchTenantContext(java.lang.String) method. |
| AbstractUnicornTenantContextProvider<T extends TenantContext> |
The base class from which the Unicorn TenantContext Provider implementations will inherit.
|
| TenantContextUtils |
Basic TenantContext utility methods and system properties constants.
|
| YamlTenantContextProvider |
Atlassian TenantContext API, YAML provider implementation.
|
Also contains the base abstract classes for the TenantContext providers for local and remote service TC instantiation, the base abstract provider class for Unicorn environment, and the TC provider for local YAML based configuration.
A sample class that shows how to utilize the AbstractTenantContextProvider,
to create, say, RefAppTenantContextProvider, may look something like:
public final class RefAppTenantContext extends TenantContext {
public RefAppTenantContext(TenantContext tc) {
super(tc);
}
public String getRefAppSpecialField() {
return getExtraContext().get("SPECIAL_KEY");
}
}
public final class RefAppTenantContextProvider extends AbstractTenantContextProvider<RefAppTenantContext> {
@Override
protected TenantContext fetchTenantContext(String tenantId) {
return new TenantContextYaml(tenantId);
}
@Override
protected RefAppTenantContext decorate(TenantContext tc) {
return new RefAppTenantContext(tc);
}
}
public final class RefAppTenantContextFactory {
private static final RefAppTenantContextProvider provider = new RefAppTenantContextProvider();
private RefAppTenantContextFactory() { }
static void apply(String tenantId) { // this method will be called from the Tomcat filter, for example
provider.setTenantId(tenantId);
}
public static RefAppTenantContext currentTenant() {
return provider.getTenantContext();
}
}
//...
RefAppTenantContext tc = RefAppTenantContextFactory.currentTenant(); // this could be statically imported
String tenantId = tc.getTenantId();
String specialField = tc.getRefAppSpecialField();
//...
Copyright © 2016 Atlassian. All rights reserved.