It's all about the answers!

Ask a question

Entry point for SCM access in server-side plugin


Sola Otudeko (4511516) | asked Dec 14 '12, 10:23 a.m.
Hi. I need to get hold of some files in scm during a work item save, but can't seem to find how to access the source code. I've seen references to IScmQueryService, but I can't find that in the sdk. I already have all this in a plain java app, but was expecting that IScmService would be the equivalent? Any help please?
Thanks
Sola

3 answers



permanent link
Andrew Hoo (1.0k1) | answered Dec 14 '12, 1:59 p.m.
JAZZ DEVELOPER

First, I don't have a full picture of what you are trying to accomplish but I'll comment on some possible caveats and you can decide whether or not they apply to you.

There's a couple of degrees of separation from a File to be related to a Work Item. The way that we use RTC is that Work Items are "linked" to Change Sets, and the Change Sets will have a set of "IChanges", and each IChange may have an IVersionable of a file or folder.

Depending on whether you're writing your code on the server side or the client side, you will have to fetch the "full" change set by some means. (either by the ItemManager in the client or the ItemService on the server).

Then you can iterate over your changesets's changes() and use IChange.getItem() to get the IVersionableHandles. (The files and folders).

You should only need the IScmQueryService if you're doing a change set "search" - which I suspect that you should not need to because you make mention of Work Items. I would suspect that the work items have access to the "Links: to the Change Sets and that's how you would be traversing the relationship.

But, to answer your question: The IScmQueryService is declared in the com.ibm.team.scm.common plugin (in an internal java package). I have downloaded and verified it is in the 4.0.1 SDK.


permanent link
Sola Otudeko (4511516) | answered Dec 17 '12, 5:24 a.m.
Hi Andrew
Thanks for your response. There is not a direct link between the work item being saved and the files I need to get. On save, I want to go to scm and get contents of a specific set of named files, the changes to which are linked to one or more different work items. We have a control file that lists the separate work item numbers for each file, to which we go to get the file content.
Actually, I am trying to replicate similar stuff I did in a client-side app. The starting point for that is a component name, then it gets the change set list, from which I pick out what I need.  What I was looking for in the server-side is similar starting point, workspace (stream)/component handles.
Anyway, re-thinking from what you've said, I think I will use the work item number of the control file as my starting point. That should work.
Thanks.
Sola




permanent link
Simon Fisher (1631710) | answered Dec 17 '12, 8:02 a.m.
JAZZ DEVELOPER
Hi Sola,

In a precondition you usually extend the AbstractService class, which gives you a getService() method, which obtains an instance to one of RTC's services.

The SCM service is called IScmService so you can use the following code to get an instance of it:

IScmService scmService = getService(IScmService.class);

There's methods in there which allow you to get and work with SCM-related objects.

Cheers,

Simon



Your answer


Register or 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.