* @throws ExecutionException
* Execution of requests failed.
*/
public static void createCSV(final String host, final Integer port, final File target) throws IOException,
JGBXException, InterruptedException, ExecutionException {
final JGBXConnector con = new JGBXConnector(host, port);
final FileOutputStream fos = new FileOutputStream(target);
final PrintWriter csv = new PrintWriter(fos);
// CSV Header
csv.print("Package;");
csv.print("Name;");
csv.print("Description;");
csv.print("Deprecated;");
csv.print("Return Type;");
csv.print("Return Function 1 Name;");
csv.print("Return Function 1 Desc;");
csv.print("Return Function 1 Type;");
csv.print("Return Function 1 JDRet;");
csv.print("Return Function 2 Name;");
csv.print("Return Function 2 Desc;");
csv.print("Return Function 2 Type;");
csv.print("Return Function 2 JDRet;");
csv.print("Return Function 3 Name;");
csv.print("Return Function 3 Desc;");
csv.print("Return Function 3 Type;");
csv.print("Return Function 3 JDRet;");
csv.print("Return Function 4 Name;");
csv.print("Return Function 4 Desc;");
csv.print("Return Function 4 Type;");
csv.print("Return Function 4 JDRet;");
csv.print("Argument 1 Type;");
csv.print("Argument 1 Name;");
csv.print("Argument 1 Description;");
csv.print("Argument 2 Type;");
csv.print("Argument 2 Name;");
csv.print("Argument 2 Description;");
csv.print("Argument 3 Type;");
csv.print("Argument 3 Name;");
csv.print("Argument 3 Description;");
csv.print("Argument 4 Type;");
csv.print("Argument 4 Name;");
csv.print("Argument 4 Description;");
csv.print("Argument 5 Type;");
csv.print("Argument 5 Name;");
csv.print("Argument 5 Description;");
csv.print("Argument 6 Type;");
csv.print("Argument 6 Name;");
csv.print("Argument 6 Description;");
csv.print("Argument 7 Type;");
csv.print("Argument 7 Name;");
csv.print("Argument 7 Description;");
csv.print("Argument 8 Type;");
csv.print("Argument 8 Name;");
csv.print("Argument 8 Description;");
csv.print("Argument 9 Type;");
csv.print("Argument 9 Name;");
csv.print("Argument 9 Description;");
csv.print("Argument 10 Type;");
csv.print("Argument 10 Name;");
csv.println("Argument 10 Description;");
final ListMethodsResponse methodListResponse = con.syncQuery(new ListMethodsRequest());
final List<String> methodList = methodListResponse.getMethodList();
for (String methodName : methodList) {
final Future<MethodSignatureResponse> msr = con.asyncQuery(new MethodSignatureRequest(methodName));
final Future<MethodHelpResponse> fmh = con.asyncQuery(new MethodHelpRequest(methodName));
final MethodSignatureResponse signatureResponse = msr.get();
final List<List<String>> signatures = signatureResponse.getMethodSignatures();
for (final List<String> signature : signatures) {
final String returnType = signature.get(0);
signature.remove(0);
csv.print("org.ch3ck3r.jgbx.requests");
if (methodName.startsWith("system.")) {
csv.print(".system");
methodName = methodName.substring(7);
}
csv.print(";");
final String requestName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1)
+ "Request";
csv.print(requestName + ";");
final MethodHelpResponse helpResponse = fmh.get();
final String help = helpResponse.getMethodDescription().replace("\r", "").replace("\n", "");
csv.print("\"" + help + "\";");
if (help.toLowerCase().equals("(deprecated)")) {
csv.print("1;");
}
else {
csv.print("0;");
}
csv.print(returnType + ";");
csv.print("; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;");
for (final String argType : signature) {
csv.print(argType + "; ; ;");
}
csv.println();
}
}
csv.close();
con.disconnect();
}