It's all about the answers!

Ask a question

Dangling reference to workspace


Gidi Gal (962056) | asked Nov 19 '14, 10:25 a.m.
Hello to the forum members,

I have a reference to IWorkspace instance in my RTC extension. User may delete the workspace, resulting in dangling reference to IWorkspace. Is there an  API to recognize such dangling reference ? Currently, my way of recognizing such case is using code like:

try{
     final IWorkspaceManager wsmgr = SCMPlatform..getWorkspaceManager((ITeamRepository) workspace.getOrigin());
     final IWorkspaceConnection wsc = wsmgr.getWorkspaceConnection(workspace, null); //Throws ItemNotFoundException
   //Do something with the workspace
} catch (ItemNotFoundException e) {
    //Update reference to workspace to null
}

If there is a more direct API to check validity of IWorkspace reference I'll be grateful for your comments. If there's an event I can listen to when workspace is deleted, that will be great as well.

Thanks,
Gidi

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Nov 21 '14, 7:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Gidi, I don't think there is a more direct way. In https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/ it works for me.
Gidi Gal selected this answer as the correct answer

Comments
Gidi Gal commented Nov 27 '14, 3:42 a.m.

Thanks Ralph, I'll continue using this approach.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.