Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 49295200B81 for ; Tue, 13 Sep 2016 12:41:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 47E02160AE7; Tue, 13 Sep 2016 10:41:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D9A82160AD2 for ; Tue, 13 Sep 2016 12:41:19 +0200 (CEST) Received: (qmail 84549 invoked by uid 500); 13 Sep 2016 10:41:19 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 84506 invoked by uid 99); 13 Sep 2016 10:41:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Sep 2016 10:41:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B02B4E08B8; Tue, 13 Sep 2016 10:41:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: oleewere@apache.org To: commits@ambari.apache.org Date: Tue, 13 Sep 2016 10:41:19 -0000 Message-Id: In-Reply-To: <10d77c3352364029bcbcc7a7ac6c1261@git.apache.org> References: <10d77c3352364029bcbcc7a7ac6c1261@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/51] [abbrv] ambari git commit: AMBARI-18214. Restify Log Search endpoints (oleewere) archived-at: Tue, 13 Sep 2016 10:41:22 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/593cc9a0/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/DashboardREST.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/DashboardREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/DashboardREST.java deleted file mode 100644 index 0144edc..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/DashboardREST.java +++ /dev/null @@ -1,575 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.rest; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.common.SearchCriteria; -import org.apache.ambari.logsearch.manager.LogsMgr; -import org.apache.ambari.logsearch.util.RESTErrorUtil; -import org.apache.ambari.logsearch.view.VCountList; -import org.apache.ambari.logsearch.view.VNameValueList; -import org.apache.ambari.logsearch.view.VNodeList; -import org.apache.commons.lang.StringEscapeUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.*; -import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.*; -import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*; - -@Api(value = "dashboard", description = "Dashboard operations") -@Path("dashboard") -@Component -@Scope("request") -public class DashboardREST { - - @Autowired - LogsMgr logMgr; - - @Autowired - RESTErrorUtil restErrorUtil; - - @GET - @Path("/solr/logs_search") - @Produces({"application/json"}) - @ApiOperation(SEARCH_LOGS_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FIND_D, name = "find", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = SOURCE_LOG_ID_D, name = "sourceLogId", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = KEYWORD_TYPE_D, name = "keywordType", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TOKEN_D, name = "token", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = IS_LAST_PAGE_D, name = "isLastPage", dataType = "boolean", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String searchSolrData(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - searchCriteria.addParam("keyword", StringEscapeUtils.unescapeXml(request.getParameter("find"))); - searchCriteria.addParam("sourceLogId", request.getParameter("sourceLogId")); - searchCriteria.addParam("keywordType", - request.getParameter("keywordType")); - searchCriteria.addParam("token", - request.getParameter("token")); - searchCriteria.addParam("isLastPage",request.getParameter("isLastPage")); - return logMgr.searchLogs(searchCriteria); - } - - @GET - @Path("/hosts") - @Produces({"application/json"}) - @ApiOperation(GET_HOSTS_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query") - }) - public String getHosts(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addParam("q", request.getParameter("q")); - return logMgr.getHosts(searchCriteria); - } - - @GET - @Path("/components") - @Produces({"application/json"}) - @ApiOperation(GET_COMPONENTS_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query") - }) - public String getComponents(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addParam("q", request.getParameter("q")); - return logMgr.getComponents(searchCriteria); - } - - @GET - @Path("/aggregatedData") - @Produces({"application/json"}) - @ApiOperation(GET_AGGREGATED_INFO_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String getAggregatedInfo(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(); - searchCriteria.addRequiredServiceLogsParams(request); - return logMgr.getAggregatedInfo(searchCriteria); - } - - @GET - @Path("/levels_count") - @Produces({"application/json"}) - @ApiOperation(GET_LOG_LEVELS_COUNT_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public VCountList getLogLevelsCount(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(); - searchCriteria.addParam("q", request.getParameter("q")); - searchCriteria - .addParam("startDate", request.getParameter("start_time")); - searchCriteria.addParam("endDate", request.getParameter("end_time")); - return logMgr.getLogLevelCount(searchCriteria); - } - - @GET - @Path("/components_count") - @Produces({"application/json"}) - @ApiOperation(GET_COMPONENTS_COUNT_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public VCountList getComponentsCount(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(); - searchCriteria.addParam("q", request.getParameter("q")); - searchCriteria - .addParam("startDate", request.getParameter("start_time")); - searchCriteria.addParam("endDate", request.getParameter("end_time")); - return logMgr.getComponentsCount(searchCriteria); - } - - @GET - @Path("/hosts_count") - @Produces({"application/json"}) - @ApiOperation(GET_HOSTS_COUNT_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query") - }) - public VCountList getHostsCount(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(); - searchCriteria.addParam("q", request.getParameter("q")); - searchCriteria - .addParam("startDate", request.getParameter("start_time")); - searchCriteria.addParam("endDate", request.getParameter("end_time")); - searchCriteria.addParam("excludeQuery", StringEscapeUtils - .unescapeXml(request.getParameter("excludeQuery"))); - searchCriteria.addParam("includeQuery", StringEscapeUtils - .unescapeXml(request.getParameter("includeQuery"))); - return logMgr.getHostsCount(searchCriteria); - } - - @GET - @Path("/getTreeExtension") - @Produces({"application/json"}) - @ApiOperation(GET_TREE_EXTENSION_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public VNodeList getTreeExtension(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - searchCriteria.addParam("hostName", request.getParameter("hostName")); - return logMgr.getTreeExtension(searchCriteria); - } - - @GET - @Path("/getLogLevelCounts") - @Produces({"application/json"}) - @ApiOperation(GET_LOG_LEVELS_COUNT_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public VNameValueList getLogsLevelCount(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - return logMgr.getLogsLevelCount(searchCriteria); - } - - @GET - @Path("/getHistogramData") - @Produces({"application/json"}) - @ApiOperation(GET_HISTOGRAM_DATA_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String getHistogramData(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - searchCriteria.addParam("unit", request.getParameter("unit")); - return logMgr.getHistogramData(searchCriteria); - } - - @GET - @Path("/cancelFindRequest") - @Produces({"application/json"}) - @ApiOperation(CANCEL_FIND_REQUEST_OD) - public String cancelFindRequest(@Context HttpServletRequest request) { - return logMgr.cancelFindRequestByDate(request); - } - - @GET - @Path("/exportToTextFile") - @Produces({"application/json"}) - @ApiOperation(EXPORT_TO_TEXT_FILE_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FORMAT_D, name = "format", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = UTC_OFFSET_D, name = "utcOffset", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public Response exportToTextFile(@Context HttpServletRequest request) { - - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - searchCriteria.addParam("format", request.getParameter("format")); - searchCriteria.addParam("utcOffset", request.getParameter("utcOffset")); - return logMgr.exportToTextFile(searchCriteria); - - } - - @GET - @Path("/getHostListByComponent") - @Produces({"application/json"}) - @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String getHostListByComponent(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - searchCriteria.addParam("componentName", - request.getParameter("componentName")); - return logMgr.getHostListByComponent(searchCriteria); - } - - @GET - @Path("/getComponentListWithLevelCounts") - @Produces({"application/json"}) - @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String getComponentListWithLevelCounts( - @Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - return logMgr.getComponentListWithLevelCounts(searchCriteria); - } - - @GET - @Path("/solr/getBundleIdBoundaryDates") - @Produces({"application/json"}) - @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD) - public String getExtremeDatesForBundelId(@Context HttpServletRequest request) { - - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addParam(LogSearchConstants.BUNDLE_ID, - request.getParameter("bundle_id")); - - return logMgr.getExtremeDatesForBundelId(searchCriteria); - - } - - @GET - @Path("/getServiceLogsFieldsName") - @Produces({"application/json"}) - @ApiOperation(GET_SERVICE_LOGS_FIELD_NAME_OD) - public String getServiceLogsFieldsName() { - return logMgr.getServiceLogsFieldsName(); - } - - @GET - @Path("/getServiceLogsSchemaFieldsName") - @Produces({"application/json"}) - @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD) - public String getServiceLogsSchemaFieldsName() { - return logMgr.getServiceLogsSchemaFieldsName(); - } - - @GET - @Path("/getAnyGraphData") - @Produces({"application/json"}) - @ApiOperation(GET_ANY_GRAPH_DATA_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = X_AXIS_D, name = "xAxis", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = Y_AXIS_D, name = "yAxis", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = STACK_BY_D, name = "stackBy", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String getAnyGraphData(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("xAxis", request.getParameter("xAxis")); - searchCriteria.addParam("yAxis", request.getParameter("yAxis")); - searchCriteria.addParam("stackBy", request.getParameter("stackBy")); - searchCriteria.addParam("from", request.getParameter("from")); - searchCriteria.addParam("to", request.getParameter("to")); - searchCriteria.addParam("unit", request.getParameter("unit")); - return logMgr.getAnyGraphData(searchCriteria); - } - - @GET - @Path("/getAfterBeforeLogs") - @Produces({"application/json"}) - @ApiOperation(GET_AFTER_BEFORE_LOGS_OD) - @ApiImplicitParams(value = { - @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_D,name = "component", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ID_D, name = "id", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = SCROLL_TYPE_D, name = "scrollType", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = NUMBER_ROWS_D, name = "numberRows", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") - }) - public String getAfterBeforeLogs(@Context HttpServletRequest request) { - SearchCriteria searchCriteria = new SearchCriteria(request); - searchCriteria.addRequiredServiceLogsParams(request); - searchCriteria.addParam("hostLogFile", request.getParameter("host")); - searchCriteria.addParam("compLogFile", - request.getParameter("component")); - searchCriteria.addParam("id", request.getParameter("id")); - searchCriteria.addParam("scrollType", - request.getParameter("scrollType")); - searchCriteria.addParam("numberRows", - request.getParameter("numberRows")); - return logMgr.getAfterBeforeLogs(searchCriteria); - } - - @GET - @Path("/getHadoopServiceConfigJSON") - @Produces({"application/json"}) - @ApiOperation(GET_HADOOP_SERVICE_CONFIG_JSON_OD) - public String getHadoopServiceConfigJSON() { - return logMgr.getHadoopServiceConfigJSON(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/593cc9a0/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java index d53cff9..6099e0f 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java @@ -63,13 +63,14 @@ public class LogFileREST { } @GET - @Path("/getLogFileTail") + @Path("/tail") @Produces({"application/json"}) @ApiOperation(GET_LOG_FILE_TAIL_OD) @ApiImplicitParams(value = { @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), - @ApiImplicitParam(value = LOG_TYPE_D, name = "logType", dataType = "string", paramType = "query") + @ApiImplicitParam(value = LOG_TYPE_D, name = "logType", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TAIL_SIZE_D, name = "tailSize", dataType = "string", paramType = "query") }) public String getLogFileTail(@Context HttpServletRequest request) { SearchCriteria searchCriteria = new SearchCriteria(); http://git-wip-us.apache.org/repos/asf/ambari/blob/593cc9a0/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java index af48acd..5218f5d 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java @@ -40,7 +40,7 @@ public class PublicREST { PublicMgr generalMgr; @GET - @Path("/getGeneralConfig") + @Path("/config") @ApiOperation(OBTAIN_GENERAL_CONFIG_OD) public String getGeneralConfig() { return generalMgr.getGeneralConfig(); http://git-wip-us.apache.org/repos/asf/ambari/blob/593cc9a0/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java new file mode 100644 index 0000000..373f7ff --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java @@ -0,0 +1,578 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.rest; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.common.SearchCriteria; +import org.apache.ambari.logsearch.manager.LogsMgr; +import org.apache.ambari.logsearch.util.RESTErrorUtil; +import org.apache.ambari.logsearch.view.VCountList; +import org.apache.ambari.logsearch.view.VNameValueList; +import org.apache.ambari.logsearch.view.VNodeList; +import org.apache.commons.lang.StringEscapeUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.*; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.*; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*; + +@Api(value = "service/logs", description = "Service log operations") +@Path("service/logs") +@Component +@Scope("request") +public class ServiceLogsREST { + + @Autowired + LogsMgr logMgr; + + @Autowired + RESTErrorUtil restErrorUtil; + + @GET + @Produces({"application/json"}) + @ApiOperation(SEARCH_LOGS_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FIND_D, name = "find", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = SOURCE_LOG_ID_D, name = "sourceLogId", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = KEYWORD_TYPE_D, name = "keywordType", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TOKEN_D, name = "token", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = IS_LAST_PAGE_D, name = "isLastPage", dataType = "boolean", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String searchSolrData(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + searchCriteria.addParam("keyword", StringEscapeUtils.unescapeXml(request.getParameter("find"))); + searchCriteria.addParam("sourceLogId", request.getParameter("sourceLogId")); + searchCriteria.addParam("keywordType", + request.getParameter("keywordType")); + searchCriteria.addParam("token", + request.getParameter("token")); + searchCriteria.addParam("isLastPage",request.getParameter("isLastPage")); + return logMgr.searchLogs(searchCriteria); + } + + @GET + @Path("/hosts") + @Produces({"application/json"}) + @ApiOperation(GET_HOSTS_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query") + }) + public String getHosts(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addParam("q", request.getParameter("q")); + return logMgr.getHosts(searchCriteria); + } + + @GET + @Path("/components") + @Produces({"application/json"}) + @ApiOperation(GET_COMPONENTS_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query") + }) + public String getComponents(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addParam("q", request.getParameter("q")); + return logMgr.getComponents(searchCriteria); + } + + @GET + @Path("/aggregated") + @Produces({"application/json"}) + @ApiOperation(GET_AGGREGATED_INFO_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String getAggregatedInfo(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(); + searchCriteria.addRequiredServiceLogsParams(request); + return logMgr.getAggregatedInfo(searchCriteria); + } + + @GET + @Path("/levels/count") + @Produces({"application/json"}) + @ApiOperation(GET_LOG_LEVELS_COUNT_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public VCountList getLogLevelsCount(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(); + searchCriteria.addParam("q", request.getParameter("q")); + searchCriteria + .addParam("startDate", request.getParameter("start_time")); + searchCriteria.addParam("endDate", request.getParameter("end_time")); + return logMgr.getLogLevelCount(searchCriteria); + } + + @GET + @Path("/components/count") + @Produces({"application/json"}) + @ApiOperation(GET_COMPONENTS_COUNT_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public VCountList getComponentsCount(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(); + searchCriteria.addParam("q", request.getParameter("q")); + searchCriteria + .addParam("startDate", request.getParameter("start_time")); + searchCriteria.addParam("endDate", request.getParameter("end_time")); + return logMgr.getComponentsCount(searchCriteria); + } + + @GET + @Path("/hosts/count") + @Produces({"application/json"}) + @ApiOperation(GET_HOSTS_COUNT_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query") + }) + public VCountList getHostsCount(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(); + searchCriteria.addParam("q", request.getParameter("q")); + searchCriteria + .addParam("startDate", request.getParameter("start_time")); + searchCriteria.addParam("endDate", request.getParameter("end_time")); + searchCriteria.addParam("excludeQuery", StringEscapeUtils + .unescapeXml(request.getParameter("excludeQuery"))); + searchCriteria.addParam("includeQuery", StringEscapeUtils + .unescapeXml(request.getParameter("includeQuery"))); + return logMgr.getHostsCount(searchCriteria); + } + + @GET + @Path("/tree") + @Produces({"application/json"}) + @ApiOperation(GET_TREE_EXTENSION_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public VNodeList getTreeExtension(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + searchCriteria.addParam("hostName", request.getParameter("hostName")); + return logMgr.getTreeExtension(searchCriteria); + } + + @GET + @Path("/levels/counts/namevalues") + @Produces({"application/json"}) + @ApiOperation(GET_LOG_LEVELS_COUNT_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public VNameValueList getLogsLevelCount(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + return logMgr.getLogsLevelCount(searchCriteria); + } + + @GET + @Path("/histogram") + @Produces({"application/json"}) + @ApiOperation(GET_HISTOGRAM_DATA_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String getHistogramData(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + searchCriteria.addParam("unit", request.getParameter("unit")); + return logMgr.getHistogramData(searchCriteria); + } + + @GET + @Path("/request/cancel") + @Produces({"application/json"}) + @ApiOperation(CANCEL_FIND_REQUEST_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = TOKEN_D, name = "token", dataType = "string", paramType = "query"), + }) + public String cancelFindRequest(@Context HttpServletRequest request) { + String uniqueId = request.getParameter("token"); + return logMgr.cancelFindRequestByDate(uniqueId); + } + + @GET + @Path("/export") + @Produces({"application/json"}) + @ApiOperation(EXPORT_TO_TEXT_FILE_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FORMAT_D, name = "format", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = UTC_OFFSET_D, name = "utcOffset", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public Response exportToTextFile(@Context HttpServletRequest request) { + + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + searchCriteria.addParam("format", request.getParameter("format")); + searchCriteria.addParam("utcOffset", request.getParameter("utcOffset")); + return logMgr.exportToTextFile(searchCriteria); + + } + + @GET + @Path("/hosts/components") + @Produces({"application/json"}) + @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String getHostListByComponent(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + searchCriteria.addParam("componentName", + request.getParameter("componentName")); + return logMgr.getHostListByComponent(searchCriteria); + } + + @GET + @Path("/components/level/counts") + @Produces({"application/json"}) + @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String getComponentListWithLevelCounts( + @Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + return logMgr.getComponentListWithLevelCounts(searchCriteria); + } + + @GET + @Path("/solr/boundarydates") + @Produces({"application/json"}) + @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD) + public String getExtremeDatesForBundelId(@Context HttpServletRequest request) { + + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addParam(LogSearchConstants.BUNDLE_ID, + request.getParameter("bundle_id")); + + return logMgr.getExtremeDatesForBundelId(searchCriteria); + + } + + @GET + @Path("/fields") + @Produces({"application/json"}) + @ApiOperation(GET_SERVICE_LOGS_FIELD_NAME_OD) + public String getServiceLogsFieldsName() { + return logMgr.getServiceLogsFieldsName(); + } + + @GET + @Path("/schema/fields") + @Produces({"application/json"}) + @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD) + public String getServiceLogsSchemaFieldsName() { + return logMgr.getServiceLogsSchemaFieldsName(); + } + + @GET + @Path("/anygraph") + @Produces({"application/json"}) + @ApiOperation(GET_ANY_GRAPH_DATA_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = X_AXIS_D, name = "xAxis", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = Y_AXIS_D, name = "yAxis", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = STACK_BY_D, name = "stackBy", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String getAnyGraphData(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("xAxis", request.getParameter("xAxis")); + searchCriteria.addParam("yAxis", request.getParameter("yAxis")); + searchCriteria.addParam("stackBy", request.getParameter("stackBy")); + searchCriteria.addParam("from", request.getParameter("from")); + searchCriteria.addParam("to", request.getParameter("to")); + searchCriteria.addParam("unit", request.getParameter("unit")); + return logMgr.getAnyGraphData(searchCriteria); + } + + @GET + @Path("/truncated") + @Produces({"application/json"}) + @ApiOperation(GET_AFTER_BEFORE_LOGS_OD) + @ApiImplicitParams(value = { + @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_D,name = "component", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ID_D, name = "id", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = SCROLL_TYPE_D, name = "scrollType", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = NUMBER_ROWS_D, name = "numberRows", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"), + @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query") + }) + public String getAfterBeforeLogs(@Context HttpServletRequest request) { + SearchCriteria searchCriteria = new SearchCriteria(request); + searchCriteria.addRequiredServiceLogsParams(request); + searchCriteria.addParam("hostLogFile", request.getParameter("host")); + searchCriteria.addParam("compLogFile", + request.getParameter("component")); + searchCriteria.addParam("id", request.getParameter("id")); + searchCriteria.addParam("scrollType", + request.getParameter("scrollType")); + searchCriteria.addParam("numberRows", + request.getParameter("numberRows")); + return logMgr.getAfterBeforeLogs(searchCriteria); + } + + @GET + @Path("/serviceconfig") + @Produces({"application/json"}) + @ApiOperation(GET_HADOOP_SERVICE_CONFIG_JSON_OD) + public String getHadoopServiceConfigJSON() { + return logMgr.getHadoopServiceConfigJSON(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/593cc9a0/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java index 4b1675f..a79a737 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -58,7 +58,6 @@ public class UserConfigREST { UserConfigMgr userConfigMgr; @POST - @Path("/saveUserConfig") @Produces({"application/json"}) @ApiOperation(SAVE_USER_CONFIG_OD) public String saveUserConfig(VUserConfig vhist) { @@ -66,7 +65,6 @@ public class UserConfigREST { } @PUT - @Path("/updateUserConfig") @Produces({"application/json"}) @ApiOperation(UPDATE_USER_CONFIG_OD) public String updateUserConfig(VUserConfig vhist) { @@ -74,14 +72,13 @@ public class UserConfigREST { } @DELETE - @Path("/deleteUserConfig/{id}") + @Path("/{id}") @ApiOperation(DELETE_USER_CONFIG_OD) public void deleteUserConfig(@PathParam("id") String id) { userConfigMgr.deleteUserConfig(id); } @GET - @Path("/getUserConfig") @Produces({"application/json"}) @ApiOperation(GET_USER_CONFIG_OD) @ApiImplicitParams(value = { @@ -101,7 +98,7 @@ public class UserConfigREST { } @GET - @Path("/user_filter") + @Path("/users/filter") @Produces({"application/json"}) @ApiOperation(GET_USER_FILTER_OD) public String getUserFilter(@Context HttpServletRequest request) { @@ -109,7 +106,7 @@ public class UserConfigREST { } @POST - @Path("/user_filter") + @Path("/users/filter") @Produces({"application/json"}) @ApiOperation(UPDATE_USER_FILTER_OD) public String createUserFilter(String json) { @@ -117,7 +114,7 @@ public class UserConfigREST { } @PUT - @Path("/user_filter/{id}") + @Path("/users/filter/{id}") @Produces({"application/json"}) @ApiOperation(GET_USER_FILTER_BY_ID_OD) public String updateUserFilter(String json) { @@ -125,7 +122,7 @@ public class UserConfigREST { } @GET - @Path("/getAllUserName") + @Path("/users/names") @Produces({"application/json"}) @ApiOperation(GET_ALL_USER_NAMES_OD) public String getAllUserName() { http://git-wip-us.apache.org/repos/asf/ambari/blob/593cc9a0/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/login.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/login.html b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/login.html index 44f1aeb..038cec2 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/login.html +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/login.html @@ -1,4 +1,4 @@ -