Is it possible to implement SCM command line using Java API?
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.
2 answers
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.
You can cal LSCM or the SCM commandline as a process and then you can parse the text output see the LSCM reference.
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jan 21 '16, 4:08 a.m.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.