Source:
public void deploy(String absoluteFilePath) throws DeploymentException { UserStoreConfigXMLProcessor userStoreXMLProcessor = new UserStoreConfigXMLProcessor(absoluteFilePath); RealmConfiguration realmConfiguration; File userMgtConfigFile = new File(absoluteFilePath); AbstractUserStoreManager primaryUSM = null; try { String pattern = Pattern.quote(System.getProperty("file.separator")); String[] filePathSegments = absoluteFilePath.split(pattern); if (filePathSegments[filePathSegments.length - 2].equals(UserStoreConfigConstants.USER_STORES)) { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); UserCoreUtil.getRealmService().clearCachedUserRealm(tenantId); TenantCache.getInstance().clearCacheEntry(new TenantIdKey(tenantId)); realmConfiguration = userStoreXMLProcessor.buildUserStoreConfigurationFromFile(); UserRealm userRealm = (UserRealm) CarbonContext.getThreadLocalCarbonContext().getUserRealm(); if (filePathSegments[filePathSegments.length - 4].equals(UserStoreConfigConstants.TENANTS)) { realmConfiguration.setTenantId(tenantId); } setSecondaryUserStore(userRealm.getRealmConfiguration(), realmConfiguration); primaryUSM = (AbstractUserStoreManager) userRealm.getUserStoreManager(); try { primaryUSM.addSecondaryUserStoreManager(realmConfiguration, userRealm); } catch (UserStoreException ex) { throw new DeploymentException("Error occurred while initializing new user store manager.", ex); } log.info("Realm configuration of tenant:" + CarbonContext.getThreadLocalCarbonContext().getTenantId() + " modified with " + absoluteFilePath); } else { } } catch (UserStoreException ex) { String errorMessage = "The deployment of " + userMgtConfigFile.getName() + " is not valid."; if (log.isDebugEnabled()) { log.debug(errorMessage, ex); } throw new DeploymentException(errorMessage, ex); } }

Target:
public void deploy(String absoluteFilePath) throws DeploymentException { UserStoreConfigXMLProcessor userStoreXMLProcessor = new UserStoreConfigXMLProcessor(absoluteFilePath); RealmConfiguration realmConfiguration; File userMgtConfigFile = new File(absoluteFilePath); AbstractUserStoreManager primaryUSM = null; try { String pattern = Pattern.quote(System.getProperty("file.separator")); String[] filePathSegments = absoluteFilePath.split(pattern); if (filePathSegments[filePathSegments.length - 2].equals(UserStoreConfigConstants.USER_STORES)) { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); UserCoreUtil.getRealmService().clearCachedUserRealm(tenantId); TenantCache.getInstance().clearCacheEntry(new TenantIdKey(tenantId)); realmConfiguration = userStoreXMLProcessor.buildUserStoreConfigurationFromFile(); UserRealm userRealm = (UserRealm) CarbonContext.getThreadLocalCarbonContext().getUserRealm(); if (filePathSegments[filePathSegments.length - 4].equals(UserStoreConfigConstants.TENANTS)) { realmConfiguration.setTenantId(tenantId); } setSecondaryUserStore(userRealm.getRealmConfiguration(), realmConfiguration); primaryUSM = (AbstractUserStoreManager) userRealm.getUserStoreManager(); try { primaryUSM.addSecondaryUserStoreManager(realmConfiguration, userRealm); } catch (UserStoreException ex) { String domainName = realmConfiguration .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME); if (log.isDebugEnabled()) { log.debug("Error occurred while initializing secondary user store manager with domain: " + domainName); } throw new DeploymentException("Error occurred while initializing secondary user store manager.", ex); } log.info("Realm configuration of tenant:" + CarbonContext.getThreadLocalCarbonContext().getTenantId() + " modified with " + absoluteFilePath); } else { } } catch (UserStoreException ex) { String errorMessage = "The deployment of " + userMgtConfigFile.getName() + " is not valid."; if (log.isDebugEnabled()) { log.debug(errorMessage, ex); } throw new DeploymentException(errorMessage, ex); } }