Package org.wso2.carbon.core.multitenancy

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


     * @throws IOException if the operation failed.
     */
    public static String generateAppArchiveForTenant(String source, HttpSession session,
                                                     String propertyFile)
            throws IOException {
        SuperTenantCarbonContext carbonContext =
                SuperTenantCarbonContext.getCurrentContext();
        int tenantId = carbonContext.getTenantId();
        if (tenantId <= 0) {
            return source;
        }
        String tenantDomain = carbonContext.getTenantDomain(true);
        String username = carbonContext.getUsername();
        File tempDir = File.createTempFile(TENANT_APP_TEMP_DIRECTORY_PATH, "");
        File tempFile = File.createTempFile(TENANT_APP_TEMP_FILE_PATH, "");
        String dir = tempDir.getAbsolutePath();
        String destination = tempFile.getAbsolutePath() +
                source.substring(source.lastIndexOf(File.separator));
View Full Code Here


            registry = (Registry)
                    httpSession.getAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE);
            if (registry != null) {
                return registry;
            } else if (registryService != null) {
                SuperTenantCarbonContext carbonContext =
                        SuperTenantCarbonContext.getCurrentContext(httpSession);
                int tenantId = carbonContext.getTenantId();
                String username = carbonContext.getUsername();
                try {
                    registry = registryService.getRegistry(username, tenantId);
                    httpSession.setAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE, registry);
                    return registry;
                } catch (Exception ignored) {
View Full Code Here

    private String getTenantDomain(MessageContext messageContext) {
        return SuperTenantCarbonContext.getCurrentContext(messageContext).getTenantDomain(true);
    }

    private int getTenantId(MessageContext messageContext) {
        SuperTenantCarbonContext carbonContext =
                SuperTenantCarbonContext.getCurrentContext(messageContext);
        int tenantId = carbonContext.getTenantId();
        if (tenantId > -1) {
            return tenantId;
        }
        String domain = carbonContext.getTenantDomain();
        if (domain == null) {
            SOAPBody soapBody = messageContext.getEnvelope().getBody();
            if (soapBody != null && soapBody.getFirstElement() != null) {
                OMElement usernameElem = soapBody.getFirstElement().getFirstChildWithName(
                        new QName(ServerConstants.AUTHENTICATION_SERVICE_NS,
View Full Code Here

        messageContext.setProperty(MessageBoxConstants.SQS_AUTHENTICATED, Boolean.TRUE);
        if (servletRequest != null) {
            HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;

            try {
                SuperTenantCarbonContext carbonContext =
                        SuperTenantCarbonContext.getCurrentContext(messageContext);
                CarbonAuthenticationUtil.onSuccessAdminLogin(httpServletRequest.getSession(),
                                                             accessKeyId,
                                                             carbonContext.getTenantId(),
                                                             carbonContext.getTenantDomain(),
                                                             null);
            } catch (Exception e) {
                throw new SQSAuthenticationException("Failed to set on success admin " +
                                                     "log in parameters" + e.getMessage());
            }
View Full Code Here


            // at the stratos automatically subscribe

            AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
            SuperTenantCarbonContext superTenantCarbonContext = SuperTenantCarbonContext.getCurrentContext(axisConfiguration);
            String tenantDomainName = superTenantCarbonContext.getTenantDomain();

            if (tenantDomainName == null) {
                ServerConfiguration serverConfiguration = this.serverConfiguration;
                String mediationServerURL = serverConfiguration.getFirstProperty(BAM_SERVER_URL);
View Full Code Here

        ConfigurationContextService confContextService = PublisherUtils.getConfigurationContextService();
        int port = CarbonUtils.getTransportPort(confContextService.getServerConfigContext(), "https");
        String baseServerUrl = TRANSPORT + "://" + hostName + ":" + port;
        ConfigurationContext configurationContext = confContextService.getServerConfigContext();
        String context = configurationContext.getContextRoot();
        SuperTenantCarbonContext tenantCarbonContext = SuperTenantCarbonContext.getCurrentContext(axisConfiguration);
        String tenantDomain = null;
        if (tenantCarbonContext != null) {
            tenantDomain = tenantCarbonContext.getTenantDomain();
        }

        if (tenantDomain != null) {
            serverName = baseServerUrl + context + "t/" + tenantDomain;
        } else if (tenantDomain == null && context.equals("/")) {
View Full Code Here

        }
        return isJMSEnabled;
    }

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

        if (httpSession == null) {
          return new String[0];
        }

        /* first return the tenant id from the tenant domain */
        SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(httpSession);
    String tenantDomain = carbonContext.getTenantDomain();
        int tenantId = carbonContext.getTenantId();
        if (tenantId < 0) {
            tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
        }
        if (tenantId < 0) {
            /* the tenant doesn't exist. */
 
View Full Code Here

            log.error("Error while obtaining registry instance for the deployment interceptor", e);
        }
    }

    private void extractTenantInfo(AxisConfiguration axisConfig) {
        SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(axisConfig);
        tenantId = carbonContext.getTenantId();
        tenantDomain = carbonContext.getTenantDomain();
    }
View Full Code Here

    }

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

TOP

Related Classes of org.wso2.carbon.core.multitenancy.SuperTenantCarbonContext

Copyright © 2018 www.massapicom. 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.