public class ProfilesConfigFileWriter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
ProfilesConfigFileWriter.ProfilesConfigFileWriterHelper
Implementation of AbstractProfilesConfigFileScanner, which reads the
content from an existing credentials file (if any) and then modifies some
of the profile properties in place.
|
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
ProfilesConfigFileWriter() |
Modifier and Type | Method and Description |
---|---|
static void |
deleteProfiles(java.io.File destination,
java.lang.String... profileNames)
Remove one or more profiles from the existing credentials file by
in-place modification.
|
static void |
dumpToFile(java.io.File destination,
boolean overwrite,
Profile... profiles)
Write all the credential profiles to a file.
|
static void |
modifyOneProfile(java.io.File destination,
java.lang.String profileName,
Profile newProfile)
Modify one profile in the existing credentials file by in-place
modification.
|
static void |
modifyOrInsertProfiles(java.io.File destination,
Profile... profiles)
Modify or insert new profiles into an existing credentials file by
in-place modification.
|
(package private) static void |
modifyProfiles(java.io.File destination,
java.util.Map<java.lang.String,Profile> modifications)
A package-private method that supports all kinds of profile modification,
including renaming or deleting one or more profiles.
|
public static void dumpToFile(java.io.File destination, boolean overwrite, Profile... profiles)
modifyOrInsertProfiles(File, Profile...)
instead, if you want to perform in-place modification on your existing
credentials file.destination
- The destination file where the credentials will be written to.overwrite
- If true, this method If false, this method will throw
exception if the file already exists.profiles
- All the credential profiles to be written.public static void modifyOrInsertProfiles(java.io.File destination, Profile... profiles)
destination
- The destination file to modifyprofiles
- All the credential profiles to be written.public static void modifyOneProfile(java.io.File destination, java.lang.String profileName, Profile newProfile)
destination
- The destination file to modifyprofileName
- The name of the existing profile to be modifiednewProfile
- The new Profile object.public static void deleteProfiles(java.io.File destination, java.lang.String... profileNames)
destination
- The destination file to modifyprofileNames
- The names of all the profiles to be deleted.static void modifyProfiles(java.io.File destination, java.util.Map<java.lang.String,Profile> modifications)
modifications
- Use null key value to indicate a profile that is to be
deleted.