Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

SCM - Best way to get workspace connection for a file?

Hello,
Just wanted to find out if there was an easier way to get the
IWorkspaceConnection associated with a IResource?

Currently I go through IResource > IShareable > IShare >
ISharingDescriptor > IWorkspaceHandle. From the IWorkspaceHandle I cycle
all repository connections trying to find that handle is the
repository's connection manager. Needless to say it seems a lot of code
for something which will be frequently called.
Regards,
Sri.

0 votes



7 answers

Permanent link
On Mon, 22 Oct 2007 23:47:58 -0400, Srimanth Gunturi wrote:

Currently I go through IResource > IShareable > IShare
ISharingDescriptor > IWorkspaceHandle. From the IWorkspaceHandle I cycle
all repository connections trying to find that handle is the
repository's connection manager.

That is the right path to get the IWorkspaceHandle, once you have the
handle you can call IWorkspaceManager.getWorkspaceConnection(handle,
monitor), so there is no need to search for it within the workspace
manager.

- Dmitry

0 votes


Permanent link
On Wed, 24 Oct 2007 12:25:34 -0400, Srimanth Gunturi wrote:

But to get IWorkspaceManager, one would need to cycle through the
repository connections in the workspace?

To get the IWorkspaceManager you can call

SCMPlatform.getWorkspaceManager(Repositories.getRepository
(sharingDescriptor));

- Dmitry

0 votes


Permanent link
But to get IWorkspaceManager, one would need to cycle through the
repository connections in the workspace?
Regards,
Sri.


Dmitry Karasik wrote:
On Mon, 22 Oct 2007 23:47:58 -0400, Srimanth Gunturi wrote:

Currently I go through IResource > IShareable > IShare
ISharingDescriptor > IWorkspaceHandle. From the IWorkspaceHandle I cycle
all repository connections trying to find that handle is the
repository's connection manager.

That is the right path to get the IWorkspaceHandle, once you have the
handle you can call IWorkspaceManager.getWorkspaceConnection(handle,
monitor), so there is no need to search for it within the workspace
manager.

- Dmitry

0 votes


Permanent link
Is it possible to get all the IWorkspaceHandles of the workspace? I mean is there a API to do that, not collecting them through searching the whole workspace (SharingDescriptor > IWorkspaceHandle)?




But to get IWorkspaceManager, one would need to cycle through the
repository connections in the workspace?
Regards,
Sri.


Dmitry Karasik wrote:
On Mon, 22 Oct 2007 23:47:58 -0400, Srimanth Gunturi wrote:

Currently I go through IResource > IShareable > IShare
ISharingDescriptor > IWorkspaceHandle. From the IWorkspaceHandle I cycle
all repository connections trying to find that handle is the
repository's connection manager.

That is the right path to get the IWorkspaceHandle, once you have the
handle you can call IWorkspaceManager.getWorkspaceConnection(handle,
monitor), so there is no need to search for it within the workspace
manager.

- Dmitry

0 votes


Permanent link
Is it possible to get all the IWorkspaceHandles of the workspace? I mean
is there a API to do that, not collecting them through searching the
whole workspace (SharingDescriptor > IWorkspaceHandle)?

The best you can do is:


for (IShare share : ISharingManager.allShares()) {
workspaces.add(share.getSharingDescriptor().getConnectionHandle());
}

- Dmitry

0 votes


Permanent link
I found another solution that might be simpler: IWorkspaceConnection.getContextHandle()

Is it possible to get all the IWorkspaceHandles of the workspace? I mean
is there a API to do that, not collecting them through searching the
whole workspace (SharingDescriptor > IWorkspaceHandle)?

The best you can do is:


for (IShare share : ISharingManager.allShares()) {
workspaces.add(share.getSharingDescriptor().getConnectionHandle());
}

- Dmitry

0 votes


Permanent link
I found another solution that might be simpler:
IWorkspaceConnection.getContextHandle()

I thought you were talking about getting the workspace handles for all
the shares in the eclipse workspace since this thread was about getting
connections for filesystem objects and you said: "Is it possible to get
all the IWorkspaceHandles of the workspace?"

An IWorkspaceConnection has exactly 1 handle and you obtain it in exactly
the way you said, with getContextHandle().

- Dmitry

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Oct 22 '07, 11:47 p.m.

Question was seen: 8,642 times

Last updated: Oct 22 '07, 11:47 p.m.

Confirmation Cancel Confirm