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

How to get file content using rtc plain java api or scm command line

Hello Community,
Objective :
I am working on a tool development that takes file name,user id,user password,server uri & output file path as an input parameter

Use Case :
As user provides the file name, tool shall search across all SCM Project Areas and download the the content of file in given output .txt file

What i have already discovered :
  • Option 1 : Using API
Link : http://thescmlounge.blogspot.com/2013/08/getting-your-stuff-using-rtc-sdk-to-zip.html (But the disadvantage over here is , in the blog they have clearly mentioned "This post uses unsupported API. It is likely that the APIs will change without warning in future iterations of RTC - you should use the Source Control command line tool instead. You are using these APIs at your own risk." )
  • Option 2 : Using SCM Command :
Link : https://www.ibm.com/docs/en/elm/6.0.3?topic=get-file-example
Here the disadvantage is its too long process and does not goes with user requirement
By too long i mean :
-> I have to search file using rtc api -> then using rtc api i need to find out file path and then i have to pass it in scm command(-f) and along with that i need user to provide component, file version (please correct me ) as an input parameter

Also i came across one thread created by one user where Ralph mentioned that "You read up on the scm commandline in the help (search for lscm or scm) in the online help. You can load a repository workspace and download files and then act on them"(https://jazz.net/forum/questions/157916/download-file-process-using-java-api) but in this case the tool execution time will increase because of large sandbox size

Request you to please provide some solution over here , also please let me know if my question is unclear

Thanks in advance
Good Day!!

 



0 votes


Accepted answer

Permanent link
For all I can tell, you have the options above. Using the SCM command line is supported and you are safe.

Using the API is harder to do and might require using internal API, in which case you are not supported and if stuff breaks you have to fix them on your own.

Thesse are always the choices you have.

I used some of the API from the SCM lounge in these utils: https://github.com/jazz-community/ewm-scm-utils and I have used it before and there was never a break in the apis used here. But you never know. You have been warned.

I do not know how to search SCM content and given your use case I also warn you, that using the APIs excessively and irresponsively can slow down your server and in the worst case crash it which might even cause loss of data. This should be common sense, but I have seen these problems, so I bring it up.

I would ask you to consider reading the reference for the scm command line and try to figure out if you could use it first. If not, the API allows you to be more flexible e.g. download content to some file location somewhere without having to load the whole workspace. Consider the warnings about internal APIS and risks using API.

The application linked above uses the API to load and zip stuff to disk, so you might be able to learn from it.
Rajat Krishnan selected this answer as the correct answer

1 vote

Comments

We are also in the review process of updating the RTC Extensions Workshop and I have added an optional lab section to Lab 1 that should greatly help with developing for the Plain Java Client Libraries, which is what you want to do. I hope to have it up this week. Once it is up the whole Lab 1 is a must do,

Hi Ralph,
Thanks for addressing my thread , i will try this out and will let you know
Thank you

The update to the RTC Extensions Workshop is out now: https://jazz.net/library/article/1000


I would suggest to perform Lab 1, including the last optional section to be provided with a development environment, should you consider using the Plain Java Client Libraries. 

Hi Ralph,
Just a short confirmation, if we are implementing the same via SCM Command line , will it have any impact on server performance or worst scenario like server crash...

Thank you

That was a general warning and it does not matter how you generate the load, if you run too much automation, you can break the server or slow it to a halt. I did not mean to imply any of the possible solutions is better/worse in this respect. The description of the use case does not allow any estimation. I just meant to make sure you consider it and test and make sure to crank up the load slowly and carefully. It might well be that using the API creates less load than using the command line. Just keep in mind that automation is also usage and adds to the server load. Only you can guess how much operations your automation performs compared to load generated by normal users. Automated builds can also generate a lot of load for example. 

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,937
× 7,495
× 1,325
× 1,202

Question asked: Apr 21 '21, 12:21 p.m.

Question was seen: 1,541 times

Last updated: Apr 27 '21, 2:22 a.m.

Confirmation Cancel Confirm