Roedy Green said:
you have there about 100 lines of bubblegum that manages to persist
one value. Does that not seem ridiculous to you?
That bubble gum is more to do with implementing the preferences API than
using the persistence service. And note you can store more than one value.
You can store a whole hierarchy of values.
This is like some fancy car door lock that manages to befuddle the
owner into locking himself out. It often keeps the owner out, but
always permits in professional thieves.
And what you are suggesting is a tiny padlock that is totally inadequate for
any but the most trivial applications.
That bailing wire scheme is highly inconvenient and further it offers
no more security that had the unsigned app been told it could write
only X bytes of files in the current directory.
Such a limitation on access cannot be done with the current I/O scheme.
There is no means for allowing only access to a given directory and limiting
how much you can write. It would require some new API instead of the normal
File, FileInputStream, and FileOutputStream. Such an API would not be
drastically different than the Persistence service.
Your scheme would lose the ability to share data between different apps from
the same host. That is a design feature of the PersistenceService. And don't
forget the ability to "tag" data as CACHED, DIRTY, or TEMPORARY.