Examples of CarbonContext


Examples of org.wso2.carbon.context.CarbonContext

    private int ownerTenantId;
    private CacheManagerFactoryImpl cacheManagerFactory;

    public HazelcastCacheManager(String name, CacheManagerFactoryImpl cacheManagerFactory) {
        this.cacheManagerFactory = cacheManagerFactory;
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        if (carbonContext == null) {
            throw new IllegalStateException("CarbonContext cannot be null");
        }
        ownerTenantDomain = carbonContext.getTenantDomain();
        if (ownerTenantDomain == null) {
            throw new IllegalStateException("Tenant domain cannot be " + ownerTenantDomain);
        }
        ownerTenantId = carbonContext.getTenantId();
        if (ownerTenantId == MultitenantConstants.INVALID_TENANT_ID) {
            throw new IllegalStateException("Tenant ID cannot be " + ownerTenantId);
        }
        this.name = name;
        status = Status.STARTED;
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

    private long capacity = CachingConstants.DEFAULT_CACHE_CAPACITY;
    private EvictionAlgorithm evictionAlgorithm = CachingConstants.DEFAULT_EVICTION_ALGORITHM;

    public CacheImpl(String cacheName, CacheManager cacheManager) {
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        if (carbonContext == null) {
            throw new IllegalStateException("CarbonContext cannot be null");
        }
        ownerTenantDomain = carbonContext.getTenantDomain();
        if (ownerTenantDomain == null) {
            throw new IllegalStateException("Tenant domain cannot be " + ownerTenantDomain);
        }
        ownerTenantId = carbonContext.getTenantId();
        if (ownerTenantId == MultitenantConstants.INVALID_TENANT_ID) {
            throw new IllegalStateException("Tenant ID cannot be " + ownerTenantId);
        }
        this.cacheName = cacheName;
        this.cacheManager = cacheManager;
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

* TODO: class description
*/
public final class Util {

    public static void checkAccess(String ownerTenantDomain, int ownerTenantId) {
        CarbonContext carbonContext = getCarbonContext();
        String callerTenantDomain = carbonContext.getTenantDomain();
        if (callerTenantDomain == null) {
            throw new IllegalStateException("Caller tenant domain cannot be null");
        }
        int callerTenantId = carbonContext.getTenantId();
        if (callerTenantId == MultitenantConstants.INVALID_TENANT_ID) {
            throw new IllegalStateException("Caller Tenant ID cannot be " + MultitenantConstants.INVALID_TENANT_ID);
        }

        if (callerTenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME) &&
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

                                        "],[" + callerTenantId + "]}");
        }
    }

    private static CarbonContext getCarbonContext() {
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        if (carbonContext == null) {
            throw new IllegalStateException("CarbonContext cannot be null");
        }
        return carbonContext;
    }
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

            return null;
        }
        if (containsKey(key)) {
            return null;
        }
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        FutureTask<V> task = new FutureTask<V>(new CacheLoaderLoadCallable<K, V>(this, cacheLoader, key,
                                                                                 carbonContext.getTenantDomain(),
                                                                                 carbonContext.getTenantId()));
        cacheLoadExecService.submit(task);
        return task;
    }
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

            return null;
        }
        if (keys.contains(null)) {
            throw new NullPointerException("key");
        }
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        Callable<Map<K, ? extends V>> callable =
                new CacheLoaderLoadAllCallable<K, V>(this, cacheLoader, keys,
                                                     carbonContext.getTenantDomain(),
                                                     carbonContext.getTenantId());
        FutureTask<Map<K, ? extends V>> task = new FutureTask<Map<K, ? extends V>>(callable);
        cacheLoadExecService.submit(task);
        return task;
    }
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

     */
    public RegistryEvent(T message) {
        this.message = message;
        Date date = new Date();
        this.timestamp = DATE_FORMAT.format(date);
        CarbonContext carbonContext = CarbonContext.getCurrentContext();
        this.contextDetails.setUsername(carbonContext.getUsername());
        this.contextDetails.setTenantId(carbonContext.getTenantId());
        this.registrySessionDetails.setChroot(CurrentSession.getChroot());
        this.registrySessionDetails.setUsername(CurrentSession.getUser());
        this.registrySessionDetails.setTenantId(CurrentSession.getTenantId());
    }
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

      return NO_LOGS_MESSAGE;
    }
  }

  public boolean isSuperTenantUser() {
    CarbonContext carbonContext = CarbonContext.getCurrentContext();
    int tenantId = carbonContext.getTenantId();
    if (tenantId == 0) {
      return true;
    } else {
      return false;
    }
View Full Code Here

Examples of org.wso2.carbon.context.CarbonContext

     *
     * @return Not null <code> Cluster</code> instance
     * @see #getClusterForCurrentUser()
     */
    public Cluster getClusterForCurrentUser() {
        CarbonContext carbonContext = CarbonContext.getCurrentContext();
        String userName = carbonContext.getUsername();

        String tenantDomain = carbonContext.getTenantDomain();
        if (tenantDomain != null && !"".equals(tenantDomain)) {
            userName += "@" + tenantDomain;
        }

        ClusterConfiguration configuration =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.