It's all about the answers!

Ask a question

Retrieve workspace handle in server plugin


megha mittal (15112615) | asked Jun 15 '09, 8:07 a.m.
Hi ,

My problem is to get workspace handle in my server side bundle.i have access to projectarea and process area but no idea on which SCM service to use to get workspace handle.
i have written following piece of code to get process area.

IRepositoryItemService itemService = getService(IRepositoryItemService.class);

IProcessArea process = (IProcessArea) itemService.fetchItem(processAreaHandle, IRepositoryItemService.COMPLETE);



No idea on how to proceed further from this point to get workspace handle.Please help me on this.

Thanks

8 answers



permanent link
Crispin Veall (5131) | answered Jun 15 '09, 11:22 a.m.
Hi ,

My problem is to get workspace handle in my server side bundle.i have access to projectarea and process area but no idea on which SCM service to use to get workspace handle.
i have written following piece of code to get process area.

IRepositoryItemService itemService = getService(IRepositoryItemService.class);

IProcessArea process = (IProcessArea) itemService.fetchItem(processAreaHandle, IRepositoryItemService.COMPLETE);



No idea on how to proceed further from this point to get workspace handle.Please help me on this.

Thanks

If you are just trying to get a workspace and you know it's name, you can do something like this:

private IWorkspaceConnection getWorkSpaceConnection(String wsName,int kind) throws TeamRepositoryException {
IWorkspaceSearchCriteria search = IWorkspaceSearchCriteria.FACTORY.newInstance();
search.setExactName(wsName);
/*
* set the kind to be one of
* IWorkspaceSearchCriteria.WORKSPACES
* or
* IWorkspaceSearchCriteria.STREAMS
*/
search.setKind(kind);
// I assume you have access to the ITeamRepository 'repo'
private IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
List<IWorkspaceHandle> workspaces = wm.findWorkspaces(search, Integer.MAX_VALUE, monitor);
if ( workspaces.size() > 0 ) {
return wm.getWorkspaceConnection(workspaces.get(0),monitor);
}
return null;
}

permanent link
megha mittal (15112615) | answered Jun 16 '09, 1:14 a.m.
Hi ,

My problem is to get workspace handle in my server side bundle.i have access to projectarea and process area but no idea on which SCM service to use to get workspace handle.
i have written following piece of code to get process area.

IRepositoryItemService itemService = getService(IRepositoryItemService.class);

IProcessArea process = (IProcessArea) itemService.fetchItem(processAreaHandle, IRepositoryItemService.COMPLETE);



No idea on how to proceed further from this point to get workspace handle.Please help me on this.

Thanks

If you are just trying to get a workspace and you know it's name, you can do something like this:

private IWorkspaceConnection getWorkSpaceConnection(String wsName,int kind) throws TeamRepositoryException {
IWorkspaceSearchCriteria search = IWorkspaceSearchCriteria.FACTORY.newInstance();
search.setExactName(wsName);
/*
* set the kind to be one of
* IWorkspaceSearchCriteria.WORKSPACES
* or
* IWorkspaceSearchCriteria.STREAMS
*/
search.setKind(kind);
// I assume you have access to the ITeamRepository 'repo'
private IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
List<IWorkspaceHandle> workspaces = wm.findWorkspaces(search, Integer.MAX_VALUE, monitor);
if ( workspaces.size() > 0 ) {
return wm.getWorkspaceConnection(workspaces.get(0),monitor);
}
return null;
}


Thanks for your reply .But i dont have access to ITeamRepository.Is there any other alternative then using ITeamRepository

permanent link
Crispin Veall (5131) | answered Jun 16 '09, 10:52 a.m.

Thanks for your reply .But i dont have access to ITeamRepository.Is there any other alternative then using ITeamRepository


I'm not aware of an alternative, and I suspect there isn't one, but the following will give the repository (taken from the plainJavaClient snippets). REPOSITORY_ADDRESS would be something like https://localhost:9443/jazz:

public static ITeamRepository login() throws TeamRepositoryException {
IProgressMonitor mon = new NullProgressMonitor();
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(REPOSITORY_ADDRESS);
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repository) {
return new ILoginInfo() {
public String getUserId() {
return USER_AND_PASSWORD;
}
public String getPassword() {
return USER_AND_PASSWORD;
}
};
}
});
monitor.subTask("Contacting " + repository.getRepositoryURI() + "...");
repository.login(monitor);
monitor.subTask("Connected");
return repository;
}

permanent link
megha mittal (15112615) | answered Jun 18 '09, 1:49 a.m.
Adding com.ibm.team.repository.client.ITeamRepository in my plugin dependencies start giving me error of missing required bundle.And the reason for this is probably that i am writing server side plugin and ITeamRepository is a client side plugin.So was thinking of any alternative way of getting workspace handle.
Infact my main requirement is to get custom attributes of RTC stream , so i was thinking of getting it through workspace handle .But now i am stuck in getting access to workspace.So it would be really grateful if you can tell me any service available on server side through which i can get access to RTC stream.

Thanks for your reply .But i dont have access to ITeamRepository.Is there any other alternative then using ITeamRepository


I'm not aware of an alternative, and I suspect there isn't one, but the following will give the repository (taken from the plainJavaClient snippets). REPOSITORY_ADDRESS would be something like https://localhost:9443/jazz:

public static ITeamRepository login() throws TeamRepositoryException {
IProgressMonitor mon = new NullProgressMonitor();
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(REPOSITORY_ADDRESS);
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repository) {
return new ILoginInfo() {
public String getUserId() {
return USER_AND_PASSWORD;
}
public String getPassword() {
return USER_AND_PASSWORD;
}
};
}
});
monitor.subTask("Contacting " + repository.getRepositoryURI() + "...");
repository.login(monitor);
monitor.subTask("Connected");
return repository;
}

permanent link
Crispin Veall (5131) | answered Jun 18 '09, 10:35 a.m.
Adding com.ibm.team.repository.client.ITeamRepository in my plugin dependencies start giving me error of missing required bundle.And the reason for this is probably that i am writing server side plugin and ITeamRepository is a client side plugin.So was thinking of any alternative way of getting workspace handle.
Infact my main requirement is to get custom attributes of RTC stream , so i was thinking of getting it through workspace handle .But now i am stuck in getting access to workspace.So it would be really grateful if you can tell me any service available on server side through which i can get access to RTC stream.

I'm afraid I've reached the end of my knowledge there - I only started working with RTC a couple of weeks ago and have got as far as using the PlainJavcaClient libs and that's it!
Maybe one of the devs could step in and help here?

Good luck,
Crispin

permanent link
Vivek Gupta (5195) | answered Jul 14 '09, 7:43 a.m.
JAZZ DEVELOPER
We need this information to proceed further on our CMVC RTC integration. Request some help from the team

permanent link
Pancha Gyaneswari Yelika (45811) | answered Feb 08 '13, 8:06 a.m.
 Hi Vivek,

I am also developing a similar kind of advisor on server. I need to get the list of files changed for the work item.
I have got the change set related to the work item, but not able to get the file names from the changeset.

I am using in RTC 4.0.1.

Please help. Please can you share your code if you have found the solution.



permanent link
Marco Gianfico (2049) | answered Sep 12 '14, 6:49 a.m.
Does anyone find a solution?

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.