eXo Kernel :: Container 2.4.4-CLD

org.exoplatform.container.multitenancy.bridge
Class TenantsServiceImpl

java.lang.Object
  extended by org.exoplatform.container.multitenancy.bridge.TenantsServiceImpl
All Implemented Interfaces:
TenantsService

public class TenantsServiceImpl
extends Object
implements TenantsService

Implementation of TenantsService based on plugins. Following kinds of plugin supported:

NOTE: TenantsServiceImpl can be consumed before the container start (e.g. to add a listener or check current tenant).

Author:
Peter Nedonosko

Field Summary
protected static Log LOG
           
protected  List<CurrentTenantLookup> lookups
          List of registered CurrentTenantLookup implementations.
protected  List<TenantStateObserver> observers
          List of registered TenantStateObserver implementations.
 
Constructor Summary
TenantsServiceImpl()
          Constructor without dependencies.
 
Method Summary
 void addListener(TenantsStateListener listener)
          Add listener for Tenant events in Multitenancy sub-system.
 void addPlugin(ComponentPlugin plugin)
          Register component plugin.
 Tenant getCurrentTanant()
          Return Current Tenant or throws an exception if Current Tenant not set in current thread.
 boolean hasCurrentTanant()
          Answers if Current Tenant is set in current thread.
 void removeListener(TenantsStateListener listener)
          Remove Tenant events listener from Multitenancy sub-system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final Log LOG

lookups

protected final List<CurrentTenantLookup> lookups
List of registered CurrentTenantLookup implementations.


observers

protected final List<TenantStateObserver> observers
List of registered TenantStateObserver implementations.

Constructor Detail

TenantsServiceImpl

public TenantsServiceImpl()
Constructor without dependencies.

Method Detail

addPlugin

public void addPlugin(ComponentPlugin plugin)
Register component plugin. Used by container during the service instantiation. Not recommended for use in runtime.

Parameters:
plugin - ComponentPlugin

addListener

public void addListener(TenantsStateListener listener)
Add listener for Tenant events in Multitenancy sub-system. Added listener later can be removed by TenantsService.removeListener(TenantsStateListener) method.

Specified by:
addListener in interface TenantsService
Parameters:
listener - TenantsStateListener

removeListener

public void removeListener(TenantsStateListener listener)
Remove Tenant events listener from Multitenancy sub-system.
Take in account that it's possible to remove only explicitly added listeners. Listeners available as components in eXo Container don't affected by this method.

Specified by:
removeListener in interface TenantsService
Parameters:
listener - TenantsStateListener

getCurrentTanant

public Tenant getCurrentTanant()
                        throws CurrentTenantNotSetException
Return Current Tenant or throws an exception if Current Tenant not set in current thread. Current Tenant can be not set in two cases: In both cases an application should not rely on multitenant environment in this thread.

Specified by:
getCurrentTanant in interface TenantsService
Returns:
Tenant Current Tenant descriptor.
Throws:
CurrentTenantNotSetException - if Current Tenant not found or not set.

hasCurrentTanant

public boolean hasCurrentTanant()
Answers if Current Tenant is set in current thread. See #getCurrentTenant() for details.

Specified by:
hasCurrentTanant in interface TenantsService
Returns:
boolean, true if current tenant is set in current thread, false otherwise.
See Also:
#getCurrentTenant()

eXo Kernel :: Container 2.4.4-CLD

Copyright © 2013 eXo Platform SAS. All Rights Reserved.