package gvs.business.model;

import java.util.Collection;
import java.util.HashSet;
import java.util.Observable;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import gvs.interfaces.ISession;

/**
 * Holds the model of the current session.
 * 
 * @author aegli
 *
 */
@Singleton
public class SessionHolder extends Observable {

  private ISession currentSession = null;
  private final Collection<ISession> sessions;

  @Inject
  public SessionHolder() {
    this.sessions = new HashSet<>();
  }

  /**
   * Sets currently requested session.
   * 
   * @param newSession
   */
  public synchronized void setCurrentSession(ISession newSession) {
    this.currentSession = newSession;
    this.currentSession.changeCurrentGraphToFirst();
    setChanged();
    notifyObservers();
  }

  /**
   * Returns current session, which is held by the model.
   * 
   * @return session controller
   */
  public synchronized ISession getCurrentSession() {
    return currentSession;
  }

  /**
   * Add a session.
   * 
   * @param session
   *          new session
   */
  public synchronized void addSession(ISession session) {
    this.sessions.add(session);
  }

  /**
   * Remove a session.
   * 
   * @param session
   *          session to delete
   */
  public synchronized void removeSession(ISession session) {
    this.sessions.remove(session);
  }

  /**
   * Returns available session for displaying in combobox.
   * 
   * @return sessionControllers
   */
  public synchronized Collection<ISession> getSessions() {
    return sessions;
  }
}

@@ -107,16 +107,74 @@
 vable;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import c
@@ -198,16 +198,16 @@
 Inject;%0A
-
 import c
@@ -493,16 +493,109 @@
 sions;%0A%0A
+  private static final Logger logger = LoggerFactory%0A      .getLogger(SessionHolder.class);%0A%0A
   @Injec
@@ -737,32 +737,32 @@
 ewSession%0A   */%0A
-
   public synchro
@@ -805,32 +805,99 @@
 n newSession) %7B%0A
+    logger.info(%22Setting current session and notify observers.%22);%0A%0A
     this.current

add logger to session holder