It's all about the answers!

Ask a question

How to get repository connection from RTC Eclipse client using java


Naveen Tyagi (1978129) | asked Dec 31 '15, 10:44 p.m.
edited Jan 10 '16, 12:12 p.m. by Geoffrey Clemm (29.4k23035)
I want to get an rtc connection from Eclipse client that i need to use in (Eclipse)plugin. If you are already logged in to the rtc client then plugin will get the session from it and processed with further operation.

Accepted answer


permanent link
Bhasker Tiwari (484) | answered Jan 13 '16, 2:34 p.m.
 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,
  1. On Debug/Run when a new instance of the RTC eclipse client starts
  2. You need to set the connection details there (accept team invitation)
  3. Accepting team invitation/ setting up the connection results in the initialization of the "TeamPlatform"
  4. Then you perform what ever you want to do
Please let me know if it helps. 

Naveen Tyagi selected this answer as the correct answer

One other answer



permanent link
sam detweiler (12.4k6175200) | answered Jan 01 '16, 9:28 a.m.
edited Jan 01 '16, 9:30 a.m.
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..

Comments
Naveen Tyagi commented Jan 04 '16, 1:09 a.m.

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?.


Naveen Tyagi commented Jan 04 '16, 1:15 a.m.

This is what i'm trying.


sam detweiler commented Jan 04 '16, 7:46 a.m.

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.


Naveen Tyagi commented Jan 08 '16, 2:27 a.m.

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.


sam detweiler commented Jan 08 '16, 7:52 a.m. | edited Jan 08 '16, 8:05 a.m.

| If you use debug, which statement is causing that?

never mind, you already provided that.


sam detweiler commented Jan 10 '16, 12:40 p.m.
showing 5 of 6 show 1 more comments

Your answer


Register or to post your answer.