It's all about the answers!

Ask a question

IWorkspaceHandle and IVersionableHandle?

Murad Korejo (26199) | asked Oct 04 '10, 12:25 p.m.
retagged Dec 02 '13, 3:11 p.m. by David Lafreniere (4.8k7)

I'm looking at the first code snippet on this page:

ITeamRepository repo = ...;
IWorkspaceHandle workspaceHandle = ...;
IVersionableHandle versionableHandle = ...;

//fetch workspace from IItemManager
IItemManager itemManager = repo.itemManager();
IWorkspace workspace = (IWorkspace) itemManager.fetchCompleteItem(workspaceHandle, monitor);

//fetch workspace connection from IWorkspaceManager
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandle, monitor);

//fetch a list of components from IItemManager
List<IComponentHandle> componentHandles = workspace.getComponents();
List<IComponent> components = itemManager.fetchCompleteItems(components, componentHandles);

//fetch a versionable from IConfiguration
IComponentHandle componentHandle = components.get(0);
IConfiguration configuration = workspaceConnection.configuration(componentHandle);
IVersionable versionable = configuration.fetchCompleteItem(versionable);

//cast IVersionable to IFileItem
if (IFileItem.ITEM_TYPE.equals(versionable.getItemType())) {
IFileItem file = (IFileItem) versionable;

Can someone please clarify the purpose of IWorkspaceHandle and IVersionableHandle? How should I initialize workspaceHandle and versionbleHandle?


3 answers

permanent link
Michael Valenta (3.7k3) | answered Oct 05 '10, 8:55 a.m.
edited Oct 13 '17, 3:28 p.m. by David Lafreniere (4.8k7)

I suspect that the code snippet assumes that you already have a handle
to a repository, a workspace and a versionable (i.e.a file or folder).
Where you would get them from really depends on the operation you are
trying to write.


Kirk Broadwater commented Oct 07 '10, 4:55 p.m. | edited Oct 13 '17, 3:28 p.m.

I am trying to access the source files that are in the repositry.

Thanks for any help.

Jacqui Finlay commented Oct 14 '10, 10:33 p.m. | edited Oct 13 '17, 3:29 p.m.

Hi there,

I am also looking for ways to access/extract the source files. Any help would be greatly appreciated

- Jacqui

permanent link
Tim Mok (6.6k38) | answered Oct 16 '10, 12:47 p.m.
The workspace is the place to check out and check in changes. You can also access the configuration from a workspace to get the versionables. There has to be some sort of context (stream/workspace/snapshot) to what you want to access. This is why you need the IWorkspaceHandle. It can get you the IWorkspaceConnection that can get to the versionables.

sam matthews commented Oct 16 '13, 10:32 a.m. | edited Oct 16 '13, 11:37 a.m.

No one asked that question Tim Moke!! dont post unless you know the answer to the question aksed

Tim Mok commented Oct 16 '13, 11:40 a.m.

I answered the first question of what they were. I apologize if I misinterpreted the question but I have no clue since you didn't ask it and cannot clarify it. I felt that Michael tried to answer the part of how to initialize them, which he asked for more information and never received.

Please refrain from adding an answer to questions when you do not provide an answer. You can however add a comment to an answer if you want to continue a discussion. I have converted your answer to a comment to prevent confusion for other users.

permanent link
Jacqui Finlay (11) | answered Oct 17 '10, 7:24 p.m.
I found that this helps too for accessing source files :)

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.