String name = settings.get("/user/authentication/asynchronous/name");
String uri = settings.get("/user/authentication/asynchronous/uri");
AsynchronousMessageQueueChangeTracker changeTracker = new AsynchronousMessageQueueChangeTracker(URI.create(uri), name);
this.changeTracker = changeTracker;
userbase = new LocalUserbase(settings.getDataDirectory(), true, changeTracker);
ChangeApplicator changeApplicator = new ChangeApplicator((LocalUserbase)userbase);
int i = 1;
String peerName;
String peerUri;
while(true) {
// loop over the sections in the file
peerName = settings.get("/user/authentication/asynchronous/peers/peer[" + i + "]/name");
if (peerName == null || "".equals(peerName)) {
break;
}
peerUri = settings.get("/user/authentication/asynchronous/peers/peer[" + i + "]/uri");
i++;
if (!peerUri.startsWith("failover:")) {
peerUri = "failover:" + peerUri;
}
changeTracker.addPeer(peerName, URI.create(peerUri), changeApplicator);
// todo: log each peer we connect to
}
initializeCuftpdUserbaseActions();
break;
} catch (Exception e) {
shutdown();
throw new ConfigurationException("Asynchronous userbase failure", e);
}
case Userbase.DEFAULT:
default:
System.out.println("Initializing LOCAL userbase");
userbase = new LocalUserbase(settings.getDataDirectory(), true, new ChangeTracker() {
@Override
public void addChange(Change change) {
// do nothing...
}
});