// because otherwise the agent will not be able to re-register with any previous name is was registered with.
Preferences preferencesNode = getPreferencesNode();
String securityToken = preferencesNode.get(AgentConfigurationConstants.AGENT_SECURITY_TOKEN, null);
ByteArrayOutputStream backup = new ByteArrayOutputStream();
preferencesNode.exportSubtree(backup);
preferencesNode.clear();
// now load in the preferences
try {
ByteArrayOutputStream raw_config_file = new ByteArrayOutputStream();
StreamUtil.copy(config_file_input_stream, raw_config_file, true);