Add embedded h2 key-value store for persistent storage
Today, there is two sources of persistent data in OwlPlug:
- H2 Datasource - An embedded SQL H2 database to store semi-persistent state data. Used by JPA/Hibernate through Spring Data. A relational database allow for some query optimization on large scale of data. But because schema migration is not managed by OwlPlug, the database is cleared when breaking changes or changes not managed by the hibernate ddl-auto-update are introduced. Managing migration would require to add a tool like
liquidbasein the app which is quite overkill. So, this datasource is used as a storage area for data that can be regenerated from plugins and pakages scans. - Preferences - Parameters in the Options tab are stored using the Java Preferences API. The data is stored in an OS dependant backing store. Some limitations for storing and querying the data (limited key-space, limited string value size, ...) are present. It cannot be used to store large dataset.
Anoter source is required to store user data related to plugins (aka plugins footprint reference) or packages (aka packages footprint references). This can be used to store tag/labels associated to plugins (#18)
MongoDB can be used to replace the H2 database and remove the schema migration constraint. The java embeddable mongodb is repackaged by flapdoodle. Even if widely used for java integration test, in might not be the best solution for the long term. Moreover, migrating the data might be required anymay in case of breaking changes in data structures.
Instead, the H2 native MVStore could be used to store and fetch key-value data in the owlplug user workspace (~/.owlpug)
For an H2-based solution, the version of the database file might be incompatible with the runtime version used in OwlPlug. Some updates might require dropping user-data or installing a version that allows the migration from an old to a newer format (quite complex to implement)