mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
added a cache to the IdentityManager, changed its signature, modified when and where the author is stored
made the author creation single-threaded again in the LifecycleManager, removed redundant code
This commit is contained in:
@@ -26,8 +26,6 @@ import org.briarproject.api.identity.Author;
|
||||
import org.briarproject.api.identity.Author.Status;
|
||||
import org.briarproject.api.identity.AuthorId;
|
||||
import org.briarproject.api.identity.IdentityManager;
|
||||
import org.briarproject.api.identity.IdentityManager.AddIdentityHook;
|
||||
import org.briarproject.api.identity.IdentityManager.RemoveIdentityHook;
|
||||
import org.briarproject.api.identity.LocalAuthor;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.Group;
|
||||
@@ -75,8 +73,7 @@ import static org.briarproject.api.contact.ContactManager.RemoveContactHook;
|
||||
import static org.briarproject.blogs.BlogPostValidator.authorToBdfDictionary;
|
||||
|
||||
class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
AddContactHook, RemoveContactHook, Client,
|
||||
AddIdentityHook, RemoveIdentityHook {
|
||||
AddContactHook, RemoveContactHook, Client {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(BlogManagerImpl.class.getName());
|
||||
@@ -151,25 +148,6 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addingIdentity(Transaction txn, LocalAuthor a)
|
||||
throws DbException {
|
||||
|
||||
// add a personal blog for the new identity
|
||||
LOG.info("New Personal Blog Added.");
|
||||
Blog b = blogFactory.createBlog(a);
|
||||
db.addGroup(txn, b.getGroup());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removingIdentity(Transaction txn, LocalAuthor a)
|
||||
throws DbException {
|
||||
|
||||
// remove the personal blog of that identity
|
||||
Blog b = blogFactory.createBlog(a);
|
||||
db.removeGroup(txn, b.getGroup());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean incomingMessage(Transaction txn, Message m, BdfList list,
|
||||
BdfDictionary meta) throws DbException, FormatException {
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.briarproject.api.clients.ClientHelper;
|
||||
import org.briarproject.api.contact.ContactManager;
|
||||
import org.briarproject.api.data.MetadataEncoder;
|
||||
import org.briarproject.api.identity.AuthorFactory;
|
||||
import org.briarproject.api.identity.IdentityManager;
|
||||
import org.briarproject.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.api.sync.GroupFactory;
|
||||
import org.briarproject.api.sync.MessageFactory;
|
||||
@@ -36,14 +35,11 @@ public class BlogsModule {
|
||||
@Singleton
|
||||
BlogManager provideBlogManager(BlogManagerImpl blogManager,
|
||||
LifecycleManager lifecycleManager, ContactManager contactManager,
|
||||
IdentityManager identityManager,
|
||||
ValidationManager validationManager) {
|
||||
|
||||
lifecycleManager.registerClient(blogManager);
|
||||
contactManager.registerAddContactHook(blogManager);
|
||||
contactManager.registerRemoveContactHook(blogManager);
|
||||
identityManager.registerAddIdentityHook(blogManager);
|
||||
identityManager.registerRemoveIdentityHook(blogManager);
|
||||
validationManager.registerIncomingMessageHook(CLIENT_ID, blogManager);
|
||||
return blogManager;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user