eXo Kernel :: Container 2.4.11-UXP01

org.exoplatform.container.multitenancy.bridge
Interface TenantsContainerContext


public interface TenantsContainerContext

Context for TenantsContainer. Prescribes general contract between container and multitenancy capable components registration/unregistration. Container should use accept(ComponentAdapter) method during the registration to answer should a some component be registered in TenantsContainer or not. The same way method accept(Object) should be used to choose from where to get a component in getters.
Context implementation should apply own "container" for per-tenant managed components and use it for TenantsContainer methods implementation.

Author:
Peter Nedonosko

Method Summary
 boolean accept(org.picocontainer.ComponentAdapter adapter)
          Answers if given component should be regarded as per-tenant service and can be registered (and unregistered) in the context.
 boolean accept(Object key)
          Answers if given component key should be regarded as a key of per-tenant service and can be used to get a component from the context.
 org.picocontainer.ComponentAdapter getComponentAdapterOfType(Class<?> key)
          Return component adapter regarding the given Class key and Current Tenant.
 List<?> getComponentAdaptersOfType(Class<?> componentType)
          Return list of component adapters regarding the given Class key and Current Tenant.
 Object getComponentInstance(Object componentKey)
          Return component instance regarding the given key (String in most cases) and Current Tenant.
 Object getComponentInstanceOfType(Class<?> componentType)
          Return component instance regarding the given Class key and Current Tenant.
 List<?> getComponentInstancesOfType(Class<?> componentType)
          Return list of component instances regarding the given Class key and Current Tenant.
 org.picocontainer.ComponentAdapter registerComponent(org.picocontainer.ComponentAdapter component)
          Register component adapter in the context.
 org.picocontainer.ComponentAdapter unregisterComponent(Object componentKey)
          Unregister component by key from the context.
 

Method Detail

getComponentAdaptersOfType

List<?> getComponentAdaptersOfType(Class<?> componentType)
Return list of component adapters regarding the given Class key and Current Tenant.

Parameters:
componentType - Class type of a components
Returns:
list of component adapters, an empty list if nothing found.

getComponentInstancesOfType

List<?> getComponentInstancesOfType(Class<?> componentType)
Return list of component instances regarding the given Class key and Current Tenant.

Parameters:
componentType - Class type of instances
Returns:
list of components, an empty list if nothing found.

getComponentAdapterOfType

org.picocontainer.ComponentAdapter getComponentAdapterOfType(Class<?> key)
Return component adapter regarding the given Class key and Current Tenant.

Parameters:
key - Class type of a component
Returns:
ComponentAdapter of a component or null if nothing found in Current Tenant.

getComponentInstance

Object getComponentInstance(Object componentKey)
Return component instance regarding the given key (String in most cases) and Current Tenant.

Parameters:
key - Object key of a component
Returns:
a component instance or null if nothing found in Current Tenant.

getComponentInstanceOfType

Object getComponentInstanceOfType(Class<?> componentType)
Return component instance regarding the given Class key and Current Tenant.

Parameters:
componentType - Class type of a component
Returns:
a component instance or null if nothing found in Current Tenant.

accept

boolean accept(org.picocontainer.ComponentAdapter adapter)
Answers if given component should be regarded as per-tenant service and can be registered (and unregistered) in the context. This method created for use in conjunction with registerComponent(ComponentAdapter) and unregisterComponent(Object) methods.

Parameters:
adapter - ComponentAdapter
Returns:
boolean, true if given component should be regarded as per-tenant service, false otherwise.

accept

boolean accept(Object key)
Answers if given component key should be regarded as a key of per-tenant service and can be used to get a component from the context. This method created for use in conjunction with getters of components.

Parameters:
key - Object, it can be a Class otherwise it will be treated as String.
Returns:
boolean, true if given key should be regarded as a key of per-tenant component, false otherwise.
See Also:
accept(ComponentAdapter)

registerComponent

org.picocontainer.ComponentAdapter registerComponent(org.picocontainer.ComponentAdapter component)
                                                     throws TenantComponentRegistrationException
Register component adapter in the context. If this context component itself not yet started by the container it will store given adapter for later new tenants and return false, otherwise will register it into current tenant container and return true.
If false returned it means that given component should be registered in the container itself also (for use by Default Tenant).
Note that registerComponent(ComponentAdapter) method doesn't check if the given component is regarding as per-tenant service. To get this answer use accept(ComponentAdapter) method.
If an error will occur during the current container calculation the component will not be registered and an exception of type TenantComponentRegistrationException will be thrown.

Parameters:
component - ComponentAdapter
Returns:
ComponentAdapter, Not null indicates that component was successfully registered, false tells that component also should be registered in the container.
Throws:
TenantComponentRegistrationException - if tenant services not ready or Current Tenant cannot be defined (not set properly in most cases).

unregisterComponent

org.picocontainer.ComponentAdapter unregisterComponent(Object componentKey)
                                                       throws TenantComponentRegistrationException
Unregister component by key from the context. If this context component itself not yet started by the container it will remove internally stored component adapter from later use for new tenants and return null, otherwise it will unregister the component from the context and return its adapter.
If null returned it means that this component should be unregistered from the container also. See also registration in registerComponent(ComponentAdapter) for false result.
Note that #unregisterComponent(ComponentAdapter) method doesn't check if the given component is regarding as per-tenant service. To get this answer use accept(ComponentAdapter) method.
If an error will occur during the current container calculation the component will not be unregistered and an exception of type TenantComponentRegistrationException will be thrown.

Parameters:
componentKey - Object
Returns:
ComponentAdapter what was registered in the context or null if component should be unregistered from the container.
Throws:
TenantComponentRegistrationException - if tenant services not ready or Current Tenant cannot be defined (not set properly in most cases).
See Also:
for registration details.

eXo Kernel :: Container 2.4.11-UXP01

Copyright © 2014 eXo Platform SAS. All Rights Reserved.