@Override public void initialize() throws UpgradeException { try { // get server instances config Set<String> serverNames = ServerConfiguration.getServers(getAdminToken()); // get the default server values and store values Properties props = ServerConfiguration.getServerInstance( getAdminToken(), ServerConfiguration.DEFAULT_SERVER_CONFIG); setDefaultValues(props); checkCTSStoreConnections(ServerConfiguration.DEFAULT_SERVER_CONFIG, props); // check values for each instance for (String serverName : serverNames) { checkCTSStoreConnections( serverName, ServerConfiguration.getServerInstance(getAdminToken(), serverName)); } } catch (Exception ex) { DEBUG.error("Unable to upgrade External CTS Configuration", ex); throw new UpgradeException(ex); } }
@Override public void perform() throws UpgradeException { try { DEBUG.message("External CTS Configuration upgrading: " + propertiesToModify); UpgradeProgress.reportStart("upgrade.cts.property"); for (Entry<String, String> serverProperty : propertiesToModify.entrySet()) { // get existing values Map<String, String> existingServerProperties = new HashMap( ServerConfiguration.getServerInstance(getAdminToken(), serverProperty.getKey())); // add new values to existing values existingServerProperties.put( CoreTokenConstants.CTS_STORE_HOSTNAME, serverProperty.getValue()); existingServerProperties.keySet().remove(CTS_STORE_PORT); ServerConfiguration.upgradeServerInstance( getAdminToken(), serverProperty.getKey(), null, existingServerProperties); } UpgradeProgress.reportEnd("upgrade.success"); } catch (Exception ex) { DEBUG.error("Unable to upgrade External CTS properties", ex); throw new UpgradeException(ex); } }