Make SecureStore an abstract class
This modification will make the implementation of a site program to
switch the secure store easier. The new SwitchSecureStore program will
be added by a follow-up change.
In switch-secure-store we need to migrate all values stored in the old
SecureStore to new one. Because we don't store (and also can't reliably
figure out) the value type the only possible way is to first try read
the value as String, then when it is null try to get it as List. But
this assumption will fail with jgit Config implementation which is used
in DefaultSecureStore. JGit Config during getString() method call will
call getRawStringList() and return its first element. Therefore migration
will be incorrect for all stored List values.
The solution here is to always use getList() and setList() in
switch-secure-store and repeat jgit behavior in SecureStore. Making the
get() method to return getList()[0] and set() to call setList() with
single element.
To provide default implementations of get() and set() method in
SecureStore we need to make it as an abstract class. Also those methods
are marked as final to prevent implementors from overriding them.
Also changes JarScanner.findImplementationsOf to findSubClassesOf(). This
method was introduced for SecureStore (and it was only used by it), so
now when SecureStore becomes abstract class its implementation (and
name) also should be updated.
Change-Id: Id13bc6ec170c31b43b5a1cd696ba746006e1f0b2
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
5 files changed