[Kylin] 2.java方式调用api进行增量build

用到了KylinHttpHelper.java 见  [Kylin] 1.Rest API和java获取model_Desc的例子

package main;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import org.apache.commons.codec.binary.Base64;
public class KylinBuildMain {

public static void main(String[] args){

SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");

String starttime= "20130101";
String endtime = "20190102";

try {
long starttime_tims = sdf.parse(starttime).getTime();
long endtime_tims = sdf.parse(endtime).getTime();
KylinHttpHelper.login("ADMIN", "KYLIN");

/**
* GET Cube_Desc: kylin_sales_cube
*/
String params = "{\"startTime\":"+starttime_tims+",\"endTime\":"+ endtime_tims +",\"buildType\":\"BUILD\"}";
System.out.println(params);
String result = KylinHttpHelper.excute("/cubes/kylin_sales_cube/rebuild", "PUT", params);

} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}


}
分类上一篇:     分类下一篇:

Leave a Reply