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 6D882200BA2 for ; Thu, 8 Sep 2016 01:37:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6C0A0160ADE; Wed, 7 Sep 2016 23:37:57 +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 2BCC4160AE2 for ; Thu, 8 Sep 2016 01:37:55 +0200 (CEST) Received: (qmail 1243 invoked by uid 500); 7 Sep 2016 23:37:53 -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 452 invoked by uid 99); 7 Sep 2016 23:37:52 -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; Wed, 07 Sep 2016 23:37:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AF3CCE0551; Wed, 7 Sep 2016 23:37:52 +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: Wed, 07 Sep 2016 23:38:21 -0000 Message-Id: <3287378870274bf5bfe0c79dd8801d43@git.apache.org> In-Reply-To: <9a6d8001d11e48849765374376490cef@git.apache.org> References: <9a6d8001d11e48849765374376490cef@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [31/50] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere) archived-at: Wed, 07 Sep 2016 23:37:57 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java new file mode 100644 index 0000000..41d8a31 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java @@ -0,0 +1,111 @@ +/* + * 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.model.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Collection; + +@ApiModel +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class NodeData { + + @ApiModelProperty + private String name; + + @ApiModelProperty + private String type; + + @ApiModelProperty + private String value; + + @ApiModelProperty + private Collection childs; + + @ApiModelProperty + private Collection logLevelCount; + + @ApiModelProperty + @JsonProperty("isParent") + private boolean parent; + + @ApiModelProperty + @JsonProperty("isRoot") + private boolean root; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public boolean isRoot() { + return root; + } + + public void setRoot(boolean root) { + this.root = root; + } + + public Collection getChilds() { + return childs; + } + + public void setChilds(Collection childs) { + this.childs = childs; + } + + public Collection getLogLevelCount() { + return logLevelCount; + } + + public void setLogLevelCount(Collection logLevelCount) { + this.logLevelCount = logLevelCount; + } + + public boolean isParent() { + return parent; + } + + public void setParent(boolean parent) { + this.parent = parent; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java new file mode 100644 index 0000000..51044b3 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java @@ -0,0 +1,50 @@ +/* + * 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.model.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; + +@ApiModel +@JsonIgnoreProperties(ignoreUnknown = true) +public class NodeListResponse extends SearchResponse { + + @ApiModelProperty + protected List vNodeList = new ArrayList(); + + public List getvNodeList() { + return vNodeList; + } + + public void setvNodeList(List vNodeList) { + this.vNodeList = vNodeList; + } + + @Override + public int getListSize() { + if (vNodeList == null) { + return 0; + } + return vNodeList.size(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java new file mode 100644 index 0000000..dd88d29 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java @@ -0,0 +1,110 @@ +/* + * 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.model.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public abstract class SearchResponse { + /** + * Start index for the result + */ + private int startIndex; + /** + * Page size used for the result + */ + private int pageSize; + /** + * Total records in the database for the given search conditions + */ + private long totalCount; + /** + * Number of rows returned for the search condition + */ + private int resultSize; + /** + * Sort type. Either desc or asc + */ + private String sortType; + /** + * Comma seperated list of the fields for sorting + */ + private String sortBy; + + private long queryTimeMS = System.currentTimeMillis(); + + public int getStartIndex() { + return startIndex; + } + + public int getPageSize() { + return pageSize; + } + + public long getTotalCount() { + return totalCount; + } + + public int getResultSize() { + return resultSize; + } + + public String getSortType() { + return sortType; + } + + public String getSortBy() { + return sortBy; + } + + public long getQueryTimeMS() { + return queryTimeMS; + } + + public void setStartIndex(int startIndex) { + this.startIndex = startIndex; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public void setTotalCount(long totalCount) { + this.totalCount = totalCount; + } + + public void setResultSize(int resultSize) { + this.resultSize = resultSize; + } + + public void setSortType(String sortType) { + this.sortType = sortType; + } + + public void setSortBy(String sortBy) { + this.sortBy = sortBy; + } + + public void setQueryTimeMS(long queryTimeMS) { + this.queryTimeMS = queryTimeMS; + } + + public abstract int getListSize(); + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java new file mode 100644 index 0000000..16aed16 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java @@ -0,0 +1,63 @@ +/* + * 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.model.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Date; + +@JsonIgnoreProperties(ignoreUnknown = true) +public interface ServiceLogData extends CommonLogData, ComponentTypeLogData, HostLogData { + + @JsonProperty("level") + String getLevel(); + + void setLevel(String level); + + @JsonProperty("line_number") + Integer getLineNumber(); + + void setLineNumber(Integer lineNumber); + + @JsonProperty("logtime") + Date getLogTime(); + + void setLogTime(Date logTime); + + @JsonProperty("ip") + String getIp(); + + void setIp(String ip); + + @JsonProperty("path") + String getPath(); + + void setPath(String path); + + @JsonProperty("type") + String getType(); + + void setType(String type); + + @JsonProperty("host") + String getHost(); + + void setHost(String host); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java new file mode 100644 index 0000000..2e689c1 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java @@ -0,0 +1,48 @@ +/* + * 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.model.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +@ApiModel +@JsonIgnoreProperties(ignoreUnknown = true) +public class ServiceLogResponse extends LogSearchResponse { + + @ApiModelProperty + private List logList; + + @Override + public List getLogList() { + return logList; + } + + @Override + public void setLogList(List logList) { + this.logList = logList; + } + + @Override + public int getListSize() { + return logList == null ? 0 : logList.size(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java index 16cf932..10224bc 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java @@ -28,9 +28,11 @@ import java.util.regex.Pattern; import org.apache.ambari.logsearch.common.ConfigHelper; import org.apache.ambari.logsearch.common.LogSearchConstants; import org.apache.ambari.logsearch.common.PropertiesHelper; -import org.apache.ambari.logsearch.common.SearchCriteria; +import org.apache.ambari.logsearch.conf.SolrAuditLogConfig; +import org.apache.ambari.logsearch.conf.SolrServiceLogConfig; +import org.apache.ambari.logsearch.query.model.SearchCriteria; import org.apache.ambari.logsearch.dao.SolrDaoBase; -import org.apache.ambari.logsearch.manager.MgrBase.LogType; +import org.apache.ambari.logsearch.manager.ManagerBase.LogType; import org.apache.ambari.logsearch.util.JSONUtil; import org.apache.ambari.logsearch.util.SolrUtil; import org.apache.commons.lang.StringUtils; @@ -44,11 +46,19 @@ import org.apache.solr.schema.TrieFloatField; import org.apache.solr.schema.TrieLongField; import org.springframework.stereotype.Component; +import javax.inject.Inject; + @Component public class QueryGeneration extends QueryGenerationBase { private static Logger logger = Logger.getLogger(QueryGeneration.class); + @Inject + private SolrServiceLogConfig solrServiceLogConfig; + + @Inject + private SolrAuditLogConfig solrAuditLogConfig; + public SolrQuery commonServiceFilterQuery(SearchCriteria searchCriteria) { LogType logType = LogType.SERVICE; SolrQuery solrQuery = new SolrQuery(); @@ -349,10 +359,10 @@ public class QueryGeneration extends QueryGenerationBase { String originalKey; switch (logType) { case AUDIT: - originalKey = ConfigHelper.auditLogsColumnMapping.get(key + LogSearchConstants.UI_SUFFIX); + originalKey = solrAuditLogConfig.getSolrAndUiColumns().get(key + LogSearchConstants.UI_SUFFIX); break; case SERVICE: - originalKey = ConfigHelper.serviceLogsColumnMapping.get(key + LogSearchConstants.UI_SUFFIX); + originalKey = solrServiceLogConfig.getSolrAndUiColumns().get(key + LogSearchConstants.UI_SUFFIX); break; default: originalKey = null; http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java index 77d4969..d7d30d7 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.common.SearchCriteria; +import org.apache.ambari.logsearch.query.model.SearchCriteria; import org.apache.ambari.logsearch.dao.AuditSolrDao; import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao; import org.apache.ambari.logsearch.util.SolrUtil; @@ -31,21 +31,22 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery.ORDER; -import org.springframework.beans.factory.annotation.Autowired; import com.google.gson.Gson; +import javax.inject.Inject; + public abstract class QueryGenerationBase { private static final Logger logger = Logger.getLogger(QueryGenerationBase.class); - @Autowired + @Inject protected AuditSolrDao auditSolrDao; - @Autowired + @Inject protected ServiceLogsSolrDao serviceLogsSolrDao; - public static enum Condition { + public enum Condition { OR, AND } @@ -98,7 +99,6 @@ public abstract class QueryGenerationBase { solrQuery.addFilterQuery(filterQuery); logger.debug("Filter added :- " + filterQuery); } - } } http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java new file mode 100644 index 0000000..798bd47 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java @@ -0,0 +1,48 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest; +import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; +import org.apache.commons.lang.StringEscapeUtils; +import org.springframework.stereotype.Component; + +@Component +public abstract class AbstractCommonAuditLogRequestConverter + extends AbstractCommonSearchRequestConverter { + + @Override + public RESULT convertToSearchCriteria(SOURCE request) { + RESULT criteria = createCriteria(request); + criteria.addParam("q", request.getQuery()); + criteria.addParam("columnQuery", StringEscapeUtils.unescapeXml(request.getColumnQuery())); + criteria.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getiMessage())); + criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage())); + criteria.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getgEMessage())); + criteria.addParam("includeString", request.getMustBe()); + criteria.addParam("unselectComp", request.getMustNot()); + criteria.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getExcludeQuery())); + criteria.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getIncludeQuery())); + criteria.addParam("startTime", request.getFrom()); + criteria.addParam("endTime", request.getTo()); + return criteria; + } + + public abstract RESULT createCriteria(SOURCE request); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java new file mode 100644 index 0000000..3fd07e2 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java @@ -0,0 +1,53 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest; +import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; +import org.apache.commons.lang.StringUtils; +import org.springframework.core.convert.converter.Converter; + +public abstract class AbstractCommonSearchRequestConverter + implements Converter { + + @Override + public RESULT convert(SOURCE source) { + RESULT criteria = convertToSearchCriteria(source); + addDefaultParams(source, criteria); + return criteria; + } + + public abstract RESULT convertToSearchCriteria(SOURCE source); + + private void addDefaultParams(SOURCE request, RESULT criteria) { + criteria.setStartIndex(StringUtils.isNumeric(request.getStartIndex()) ? new Integer(request.getStartIndex()) : 0); + criteria.setPage(StringUtils.isNumeric(request.getPage()) ? new Integer(request.getPage()) : 0); + criteria.setMaxRows(StringUtils.isNumeric(request.getPageSize()) ? new Integer(request.getPageSize()) : 50); + criteria.setSortBy(request.getSortBy()); + criteria.setSortType(request.getSortType()); + if (StringUtils.isNotEmpty(request.getStartTime())){ + criteria.setGlobalStartTime(request.getStartTime()); + criteria.getUrlParamMap().put("globalStartTime", request.getStartTime()); + } + if (StringUtils.isNotEmpty(request.getEndTime())){ + criteria.setGlobalEndTime(request.getEndTime()); + criteria.getUrlParamMap().put("globalEndTime", request.getEndTime()); + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java new file mode 100644 index 0000000..a02d585 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java @@ -0,0 +1,56 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest; +import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; +import org.apache.commons.lang.StringEscapeUtils; + +public abstract class AbstractCommonServiceLogRequestConverter + extends AbstractCommonSearchRequestConverter { + + @Override + public RESULT convertToSearchCriteria(SOURCE request) { + RESULT criteria = createCriteria(request); + criteria.addParam("advanceSearch", StringEscapeUtils.unescapeXml(request.getAdvancedSearch())); + criteria.addParam("q", request.getQuery()); + criteria.addParam("treeParams", StringEscapeUtils.unescapeHtml(request.getTreeParams())); + criteria.addParam("level", request.getLevel()); + criteria.addParam("gMustNot", request.getgMustNot()); + criteria.addParam("from", request.getFrom()); + criteria.addParam("to", request.getTo()); + criteria.addParam("selectComp", request.getMustBe()); + criteria.addParam("unselectComp", request.getMustNot()); + criteria.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getiMessage())); + criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage())); + criteria.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getgEMessage())); + criteria.addParam(LogSearchConstants.BUNDLE_ID, request.getBundleId()); + criteria.addParam("host_name", request.getHostName()); + criteria.addParam("component_name", request.getComponentName()); + criteria.addParam("file_name", request.getFileName()); + criteria.addParam("startDate", request.getStartTime()); + criteria.addParam("endDate", request.getEndTime()); + criteria.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getExcludeQuery())); + criteria.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getIncludeQuery())); + return criteria; + } + + public abstract RESULT createCriteria(SOURCE request); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java new file mode 100644 index 0000000..0372168 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java @@ -0,0 +1,39 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest; +import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class AnyGraphRequestConverter extends AbstractCommonSearchRequestConverter { + + @Override + public AnyGraphSearchCriteria convertToSearchCriteria(AnyGraphRequest anyGraphRequest) { + AnyGraphSearchCriteria criteria = new AnyGraphSearchCriteria(); + criteria.addParam("xAxis", anyGraphRequest.getxAxis()); + criteria.addParam("yAxis", anyGraphRequest.getyAxis()); + criteria.addParam("stackBy", anyGraphRequest.getStackBy()); + criteria.addParam("unit", anyGraphRequest.getUnit()); + criteria.addParam("from", anyGraphRequest.getFrom()); + criteria.addParam("to", anyGraphRequest.getTo()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java new file mode 100644 index 0000000..f72a673 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java @@ -0,0 +1,34 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest; +import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class AuditBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter{ + + @Override + public AuditBarGraphSearchCriteria createCriteria(AuditBarGraphRequest request) { + AuditBarGraphSearchCriteria criteria = new AuditBarGraphSearchCriteria(); + criteria.addParam("unit", request.getUnit()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java new file mode 100644 index 0000000..27d314d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java @@ -0,0 +1,34 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest; +import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class AuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter { + + @Override + public AuditLogSearchCriteria createCriteria(AuditLogRequest request) { + AuditLogSearchCriteria criteria = new AuditLogSearchCriteria(); + criteria.addParam("isLastPage", request.isLastPage()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java new file mode 100644 index 0000000..35aceb2 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java @@ -0,0 +1,33 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest; +import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class BaseAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter { + + @Override + public CommonSearchCriteria createCriteria(BaseAuditLogRequest request) { + return new CommonSearchCriteria(); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java new file mode 100644 index 0000000..cfd544c --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java @@ -0,0 +1,32 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest; +import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class BaseServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter { + + @Override + public CommonSearchCriteria createCriteria(BaseServiceLogRequest request) { + return new CommonSearchCriteria(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java new file mode 100644 index 0000000..089b593 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java @@ -0,0 +1,34 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest; +import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class FieldAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter { + + @Override + public FieldAuditLogSearchCriteria createCriteria(FieldAuditLogRequest request) { + FieldAuditLogSearchCriteria criteria = new FieldAuditLogSearchCriteria(); + criteria.addParam("field", request.getField()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java new file mode 100644 index 0000000..dd518f8 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java @@ -0,0 +1,35 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest; +import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class FieldBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter { + + @Override + public FieldAuditBarGraphSearchCriteria createCriteria(FieldAuditBarGraphRequest request) { + FieldAuditBarGraphSearchCriteria criteria = new FieldAuditBarGraphSearchCriteria(); + criteria.addParam("unit", request.getUnit()); + criteria.addParam("field", request.getField()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java new file mode 100644 index 0000000..7c3038e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java @@ -0,0 +1,37 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.LogFileRequest; +import org.apache.ambari.logsearch.query.model.LogFileSearchCriteria; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class LogFileRequestConverter implements Converter { + + @Override + public LogFileSearchCriteria convert(LogFileRequest request) { + LogFileSearchCriteria criteria = new LogFileSearchCriteria(); + criteria.addParam("component", request.getComponent()); + criteria.addParam("host", request.getHost()); + criteria.addParam("logType", request.getLogType()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java new file mode 100644 index 0000000..88b1a34 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.LogFileTailRequest; +import org.apache.ambari.logsearch.query.model.LogFileTailSearchCriteria; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class LogFileTailRequestConverter implements Converter { + + @Override + public LogFileTailSearchCriteria convert(LogFileTailRequest request) { + LogFileTailSearchCriteria criteria = new LogFileTailSearchCriteria(); + criteria.addParam("component", request.getComponent()); + criteria.addParam("host", request.getHost()); + criteria.addParam("logType", request.getLogType()); + criteria.addParam("tailSize", request.getTailSize()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java new file mode 100644 index 0000000..7a559de --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java @@ -0,0 +1,39 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest; +import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class ServiceAnyGraphRequestConverter extends AbstractCommonServiceLogRequestConverter { + + @Override + public ServiceAnyGraphSearchCriteria createCriteria(ServiceAnyGraphRequest anyGraphRequest) { + ServiceAnyGraphSearchCriteria criteria = new ServiceAnyGraphSearchCriteria(); + criteria.addParam("xAxis", anyGraphRequest.getxAxis()); + criteria.addParam("yAxis", anyGraphRequest.getyAxis()); + criteria.addParam("stackBy", anyGraphRequest.getStackBy()); + criteria.addParam("unit", anyGraphRequest.getUnit()); + criteria.addParam("from", anyGraphRequest.getFrom()); + criteria.addParam("to", anyGraphRequest.getTo()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java new file mode 100644 index 0000000..fe81468 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java @@ -0,0 +1,35 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest; +import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria; +import org.springframework.stereotype.Component; + +@Component +public class ServiceExtremeDatesRequestConverter extends AbstractCommonSearchRequestConverter { + + @Override + public ServiceExtremeDatesCriteria convertToSearchCriteria(ServiceExtremeDatesRequest request) { + ServiceExtremeDatesCriteria criteria = new ServiceExtremeDatesCriteria(); + criteria.addParam(LogSearchConstants.BUNDLE_ID, request.getBundleId()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java new file mode 100644 index 0000000..19165c0 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java @@ -0,0 +1,36 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest; +import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class ServiceGraphRequestConverter extends AbstractCommonServiceLogRequestConverter { + + @Override + public ServiceGraphSearchCriteria createCriteria(ServiceGraphRequest request) { + ServiceGraphSearchCriteria criteria = new ServiceGraphSearchCriteria(); + criteria.addParam("hostLogFile", request.getHostLogFile()); + criteria.addParam("compLogFile", request.getComponentLogFile()); + criteria.addParam("unit", request.getUnit()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java new file mode 100644 index 0000000..7d83e49 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest; +import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class ServiceLogExportRequestConverter extends AbstractCommonServiceLogRequestConverter { + + @Override + public ServiceLogExportSearchCriteria createCriteria(ServiceLogExportRequest request) { + ServiceLogExportSearchCriteria criteria = new ServiceLogExportSearchCriteria(); + criteria.addParam("hostLogFile", request.getHostLogFile()); + criteria.addParam("compLogFile", + request.getComponentLogFile()); + criteria.addParam("format", request.getFormat()); + criteria.addParam("utcOffset", request.getUtcOffset()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java new file mode 100644 index 0000000..f5148f3 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java @@ -0,0 +1,36 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.ServiceLogFileRequest; +import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class ServiceLogFileRequestConverter + extends AbstractCommonServiceLogRequestConverter { + + @Override + public ServiceLogFileSearchCriteria createCriteria(ServiceLogFileRequest request) { + ServiceLogFileSearchCriteria criteria = new ServiceLogFileSearchCriteria(); + criteria.addParam("hostLogFile", request.getHostLogFile()); + criteria.addParam("compLogFile", request.getComponentLogFile()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java new file mode 100644 index 0000000..6a70d55 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java @@ -0,0 +1,41 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest; +import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria; +import org.apache.commons.lang.StringEscapeUtils; +import org.springframework.stereotype.Component; + +@Component +public class ServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter { + + @Override + public ServiceLogSearchCriteria createCriteria(ServiceLogRequest request) { + ServiceLogSearchCriteria criteria = new ServiceLogSearchCriteria(); + criteria.addParam("hostLogFile", request.getHostLogFile()); + criteria.addParam("compLogFile", request.getComponentLogFile()); + criteria.addParam("keyword", StringEscapeUtils.unescapeXml(request.getKeyWord())); + criteria.addParam("sourceLogId", request.getSourceLogId()); + criteria.addParam("keywordType", request.getKeywordType()); + criteria.addParam("token", request.getToken()); + criteria.addParam("isLastPage", request.isLastPage()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java new file mode 100644 index 0000000..676f049 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest; +import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLogRequestConverter { + + @Override + public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) { + ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria(); + criteria.addParam("hostLogFile", request.getHostLogFile()); + criteria.addParam("compLogFile", request.getComponentLogFile()); + criteria.addParam("id", request.getId()); + criteria.addParam("scrollType", request.getScrollType()); + criteria.addParam("numberRows", request.getNumberRows()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java new file mode 100644 index 0000000..8c50f66 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java @@ -0,0 +1,34 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest; +import org.apache.ambari.logsearch.query.model.SearchCriteria; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class SimpleQueryRequestConverter implements Converter { + @Override + public SearchCriteria convert(SimpleQueryRequest simpleQueryRequest) { + SearchCriteria searchCriteria = new SearchCriteria(); + searchCriteria.addParam("q", simpleQueryRequest.getQuery()); + return searchCriteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java new file mode 100644 index 0000000..50847c7 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.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.query.converter; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest; +import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class UserConfigRequestConverter implements Converter { + + @Override + public UserConfigSearchCriteria convert(UserConfigRequest request) { + UserConfigSearchCriteria criteria = new UserConfigSearchCriteria(); + criteria.addParam(LogSearchConstants.USER_NAME, request.getUserId()); + criteria.addParam(LogSearchConstants.FILTER_NAME, request.getFilterName()); + criteria.addParam(LogSearchConstants.ROW_TYPE, request.getRowType()); + return criteria; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java new file mode 100644 index 0000000..a0b5f0f --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java @@ -0,0 +1,35 @@ +/* + * 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.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.UserExportRequest; +import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria; +import org.springframework.stereotype.Component; + +@Component +public class UserExportRequestConverter extends AbstractCommonAuditLogRequestConverter { + + @Override + public UserExportSearchCriteria createCriteria(UserExportRequest request) { + UserExportSearchCriteria criteria = new UserExportSearchCriteria(); + criteria.addParam("field", request.getField()); + return criteria; + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java new file mode 100644 index 0000000..a11c056 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class AnyGraphSearchCriteria extends CommonSearchCriteria { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java new file mode 100644 index 0000000..c41ec15 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class AuditBarGraphSearchCriteria extends CommonSearchCriteria { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java new file mode 100644 index 0000000..f4fe207 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class AuditLogSearchCriteria extends CommonSearchCriteria { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java new file mode 100644 index 0000000..47d12e5 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java @@ -0,0 +1,100 @@ +/* + * 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.query.model; + +public class CommonSearchCriteria extends SearchCriteria { + private int startIndex = 0; + private int maxRows = Integer.MAX_VALUE; + private String sortBy = null; + private String sortType = null; + private int page = 0; + + private String globalStartTime = null; + private String globalEndTime = null; + + @Override + public int getStartIndex() { + return startIndex; + } + + @Override + public void setStartIndex(int startIndex) { + this.startIndex = startIndex; + } + + @Override + public int getMaxRows() { + return maxRows; + } + + @Override + public void setMaxRows(int maxRows) { + this.maxRows = maxRows; + } + + @Override + public String getSortType() { + return sortType; + } + + @Override + public void setSortType(String sortType) { + this.sortType = sortType; + } + + @Override + public String getSortBy() { + return sortBy; + } + + @Override + public void setSortBy(String sortBy) { + this.sortBy = sortBy; + } + + @Override + public int getPage() { + return page; + } + + @Override + public void setPage(int page) { + this.page = page; + } + + @Override + public String getGlobalStartTime() { + return globalStartTime; + } + + @Override + public void setGlobalStartTime(String globalStartTime) { + this.globalStartTime = globalStartTime; + } + + @Override + public String getGlobalEndTime() { + return globalEndTime; + } + + @Override + public void setGlobalEndTime(String globalEndTime) { + this.globalEndTime = globalEndTime; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java new file mode 100644 index 0000000..f931f5d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class FieldAuditBarGraphSearchCriteria extends AuditBarGraphSearchCriteria { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java new file mode 100644 index 0000000..8dd5854 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class FieldAuditLogSearchCriteria extends CommonSearchCriteria { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java new file mode 100644 index 0000000..e4e2a14 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class LogFileSearchCriteria extends SearchCriteria { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/e9e834bf/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java new file mode 100644 index 0000000..fecb396 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java @@ -0,0 +1,25 @@ +/* + * 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.query.model; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public class LogFileTailSearchCriteria extends SearchCriteria { +}