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

How to get repository connection from RTC Eclipse client using java

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.

0 votes


Accepted answer

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

0 votes


One other answer

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

1 vote

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

This is what i'm trying.

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.

showing 5 of 6 show 1 more comments

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: Dec 31 '15, 10:44 p.m.

Question was seen: 5,742 times

Last updated: Jan 13 '16, 2:34 p.m.

Confirmation Cancel Confirm