Allow to update accounts and general preferences atomically

AccountsUpdate now also supports to update general preferences. This
means account properties and general preferences can now be updated in
the same transaction.

Reading and writing general preferences is now done via AccountConfig.
On load we always read the preferences.config file, but parsing it is
done lazily when the general preferences are accessed for the first
time. Most callers that load accounts are not interested in general
preferences and this avoids unneeded parsing effort for them.

PreferencesConfig encapsules all details about parsing and storing
general preferences and also provides means to read and update the
default general preferences.

Change-Id: Ic0f2adfe4e96311af0c5bfa061fc7c0ca60d91fa
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-01-05 08:32:54 +01:00
parent 56f4a159a1
commit 1b7bac945c
18 changed files with 518 additions and 370 deletions

View File

@@ -424,11 +424,8 @@ public class AccountsUpdate {
private AccountConfig read(Repository allUsersRepo, Account.Id accountId)
throws IOException, ConfigInvalidException {
AccountConfig accountConfig = new AccountConfig(accountId);
accountConfig.load(allUsersRepo);
AccountConfig accountConfig = new AccountConfig(accountId, allUsersRepo).load();
afterReadRevision.run();
return accountConfig;
}