You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2016/09/07 23:38:19 UTC
[29/50] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch
portal side code (oleewere)
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/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
deleted file mode 100644
index 7a27e1c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java
+++ /dev/null
@@ -1,574 +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.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;
-
- @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();
- }
-
- @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();
- }
-
- @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();
- }
-
- @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();
- }
-
- @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();
- }
-
- @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/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
new file mode 100644
index 0000000..5400825
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
@@ -0,0 +1,238 @@
+/*
+ * 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.inject.Inject;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogFileRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
+import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.CountDataListResponse;
+import org.apache.ambari.logsearch.model.response.GraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.GroupListResponse;
+import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
+import org.apache.ambari.logsearch.model.response.NodeListResponse;
+import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.ambari.logsearch.manager.ServiceLogsManager;
+import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
+import org.springframework.context.annotation.Scope;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Component;
+
+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 ServiceLogsResource {
+
+ @Inject
+ private ServiceLogsManager serviceLogsManager;
+
+ @Inject
+ private ConversionService conversionService;
+
+ @GET
+ @Produces({"application/json"})
+ @ApiOperation(SEARCH_LOGS_OD)
+ public ServiceLogResponse searchSolrData(@BeanParam ServiceLogRequest request) {
+ return serviceLogsManager.searchLogs(conversionService.convert(request, ServiceLogSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/hosts")
+ @Produces({"application/json"})
+ @ApiOperation(GET_HOSTS_OD)
+ public GroupListResponse getHosts() {
+ return serviceLogsManager.getHosts();
+ }
+
+ @GET
+ @Path("/components")
+ @Produces({"application/json"})
+ @ApiOperation(GET_COMPONENTS_OD)
+ public GroupListResponse getComponents() {
+ return serviceLogsManager.getComponents();
+ }
+
+ @GET
+ @Path("/aggregated")
+ @Produces({"application/json"})
+ @ApiOperation(GET_AGGREGATED_INFO_OD)
+ public GraphDataListResponse getAggregatedInfo(@BeanParam BaseServiceLogRequest request) {
+ return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/levels/count")
+ @Produces({"application/json"})
+ @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
+ public CountDataListResponse getLogLevelsCount() {
+ return serviceLogsManager.getLogLevelCount();
+ }
+
+ @GET
+ @Path("/components/count")
+ @Produces({"application/json"})
+ @ApiOperation(GET_COMPONENTS_COUNT_OD)
+ public CountDataListResponse getComponentsCount() {
+ return serviceLogsManager.getComponentsCount();
+ }
+
+ @GET
+ @Path("/hosts/count")
+ @Produces({"application/json"})
+ @ApiOperation(GET_HOSTS_COUNT_OD)
+ public CountDataListResponse getHostsCount() {
+ return serviceLogsManager.getHostsCount();
+ }
+
+ @GET
+ @Path("/tree")
+ @Produces({"application/json"})
+ @ApiOperation(GET_TREE_EXTENSION_OD)
+ public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogFileRequest request) {
+ SearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+ searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change
+ return serviceLogsManager.getTreeExtension(searchCriteria);
+ }
+
+ @GET
+ @Path("/levels/counts/namevalues")
+ @Produces({"application/json"})
+ @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
+ public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogFileRequest request) {
+ return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogFileSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/histogram")
+ @Produces({"application/json"})
+ @ApiOperation(GET_HISTOGRAM_DATA_OD)
+ public BarGraphDataListResponse getHistogramData(@BeanParam ServiceGraphRequest request) {
+ return serviceLogsManager.getHistogramData(conversionService.convert(request, ServiceGraphSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/request/cancel")
+ @Produces({"application/json"})
+ @ApiOperation(CANCEL_FIND_REQUEST_OD)
+ public String cancelFindRequest(@QueryParam("token") @ApiParam String token) {
+ return serviceLogsManager.cancelFindRequestByDate(token);
+ }
+
+ @GET
+ @Path("/export")
+ @Produces({"application/json"})
+ @ApiOperation(EXPORT_TO_TEXT_FILE_OD)
+ public Response exportToTextFile(@BeanParam ServiceLogExportRequest request) {
+ return serviceLogsManager.exportToTextFile(conversionService.convert(request, ServiceLogExportSearchCriteria.class));
+
+ }
+
+ @GET
+ @Path("/hosts/components")
+ @Produces({"application/json"})
+ @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
+ public NodeListResponse getHostListByComponent(@BeanParam ServiceLogFileRequest request, @QueryParam("componentName") @ApiParam String componentName) {
+ SearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+ searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change
+ return serviceLogsManager.getHostListByComponent(searchCriteria);
+ }
+
+ @GET
+ @Path("/components/levels/counts")
+ @Produces({"application/json"})
+ @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD)
+ public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogFileRequest request) {
+ return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogFileSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/solr/boundarydates")
+ @Produces({"application/json"})
+ @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD)
+ public NameValueDataListResponse getExtremeDatesForBundelId(@BeanParam ServiceExtremeDatesRequest request) {
+ return serviceLogsManager.getExtremeDatesForBundelId(conversionService.convert(request, ServiceExtremeDatesCriteria.class));
+ }
+
+ @GET
+ @Path("/fields")
+ @Produces({"application/json"})
+ @ApiOperation(GET_SERVICE_LOGS_FIELD_NAME_OD)
+ public String getServiceLogsFieldsName() {
+ return serviceLogsManager.getServiceLogsFieldsName();
+ }
+
+ @GET
+ @Path("/schema/fields")
+ @Produces({"application/json"})
+ @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD)
+ public String getServiceLogsSchemaFieldsName() {
+ return serviceLogsManager.getServiceLogsSchemaFieldsName();
+ }
+
+ @GET
+ @Path("/anygraph")
+ @Produces({"application/json"})
+ @ApiOperation(GET_ANY_GRAPH_DATA_OD)
+ public BarGraphDataListResponse getAnyGraphData(@BeanParam ServiceAnyGraphRequest request) {
+ return serviceLogsManager.getAnyGraphData(conversionService.convert(request, ServiceAnyGraphSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/truncated")
+ @Produces({"application/json"})
+ @ApiOperation(GET_AFTER_BEFORE_LOGS_OD)
+ public ServiceLogResponse getAfterBeforeLogs(@BeanParam ServiceLogTruncatedRequest request) {
+ return serviceLogsManager.getAfterBeforeLogs(conversionService.convert(request, ServiceLogTruncatedSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/serviceconfig")
+ @Produces({"application/json"})
+ @ApiOperation(GET_HADOOP_SERVICE_CONFIG_JSON_OD)
+ public String getHadoopServiceConfigJSON() {
+ return serviceLogsManager.getHadoopServiceConfigJSON();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/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
deleted file mode 100644
index 699dc17..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java
+++ /dev/null
@@ -1,128 +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.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-
-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.UserConfigMgr;
-import org.apache.ambari.logsearch.view.VUserConfig;
-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.UserConfigDescriptions.*;
-import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*;
-
-@Api(value = "userconfig", description = "User config operations")
-@Path("userconfig")
-@Component
-@Scope("request")
-public class UserConfigREST {
-
- @Autowired
- UserConfigMgr userConfigMgr;
-
- @POST
- @Produces({"application/json"})
- @ApiOperation(SAVE_USER_CONFIG_OD)
- public String saveUserConfig(VUserConfig vhist) {
- return userConfigMgr.saveUserConfig(vhist);
- }
-
- @PUT
- @Produces({"application/json"})
- @ApiOperation(UPDATE_USER_CONFIG_OD)
- public String updateUserConfig(VUserConfig vhist) {
- return userConfigMgr.updateUserConfig(vhist);
- }
-
- @DELETE
- @Path("/{id}")
- @ApiOperation(DELETE_USER_CONFIG_OD)
- public void deleteUserConfig(@PathParam("id") String id) {
- userConfigMgr.deleteUserConfig(id);
- }
-
- @GET
- @Produces({"application/json"})
- @ApiOperation(GET_USER_CONFIG_OD)
- @ApiImplicitParams(value = {
- @ApiImplicitParam(value = USER_ID_D, name = "userId", paramType = "query", dataType = "string"),
- @ApiImplicitParam(value = FILTER_NAME_D, name = "filterName", paramType = "query", dataType = "string"),
- @ApiImplicitParam(value = ROW_TYPE_D, name = "rowType", paramType = "query", dataType = "string")
- })
- public String getUserConfig(@Context HttpServletRequest request) {
- SearchCriteria searchCriteria = new SearchCriteria(request);
- searchCriteria.addParam(LogSearchConstants.USER_NAME,
- request.getParameter("userId"));
- searchCriteria.addParam(LogSearchConstants.FILTER_NAME,
- request.getParameter("filterName"));
- searchCriteria.addParam(LogSearchConstants.ROW_TYPE,
- request.getParameter("rowType"));
- return userConfigMgr.getUserConfig(searchCriteria);
- }
-
- @GET
- @Path("/users/filter")
- @Produces({"application/json"})
- @ApiOperation(GET_USER_FILTER_OD)
- public String getUserFilter(@Context HttpServletRequest request) {
- return userConfigMgr.getUserFilter();
- }
-
- @POST
- @Path("/users/filter")
- @Produces({"application/json"})
- @ApiOperation(UPDATE_USER_FILTER_OD)
- public String createUserFilter(String json) {
- return userConfigMgr.saveUserFiter(json);
- }
-
- @PUT
- @Path("/users/filter/{id}")
- @Produces({"application/json"})
- @ApiOperation(GET_USER_FILTER_BY_ID_OD)
- public String updateUserFilter(String json) {
- return userConfigMgr.saveUserFiter(json);
- }
-
- @GET
- @Path("/users/names")
- @Produces({"application/json"})
- @ApiOperation(GET_ALL_USER_NAMES_OD)
- public String getAllUserName() {
- return userConfigMgr.getAllUserName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
new file mode 100644
index 0000000..fd36978
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
@@ -0,0 +1,116 @@
+/*
+ * 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.inject.Inject;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ambari.logsearch.manager.UserConfigManager;
+import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
+import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria;
+import org.apache.ambari.logsearch.view.VUserConfig;
+import org.springframework.context.annotation.Scope;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Component;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*;
+
+@Api(value = "userconfig", description = "User config operations")
+@Path("userconfig")
+@Component
+@Scope("request")
+public class UserConfigResource {
+
+ @Inject
+ private UserConfigManager userConfigManager;
+
+ @Inject
+ private ConversionService conversionService;
+
+ @POST
+ @Produces({"application/json"})
+ @ApiOperation(SAVE_USER_CONFIG_OD)
+ public String saveUserConfig(VUserConfig vhist) {
+ return userConfigManager.saveUserConfig(vhist);
+ }
+
+ @PUT
+ @Produces({"application/json"})
+ @ApiOperation(UPDATE_USER_CONFIG_OD)
+ public String updateUserConfig(VUserConfig vhist) {
+ return userConfigManager.updateUserConfig(vhist);
+ }
+
+ @DELETE
+ @Path("/{id}")
+ @ApiOperation(DELETE_USER_CONFIG_OD)
+ public void deleteUserConfig(@PathParam("id") String id) {
+ userConfigManager.deleteUserConfig(id);
+ }
+
+ @GET
+ @Produces({"application/json"})
+ @ApiOperation(GET_USER_CONFIG_OD)
+ public String getUserConfig(@BeanParam UserConfigRequest request) {
+ return userConfigManager.getUserConfig(conversionService.convert(request, UserConfigSearchCriteria.class));
+ }
+
+ @GET
+ @Path("/filters")
+ @Produces({"application/json"})
+ @ApiOperation(GET_USER_FILTER_OD)
+ public String getUserFilter() {
+ return userConfigManager.getUserFilter();
+ }
+
+ @POST
+ @Path("/filters")
+ @Produces({"application/json"})
+ @ApiOperation(UPDATE_USER_FILTER_OD)
+ public String createUserFilter(String json) {
+ return userConfigManager.saveUserFiter(json);
+ }
+
+ @PUT
+ @Path("/filters/{id}")
+ @Produces({"application/json"})
+ @ApiOperation(GET_USER_FILTER_BY_ID_OD)
+ public String updateUserFilter(String json) {
+ return userConfigManager.saveUserFiter(json);
+ }
+
+ @GET
+ @Path("/names")
+ @Produces({"application/json"})
+ @ApiOperation(GET_ALL_USER_NAMES_OD)
+ public String getAllUserName() {
+ return userConfigManager.getAllUserName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
index 4b2b918..ba4431d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
@@ -18,7 +18,6 @@
*/
package org.apache.ambari.logsearch.service;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@@ -26,12 +25,14 @@ import org.apache.ambari.logsearch.dao.UserDao;
import org.apache.ambari.logsearch.web.model.User;
import org.apache.log4j.Logger;
+import javax.inject.Inject;
+
@Service
public class UserService implements UserDetailsService {
private static final Logger logger = Logger.getLogger(UserService.class);
- @Autowired
+ @Inject
private UserDao userDao;
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
new file mode 100644
index 0000000..a3f59f7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
@@ -0,0 +1,339 @@
+/*
+ * 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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.AuditLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+import java.util.Date;
+import java.util.List;
+
+public class SolrAuditLogData extends SolrCommonLogData implements AuditLogData {
+
+ @Field("logType")
+ private String logType;
+
+ @Field("policy")
+ private String policy;
+
+ @Field("access")
+ private String access;
+
+ @Field("action")
+ private String action;
+
+ @Field("agent")
+ private String agent;
+
+ @Field("agentHost")
+ private String agentHost;
+
+ @Field("cliIP")
+ private String clientIp;
+
+ @Field("cliType")
+ private String clientType;
+
+ @Field("reqContext")
+ private String requestContext;
+
+ @Field("enforcer")
+ private String enforcer;
+
+ @Field("evtTime")
+ private Date eventTime;
+
+ @Field("reason")
+ private String reason;
+
+ @Field("proxyUsers")
+ private List<String> proxyUsers;
+
+ @Field("repo")
+ private String repo;
+
+ @Field("repoType")
+ private String repoType;
+
+ @Field("reqData")
+ private String requestData;
+
+ @Field("reqUser")
+ private String requestUser;
+
+ @Field("resType")
+ private String responseType;
+
+ @Field("resource")
+ private String resource;
+
+ @Field("result")
+ private Integer result;
+
+ @Field("sess")
+ private String session;
+
+ @Field("tags")
+ private List<String> tags;
+
+ @Field("tags_str")
+ private String tagsStr;
+
+ @Field("text")
+ private String text;
+
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ @Override
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @Override
+ public String getTagsStr() {
+ return tagsStr;
+ }
+
+ @Override
+ public void setTagsStr(String tagsStr) {
+ this.tagsStr = tagsStr;
+ }
+
+ @Override
+ public List<String> getTags() {
+ return tags;
+ }
+
+ @Override
+ public void setTags(List<String> tags) {
+ this.tags = tags;
+ }
+
+ @Override
+ public String getSession() {
+ return session;
+ }
+
+ @Override
+ public void setSession(String session) {
+ this.session = session;
+ }
+
+ @Override
+ public Integer getResult() {
+ return result;
+ }
+
+ @Override
+ public void setResult(Integer result) {
+ this.result = result;
+ }
+
+ @Override
+ public String getResource() {
+ return resource;
+ }
+
+ @Override
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ @Override
+ public String getResponseType() {
+ return responseType;
+ }
+
+ public void setResponseType(String responseType) {
+ this.responseType = responseType;
+ }
+
+ @Override
+ public String getRequestUser() {
+ return requestUser;
+ }
+
+ @Override
+ public void setRequestUser(String requestUser) {
+ this.requestUser = requestUser;
+ }
+
+ @Override
+ public String getRequestData() {
+ return requestData;
+ }
+
+ @Override
+ public void setRequestData(String requestData) {
+ this.requestData = requestData;
+ }
+
+ @Override
+ public String getRepoType() {
+ return repoType;
+ }
+
+ @Override
+ public void setRepoType(String repoType) {
+ this.repoType = repoType;
+ }
+
+ @Override
+ public String getRepo() {
+ return repo;
+ }
+
+ @Override
+ public void setRepo(String repo) {
+ this.repo = repo;
+ }
+
+ @Override
+ public List<String> getProxyUsers() {
+ return proxyUsers;
+ }
+
+ @Override
+ public void setProxyUsers(List<String> proxyUsers) {
+ this.proxyUsers = proxyUsers;
+ }
+
+ @Override
+ public String getReason() {
+ return reason;
+ }
+
+ @Override
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ @Override
+ public Date getEventTime() {
+ return eventTime;
+ }
+
+ @Override
+ public void setEventTime(Date eventTime) {
+ this.eventTime = eventTime;
+ }
+
+ @Override
+ public String getEnforcer() {
+ return enforcer;
+ }
+
+ @Override
+ public void setEnforcer(String enforcer) {
+ this.enforcer = enforcer;
+ }
+
+ @Override
+ public String getRequestContext() {
+ return requestContext;
+ }
+
+ @Override
+ public void setRequestContext(String requestContext) {
+ this.requestContext = requestContext;
+ }
+
+ @Override
+ public String getClientType() {
+ return clientType;
+ }
+
+ @Override
+ public void setClientType(String clientType) {
+ this.clientType = clientType;
+ }
+
+ @Override
+ public String getClientIp() {
+ return clientIp;
+ }
+
+ @Override
+ public void setClientIp(String clientIp) {
+ this.clientIp = clientIp;
+ }
+
+ @Override
+ public String getAgent() {
+ return agent;
+ }
+
+ @Override
+ public void setAgent(String agent) {
+ this.agent = agent;
+ }
+
+ @Override
+ public String getAgentHost() {
+ return agentHost;
+ }
+
+ @Override
+ public void setAgentHost(String agentHost) {
+ this.agentHost = agentHost;
+ }
+
+ @Override
+ public String getAction() {
+ return action;
+ }
+
+ @Override
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ @Override
+ public String getAccess() {
+ return access;
+ }
+
+ @Override
+ public void setAccess(String access) {
+ this.access = access;
+ }
+
+ @Override
+ public String getPolicy() {
+ return policy;
+ }
+
+ @Override
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+
+ @Override
+ public String getLogType() {
+ return logType;
+ }
+
+ @Override
+ public void setLogType(String logType) {
+ this.logType = logType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
new file mode 100644
index 0000000..d68279d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
@@ -0,0 +1,248 @@
+/*
+ * 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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.CommonLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+import java.util.Date;
+
+public class SolrCommonLogData implements CommonLogData {
+
+ @Field("id")
+ private String id;
+
+ @Field("bundle_id")
+ private String bundleId;
+
+ @Field("case_id")
+ private String caseId;
+
+ @Field("cluster")
+ private String cluster;
+
+ @Field("seq_num")
+ private Long seqNum;
+
+ @Field("log_message")
+ private String logMessage;
+
+ @Field("logfile_line_number")
+ private Integer logFileLineNumber;
+
+ @Field("event_dur_m5")
+ private Long eventDurationMs;
+
+ @Field("file")
+ private String file;
+
+ @Field("type")
+ private String type;
+
+ @Field("event_count")
+ private Long eventCount;
+
+ @Field("event_md5")
+ private String eventMd5;
+
+ @Field("message_md5")
+ private String messageMd5;
+
+ @Field("_ttl_")
+ private String ttl;
+
+ @Field("_expire_at_")
+ private Date expire;
+
+ @Field("_version_")
+ private Long version;
+
+ @Field("_router_field_")
+ private Integer routerField;
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getCaseId() {
+ return this.caseId;
+ }
+
+ @Override
+ public void setCaseId(String caseId) {
+ this.caseId = caseId;
+ }
+
+ @Override
+ public String getLogMessage() {
+ return this.logMessage;
+ }
+
+ @Override
+ public String getBundleId() {
+ return bundleId;
+ }
+
+ @Override
+ public void setBundleId(String bundleId) {
+ this.bundleId = bundleId;
+ }
+
+ @Override
+ public Integer getLogFileLineNumber() {
+ return logFileLineNumber;
+ }
+
+ @Override
+ public void setLogFileLineNumber(Integer logFileLineNumber) {
+ this.logFileLineNumber = logFileLineNumber;
+ }
+
+ @Override
+ public void setLogMessage(String logMessage) {
+ this.logMessage = logMessage;
+ }
+
+ @Override
+ public Long getEventDurationMs() {
+ return eventDurationMs;
+ }
+
+ @Override
+ public void setEventDurationMs(Long eventDurationMs) {
+ this.eventDurationMs = eventDurationMs;
+ }
+
+ @Override
+ public String getFile() {
+ return file;
+ }
+
+ @Override
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ @Override
+ public Long getSeqNum() {
+ return seqNum;
+ }
+
+ @Override
+ public void setSeqNum(Long seqNum) {
+ this.seqNum = seqNum;
+ }
+
+ @Override
+ public String getMessageMd5() {
+ return messageMd5;
+ }
+
+ @Override
+ public void setMessageMd5(String messageMd5) {
+ this.messageMd5 = messageMd5;
+ }
+
+ @Override
+ public String getEventMd5() {
+ return eventMd5;
+ }
+
+ @Override
+ public void setEventMd5(String eventMd5) {
+ this.eventMd5 = eventMd5;
+ }
+
+ @Override
+ public String getCluster() {
+ return cluster;
+ }
+
+ @Override
+ public void setCluster(String cluster) {
+ this.cluster = cluster;
+ }
+
+ @Override
+ public Long getEventCount() {
+ return eventCount;
+ }
+
+ @Override
+ public void setEventCount(Long eventCount) {
+ this.eventCount = eventCount;
+ }
+
+ @Override
+ public String getTtl() {
+ return this.ttl;
+ }
+
+ @Override
+ public void setTtl(String ttl) {
+ this.ttl = ttl;
+ }
+
+ @Override
+ public Date getExpire() {
+ return expire;
+ }
+
+ @Override
+ public void setExpire(Date expire) {
+ this.expire = expire;
+ }
+
+ @Override
+ public Long getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+
+ @Override
+ public Integer getRouterField() {
+ return this.routerField;
+ }
+
+ @Override
+ public void setRouterField(Integer routerField) {
+ this.routerField = routerField;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(String type) {
+ this.type = type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
new file mode 100644
index 0000000..988c878
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
@@ -0,0 +1,38 @@
+/*
+ * 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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.ComponentTypeLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+public class SolrComponentTypeLogData implements ComponentTypeLogData {
+
+ @Field("type")
+ private String type;
+
+ @Override
+ public String getType() {
+ return this.type;
+ }
+
+ @Override
+ public void setType(String type) {
+ this.type = type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
new file mode 100644
index 0000000..215b22c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
@@ -0,0 +1,38 @@
+/*
+ * 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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.HostLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+public class SolrHostLogData implements HostLogData {
+
+ @Field("host")
+ private String host;
+
+ @Override
+ public String getHost() {
+ return host;
+ }
+
+ @Override
+ public void setHost(String host) {
+ this.host = host;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
new file mode 100644
index 0000000..890dc7d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
@@ -0,0 +1,118 @@
+/*
+ * 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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.ServiceLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+import java.util.Date;
+
+public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogData {
+
+ @Field("level")
+ private String level;
+
+ @Field("line_number")
+ private Integer lineNumber;
+
+ @Field("logtime")
+ private Date logTime;
+
+ @Field("type")
+ private String type;
+
+ @Field("ip")
+ private String ip;
+
+ @Field("path")
+ private String path;
+
+ @Field("host")
+ private String host;
+
+ @Override
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public String getIp() {
+ return ip;
+ }
+
+ @Override
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getHost() {
+ return host;
+ }
+
+ @Override
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ @Override
+ public Date getLogTime() {
+ return logTime;
+ }
+
+ @Override
+ public void setLogTime(Date logTime) {
+ this.logTime = logTime;
+ }
+
+ @Override
+ public Integer getLineNumber() {
+ return lineNumber;
+ }
+
+ @Override
+ public void setLineNumber(Integer lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ @Override
+ public String getLevel() {
+ return level;
+ }
+
+ @Override
+ public void setLevel(String level) {
+ this.level = level;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
index bd6cfbb..637a4d7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
@@ -32,10 +32,10 @@ import java.util.Map.Entry;
import java.util.Set;
import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.view.VBarDataList;
-import org.apache.ambari.logsearch.view.VBarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.NameValueData;
import org.apache.ambari.logsearch.view.VHost;
-import org.apache.ambari.logsearch.view.VNameValue;
import org.apache.ambari.logsearch.view.VSummary;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
@@ -173,41 +173,41 @@ public class BizUtil {
}
@SuppressWarnings({"unchecked", "rawtypes"})
- public static VBarDataList buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse,String innerJsonKey,String outerJsonKey) {
+ public static BarGraphDataListResponse buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse, String innerJsonKey, String outerJsonKey) {
- VBarDataList vBarDataList = new VBarDataList();
+ BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
- Collection<VBarGraphData> dataList = new ArrayList<VBarGraphData>();
+ Collection<BarGraphData> dataList = new ArrayList<>();
if (jsonFacetResponse == null) {
logger.info("Solr document list in null");
- return vBarDataList;
+ return barGraphDataListResponse;
}
List<Object> userList = jsonFacetResponse.getAll(outerJsonKey);
if (userList.isEmpty()) {
- return vBarDataList;
+ return barGraphDataListResponse;
}
SimpleOrderedMap<Map<String, Object>> userMap = (SimpleOrderedMap<Map<String, Object>>) userList.get(0);
if (userMap == null) {
logger.info("No top user details found");
- return vBarDataList;
+ return barGraphDataListResponse;
}
List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap.get("buckets");
if(userUsageList == null){
- return vBarDataList;
+ return barGraphDataListResponse;
}
for (SimpleOrderedMap usageMap : userUsageList) {
if (usageMap != null) {
- VBarGraphData vBarGraphData = new VBarGraphData();
+ BarGraphData barGraphData = new BarGraphData();
String userName = (String) usageMap.get("val");
if (!StringUtils.isBlank(userName)) {
- vBarGraphData.setName(userName);
+ barGraphData.setName(userName);
}
SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get(innerJsonKey);
- List<VNameValue> componetCountList = new ArrayList<VNameValue>();
- List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets");
+ List<NameValueData> componetCountList = new ArrayList<NameValueData>();
if (repoMap != null) {
+ List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets");
for (SimpleOrderedMap repoUsageMap : repoUsageList) {
- VNameValue componetCount = new VNameValue();
+ NameValueData componetCount = new NameValueData();
if (repoUsageMap.get("val") != null) {
componetCount.setName(repoUsageMap.get("val").toString());
}
@@ -221,19 +221,19 @@ public class BizUtil {
componetCount.setValue(eventCount);
componetCountList.add(componetCount);
}
- vBarGraphData.setDataCounts(componetCountList);
- dataList.add(vBarGraphData);
+ barGraphData.setDataCount(componetCountList);
+ dataList.add(barGraphData);
}
}}
- vBarDataList.setGraphData(dataList);
+ barGraphDataListResponse.setGraphData(dataList);
logger.info("getting graph data");
- return vBarDataList;
+ return barGraphDataListResponse;
}
public static HashMap<String, String> sortHashMapByValues(HashMap<String, String> passedMap) {
if (passedMap == null ) {
- return passedMap;
+ return null;
}
HashMap<String, String> sortedMap = new LinkedHashMap<String, String>();
List<String> mapValues = new ArrayList<String>(passedMap.values());
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
deleted file mode 100644
index b13946c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
+++ /dev/null
@@ -1,46 +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.view;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VBarDataList {
- protected Collection<VBarGraphData> graphData;
-
- public VBarDataList() {
- graphData = new ArrayList<VBarGraphData>();
- }
-
- public Collection<VBarGraphData> getGraphData() {
- return graphData;
- }
-
- public void setGraphData(Collection<VBarGraphData> histogramData) {
- this.graphData = histogramData;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java
deleted file mode 100644
index 50fe47e..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java
+++ /dev/null
@@ -1,50 +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.view;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VBarGraphData {
- protected Collection<VNameValue> dataCount = null;
- protected String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String level) {
- this.name = level;
- }
-
- public Collection<VNameValue> getDataCount() {
- return dataCount;
- }
-
- public void setDataCounts(Collection<VNameValue> dateValueCounts) {
- this.dataCount = dateValueCounts;
- }
-
-}