Retrieve workspace handle in server plugin
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.
No idea on how to proceed further from this point to get workspace handle.Please help me on this.
Thanks
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
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;
}
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
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;
}
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 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:
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;
}
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
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.