Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
interface PreferenceStore
{
    // see below for the Updater and Recoverer interfaces
    void Collection<PreferenceRecords> openopenAndLoad(PreferenceStoreUpdater updater, PreferenceStoreRecoverer recoverer);

    // safely persist all state and close all resources
    void close();

    // adds preferences to the store
    void create(Collection<PreferenceRecord> preferences);

    // updates existing preferences. throws an exception if preference with given id is not already in the store
    void update(Collection<PreferenceRecord> preferences);

    // updates existing preferences. if a preference with given id is not already in the store it will be added
    void updateOrCreate(Collection<PreferenceRecord> preferences);

    // remove preferences from the store. throws an exception if preference with given id is not already in the store
    void delete(Collection<PreferenceRecord> preferences);
}

interface PreferenceRecord
{
    UUID getId();
	Map<String, Object> getAttributes();
}

...

  1. Convert PreferenceRecord to Preference
  2. Attach Preference to AbstractConfiguredObject
  3. Convert generic attributes to a type specific PreferenceValue
  4. Cross link to other preferences
Code Block
languagejava

interface PreferenceStoreUpdater
{
    Collection<PreferenceRecord> updatePreferences(String currentVersion, Collection<PreferenceRecord> preferences);
    String getLatestVersion();
}

interface PreferenceStoreRecoverer
{
	void recoverPreferences(Collection<PreferenceRecord> preferences);
}

...