/* (non-Javadoc)
   * @see org.codefrags.websocket.WebSocketListener#onNewUser(org.codefrags.websocket.WebSocketUser)
   */
  public void onNewUser(WebSocketUser user) {
    try {
      System.out.println("new user " + user.getId());

      ProteanUser ptu = new ProteanUser();

      ptu.setProteanServer(this);
      ptu.setEntityUserSecurity(entityUserSecurity);
      ptu.setUser(user);
      ptu.setEntityManager(entityManager);

      users.put(user.getId(), ptu);

      for (ProteanSubscriber subscriber : subscribers) {
        subscriber.onNewUser(ptu);
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 /* (non-Javadoc)
  * @see org.codefrags.websocket.WebSocketListener#onCloseConnection(org.codefrags.websocket.WebSocketUser)
  */
 public void onCloseConnection(WebSocketUser user) {
   for (ProteanSubscriber subscriber : subscribers) {
     subscriber.onNewUser(users.get(user.getId()));
   }
   users.remove(user.getId());
 }