use of io.divide.client.auth.credentials.XmlAccoutStorage in project divide by HiddenStage.
the class BackendModule method configure.
@Override
protected final void configure() {
logConfiguration();
if (config == null)
throw new IllegalStateException("Config can not be null");
// ORDER MATTER
bind(type).toInstance(config);
bind(Config.class).toInstance(config);
bind(Backend.class).in(Singleton.class);
bind(Storage.class).toInstance(new XmlStorage(new File(config.fileSavePath + "storage.xml"), Storage.MODE_WORLD_WRITEABLE));
bind(AccountStorage.class).toInstance(new XmlAccoutStorage(new File(config.fileSavePath + "accounts.xml")));
bind(new TypeLiteral<DAO<BackendObject, BackendObject>>() {
}).to(new TypeLiteral<LocalStorageIBoxDb<BackendObject, BackendObject>>() {
}).in(Singleton.class);
// ugly but required, doesnt allow binding to itself
if (AuthManager.class.equals(getAuthManagerClass())) {
bind(AuthManager.class).in(Singleton.class);
} else {
bind(AuthManager.class).to(getAuthManagerClass()).in(Singleton.class);
}
if (DataManager.class.equals(getDataManagerClass())) {
bind(DataManager.class).in(Singleton.class);
} else {
bind(DataManager.class).to(getDataManagerClass()).in(Singleton.class);
}
if (ObjectManager.class.equals(getObjectManagerClass())) {
bind(ObjectManager.class).in(Singleton.class);
} else {
bind(ObjectManager.class).to(getObjectManagerClass()).in(Singleton.class);
}
requestStaticInjection(Backend.class);
requestStaticInjection(BackendUser.class);
requestStaticInjection(BackendServices.class);
additionalConfig(config);
}
Aggregations