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

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.

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

0 votes



8 answers

Permanent link
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;
}

0 votes


Permanent link
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

0 votes


Permanent link

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;
}

0 votes


Permanent link
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;
}

0 votes


Permanent link
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

0 votes


Permanent link
We need this information to proceed further on our CMVC RTC integration. Request some help from the team

0 votes


Permanent link
 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.


0 votes


Permanent link
Does anyone find a solution?

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,938

Question asked: Jun 15 '09, 8:07 a.m.

Question was seen: 9,259 times

Last updated: Sep 12 '14, 6:49 a.m.

Confirmation Cancel Confirm