public void update() {
   try {
     serverInfo.setVersion(
         bimServer
             .getSConverter()
             .convertFromSObject(bimServer.getVersionChecker().getLocalVersion(), null));
   } catch (BimserverDatabaseException e) {
     LOGGER.error("", e);
   }
   if (bimServer.getDatabase().getMigrator().migrationRequired()) {
     setServerState(ServerState.MIGRATION_REQUIRED);
     if (bimServer.getConfig().isAutoMigrate()) {
       try {
         bimServer.getDatabase().getMigrator().migrate();
         setServerState(ServerState.RUNNING);
       } catch (MigrationException | InconsistentModelsException e) {
         LOGGER.error("", e);
       }
     }
   } else if (bimServer.getDatabase().getMigrator().migrationImpossible()) {
     setServerState(ServerState.MIGRATION_IMPOSSIBLE);
   } else {
     DatabaseSession session = bimServer.getDatabase().createSession();
     try {
       boolean adminFound = false;
       ServerSettings settings = bimServer.getServerSettingsCache().getServerSettings();
       IfcModelInterface users =
           session.getAllOfType(StorePackage.eINSTANCE.getUser(), Query.getDefault());
       for (IdEObject idEObject : users.getValues()) {
         if (idEObject instanceof User) {
           User user = (User) idEObject;
           if (user.getUserType() == UserType.ADMIN) {
             adminFound = true;
             break;
           }
         }
       }
       if (settings.getSiteAddress().isEmpty()
           || settings.getSmtpServer().isEmpty()
           || !adminFound) {
         setServerState(ServerState.NOT_SETUP);
       } else {
         setServerState(ServerState.RUNNING);
       }
     } catch (BimserverDatabaseException e) {
       LOGGER.error("", e);
     } finally {
       session.close();
     }
   }
 }
 public ServerState getServerState() {
   return serverInfo.getServerState();
 }
 public void setErrorMessage(String message) {
   serverInfo.setErrorMessage(message);
 }
 public void setServerState(ServerState serverState) {
   ServerState oldState = serverInfo.getServerState();
   serverInfo.setServerState(serverState);
   LOGGER.info("Changing server state to " + serverState);
   notifyStateChangeListeners(oldState, serverState);
 }
 public void setOutOfMemory() {
   serverInfo.setErrorMessage(
       "This server is out of memory, more info on how to fix this can be found on <a href=\"http://support.opensourcebim.org/\">support.opensourcebim.org</a>. Or let us handle the hosting stuff and join our VIP hosting solutions at <a href=\"http://vip.bimserver.org/\">vip.bimserver.org</a>.  ");
 }
 public boolean isAvailable() {
   return serverInfo.getErrorMessage() == null
       && serverInfo.getServerState() == ServerState.RUNNING;
 }