ENH: Replaces transport config with namespaced settings

This commit is contained in:
Santiago Torres
2016-01-17 15:42:45 -05:00
parent 2b02db3023
commit 190bb12964
27 changed files with 206 additions and 238 deletions

View File

@@ -1,16 +0,0 @@
package org.briarproject.api;
import java.util.Map;
public class TransportConfig extends StringMap {
private static final long serialVersionUID = 2330384620787778596L;
public TransportConfig(Map<String, String> m) {
super(m);
}
public TransportConfig() {
super();
}
}

View File

@@ -1,7 +1,6 @@
package org.briarproject.api.db;
import org.briarproject.api.Settings;
import org.briarproject.api.TransportConfig;
import org.briarproject.api.TransportId;
import org.briarproject.api.TransportProperties;
import org.briarproject.api.contact.Contact;
@@ -139,9 +138,6 @@ public interface DatabaseComponent {
/** Returns all groups to which the user could subscribe. */
Collection<Group> getAvailableGroups() throws DbException;
/** Returns the configuration for the given transport. */
TransportConfig getConfig(TransportId t) throws DbException;
/** Returns the contact with the given ID. */
Contact getContact(ContactId c) throws DbException;
@@ -194,8 +190,8 @@ public interface DatabaseComponent {
Map<ContactId, TransportProperties> getRemoteProperties(TransportId t)
throws DbException;
/** Returns all settings. */
Settings getSettings() throws DbException;
/** Returns all settings for a given namespace. */
Settings getSettings(String namespace) throws DbException;
/** Returns all contacts who subscribe to the given group. */
Collection<Contact> getSubscribers(GroupId g) throws DbException;
@@ -220,12 +216,6 @@ public interface DatabaseComponent {
void incrementStreamCounter(ContactId c, TransportId t, long rotationPeriod)
throws DbException;
/**
* Merges the given configuration with existing configuration for the
* given transport.
*/
void mergeConfig(TransportId t, TransportConfig c) throws DbException;
/**
* Merges the given properties with the existing local properties for the
* given transport.
@@ -234,7 +224,7 @@ public interface DatabaseComponent {
throws DbException;
/** Merges the given settings with the existing settings. */
void mergeSettings(Settings s) throws DbException;
void mergeSettings(Settings s, String namespace) throws DbException;
/** Processes an ack from the given contact. */
void receiveAck(ContactId c, Ack a) throws DbException;

View File

@@ -1,8 +1,8 @@
package org.briarproject.api.plugins;
import org.briarproject.api.TransportConfig;
import org.briarproject.api.TransportProperties;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.Settings;
import java.util.Map;
@@ -12,8 +12,8 @@ import java.util.Map;
*/
public interface PluginCallback {
/** Returns the plugin's configuration. */
TransportConfig getConfig();
/** Returns the plugin's settings */
Settings getSettings();
/** Returns the plugin's local transport properties. */
TransportProperties getLocalProperties();
@@ -21,8 +21,8 @@ public interface PluginCallback {
/** Returns the plugin's remote transport properties. */
Map<ContactId, TransportProperties> getRemoteProperties();
/** Merges the given configuration with the plugin's configuration. */
void mergeConfig(TransportConfig c);
/** Merges the given settings with the namespaced settings */
void mergeSettings(Settings s);
/**
* Merges the given properties with the plugin's local transport properties.

View File

@@ -0,0 +1,20 @@
package org.briarproject.api.settings;
import org.briarproject.api.db.DbException;
import org.briarproject.api.Settings;
public interface SettingsManager {
/**
* Returns the settings object identified by the provided namespace
* string
*/
Settings getSettings(String namespace) throws DbException;
/**
* Merges (read syncs) the provided settings identified by the provided namespace
* string
*/
void mergeSettings(Settings s, String namespace) throws DbException;
}