com.atlassian.confluence.tenant
Class VolatileSingleTenantRegistry

java.lang.Object
  extended by com.atlassian.confluence.tenant.VolatileSingleTenantRegistry
All Implemented Interfaces:
TenantRegistry, com.atlassian.tenancy.api.TenantAccessor, com.atlassian.tenancy.api.TenantContext

public class VolatileSingleTenantRegistry
extends java.lang.Object
implements TenantRegistry, com.atlassian.tenancy.api.TenantAccessor, com.atlassian.tenancy.api.TenantContext

Zero to one tenant registry.

The registered tenant is not persisted, meaning it has to be replayed during bootstrap.

This class should be considered a temporary solution on the way to multi-tenancy.

Since:
5.6

Constructor Summary
VolatileSingleTenantRegistry()
           
 
Method Summary
 boolean addTenant(com.atlassian.tenancy.api.Tenant tenant)
           
<T> T
asTenant(com.atlassian.tenancy.api.Tenant tenant, java.util.concurrent.Callable<T> callback)
           
 java.lang.Iterable<com.atlassian.tenancy.api.Tenant> getAvailableTenants()
           
 com.atlassian.tenancy.api.Tenant getCurrentTenant()
           
 boolean isRegistryVacant()
           
 boolean isTenantRegistered(com.atlassian.tenancy.api.Tenant tenant)
           
 boolean removeTenant(com.atlassian.tenancy.api.Tenant tenant)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VolatileSingleTenantRegistry

public VolatileSingleTenantRegistry()
Method Detail

getAvailableTenants

public java.lang.Iterable<com.atlassian.tenancy.api.Tenant> getAvailableTenants()
Specified by:
getAvailableTenants in interface com.atlassian.tenancy.api.TenantAccessor

asTenant

public <T> T asTenant(com.atlassian.tenancy.api.Tenant tenant,
                      java.util.concurrent.Callable<T> callback)
           throws com.atlassian.tenancy.api.TenantUnavailableException,
                  java.lang.reflect.InvocationTargetException
Specified by:
asTenant in interface com.atlassian.tenancy.api.TenantAccessor
Throws:
com.atlassian.tenancy.api.TenantUnavailableException
java.lang.reflect.InvocationTargetException

addTenant

public boolean addTenant(com.atlassian.tenancy.api.Tenant tenant)
Specified by:
addTenant in interface TenantRegistry
Parameters:
tenant - the tenant to add
Returns:
true if the tenant was added during this request, false if the registry already knew it

removeTenant

public boolean removeTenant(com.atlassian.tenancy.api.Tenant tenant)
Specified by:
removeTenant in interface TenantRegistry
Parameters:
tenant - the tenant to remove
Returns:
true if the tenant was removed, false if the registry didn't know about it

isTenantRegistered

public boolean isTenantRegistered(com.atlassian.tenancy.api.Tenant tenant)
Specified by:
isTenantRegistered in interface TenantRegistry
Parameters:
tenant - the tenant to test for being registered
Returns:
true if the tenant is currently registered

isRegistryVacant

public boolean isRegistryVacant()
Specified by:
isRegistryVacant in interface TenantRegistry
Returns:
true if the registry currently has no tenants

getCurrentTenant

@Nullable
public com.atlassian.tenancy.api.Tenant getCurrentTenant()
Specified by:
getCurrentTenant in interface com.atlassian.tenancy.api.TenantContext


Copyright © 2003-2014 Atlassian. All Rights Reserved.