/** * Modify or insert new profiles into an existing credentials file by * in-place modification. Only the properties of the affected profiles will * be modified; all the unaffected profiles and comment lines will remain * the same. This method does not support renaming a profile. * * @param destination * The destination file to modify * @param profiles * All the credential profiles to be written. */ public static void modifyOrInsertProfiles(File destination, Profile... profiles) { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } modifyProfiles(destination, modifications); }
@Override protected void onProfileStartingLine(String profileName, String line) { existingProfileProperties.put(profileName, new HashSet<String>()); // Copy the line after flush the buffer flush(); if (deletedProfiles.contains(profileName)) return; // If the profile name is changed if (newProfiles.get(profileName) != null) { String newProfileName = newProfiles.get(profileName).getProfileName(); if ( !newProfileName.equals(profileName) ) { line = "[" + newProfileName + "]"; } } writeLine(line); }
private void writeProfile(Profile profile) { writeProfileName(profile.getProfileName()); for (Entry<String, String> entry : profile.getProperties().entrySet()) { writeProperty(entry.getKey(), entry.getValue()); } }
final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile);
/** * Modify or insert new profiles into an existing credentials file by * in-place modification. Only the properties of the affected profiles will * be modified; all the unaffected profiles and comment lines will remain * the same. This method does not support renaming a profile. * * @param destination * The destination file to modify * @param profiles * All the credential profiles to be written. */ public static void modifyOrInsertProfiles(File destination, Profile... profiles) { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } modifyProfiles(destination, modifications); }
@Override protected void onProfileStartingLine(String profileName, String line) { existingProfileProperties.put(profileName, new HashSet<String>()); // Copy the line after flush the buffer flush(); if (deletedProfiles.contains(profileName)) return; // If the profile name is changed if (newProfiles.get(profileName) != null) { String newProfileName = newProfiles.get(profileName).getProfileName(); if ( !newProfileName.equals(profileName) ) { line = "[" + newProfileName + "]"; } } writeLine(line); }
private void writeProfile(Profile profile) { writeProfileName(profile.getProfileName()); for (Entry<String, String> entry : profile.getProperties().entrySet()) { writeProperty(entry.getKey(), entry.getValue()); } }
final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile);
/** * Modify or insert new profiles into an existing credentials file by * in-place modification. Only the properties of the affected profiles will * be modified; all the unaffected profiles and comment lines will remain * the same. This method does not support renaming a profile. * * @param destination * The destination file to modify * @param profiles * All the credential profiles to be written. */ public static void modifyOrInsertProfiles(File destination, Profile... profiles) { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } modifyProfiles(destination, modifications); }
@Override protected void onProfileStartingLine(String profileName, String line) { existingProfileProperties.put(profileName, new HashSet<String>()); // Copy the line after flush the buffer flush(); if (deletedProfiles.contains(profileName)) return; // If the profile name is changed if (newProfiles.get(profileName) != null) { String newProfileName = newProfiles.get(profileName).getProfileName(); if ( !newProfileName.equals(profileName) ) { line = "[" + newProfileName + "]"; } } writeLine(line); }
private void writeProfile(Profile profile) { writeProfileName(profile.getProfileName()); for (Entry<String, String> entry : profile.getProperties().entrySet()) { writeProperty(entry.getKey(), entry.getValue()); } }
final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile);