I am developing a Java plugin using plugins provided by integrity to communicate with Integrity.
I am able to connect to the server. I need some inputs regarding checkout process.
I got the below code when I searched. But I am not sure what parameters do I need to pass for this method.
configPath is either sandbox path or servers path?And please check the parameters mentioned whether I am giving the correct values or not?
And In my code I am using first argument as Session instead of APISession.
When Iam running it it is giving me the error “Error occurred when running command: si: MKS124819: Invalid option: "server"”.
What are all the option values it accepts? Is it different for every command? Where can I found this information?
Please suggest me If i can develop in a different way also.
/**
* Performs a checkout of this Integrity Source File to a working file location on the build server represented by targetFile
* @param api Integrity API Session
* @param configPath Full server side path for this Integrity member's project/subproject
* @param memberID Full server side path for this Integrity member
* @param memberRev Member revision string for this Integrity member
* @param targetFile File object representing the target location for this file
* @param restoreTimestamp Toggles whether or not the original timestamp should be used
* @param lineTerminator Sets the line terminator for this file (native, crlf, or lf)
* @return true if the operation succeeded or false if failed
* @throws APIException
*/
String configPath="mentioned server side path till .pj";
File targetFile=new File("D:/Vasavi/test-generated ");
String memberID="config.ini";
String memberRev="1.10";
booleanrestoreTimestamp=false;
String lineTerminator="native";
Response res;
publicboolean checkout(APISession api,String configPath,String memberID,String memberRev,File targetFile,boolean restoreTimestamp,String lineTerminator) throws APIException {
System.out.println("In Checkout method");
if (!targetFile.getParentFile().isDirectory()) {
System.out.println("If block");
targetFile.getParentFile().mkdirs();
System.out.println("end of if block");
}
System.out.println("after if block");
Command coCMD=new Command(Command.SI,"co");
coCMD.addOption(new Option("nolock"));
coCMD.addOption(new Option("server",configPath));
coCMD.addOption(new FileOption("targetFile",targetFile));
coCMD.addOption(new Option(restoreTimestamp ? "restoreTimestamp" : "norestoreTimestamp"));
coCMD.addOption(new Option("lineTerminator",lineTerminator));
coCMD.addOption(new Option("revision",memberRev));
coCMD.addOption(new Option("changePackageId", ":none"));
coCMD.addSelection(memberID);
try{
res=integrity.cr.execute(coCMD);
}
catch (APIException e) {
System.out.println("Error occurred when running command: " + e.getMessage());
e.printStackTrace();
}
if (res.getExitCode() == 0) {
returntrue;
}
else {
returnfalse;
}
}