com.hadoopz.cloud.JCloud.SDK.utils.TableDroper Maven / Gradle / Ivy
The newest version!
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.hadoopz.cloud.JCloud.SDK.utils;
//import com.mycomm.IProtocol.sql.SqlRelationship;
import com.mycomm.YesHttp.core.HttpMethod;
import com.mycomm.YesHttp.core.Request;
import com.mycomm.YesHttp.core.Response;
import com.mycomm.YesHttp.core.StringRequest;
import com.mycomm.YesHttp.core.TextBaseResponseListener;
import com.mycomm.YesHttp.core.YesHttpEngine;
import com.mycomm.YesHttp.core.YesHttpError;
import com.mycomm.itool.SystemUtil;
import java.util.Map;
/**
*
* @author jw362j
*/
public class TableDroper {
public void droptable(String tableName, final String jcloudToken) {
if(SystemUtil.isTxtEmpty(tableName)||SystemUtil.isTxtEmpty(jcloudToken)){
return;
}
if(tableName.endsWith("_"+jcloudToken.split("_")[0])){
tableName = tableName.substring(0,tableName.indexOf("_"));
}
String url = EndpointBuilder.getFullUrlForDropTable(tableName);
Request request = new StringRequest(HttpMethod.POST, url, new TextBaseResponseListener() {
@Override
public void responseMe(String msg) {
YesLog.yeslog.d("the requestjSON TableDroper.droptable.responseMe:" + msg);
}
}, new Response.ErrorListener() {
public void onErrorResponse(YesHttpError error) {
YesLog.yeslog.e("the requestjSON TableDroper.droptable.onErrorResponse:" + error.getMessage());
}
}, YesLog.yeslog, Request.Protocol.HTTP) {
@Override
public void getHeaders(Map headers) {
headers.put("Authorization", jcloudToken);
}
@Override
public void getParams(Map ps) {
ps.put("jcloudToken", jcloudToken); //To change body of generated methods, choose Tools | Templates.
}
};
YesHttpEngine.getYesHttpEngine().send(request);
}
}