Switched Roboguice/Guice out for Dagger 2

This commit is contained in:
Ernir Erlingsson
2016-03-03 10:24:40 +01:00
parent e5d7038195
commit 1be400eb84
89 changed files with 1640 additions and 802 deletions

View File

@@ -1,7 +1,5 @@
package org.briarproject.identity;
import com.google.inject.Inject;
import org.briarproject.api.db.DatabaseComponent;
import org.briarproject.api.db.DbException;
import org.briarproject.api.db.Transaction;
@@ -13,7 +11,21 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
<<<<<<< 08099714bab27d1ed48a8bee431a35a38098ecec
class IdentityManagerImpl implements IdentityManager {
=======
import javax.inject.Inject;
import static java.util.logging.Level.WARNING;
import static org.briarproject.api.db.StorageStatus.ACTIVE;
import static org.briarproject.api.db.StorageStatus.ADDING;
import static org.briarproject.api.db.StorageStatus.REMOVING;
class IdentityManagerImpl implements IdentityManager, Service {
private static final Logger LOG =
Logger.getLogger(IdentityManagerImpl.class.getName());
>>>>>>> Switched Roboguice/Guice out for Dagger 2
private final DatabaseComponent db;
private final List<AddIdentityHook> addHooks;

View File

@@ -1,23 +1,20 @@
package org.briarproject.identity;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import org.briarproject.api.data.ObjectReader;
import org.briarproject.api.identity.Author;
import org.briarproject.api.identity.AuthorFactory;
import org.briarproject.api.db.DatabaseComponent;
import org.briarproject.api.event.EventBus;
import org.briarproject.api.identity.IdentityManager;
public class IdentityModule extends AbstractModule {
import javax.inject.Singleton;
@Override
protected void configure() {
bind(AuthorFactory.class).to(AuthorFactoryImpl.class);
bind(IdentityManager.class).to(IdentityManagerImpl.class);
}
import dagger.Module;
import dagger.Provides;
@Module
public class IdentityModule {
@Provides
ObjectReader<Author> getAuthorReader(AuthorFactory authorFactory) {
return new AuthorReader(authorFactory);
@Singleton
IdentityManager provideIdendityModule(DatabaseComponent db, EventBus eventBus) {
return new IdentityManagerImpl(db, eventBus);
}
}