Class TenantGate<T>
- java.lang.Object
-
- com.atlassian.confluence.tenant.TenantGate<T>
-
- Type Parameters:
T
- The type of the bean that we are protecting.
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<T>
@Deprecated(forRemoval=true) public abstract class TenantGate<T> extends Object implements org.springframework.beans.factory.FactoryBean<T>
Deprecated, for removal: This API element is subject to removal in a future version.since 7.5Prevents access to tenanted beans in case of a vacant (zero tenancy) instance.The default behaviour is to escape with a
VacantException
, but the gate can also delegate to a vacant implementation which could behave somehow differently.This class should be considered a temporary solution on the way to multi-tenancy. It's sole purpose is currently to delay the initialisation of
net.sf.hibernate.SessionFactory
beans until a system tenant arrived.I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the TenantGate. All those moments will be lost in time... like tears in rain... Time to die.
- Since:
- 5.6
- See Also:
SystemTenant
-
-
Field Summary
Fields Modifier and Type Field Description protected Class[]
proxyInterfaces
Deprecated.since 7.0.protected TenantRegistry
tenantRegistry
Deprecated.Since 7.0.
-
Constructor Summary
Constructors Modifier Constructor Description protected
TenantGate(TenantRegistry tenantRegistry, Class[] proxyInterfaces)
Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> Callable<T>
close(Callable<T> callback)
Deprecated.since 7.5 UseThreadLocalTenantGate.withoutTenantPermit(Callable)
protected abstract T
createTenantedDelegate()
Deprecated, for removal: This API element is subject to removal in a future version.Returns the delegate to be used when the tenant is present.protected T
createVacantDelegate()
Deprecated, for removal: This API element is subject to removal in a future version.Returns the delegate to be used when the tenant is vacant.T
getObject()
Deprecated, for removal: This API element is subject to removal in a future version.Class
getObjectType()
Deprecated, for removal: This API element is subject to removal in a future version.protected Class[]
getProxyInterfaces()
Deprecated, for removal: This API element is subject to removal in a future version.protected TenantRegistry
getTenantRegistry()
Deprecated, for removal: This API element is subject to removal in a future version.boolean
isPermitted()
Deprecated, for removal: This API element is subject to removal in a future version.boolean
isSingleton()
Deprecated, for removal: This API element is subject to removal in a future version.static <T> Callable<T>
open(Callable<T> callback)
Deprecated.since 7.5 UseThreadLocalTenantGate.withTenantPermit(Callable)
static <T> Callable<T>
permit(boolean permitted, Callable<T> callback)
Deprecated.since 7.5 UseThreadLocalTenantGate.wrap(boolean, Callable)
-
-
-
Field Detail
-
tenantRegistry
@Deprecated protected final TenantRegistry tenantRegistry
Deprecated.Since 7.0. Access viagetTenantRegistry()
.
-
proxyInterfaces
@Deprecated protected final Class[] proxyInterfaces
Deprecated.since 7.0. Access viagetProxyInterfaces()
.
-
-
Constructor Detail
-
TenantGate
protected TenantGate(TenantRegistry tenantRegistry, Class[] proxyInterfaces)
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Detail
-
getTenantRegistry
protected TenantRegistry getTenantRegistry()
Deprecated, for removal: This API element is subject to removal in a future version.- Since:
- 7.0
-
getProxyInterfaces
protected Class[] getProxyInterfaces()
Deprecated, for removal: This API element is subject to removal in a future version.- Since:
- 7.0
-
isPermitted
public boolean isPermitted()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- checks if the current thread is allowed to pass through the gate
-
open
@Deprecated public static <T> Callable<T> open(Callable<T> callback)
Deprecated.since 7.5 UseThreadLocalTenantGate.withTenantPermit(Callable)
Open all gates for the given closure on the current thread.This only makes sense in a pre-tenanted state, e.g. during setup allow code to prepare the database before it's made available to a broader audience.
- Parameters:
callback
- the function allowed to pass through the gate- Returns:
- the permitted function
-
close
@Deprecated public static <T> Callable<T> close(Callable<T> callback)
Deprecated.since 7.5 UseThreadLocalTenantGate.withoutTenantPermit(Callable)
Close all gates for the given closure on the current thread.This only makes sense in a pre-tenanted state, if you want to ensure that the given code can not access tenanted resources even though an outer closure might have granted that access, e.g. loading
DefaultPluginManager.earlyStartup()
plugins which should not be able to eagerly access tenanted resources.- Parameters:
callback
- the function allowed to pass through the gate- Returns:
- the permitted function
-
createVacantDelegate
protected T createVacantDelegate()
Deprecated, for removal: This API element is subject to removal in a future version.Returns the delegate to be used when the tenant is vacant. May be overriden by Spring using method-injection, but can be left as the default.
-
createTenantedDelegate
protected abstract T createTenantedDelegate()
Deprecated, for removal: This API element is subject to removal in a future version.Returns the delegate to be used when the tenant is present. Generally overriden by Spring using method-injection.
-
getObject
public final T getObject()
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<T>
-
getObjectType
public final Class getObjectType()
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<T>
-
isSingleton
public final boolean isSingleton()
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<T>
-
permit
@Deprecated public static <T> Callable<T> permit(boolean permitted, Callable<T> callback)
Deprecated.since 7.5 UseThreadLocalTenantGate.wrap(boolean, Callable)
-
-