public void addSession(DatabaseSession sessionToAdd) {
if ((sessionToAdd.getDatasourceLogin() == null) || !(sessionToAdd.getDatasourceLogin().getDatasourcePlatform() instanceof XMLPlatform)) {
XMLPlatform platform = new SAXPlatform();
sessionToAdd.setLogin(new XMLLogin(platform));
}
DatabaseSession session = sessionToAdd.getProject().createDatabaseSession();
if (sessionToAdd.getEventManager().hasListeners()) {
List listeners = sessionToAdd.getEventManager().getListeners();
int listenersSize = listeners.size();
for (int x = 0; x < listenersSize; x++) {
session.getEventManager().addListener((SessionEventListener) listeners.get(x));
}
}
session.setExceptionHandler(sessionToAdd.getExceptionHandler());
session.setLogLevel(SessionLog.OFF);
this.setupDocumentPreservationPolicy(session);
session.login();
sessions.add(session);
storeXMLDescriptorsByQName(session);
}