}
@Override
public void saveConnectionProfiles(Collection<ConnectionProfile> connectionProfiles)
{
Node root = new Node("connection-profiles");
for (ConnectionProfile descriptor : connectionProfiles)
{
Node child = root.createChild("connection-profile");
child.attribute(CONFIG_KEY_NAME, descriptor.getName());
child.attribute(CONFIG_KEY_DIALECT, descriptor.getDialect());
child.attribute(CONFIG_KEY_DRIVER, descriptor.getDriver());
child.attribute(CONFIG_KEY_PATH_TO_DRIVER, descriptor.getPath());
child.attribute(CONFIG_KEY_URL, descriptor.getUrl());
child.attribute(CONFIG_KEY_USER, descriptor.getUser());
child.attribute(CONFIG_KEY_SAVE_PASSWORD, descriptor.isSavePassword());
if (descriptor.isSavePassword() && !Strings.isNullOrEmpty(descriptor.getPassword()))
{
String encryptedPassword = encodePassword(descriptor.getPassword());
child.attribute(CONFIG_KEY_PASSWORD, encryptedPassword);
child.attribute(CONFIG_KEY_ENCRYPTED_PASSWORD, "true");
}
}
if (root.getChildren().isEmpty())
{
config.clearProperty("connection-profiles");