eXo Kernel :: Container 2.4.4-CLD

org.exoplatform.container.multitenancy
Annotation Type Multitenant


public @interface Multitenant

An element annotated with @Multitenant will be enhanced to be mutlitenant capable in eXo container.

If applied to a class then it means that such class should be enhanced in special way by the container to provide per-tenant instances of the component.
When applied to a method of the class already annotated as multitenant, then the method's return type (if it is not void) should be also enhanced to provide per-tenant isolation of the returned instance in future. But take in account, such annotation on a method doesn't guaranty the returned object will be enhanced by the multitenant container in all cases. In general only interfaces and non final classes with default (empty) constructor are good candidates for such manipulation. Refer to the actual implementation of multitenancy for details of what and how can be enhanced.
To skip such manipulation on a method use @Multitenant(false), it can be useful if the method already supports multitenancy (natively or not requires to be such) but other methods should be still enhanced.
It also possible to enable enhancement explicitly for only selected methods using @Multitenant(explicitly=true) on a class and then annotate target methods with @Multitenant.

Example 1: Enhance all methods of the class except of getInfo().

 @Multitenant
 public class AcmeComponent {
   
   // This method, and optionally its return value, will be enhanced.  
   public AcmeData getData() {
     return new AcmeData();
   }
   
   // This method will not be enhanced.
   @Multitenant(false)  
   public InfoData getInfo() {
     return new InfoData();
   }
 }
 
Example 2: enhance only explicitly selected methods.
 @Multitenant(explicitly=true)
 public class AcmeComponent {
   
   // This method, and optionally its return value, will be enhanced.
   @Multitenant  
   public AcmeData getData() {
     return new AcmeData();
   }
   
   // This method will not be enhanced.
   public InfoData getInfo() {
     return new InfoData();
   }
 }
 

Version:
$Id: Multitenant.java 00000 Mar 20, 2013 11:10:17 PM pnedonosko $
Author:
Peter Nedonosko

Optional Element Summary
 boolean explicitly
          If will be set in an annotation of a class, then it will mean to enhance only explicitly annotated methods of the class.
 boolean value
          Value true means 'make it multitenant', false means 'skip it and don't do anything'.
 

value

public abstract boolean value
Value true means 'make it multitenant', false means 'skip it and don't do anything'.

Returns:
boolean, true by default and means enhance a type to make it multitenant capable, false means to skip enhancement.
Default:
true

explicitly

public abstract boolean explicitly
If will be set in an annotation of a class, then it will mean to enhance only explicitly annotated methods of the class. By default all methods will be enhanced to be multitenant capable.

Returns:
boolean, true if special treating should be performed on a type to make it multitenant capable, false by default and it means enhance all methods.
Default:
false

eXo Kernel :: Container 2.4.4-CLD

Copyright © 2013 eXo Platform SAS. All Rights Reserved.