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).
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("com.teamcenter.rac.kernel.TCSession");
return null;
}
}
That snippet is taken from code that compiled, and when I run my plugin and try invoking some method in the AIFUtility
class, AifrcpPlugin
throws an exception.
Does anyone know how to get the user name of the current session?