com.nflabs.zeppelin.rest.ZQL Maven / Gradle / Ivy
package com.nflabs.zeppelin.rest;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import com.google.gson.Gson;
import com.nflabs.zeppelin.server.ZQLSession;
import com.nflabs.zeppelin.server.ZQLSessionManager;
import com.nflabs.zeppelin.server.JsonResponse;
import com.nflabs.zeppelin.zengine.Z;
import com.nflabs.zeppelin.zengine.ZException;
@Path("/zql")
public class ZQL {
Logger logger = Logger.getLogger(ZQL.class);
ZQLSessionManager sessionManager;
private Gson gson;
public ZQL(ZQLSessionManager sessionManager){
this.sessionManager = sessionManager;
gson = new Gson();
}
@GET
@Path("new")
@Produces("application/json")
public Response newSession() {
ZQLSession s = sessionManager.create();
return new JsonResponse(Status.OK, "", s).build();
}
static class SetZqlParam{
String name;
String zql;
List