protected ConfigurationContext getConfigContext() {
// If a tenant has been set, then try to get the ConfigurationContext of that tenant
PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
ConfigurationContextService configurationContextService =
(ConfigurationContextService) carbonContext.getOSGiService(ConfigurationContextService.class);
ConfigurationContext mainConfigContext = configurationContextService.getServerConfigContext();
String domain = carbonContext.getTenantDomain();
if (domain != null && !MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(domain)) {
return TenantAxisUtils.getTenantConfigurationContext(domain, mainConfigContext);
} else if (carbonContext.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) {
return mainConfigContext;