package com.gopivotal.xd.sqoop;

import org.apache.sqoop.Sqoop;

public class SqoopRunner {

	// sqoop export --connect jdbc:mysql://192.168.178.13/sqoop_test --username gpadmin --password gpadmin --table cdr_orig --export-dir /xd/ti/data/out/prepared/dvcallreceived.csv

	public static void main(String[] args) {
		String[] args2 = new String[] { "export", "--connect",
				"jdbc:mysql://192.168.178.13/sqoop_test", "--username", "gpadmin", "--password", "gpadmin",
				"--table", "cdr_orig", "--export-dir",
				"/xd/ti/data/out/prepared/dvcallreceived.csv", "" };
		String[] args3 = args[0].split(" ");
		final int ret = Sqoop.runTool(args3);
		if (ret != 0) {
			throw new RuntimeException("Sqoop failed - return code "
					+ Integer.toString(ret));
		}
	}


}

@@ -162,16 +162,20 @@
 username
+%0A%09//
  gpadmin
@@ -223,16 +223,20 @@
 port-dir
+%0A%09//
  /xd/ti/
@@ -315,16 +315,17 @@
 args) %7B%0A
+%0A
 %09%09String
@@ -331,266 +331,22 @@
 g%5B%5D 
-args2 = new String%5B%5D %7B %22export%22, %22--connect%22,%0A%09%09%09%09%22jdbc:mysql://192.168.178.13/sqoop_test%22, %22--username%22, %22gpadmin%22, %22--password%22, %22gpadmin%22,%0A%09%09%09%09%22--table%22, %22cdr_orig%22, %22--export-dir%22,%0A%09%09%09%09%22/xd/ti/data/out/prepared/dvcallreceived.csv%22, %22%22 %7D;%0A%09%09String%5B%5D args3
+sqoopArguments
  = a
@@ -364,16 +364,17 @@
 t(%22 %22);%0A
+%0A
 %09%09final 
@@ -401,16 +401,26 @@
 ool(
-args3
+sqoopArguments
 );%0A
+%0A
 %09%09if
@@ -531,12 +531,10 @@
 %0A%09%09%7D%0A%09%7D%0A
-%0A%0A
 %7D%0A

clean the SqoopRunner code