/** * Constructs a new {@code PluginDefaults} based on the provided {@link StorageProvider}. * * @param provider the storage provider */ public PluginDefaults(StorageProvider provider) { refs = provider.getRefsDatabaseFormat(); objects = provider.getObjectDatabaseFormat(); index = provider.getIndexDatabaseFormat(); conflicts = provider.getConflictsDatabaseFormat(); }
/** * Constructs a new {@code PluginDefaults} based on the provided {@link StorageProvider}. * * @param provider the storage provider */ public PluginDefaults(StorageProvider provider) { refs = provider.getRefsDatabaseFormat(); objects = provider.getObjectDatabaseFormat(); index = provider.getIndexDatabaseFormat(); conflicts = provider.getConflictsDatabaseFormat(); }
@Override protected final VersionedFormat readConfig(ConfigDatabase config) { final String formatKey = "storage.index"; String versionKey = null; String format = null, version = null; try { format = getConfig(formatKey, config).orNull(); if (format != null) { versionKey = format + ".version"; version = getConfig(versionKey, config).orNull(); } } catch (RuntimeException e) { // ignore, the config may not be available when we need this. } if (format == null || version == null) { // .get, not .orNull. we should only be using the plugin providers when there are // plugins set up return defaults.getIndex().get(); } for (StorageProvider p : StorageProvider.findProviders()) { VersionedFormat indexFormat = p.getIndexDatabaseFormat(); if (indexFormat != null && format.equals(indexFormat.getFormat()) && version.equals(indexFormat.getVersion())) { return indexFormat; } } throw new IllegalStateException( String.format("No storage provider found for %s='%s' and %s='%s'", formatKey, format, versionKey, version)); }
@Override protected final VersionedFormat readConfig(ConfigDatabase config) { final String formatKey = "storage.index"; String versionKey = null; String format = null, version = null; try { format = getConfig(formatKey, config).orNull(); if (format != null) { versionKey = format + ".version"; version = getConfig(versionKey, config).orNull(); } } catch (RuntimeException e) { // ignore, the config may not be available when we need this. } if (format == null || version == null) { // .get, not .orNull. we should only be using the plugin providers when there are // plugins set up return defaults.getIndex().get(); } for (StorageProvider p : StorageProvider.findProviders()) { VersionedFormat indexFormat = p.getIndexDatabaseFormat(); if (indexFormat != null && format.equals(indexFormat.getFormat()) && version.equals(indexFormat.getVersion())) { return indexFormat; } } throw new IllegalStateException( String.format("No storage provider found for %s='%s' and %s='%s'", formatKey, format, versionKey, version)); }
VersionedFormat indexDatabaseFormat = sp.getIndexDatabaseFormat(); VersionedFormat conflictsDatabaseFormat = sp.getConflictsDatabaseFormat(); VersionedFormat refsDatabaseFormat = sp.getRefsDatabaseFormat();
VersionedFormat indexDatabaseFormat = sp.getIndexDatabaseFormat(); VersionedFormat refsDatabaseFormat = sp.getRefsDatabaseFormat(); VersionedFormat conflictsDatabaseFormat = sp.getConflictsDatabaseFormat();
VersionedFormat indexDatabaseFormat = sp.getIndexDatabaseFormat(); VersionedFormat refsDatabaseFormat = sp.getRefsDatabaseFormat(); VersionedFormat conflictsDatabaseFormat = sp.getConflictsDatabaseFormat();