How to get repository connection from RTC Eclipse client using java
Accepted answer
- 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
One other answer
// 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
Hi sam,
I have been trying using same logic but getting "org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array." at ITeamRepository teamRepositoy[] = TeamPlatform.getTeamRepositoryService().getTeamRepositories(); line. is there anything else i need to do to get repository defined for run.I hope when you say run time repository it mean all the active(logged in)repository on Eclipse client i am running my code to get log session?.
hm.. it looks good to me, and compares the same as Ralph's Blog entry.
if you look at the eclipse client for Jazz, you can have multiple repositiories defined, but not be logged into all of them at the same time.
(I have 10 repos defined in my dev environment, and have been logged in to as many as 5 at a time).
so you should check the login state as I listed.
Sam,
Still not able to figured out what is wrong with my code or missing something. I created only one repository and connected to the local server even tried same on production server but getting same exception.
| If you use debug, which statement is causing that?
never mind, you already provided that.
this post seems like it is relevant
http://www.coderanch.com/t/433238/Testing/ClassNotLoadedException-Eclipse-debugger