org.apache.lens.server.ui
Class QueryServiceUIResource

java.lang.Object
  extended by org.apache.lens.server.ui.QueryServiceUIResource

@Path(value="/queryuiapi")
public class QueryServiceUIResource
extends Object

The Class QueryServiceUIResource.


Field Summary
static org.apache.commons.logging.Log LOG
          The Constant LOG.
 
Constructor Summary
QueryServiceUIResource()
          Instantiates a new query service ui resource.
 
Method Summary
 APIResult cancelQuery(UUID publicId, String queryHandle)
          Cancel the query specified by the handle.
 List<QueryHandle> getAllQueries(UUID publicId, String state, String user, String queryName, long fromDate, long toDate)
          Get all the queries in the query server; can be filtered with state and user.
 javax.ws.rs.core.Response getHttpResultSet(UUID publicId, String queryHandle)
          Get the http endpoint for result set.
 ResultRow getResultSet(UUID publicId, String queryHandle, int pageNumber, int fetchSize)
          Fetch the result set.
 LensQuery getStatus(UUID publicId, String queryHandle)
          Get lens query and its current status.
 QuerySubmitResult query(UUID publicId, String query, String queryName)
          Submit the query for explain or execute or execute with a timeout.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
The Constant LOG.

Constructor Detail

QueryServiceUIResource

public QueryServiceUIResource()
Instantiates a new query service ui resource.

Method Detail

getAllQueries

@GET
@Path(value="queries")
@Produces(value={"application/json","application/xml","text/plain"})
public List<QueryHandle> getAllQueries(@QueryParam(value="publicId")
                                                         UUID publicId,
                                                         @DefaultValue(value="")@QueryParam(value="state")
                                                         String state,
                                                         @DefaultValue(value="")@QueryParam(value="user")
                                                         String user,
                                                         @DefaultValue(value="")@QueryParam(value="queryName")
                                                         String queryName,
                                                         @DefaultValue(value="-1")@QueryParam(value="fromDate")
                                                         long fromDate,
                                                         @DefaultValue(value="-1")@QueryParam(value="toDate")
                                                         long toDate)
Get all the queries in the query server; can be filtered with state and user.

Parameters:
publicId - The public id of the session in which user is working
state - If any state is passed, all the queries in that state will be returned, otherwise all queries will be returned. Possible states are
user - return queries matching the user. If set to "all", return queries of all users. By default, returns queries of the current user.
queryName - human readable query name set by user (optional)
fromDate - the from date
toDate - the to date
Returns:
List of QueryHandle objects

query

@POST
@Path(value="queries")
@Consumes(value="multipart/form-data")
@Produces(value={"application/json","application/xml","text/plain"})
public QuerySubmitResult query(UUID publicId,
                                                           String query,
                                                           @DefaultValue(value="")
                                                           String queryName)
Submit the query for explain or execute or execute with a timeout.

Parameters:
publicId - The public id of the session in which user is submitting the query. Any configuration set in the session will be picked up.
query - The query to run
queryName - human readable query name set by user (optional)
Returns:
QueryHandle

getStatus

@GET
@Path(value="queries/{queryHandle}")
@Produces(value={"application/json","application/xml","text/plain"})
public LensQuery getStatus(@QueryParam(value="publicId")
                                             UUID publicId,
                                             @PathParam(value="queryHandle")
                                             String queryHandle)
Get lens query and its current status.

Parameters:
publicId - The public id of session handle
queryHandle - The query handle
Returns:
LensQuery

getResultSet

@GET
@Path(value="queries/{queryHandle}/resultset")
@Produces(value={"application/json","application/xml","text/plain"})
public ResultRow getResultSet(@QueryParam(value="publicId")
                                                UUID publicId,
                                                @PathParam(value="queryHandle")
                                                String queryHandle,
                                                @QueryParam(value="pageNumber")
                                                int pageNumber,
                                                @QueryParam(value="fetchsize")
                                                int fetchSize)
Fetch the result set.

Parameters:
publicId - The public id of user's session handle
queryHandle - The query handle
pageNumber - page number of the query result set to be read
fetchSize - fetch size
Returns:
ResultRow

cancelQuery

@DELETE
@Path(value="queries/{queryHandle}")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult cancelQuery(@QueryParam(value="sessionid")
                                                  UUID publicId,
                                                  @PathParam(value="queryHandle")
                                                  String queryHandle)
Cancel the query specified by the handle.

Parameters:
publicId - The user session handle
queryHandle - The query handle
Returns:
APIResult with state in case of successful cancellation. APIResult with state in case of cancellation failure.

getHttpResultSet

@GET
@Path(value="queries/{queryHandle}/httpresultset")
@Produces(value="application/octet-stream")
public javax.ws.rs.core.Response getHttpResultSet(@QueryParam(value="sessionid")
                                                                    UUID publicId,
                                                                    @PathParam(value="queryHandle")
                                                                    String queryHandle)
Get the http endpoint for result set.

Parameters:
publicId - the public id
queryHandle - The query handle
Returns:
Response with result as octet stream


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.