mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
ENH: Replaces transport config with namespaced settings
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package org.briarproject.settings;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.briarproject.api.settings.SettingsManager;
|
||||
import org.briarproject.api.Settings;
|
||||
|
||||
import org.briarproject.api.db.DatabaseComponent;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
class SettingsManagerImpl implements SettingsManager {
|
||||
|
||||
private final DatabaseComponent db;
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger("SettingsManagerImpl");
|
||||
|
||||
@Inject
|
||||
SettingsManagerImpl(DatabaseComponent db) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the settings object identified by the provided namespace
|
||||
* string
|
||||
*/
|
||||
@Override
|
||||
public Settings getSettings(String namespace) throws DbException {
|
||||
return db.getSettings(namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges (read syncs) the provided settings identified by the provided namespace
|
||||
* string
|
||||
*/
|
||||
@Override
|
||||
public void mergeSettings(Settings s, String namespace) throws DbException {
|
||||
db.mergeSettings(s, namespace);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
13
briar-core/src/org/briarproject/settings/SettingsModule.java
Normal file
13
briar-core/src/org/briarproject/settings/SettingsModule.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package org.briarproject.settings;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
import org.briarproject.api.settings.SettingsManager;
|
||||
|
||||
public class SettingsModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(SettingsManager.class).to(SettingsManagerImpl.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user