Examples of SuperTenantCarbonContext


Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

    }

    public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) {
        SuperTenantCarbonContext.startTenantFlow();
        try {
            SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext();
            carbonContext.setTenantId(tenantId);
            carbonContext.setTenantDomain(tenantDomain);
            // We do not persist Admin service events
            if (SystemFilter.isFilteredOutService((AxisServiceGroup) axisService.getParent())) {
                return;
            }
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

    }

    public void moduleUpdate(AxisEvent axisEvent, AxisModule axisModule) {
        SuperTenantCarbonContext.startTenantFlow();
        try {
            SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext();
            carbonContext.setTenantId(tenantId);
            carbonContext.setTenantDomain(tenantDomain);
            //TODO: Check whether we can ignore AdminModules - SystemFilter.isFilteredOutModule
            // We ignore admin module events
            String moduleName = axisModule.getName();
            /*if (moduleName.equals(ServerConstants.ADMIN_MODULE) ||
                moduleName.equals(ServerConstants.TRACER_MODULE) ||
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

        axisConfig = new AxisConfiguration();

        //set the registry instance in AxisConfiguration
        try {
            RegistryService rs = CarbonCoreDataHolder.getInstance().getRegistryService();
            SuperTenantCarbonContext carbonContext =
                    SuperTenantCarbonContext.getCurrentContext(axisConfig);
            carbonContext.setRegistry(RegistryType.SYSTEM_CONFIGURATION,
                    rs.getConfigSystemRegistry());
            carbonContext.setRegistry(RegistryType.SYSTEM_GOVERNANCE,
                    rs.getGovernanceSystemRegistry());
            carbonContext.setRegistry(RegistryType.LOCAL_REPOSITORY,
                    rs.getLocalRepository());
            carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
            CarbonContextHolder.getThreadLocalCarbonContextHolder().setTenantId(MultitenantConstants.SUPER_TENANT_ID);

        } catch (Exception e) {
            String msg = "Error occurred while populating the CarbonContext on the " +
                    "AxisConfiguration";
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

    private static final Log log = LogFactory.getLog(CarbonAppPersistenceManager.class);

    public CarbonAppPersistenceManager(AxisConfiguration axisConfig) throws CarbonException {
        this.axisConfig = axisConfig;
        try {
            SuperTenantCarbonContext carbonCtx = SuperTenantCarbonContext.getCurrentContext(axisConfig);
            localRegistry = (Registry) carbonCtx.getRegistry(RegistryType.LOCAL_REPOSITORY);
            configRegistry = (Registry) carbonCtx.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
            governanceRegistry = (Registry) carbonCtx.getRegistry(RegistryType.SYSTEM_GOVERNANCE);

            // get the root registry for the current tenant from RegistryService
            rootRegistry = AppDeployerServiceComponent.getRegistryService().getRegistry(
                    CarbonConstants.REGISTRY_SYSTEM_USERNAME, carbonCtx.getTenantId());
        } catch (Exception e) {
            log.error("Error while retrieving config registry from Axis configuration", e);
        }
        if (configRegistry == null) {
            throw new CarbonException("Configuration Registry is not available");
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

    public static String getTenantIdString(AxisConfiguration axisConfig) {
        return String.valueOf(getTenantId(axisConfig));
    }

    public static int getTenantId(AxisConfiguration axisConfig) {
        SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(axisConfig);
        return carbonContext.getTenantId();
    }
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

            newSession.setAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE, session
                    .getAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE));
            newSession.setAttribute(ServerConstants.USER_LOGGED_IN, session
                    .getAttribute(ServerConstants.USER_LOGGED_IN));

            SuperTenantCarbonContext newContext = SuperTenantCarbonContext.getCurrentContext(newSession);
            SuperTenantCarbonContext oldContext = SuperTenantCarbonContext.getCurrentContext(session);

            newContext
                    .setRegistry(RegistryType.USER_GOVERNANCE, oldContext.getRegistry(
                            RegistryType.USER_GOVERNANCE));
            newContext.setRegistry(RegistryType.USER_CONFIGURATION,
                    oldContext.getRegistry(
                            RegistryType.USER_CONFIGURATION));
            newContext.setRegistry(RegistryType.SYSTEM_CONFIGURATION,
                    oldContext.getRegistry(
                            RegistryType.SYSTEM_CONFIGURATION));
            newContext.setRegistry(RegistryType.SYSTEM_GOVERNANCE,
                    oldContext.getRegistry(
                            RegistryType.SYSTEM_GOVERNANCE));
            newContext.setUserRealm(oldContext.getUserRealm());
            newContext.setTenantDomain(oldContext.getTenantDomain());
            newContext.setTenantId(oldContext.getTenantId());

            String loginStatus = (String) session.getAttribute(ServerConstants.USER_LOGGED_IN);
            return (loginStatus!=null);
        }
        return false;
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

    public void createdConfigurationContext(ConfigurationContext configurationContext) {
        AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
        try {
            axisConfig.engageModule(StatisticsConstants.STATISTISTICS_MODULE_NAME);
        } catch (Throwable e) {
            SuperTenantCarbonContext carbonContext =
                    SuperTenantCarbonContext.getCurrentContext(axisConfig);
            String msg;
            if (carbonContext.getTenantDomain() != null) {
                msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME +
                      " module to tenant " + carbonContext.getTenantDomain() +
                      "[" + carbonContext.getTenantId() + "]";
            } else {
                msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME +
                      " module to super tenant ";
            }
            log.error(msg, e);
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

                            topic);
            subscription.setEventDispatcherName(RegistryEventingConstants.TOPIC_PREFIX);
            subscription.setTenantId(registry.getCallerTenantId());
            subscription.setOwner(registry.getUserName());

            SuperTenantCarbonContext currentContext = SuperTenantCarbonContext.getCurrentContext();
            currentContext.setTenantId(registry.getCallerTenantId(), true);
            currentContext.setUserRealm(registry.getUserRealm());
            currentContext.setUsername(registry.getUserName());

            return eventingService.subscribe(subscription);
        } catch (InvalidMessageException e) {
            throw new DeploymentSynchronizerException("Error while subscribing for registry " +
                    "events on collection: " + absolutePath, e);
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

            throw new IllegalStateException("Registry eventing service unavailable");
        }

        SuperTenantCarbonContext.startTenantFlow();
        try {
            SuperTenantCarbonContext currentContext = SuperTenantCarbonContext.getCurrentContext();
            currentContext.setTenantId(tenantId, true);
            return eventingService.unsubscribe(subscriptionId);
        } finally {
            SuperTenantCarbonContext.endTenantFlow();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

        String repoPath = configCtx.getAxisConfiguration().getRepository().getPath();
        File webappsDirFile = new File(repoPath + File.separator + webappsDir);
        if (!webappsDirFile.exists() && !webappsDirFile.mkdirs()) {
            log.warn("Could not create directory " + webappsDirFile.getAbsolutePath());
        }
        SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(configCtx);
        int tenantId = carbonContext.getTenantId();
        String tenantDomain = carbonContext.getTenantDomain();
        String webContextPrefix = (tenantDomain != null) ?
                                  "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX +
                                  "/" + tenantDomain + "/" + WebappsConstants.WEBAPP_PREFIX + "/" :
                                  "";
        WebApplicationsHolder webappsHolder = new WebApplicationsHolder(new File(webappsDir));
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.