oldConfiguration = new Configuration(new MapConfigurationBackend());
}
}
final Configuration startConfiguration = oldConfiguration;
final EventBus eventBus = new EventBus();
/* Freenet injector configuration. */
AbstractModule freenetModule = new AbstractModule() {
@Override
@SuppressWarnings("synthetic-access")
protected void configure() {
bind(PluginRespirator.class).toInstance(SonePlugin.this.pluginRespirator);
bind(Node.class).toInstance(SonePlugin.this.pluginRespirator.getNode());
}
};
/* Sone injector configuration. */
AbstractModule soneModule = new AbstractModule() {
@Override
protected void configure() {
bind(Core.class).in(Singleton.class);
bind(MemoryDatabase.class).in(Singleton.class);
bind(EventBus.class).toInstance(eventBus);
bind(Configuration.class).toInstance(startConfiguration);
bind(FreenetInterface.class).in(Singleton.class);
bind(PluginConnector.class).in(Singleton.class);
bind(WebOfTrustConnector.class).in(Singleton.class);
bind(WebOfTrustUpdater.class).in(Singleton.class);
bind(IdentityManager.class).in(Singleton.class);
bind(String.class).annotatedWith(Names.named("WebOfTrustContext")).toInstance("Sone");
bind(SonePlugin.class).toInstance(SonePlugin.this);
bind(FcpInterface.class).in(Singleton.class);
bind(Database.class).to(MemoryDatabase.class);
bind(PostBuilderFactory.class).to(MemoryDatabase.class);
bind(PostReplyBuilderFactory.class).to(MemoryDatabase.class);
bind(SoneProvider.class).to(Core.class).in(Singleton.class);
bind(PostProvider.class).to(MemoryDatabase.class);
bindListener(Matchers.any(), new TypeListener() {
@Override
public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) {
typeEncounter.register(new InjectionListener<I>() {
@Override
public void afterInjection(I injectee) {
eventBus.register(injectee);
}
});
}
});
}