It's all about the answers!

Ask a question

Is it possible to implement SCM command line using Java API?


shweta ranaware (371751) | asked Jan 20 '16, 4:43 a.m.
edited Jan 21 '16, 4:05 a.m. by Ralph Schoon (63.1k33646)
 Hi all,
 I am using the SCM commands in my Java Program for Login to repository, fetching streams for eg  
code for Login to repository 
String Logincommand="cmd /c D:/RTC502DEV/IBM/TeamConcert/jazz/scmtools/eclipse/lscm login -r "+repositoryURI+ " -u " +userId+ " -P " +password;
Process pro=Runtime.getRuntime().exec(Logincommand);
BufferedReader r = new BufferedReader(new InputStreamReader(pro.getInputStream()));
String line;
while (true) {
       line = r.readLine();
       if (line == null) {break; }
System.out.println(line);}
From above eg. we can Login to repository. from same Logic we can also get the List of Streams of specific project.
Now I want to fetch the ichangeset Handle details like UUID ,Item Id ,state id etc. by using SCM commands. in java program . Is it  Possible to get that details using scm commands.

Comments
Ralph Schoon commented Jan 21 '16, 4:08 a.m. | edited Jan 21 '16, 4:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The LSCM command is designed to be called using a shell or command window. My assumption is, that you will have to do that and parse the data that is returned in the standard out. There might be a way to call LSCM directly from the libraries, but I have never attempted to do that and don't have specific suggestions at the moment. I would likely try to find the main method that is called from looking at the libraries in Eclipse and try where that leads me.

2 answers



permanent link
Ralph Schoon (63.1k33646) | answered Sep 22 '16, 9:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The Java API can be used to access such data. See https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/ and the related posts.
You can cal LSCM or the SCM commandline as a process and then you can parse the text output see the LSCM reference.

permanent link
Janani Vinayagam (11) | answered Jan 22 '20, 12:25 a.m.

 Hi shweta,

While excecuting lscm show status using using java api, it is returning null. Can you tell me what am i missing.

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.