mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Created TransportPropertyManager facade.
This commit is contained in:
14
briar-core/src/org/briarproject/property/PropertyModule.java
Normal file
14
briar-core/src/org/briarproject/property/PropertyModule.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.briarproject.property;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
import org.briarproject.api.property.TransportPropertyManager;
|
||||
|
||||
public class PropertyModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(TransportPropertyManager.class).to(
|
||||
TransportPropertyManagerImpl.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.briarproject.property;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.TransportProperties;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DatabaseComponent;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.property.TransportPropertyManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
// Temporary facade during sync protocol refactoring
|
||||
class TransportPropertyManagerImpl implements TransportPropertyManager {
|
||||
|
||||
private final DatabaseComponent db;
|
||||
|
||||
@Inject
|
||||
TransportPropertyManagerImpl(DatabaseComponent db) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<TransportId, TransportProperties> getLocalProperties()
|
||||
throws DbException {
|
||||
return db.getLocalProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransportProperties getLocalProperties(TransportId t)
|
||||
throws DbException {
|
||||
return db.getLocalProperties(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ContactId, TransportProperties> getRemoteProperties(
|
||||
TransportId t) throws DbException {
|
||||
return db.getRemoteProperties(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mergeLocalProperties(TransportId t, TransportProperties p)
|
||||
throws DbException {
|
||||
db.mergeLocalProperties(t, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoteProperties(ContactId c,
|
||||
Map<TransportId, TransportProperties> p) throws DbException {
|
||||
db.setRemoteProperties(c, p);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user