How to get repository connection from RTC Eclipse client using java
Accepted answer
Hi Naveen,
Your code is correct.
You seems to be doing the Debug/execution incorrectly.
Please check if you have added the following in dependency:
com.ibm.team.repository.common;bundle-version="1.4.0"
com.ibm.team.repository.client;bundle-version="1.3.0"
Then,
- On Debug/Run when a new instance of the RTC eclipse client starts
- You need to set the connection details there (accept team invitation)
- Accepting team invitation/ setting up the connection results in the initialization of the "TeamPlatform"
- Then you perform what ever you want to do
Please let me know if it helps.
One other answer
I would guess you would start here in the plain java classes (which is what the Eclipse client plugin uses)
// check if TeamPlatform is running..
if TeamPlatform.isStarted()
// decide what to do if not started (means no userid possible)
// get the list of repositories defined for this runtime
TeamPlatform.getTeamRepositoryService().getTeamRepositories()
// loop thru the list of connections,
ITeamRepository srcServer= one of the list of repositories
// check if active
if SrcServer.getState()==STATE_LOGGED_IN
// get the userid used to logon
srcServer.getUserID()
(use the repository contributor manager to get the contributor for this userid.,
if not already stored in the LogInInfo2 object class, I didn't go that far)
probably something in those classes that will do it for you.
I found this all using Eclipse on a java source file with the dev libs setup.. ctrl-space or using . (dot) on a class object name..
// check if TeamPlatform is running..
if TeamPlatform.isStarted()
// decide what to do if not started (means no userid possible)
// get the list of repositories defined for this runtime
TeamPlatform.getTeamRepositoryService().getTeamRepositories()
// loop thru the list of connections,
ITeamRepository srcServer= one of the list of repositories
// check if active
if SrcServer.getState()==STATE_LOGGED_IN
// get the userid used to logon
srcServer.getUserID()
(use the repository contributor manager to get the contributor for this userid.,
if not already stored in the LogInInfo2 object class, I didn't go that far)
probably something in those classes that will do it for you.
I found this all using Eclipse on a java source file with the dev libs setup.. ctrl-space or using . (dot) on a class object name..
Comments
showing 5 of 6
show 1 more comments