title: How to get username of currently-logged-in user
body: <p>I am trying to get session parameters, e.g. user name, from a logged-in session in the Teamcenter 8 rich client using Java (and Eclipse).</p>
  <pre><code>public class SampleHandler extends AbstractHandler
  {
      public Object execute(ExecutionEvent event) throws ExecutionException
      {
          // good, but useless
          IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
      
          // wrong
          AbstractAIFSession a = AIFUtility.getSessionManager().getDefaultSession();
      
          // wrong
          AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
          TCSession session = (TCSession)app.getSession();
  
          // wrong
          ISessionService iss = AifrcpPlugin.getSessionService();
          session = (TCSession)iss.getSession(&quot;com.teamcenter.rac.kernel.TCSession&quot;);
  
          return null;
      }
  }
  </code></pre>
  <p>That snippet is taken from code that compiled, and when I run my plugin and try invoking some method in the <code>AIFUtility</code> class, <code>AifrcpPlugin</code> throws an exception.</p>
  <p>Does anyone know how to get the user name of the current session?</p>