private void startTenantFlow(String tenantDomain) throws IdentityApplicationManagementException {
   int tenantId;
   try {
     tenantId =
         ApplicationManagementServiceComponentHolder.getInstance()
             .getRealmService()
             .getTenantManager()
             .getTenantId(tenantDomain);
   } catch (UserStoreException e) {
     throw new IdentityApplicationManagementException("Error when setting tenant domain. ", e);
   }
   PrivilegedCarbonContext.startTenantFlow();
   PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain);
   PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId);
 }
 /**
  * Get config system registry
  *
  * @return config system registry
  * @throws org.wso2.carbon.registry.api.RegistryException
  */
 private Registry getConfigSystemRegistry() throws RegistryException {
   return (Registry)
       ApplicationManagementServiceComponentHolder.getInstance()
           .getRegistryService()
           .getConfigSystemRegistry();
 }
 /**
  * Get axis config
  *
  * @return axis configuration
  */
 private AxisConfiguration getAxisConfig() {
   return ApplicationManagementServiceComponentHolder.getInstance()
       .getConfigContextService()
       .getServerConfigContext()
       .getAxisConfiguration();
 }