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!!
Accepted answer
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.