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 4084B200C54 for ; Wed, 29 Mar 2017 00:14:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F358160BA1; Tue, 28 Mar 2017 22:14:44 +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 B3EDE160B9C for ; Wed, 29 Mar 2017 00:14:41 +0200 (CEST) Received: (qmail 46146 invoked by uid 500); 28 Mar 2017 22:14:39 -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 45239 invoked by uid 99); 28 Mar 2017 22:14:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Mar 2017 22:14:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B103DE93E2; Tue, 28 Mar 2017 22:14:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jaimin@apache.org To: commits@ambari.apache.org Date: Tue, 28 Mar 2017 22:14:59 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [22/64] [abbrv] ambari git commit: AMBARI-20528. Rename Log Search Portal module to Log Search Server (oleewere) archived-at: Tue, 28 Mar 2017 22:14:44 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java deleted file mode 100644 index 5a67606..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java +++ /dev/null @@ -1,48 +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.model.response; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -@ApiModel -public class LogFileData { - - @ApiModelProperty - private String name; - - @ApiModelProperty - private String path; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java deleted file mode 100644 index 57614c3..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java +++ /dev/null @@ -1,48 +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.model.response; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.util.ArrayList; -import java.util.List; - -@ApiModel -public class LogFileDataListResponse extends SearchResponse { - - @ApiModelProperty - private List logFiles = new ArrayList(); - - @Override - public int getListSize() { - if (logFiles == null) { - return 0; - } - return logFiles.size(); - } - - public List getLogFiles() { - return logFiles; - } - - public void setLogFiles(List logFiles) { - this.logFiles = logFiles; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java deleted file mode 100644 index c075fe2..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java +++ /dev/null @@ -1,27 +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.model.response; - -import java.util.List; - -public interface LogListResponse { - List getLogList(); - - void setLogList(List logList); -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java deleted file mode 100644 index a63415b..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java +++ /dev/null @@ -1,22 +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.model.response; - -abstract public class LogSearchResponse extends SearchResponse implements LogListResponse { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java deleted file mode 100644 index 3f320e7..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java +++ /dev/null @@ -1,62 +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.model.response; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -@ApiModel -@JsonIgnoreProperties(ignoreUnknown = true) -public class NameValueData { - - @ApiModelProperty - private String name; - @ApiModelProperty - private String value; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - if (value.contains(".") && (value.contains("e") || value.contains("E"))) { - this.value = getExponentialValueReplaced(value); - } else { - this.value = value; - } - } - - private String getExponentialValueReplaced(String value) { - try{ - Double number = Double.parseDouble(value); - return String.format("%.0f", number); - } catch(Exception e){ - return value; - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java deleted file mode 100644 index 4cb983f..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java +++ /dev/null @@ -1,49 +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.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 NameValueDataListResponse extends SearchResponse { - @ApiModelProperty - protected List vNameValues = new ArrayList<>(); - - public List getvNameValues() { - return vNameValues; - } - - public void setvNameValues(List vNameValues) { - this.vNameValues = vNameValues; - } - - @Override - public int getListSize() { - if (vNameValues != null) { - return vNameValues.size(); - } - return 0; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/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 deleted file mode 100644 index b226ef8..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java +++ /dev/null @@ -1,110 +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.model.response; - -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/b0f1e340/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 deleted file mode 100644 index 51044b3..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.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.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/b0f1e340/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 deleted file mode 100644 index dd88d29..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java +++ /dev/null @@ -1,110 +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.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/b0f1e340/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 deleted file mode 100644 index 16aed16..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java +++ /dev/null @@ -1,63 +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.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/b0f1e340/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 deleted file mode 100644 index 2e689c1..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java +++ /dev/null @@ -1,48 +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.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/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java deleted file mode 100644 index 05deebd..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java +++ /dev/null @@ -1,36 +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.model.response; - -public class TemplateData { - - private String data; - - public TemplateData(String data) { - this.data = data; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java deleted file mode 100644 index ef4e0be..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java +++ /dev/null @@ -1,97 +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.model.response; - -import io.swagger.annotations.ApiModelProperty; - -import java.util.Date; -import java.util.List; - -public class UserConfigData { - - @ApiModelProperty - private String id; - - @ApiModelProperty - private String userName; - - @ApiModelProperty - private String filtername; - - @ApiModelProperty - private String values; - - @ApiModelProperty - private List shareNameList; - - @ApiModelProperty - private String rowType; - - public UserConfigData() { - id = String.valueOf(new Date().getTime()); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getFiltername() { - return filtername; - } - - public void setFiltername(String filtername) { - this.filtername = filtername; - } - - public List getShareNameList() { - return shareNameList; - } - - public void setShareNameList(List shareNameList) { - this.shareNameList = shareNameList; - } - - public String getValues() { - return values; - } - - public void setValues(String values) { - this.values = values; - } - - public String getRowType() { - return rowType; - } - - public void setRowType(String rowType) { - this.rowType = rowType; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java deleted file mode 100644 index 5c445b2..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java +++ /dev/null @@ -1,55 +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.model.response; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.util.Collection; - -@ApiModel -public class UserConfigDataListResponse extends SearchResponse{ - - @ApiModelProperty - private String name; - - @ApiModelProperty - private Collection userConfigList; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Collection getUserConfigList() { - return userConfigList; - } - - public void setUserConfigList(Collection userConfigList) { - this.userConfigList = userConfigList; - } - - @Override - public int getListSize() { - return userConfigList != null ? userConfigList.size() : 0; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java deleted file mode 100644 index 2013dc7..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java +++ /dev/null @@ -1,120 +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.inject.Inject; -import javax.inject.Named; -import javax.ws.rs.BeanParam; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -import freemarker.template.TemplateException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.ambari.logsearch.common.StatusMessage; -import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest; -import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest; -import org.apache.ambari.logsearch.model.request.impl.AuditServiceLoadRequest; -import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest; -import org.apache.ambari.logsearch.model.request.impl.UserExportRequest; -import org.apache.ambari.logsearch.model.response.AuditLogResponse; -import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse; -import org.apache.ambari.logsearch.model.response.GroupListResponse; -import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest; -import org.apache.ambari.logsearch.manager.AuditLogsManager; -import org.springframework.context.annotation.Scope; - -import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*; - -@Api(value = "audit/logs", description = "Audit log operations") -@Path("audit/logs") -@Named -@Scope("request") -public class AuditLogsResource { - - @Inject - private AuditLogsManager auditLogsManager; - - @GET - @Path("/schema/fields") - @Produces({"application/json"}) - @ApiOperation(GET_AUDIT_SCHEMA_FIELD_LIST_OD) - public String getSolrFieldList() { - return auditLogsManager.getAuditLogsSchemaFieldsName(); - } - - @GET - @Produces({"application/json"}) - @ApiOperation(GET_AUDIT_LOGS_OD) - public AuditLogResponse getAuditLogs(@BeanParam AuditLogRequest auditLogRequest) { - return auditLogsManager.getLogs(auditLogRequest); - } - - @DELETE - @Produces({"application/json"}) - @ApiOperation(PURGE_AUDIT_LOGS_OD) - public StatusMessage deleteAuditLogs(@BeanParam AuditLogRequest auditLogRequest) { - return auditLogsManager.deleteLogs(auditLogRequest); - } - - @GET - @Path("/components") - @Produces({"application/json"}) - @ApiOperation(GET_AUDIT_COMPONENTS_OD) - public GroupListResponse getAuditComponents(@BeanParam AuditComponentRequest request) { - return auditLogsManager.getAuditComponents(request); - } - - @GET - @Path("/bargraph") - @Produces({"application/json"}) - @ApiOperation(GET_AUDIT_LINE_GRAPH_DATA_OD) - public BarGraphDataListResponse getAuditBarGraphData(@BeanParam AuditBarGraphRequest request) { - return auditLogsManager.getAuditBarGraphData(request); - } - - @GET - @Path("/resources/{top}") - @Produces({"application/json"}) - @ApiOperation(GET_TOP_AUDIT_RESOURCES_OD) - public BarGraphDataListResponse getResources(@BeanParam FieldAuditLogRequest request) { - return auditLogsManager.topResources(request); - } - - @GET - @Path("/export") - @Produces({"application/json"}) - @ApiOperation(EXPORT_USER_TALBE_TO_TEXT_FILE_OD) - public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) throws TemplateException { - return auditLogsManager.export(request); - } - - @GET - @Path("/serviceload") - @Produces({"application/json"}) - @ApiOperation(GET_SERVICE_LOAD_OD) - public BarGraphDataListResponse getServiceLoad(@BeanParam AuditServiceLoadRequest request) { - return auditLogsManager.getServiceLoad(request); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java deleted file mode 100644 index df83d44..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java +++ /dev/null @@ -1,48 +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.inject.Inject; -import javax.inject.Named; -import javax.ws.rs.GET; -import javax.ws.rs.Path; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.ambari.logsearch.manager.PublicManager; -import org.springframework.context.annotation.Scope; - -import static org.apache.ambari.logsearch.doc.DocConstants.PublicOperationDescriptions.OBTAIN_GENERAL_CONFIG_OD; - -@Api(value = "public", description = "Public operations") -@Path("public") -@Named -@Scope("request") -public class PublicResource { - - @Inject - private PublicManager publicManager; - - @GET - @Path("/config") - @ApiOperation(OBTAIN_GENERAL_CONFIG_OD) - public String getGeneralConfig() { - return publicManager.getGeneralConfig(); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/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 deleted file mode 100644 index 498da69..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java +++ /dev/null @@ -1,222 +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.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Named; -import javax.validation.Valid; -import javax.validation.executable.ValidateOnExecution; -import javax.ws.rs.BeanParam; -import javax.ws.rs.DELETE; -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 org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.common.StatusMessage; -import org.apache.ambari.logsearch.model.request.impl.HostLogFilesRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceLogAggregatedInfoRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentLevelRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest; -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.HostLogFilesResponse; -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.manager.ServiceLogsManager; -import org.springframework.context.annotation.Scope; - -import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*; - -@Api(value = "service/logs", description = "Service log operations") -@Path("service/logs") -@Named -@Scope("request") -public class ServiceLogsResource { - - @Inject - private ServiceLogsManager serviceLogsManager; - - @GET - @Produces({"application/json"}) - @ApiOperation(SEARCH_LOGS_OD) - public ServiceLogResponse searchServiceLogs(@BeanParam ServiceLogRequest request) { - return serviceLogsManager.searchLogs(request); - } - - @DELETE - @Produces({"application/json"}) - @ApiOperation(PURGE_LOGS_OD) - public StatusMessage deleteServiceLogs(@BeanParam ServiceLogRequest request) { - return serviceLogsManager.deleteLogs(request); - } - - @GET - @Path("/hosts") - @Produces({"application/json"}) - @ApiOperation(GET_HOSTS_OD) - public GroupListResponse getHosts(@QueryParam(LogSearchConstants.REQUEST_PARAM_CLUSTER_NAMES) @Nullable String clusters) { - return serviceLogsManager.getHosts(clusters); - } - - @GET - @Path("/components") - @Produces({"application/json"}) - @ApiOperation(GET_COMPONENTS_OD) - public GroupListResponse getComponents(@QueryParam(LogSearchConstants.REQUEST_PARAM_CLUSTER_NAMES) @Nullable String clusters) { - return serviceLogsManager.getComponents(clusters); - } - - @GET - @Path("/aggregated") - @Produces({"application/json"}) - @ApiOperation(GET_AGGREGATED_INFO_OD) - public GraphDataListResponse getAggregatedInfo(@BeanParam ServiceLogAggregatedInfoRequest request) { - return serviceLogsManager.getAggregatedInfo(request); - } - - @GET - @Path("/components/count") - @Produces({"application/json"}) - @ApiOperation(GET_COMPONENTS_COUNT_OD) - public CountDataListResponse getComponentsCount(@QueryParam(LogSearchConstants.REQUEST_PARAM_CLUSTER_NAMES) @Nullable String clusters) { - return serviceLogsManager.getComponentsCount(clusters); - } - - @GET - @Path("/hosts/count") - @Produces({"application/json"}) - @ApiOperation(GET_HOSTS_COUNT_OD) - public CountDataListResponse getHostsCount(@QueryParam(LogSearchConstants.REQUEST_PARAM_CLUSTER_NAMES) @Nullable String clusters) { - return serviceLogsManager.getHostsCount(clusters); - } - - @GET - @Path("/tree") - @Produces({"application/json"}) - @ApiOperation(GET_TREE_EXTENSION_OD) - public NodeListResponse getTreeExtension(@BeanParam ServiceLogHostComponentRequest request) { - return serviceLogsManager.getTreeExtension(request); - } - - @GET - @Path("/levels/counts") - @Produces({"application/json"}) - @ApiOperation(GET_LOG_LEVELS_COUNT_OD) - public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogLevelCountRequest request) { - return serviceLogsManager.getLogsLevelCount(request); - } - - @GET - @Path("/histogram") - @Produces({"application/json"}) - @ApiOperation(GET_HISTOGRAM_DATA_OD) - public BarGraphDataListResponse getHistogramData(@BeanParam ServiceGraphRequest request) { - return serviceLogsManager.getHistogramData(request); - } - - @GET - @Path("/export") - @Produces({"application/json"}) - @ApiOperation(EXPORT_TO_TEXT_FILE_OD) - public Response exportToTextFile(@BeanParam ServiceLogExportRequest request) { - return serviceLogsManager.export(request); - } - - @GET - @Path("/hosts/components") - @Produces({"application/json"}) - @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD) - public NodeListResponse getHostListByComponent(@BeanParam ServiceLogComponentHostRequest request) { - return serviceLogsManager.getHostListByComponent(request); - } - - @GET - @Path("/components/levels/counts") - @Produces({"application/json"}) - @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD) - public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogComponentLevelRequest request) { - return serviceLogsManager.getComponentListWithLevelCounts(request); - } - @GET - @Path("/schema/fields") - @Produces({"application/json"}) - @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD) - public String getServiceLogsSchemaFieldsName() { - return serviceLogsManager.getServiceLogsSchemaFieldsName(); - } - - @GET - @Path("/count/anygraph") - @Produces({"application/json"}) - @ApiOperation(GET_ANY_GRAPH_COUNT_DATA_OD) - public BarGraphDataListResponse getAnyGraphCountData(@BeanParam ServiceAnyGraphRequest request) { - return serviceLogsManager.getAnyGraphCountData(request); - } - - @GET - @Path("/truncated") - @Produces({"application/json"}) - @ApiOperation(GET_AFTER_BEFORE_LOGS_OD) - public ServiceLogResponse getAfterBeforeLogs(@BeanParam ServiceLogTruncatedRequest request) { - return serviceLogsManager.getAfterBeforeLogs(request); - } - - @GET - @Path("/serviceconfig") - @Produces({"application/json"}) - @ApiOperation(GET_HADOOP_SERVICE_CONFIG_JSON_OD) - public String getHadoopServiceConfigJSON() { - return serviceLogsManager.getHadoopServiceConfigJSON(); - } - - @GET - @Path("/request/cancel") - @Produces({"application/json"}) - @ApiOperation(REQUEST_CANCEL) - public String cancelRequest() { - // TODO: create function that cancels an ongoing solr request - return "{\"endpoint status\": \"not supported yet\"}"; - } - - @GET - @Path("/files") - @Produces({"application/json"}) - @ApiOperation(GET_HOST_LOGFILES_OD) - @ValidateOnExecution - public HostLogFilesResponse getHostLogFiles(@Valid @BeanParam HostLogFilesRequest request) { - return serviceLogsManager.getHostLogFileData(request); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/StatusResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/StatusResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/StatusResource.java deleted file mode 100644 index 8cc6b94..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/StatusResource.java +++ /dev/null @@ -1,91 +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 io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.ambari.logsearch.conf.global.SolrCollectionState; -import org.springframework.context.annotation.Scope; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import java.util.HashMap; -import java.util.Map; - -import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.AUDIT_LOGS_STATUS_OD; -import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.SERVICE_LOGS_STATUS_OD; -import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.STATUS_OD; -import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.USER_CONFIG_STATUS_OD; - -@Api(value = "status", description = "Status Operations") -@Path("status") -@Named -@Scope("request") -public class StatusResource { - - @Inject - @Named("solrServiceLogsState") - private SolrCollectionState solrServiceLogsState; - - @Inject - @Named("solrAuditLogsState") - private SolrCollectionState solrAuditLogsState; - - @Inject - @Named("solrUserConfigState") - private SolrCollectionState solrUserConfigState; - - @GET - @Produces({"application/json"}) - @ApiOperation(STATUS_OD) - public Map getStatus() { - Map response = new HashMap<>(); - response.put("serviceLogs", solrServiceLogsState); - response.put("auditLogs", solrAuditLogsState); - response.put("userConfig", solrUserConfigState); - return response; - } - - @GET - @Path("/servicelogs") - @Produces({"application/json"}) - @ApiOperation(SERVICE_LOGS_STATUS_OD) - public SolrCollectionState getServiceLogStatus() { - return solrServiceLogsState; - } - - @GET - @Path("/auditlogs") - @Produces({"application/json"}) - @ApiOperation(AUDIT_LOGS_STATUS_OD) - public SolrCollectionState getSolrAuditLogsStatus() { - return solrAuditLogsState; - } - - @GET - @Path("/userconfig") - @Produces({"application/json"}) - @ApiOperation(USER_CONFIG_STATUS_OD) - public SolrCollectionState getSolrUserConfigStatus() { - return solrUserConfigState; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/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 deleted file mode 100644 index 19cfbed..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java +++ /dev/null @@ -1,100 +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.inject.Inject; -import javax.inject.Named; -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.common.LogFeederDataMap; -import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest; -import org.apache.ambari.logsearch.model.response.UserConfigData; -import org.apache.ambari.logsearch.model.response.UserConfigDataListResponse; -import org.springframework.context.annotation.Scope; - -import java.util.List; - -import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*; - -@Api(value = "userconfig", description = "User config operations") -@Path("userconfig") -@Named -@Scope("request") -public class UserConfigResource { - - @Inject - private UserConfigManager userConfigManager; - - @POST - @Produces({"application/json"}) - @ApiOperation(SAVE_USER_CONFIG_OD) - public String saveUserConfig(UserConfigData userConfig) { - return userConfigManager.saveUserConfig(userConfig); - } - - @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 UserConfigDataListResponse getUserConfig(@BeanParam UserConfigRequest request) { - return userConfigManager.getUserConfig(request); - } - - @GET - @Path("/filters") - @Produces({"application/json"}) - @ApiOperation(GET_USER_FILTER_OD) - public LogFeederDataMap getUserFilter() { - return userConfigManager.getUserFilter(); - } - - @PUT - @Path("/filters/{id}") - @Produces({"application/json"}) - @ApiOperation(UPDATE_USER_FILTER_OD) - public LogFeederDataMap updateUserFilter(LogFeederDataMap request) { - return userConfigManager.saveUserFiter(request); - } - - @GET - @Path("/names") - @Produces({"application/json"}) - @ApiOperation(GET_ALL_USER_NAMES_OD) - public List getAllUserName() { - return userConfigManager.getAllUserName(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/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 deleted file mode 100644 index ba4431d..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java +++ /dev/null @@ -1,44 +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.service; - -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; -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); - - @Inject - private UserDao userDao; - - @Override - public User loadUserByUsername(final String username) throws UsernameNotFoundException { - logger.debug(userDao + " loadUserByUsername " + username); - return userDao.loadUserByUsername(username); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java deleted file mode 100644 index 74e9c11..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java +++ /dev/null @@ -1,452 +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.solr; - -import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT; -import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.PATH; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -import org.apache.ambari.logsearch.model.response.BarGraphData; -import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse; -import org.apache.ambari.logsearch.model.response.CountData; -import org.apache.ambari.logsearch.model.response.CountDataListResponse; -import org.apache.ambari.logsearch.model.response.GraphData; -import org.apache.ambari.logsearch.model.response.GraphDataListResponse; -import org.apache.ambari.logsearch.model.response.HostLogFilesResponse; -import org.apache.ambari.logsearch.model.response.NameValueData; -import org.apache.ambari.logsearch.model.response.NameValueDataListResponse; -import org.apache.ambari.logsearch.model.response.NodeData; -import org.apache.ambari.logsearch.model.response.NodeListResponse; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.solr.client.solrj.response.FacetField; -import org.apache.solr.client.solrj.response.FacetField.Count; -import org.apache.solr.client.solrj.response.PivotField; -import org.apache.solr.client.solrj.response.QueryResponse; -import org.apache.solr.client.solrj.response.RangeFacet; -import org.apache.solr.common.util.NamedList; - -import javax.inject.Named; - -@Named -public class ResponseDataGenerator { - - public BarGraphDataListResponse generateBarGraphDataResponseWithRanges(QueryResponse response, String typeField, boolean typeUppercase) { - BarGraphDataListResponse dataList = new BarGraphDataListResponse(); - if (response == null) { - return dataList; - } - NamedList> facetPivotResponse = response.getFacetPivot(); - if (response.getFacetPivot() == null) { - return dataList; - } - List pivotFields = facetPivotResponse.get(typeField); - for (int pivotIndex = 0; pivotIndex < pivotFields.size(); pivotIndex++) { - PivotField pivotField = facetPivotResponse.get(typeField).get(pivotIndex); - List nameValues = generateNameValueDataList(pivotField.getFacetRanges()); - BarGraphData barGraphData = new BarGraphData(); - barGraphData.setDataCount(nameValues); - String typeValue = typeUppercase ? StringUtils.upperCase(pivotField.getValue().toString()) : pivotField.getValue().toString(); - barGraphData.setName(typeValue); - dataList.getGraphData().add(barGraphData); - } - return dataList; - } - - public BarGraphDataListResponse generateSecondLevelBarGraphDataResponse(QueryResponse response, int val) { - BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse(); - NamedList> pivotFieldNameList = response.getFacetPivot(); - if (pivotFieldNameList == null) { - return barGraphDataListResponse; - } - List pivotFields = pivotFieldNameList.getVal(val); - List barGraphDataList = new ArrayList<>(); - for (PivotField pivotField : pivotFields) { - BarGraphData barGraphData = new BarGraphData(); - barGraphData.setName(String.valueOf(pivotField.getValue())); - List secondLevelPivotFields = pivotField.getPivot(); - List nameValueDataList = new ArrayList<>(); - for (PivotField sPivotField : secondLevelPivotFields) { - NameValueData nvD = new NameValueData(); - nvD.setName(String.valueOf(sPivotField.getValue())); - nvD.setValue(String.valueOf(sPivotField.getCount())); - nameValueDataList.add(nvD); - } - barGraphData.setDataCount(nameValueDataList); - barGraphDataList.add(barGraphData); - } - barGraphDataListResponse.setGraphData(barGraphDataList); - return barGraphDataListResponse; - } - - public BarGraphDataListResponse generateBarGraphFromFieldFacet(QueryResponse response, String facetField) { - BarGraphDataListResponse dataList = new BarGraphDataListResponse(); - Collection vaDatas = new ArrayList<>(); - dataList.setGraphData(vaDatas); - if (response == null) { - return dataList; - } - FacetField facetFieldObj = response.getFacetField(facetField); - if (facetFieldObj == null) { - return dataList; - } - - List counts = facetFieldObj.getValues(); - if (counts == null) { - return dataList; - } - for (Count cnt : counts) { - List valueList = new ArrayList<>(); - BarGraphData vBarGraphData = new BarGraphData(); - vaDatas.add(vBarGraphData); - NameValueData vNameValue = new NameValueData(); - vNameValue.setName(cnt.getName()); - vBarGraphData.setName(cnt.getName().toUpperCase()); - vNameValue.setValue("" + cnt.getCount()); - valueList.add(vNameValue); - vBarGraphData.setDataCount(valueList); - } - return dataList; - } - - public List generateNameValueDataList(List rangeFacet) { - List nameValues = new ArrayList<>(); - if (rangeFacet == null) { - return nameValues; - } - RangeFacet range = rangeFacet.get(0); - - if (range == null) { - return nameValues; - } - List listCount = range.getCounts(); - for (RangeFacet.Count cnt : listCount) { - NameValueData nameValue = new NameValueData(); - nameValue.setName(String.valueOf(cnt.getValue())); - nameValue.setValue(String.valueOf(cnt.getCount())); - nameValues.add(nameValue); - } - return nameValues; - } - - public List generateCount(QueryResponse response) { - List counts = new ArrayList<>(); - List facetFields = null; - FacetField facetField = null; - if (response == null) { - return counts; - } - - facetFields = response.getFacetFields(); - if (facetFields == null) { - return counts; - } - if (!facetFields.isEmpty()) { - facetField = facetFields.get(0); - } - if (facetField != null) { - counts = facetField.getValues(); - } - return counts; - } - - public BarGraphDataListResponse getGraphDataWithDefaults(QueryResponse queryResponse, String field, String[] defaults) { - BarGraphDataListResponse response = new BarGraphDataListResponse(); - BarGraphData barGraphData = new BarGraphData(); - List nameValues = generateLevelCountData(queryResponse, defaults, true); - barGraphData.setName(field); - barGraphData.setDataCount(nameValues); - response.setGraphData(Lists.newArrayList(barGraphData)); - return response; - } - - public NameValueDataListResponse getNameValueDataListResponseWithDefaults(QueryResponse response, String[] defaults, boolean emptyResponseDisabled) { - NameValueDataListResponse result = new NameValueDataListResponse(); - result.setvNameValues(generateLevelCountData(response, defaults, emptyResponseDisabled)); - return result; - } - - public NodeListResponse generateServiceNodeTreeFromFacetResponse(QueryResponse queryResponse, - String firstHierarchy, String secondHierarchy, - String firstType, String secondType) { - NodeListResponse response = new NodeListResponse(); - if (queryResponse == null) { - return response; - } - NamedList> namedPivotFieldList = queryResponse.getFacetPivot(); - List firstLevelPivots = namedPivotFieldList.get(firstHierarchy); - List secondLevelPivots = namedPivotFieldList.get(secondHierarchy); - if (!CollectionUtils.isNotEmpty(firstLevelPivots) || !CollectionUtils.isNotEmpty(secondLevelPivots)) { - return response; - } - List nodeDataList = buidTreeData(firstLevelPivots, secondLevelPivots, firstType, secondType); - response.setvNodeList(nodeDataList); - return response; - } - - public NodeListResponse generateOneLevelServiceNodeTree(QueryResponse queryResponse, String componentLevelHirachy) { - NodeListResponse response = new NodeListResponse(); - List datatList = new ArrayList<>(); - List> listPivotField = new ArrayList<>(); - NamedList> namedList = queryResponse.getFacetPivot(); - if (namedList != null) { - listPivotField = namedList.getAll(componentLevelHirachy); - } - List secondHirarchicalPivotFields = null; - if (listPivotField == null || listPivotField.isEmpty()) { - return response; - } else { - secondHirarchicalPivotFields = listPivotField.get(0); - } - for (PivotField singlePivotField : secondHirarchicalPivotFields) { - if (singlePivotField != null) { - NodeData comp = new NodeData(); - comp.setName("" + singlePivotField.getValue()); - List levelList = singlePivotField.getPivot(); - List levelCountList = new ArrayList<>(); - comp.setLogLevelCount(levelCountList); - if (levelList != null) { - for (PivotField levelPivot : levelList) { - NameValueData level = new NameValueData(); - level.setName(("" + levelPivot.getValue()).toUpperCase()); - level.setValue("" + levelPivot.getCount()); - levelCountList.add(level); - } - } - datatList.add(comp); - } - } - response.setvNodeList(datatList); - return response; - } - - private List buidTreeData(List firstHirarchicalPivotFields, - List secondHirarchicalPivotFields, - String firstPriority, String secondPriority) { - List extensionTree = new ArrayList<>(); - if (firstHirarchicalPivotFields != null) { - for (PivotField pivotHost : firstHirarchicalPivotFields) { - if (pivotHost != null) { - NodeData hostNode = new NodeData(); - String name = (pivotHost.getValue() == null ? "" : "" + pivotHost.getValue()); - String value = "" + pivotHost.getCount(); - if (StringUtils.isNotBlank(name)) { - hostNode.setName(name); - } - if (StringUtils.isNotBlank(value)) { - hostNode.setValue(value); - } - if (StringUtils.isNotBlank(firstPriority)) { - hostNode.setType(firstPriority); - } - - hostNode.setParent(true); - hostNode.setRoot(true); - PivotField hostPivot = null; - for (PivotField searchHost : secondHirarchicalPivotFields) { - if (StringUtils.isNotBlank(hostNode.getName()) - && hostNode.getName().equals(searchHost.getValue())) { - hostPivot = searchHost; - break; - } - } - List pivotLevelHost = hostPivot == null? null : hostPivot.getPivot(); - if (pivotLevelHost != null) { - Collection logLevelCount = new ArrayList<>(); - for (PivotField pivotLevel : pivotLevelHost) { - if (pivotLevel != null) { - NameValueData vnameValue = new NameValueData(); - String levelName = (pivotLevel.getValue() == null ? "" : "" + pivotLevel.getValue()); - vnameValue.setName(levelName.toUpperCase()); - vnameValue.setValue("" + pivotLevel.getCount()); - logLevelCount.add(vnameValue); - } - } - hostNode.setLogLevelCount(logLevelCount); - } - List pivotComponents = pivotHost.getPivot(); - if (pivotComponents != null) { - Collection componentNodes = new ArrayList<>(); - for (PivotField pivotComp : pivotComponents) { - if (pivotComp != null) { - NodeData compNode = new NodeData(); - String compName = (pivotComp.getValue() == null ? "" : "" + pivotComp.getValue()); - compNode.setName(compName); - if (StringUtils.isNotBlank(secondPriority)) { - compNode.setType(secondPriority); - } - compNode.setValue("" + pivotComp.getCount()); - compNode.setParent(false); - compNode.setRoot(false); - List pivotLevels = pivotComp.getPivot(); - if (pivotLevels != null) { - Collection logLevelCount = new ArrayList<>(); - for (PivotField pivotLevel : pivotLevels) { - if (pivotLevel != null) { - NameValueData vnameValue = new NameValueData(); - String compLevel = pivotLevel.getValue() == null ? "" : "" + pivotLevel.getValue(); - vnameValue.setName((compLevel).toUpperCase()); - - vnameValue.setValue("" + pivotLevel.getCount()); - logLevelCount.add(vnameValue); - } - } - compNode.setLogLevelCount(logLevelCount); - } - componentNodes.add(compNode); - } - } - hostNode.setChilds(componentNodes); - } - extensionTree.add(hostNode); - } - } - } - - return extensionTree; - } - - private List generateLevelCountData(QueryResponse queryResponse, String[] defaults, boolean emptyResponseEnabled) { - List nameValues = Lists.newLinkedList(); - Map linkedMap = Maps.newLinkedHashMap(); - List counts = generateCount(queryResponse); - if (!CollectionUtils.isNotEmpty(counts) && emptyResponseEnabled) { - return nameValues; - } - for (String defaultValue : defaults) { - NameValueData nameValue = new NameValueData(); - nameValue.setName(defaultValue); - nameValue.setValue("0"); - linkedMap.put(defaultValue, nameValue); - } - if (CollectionUtils.isNotEmpty(counts)) { - for (Count count : counts) { - if (!linkedMap.containsKey(count.getName())) { - NameValueData nameValue = new NameValueData(); - String name = count.getName().toUpperCase(); - nameValue.setName(name); - nameValue.setValue(String.valueOf(count.getCount())); - linkedMap.put(name, nameValue); - } - } - } - - for (Map.Entry nameValueDataEntry : linkedMap.entrySet()) { - nameValues.add(nameValueDataEntry.getValue()); - } - return nameValues; - } - - public CountDataListResponse generateCountResponseByField(QueryResponse response, String field) { - CountDataListResponse collection = new CountDataListResponse(); - List vCounts = new ArrayList<>(); - if (response == null) { - return collection; - } - FacetField facetFields = response.getFacetField(field); - if (facetFields == null) { - return collection; - } - List fieldList = facetFields.getValues(); - - if (fieldList == null) { - return collection; - } - - for (Count cnt : fieldList) { - if (cnt != null) { - CountData vCount = new CountData(); - vCount.setName(cnt.getName()); - vCount.setCount(cnt.getCount()); - vCounts.add(vCount); - } - } - collection.setvCounts(vCounts); - return collection; - } - - public GraphDataListResponse generateSimpleGraphResponse(QueryResponse response, String hierarchy) { - GraphDataListResponse graphInfo = new GraphDataListResponse(); - if (response == null) { - return graphInfo; - } - List> hirarchicalPivotField = new ArrayList>(); - List dataList = new ArrayList<>(); - NamedList> namedList = response.getFacetPivot(); - if (namedList != null) { - hirarchicalPivotField = namedList.getAll(hierarchy); - } - if (!hirarchicalPivotField.isEmpty()) { - dataList = buidGraphData(hirarchicalPivotField.get(0)); - } - if (!dataList.isEmpty()) { - graphInfo.setGraphData(dataList); - } - - return graphInfo; - } - - private List buidGraphData(List pivotFields) { - List logList = new ArrayList<>(); - if (pivotFields != null) { - for (PivotField pivotField : pivotFields) { - if (pivotField != null) { - GraphData logLevel = new GraphData(); - logLevel.setName("" + pivotField.getValue()); - logLevel.setCount(Long.valueOf(pivotField.getCount())); - if (pivotField.getPivot() != null) { - logLevel.setDataList(buidGraphData(pivotField.getPivot())); - } - logList.add(logLevel); - } - } - } - return logList; - } - - - public HostLogFilesResponse generateHostLogFilesResponse(QueryResponse queryResponse) { - HostLogFilesResponse response = new HostLogFilesResponse(); - Map> componentLogFiles = response.getHostLogFiles(); - - NamedList> facetPivot = queryResponse.getFacetPivot(); - List componentFields = facetPivot.get(COMPONENT + "," + PATH); - for (PivotField componentField : componentFields) { - String component = (String)componentField.getValue(); - LinkedList logFileList = new LinkedList<>(); - componentLogFiles.put(component, logFileList); - - for (PivotField logField : componentField.getPivot()) { - // the log file names are in increasing order of their cardinality, using addFirst reverses the list - logFileList.addFirst((String)logField.getValue()); - } - } - - return response; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java deleted file mode 100644 index 39e134a..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java +++ /dev/null @@ -1,112 +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.solr; - -public class SolrConstants { - - private SolrConstants() { - } - - public class CommonLogConstants { - private CommonLogConstants() { - } - - public static final String ID = "id"; - public static final String SEQUENCE_ID = "seq_num"; - public static final String BUNDLE_ID = "bundle_id"; - public static final String CASE_ID = "case_id"; - public static final String CLUSTER = "cluster"; - public static final String LOG_MESSAGE = "log_message"; - public static final String LOGFILE_LINE_NUMBER = "logfile_line_number"; - public static final String EVENT_DURATION_MD5 = "event_dur_m5"; - public static final String FILE = "file"; - public static final String EVENT_COUNT = "event_count"; - public static final String EVENT_MD5 = "event_md5"; - public static final String MESSAGE_MD5= "message_md5"; - public static final String TTL = "_ttl_"; - public static final String EXPIRE_AT = "_expire_at_"; - public static final String VERSION = "_version_"; - public static final String ROUTER_FIELD = "_router_field_"; - public static final String TYPE = "type"; - } - - public class ServiceLogConstants { - - private ServiceLogConstants() { - } - - public static final String BUNDLE_ID = "bundle_id"; - public static final String LOGTIME = "logtime"; - public static final String COMPONENT = "type"; - public static final String LOG_MESSAGE = "log_message"; - public static final String KEY_LOG_MESSAGE = "key_log_message"; - public static final String HOST = "host"; - public static final String LEVEL = "level"; - public static final String THREAD_NAME = "thread_name"; - public static final String LOGGER_NAME = "logger_name"; - public static final String LINE_NUMBER = "line_number"; - public static final String PATH = "path"; - public static final String IP = "ip"; - public static final String STORED_TOKEN_DYNAMIC_FIELDS = "std_*"; - public static final String KEY_DYNAMIC_FIELDS = "key_*"; - public static final String WS_DYNAMIC_FIELDS = "ws_*"; - } - - public class AuditLogConstants { - private AuditLogConstants() { - } - - public static final String AUDIT_LOG_TYPE = "logType"; - public static final String AUDIT_POLICY = "policy"; - public static final String AUDIT_ACCESS = "access"; - public static final String AUDIT_ACTION = "action"; - public static final String AUDIT_AGENT = "agent"; - public static final String AUDIT_AGENT_HOST = "agentHost"; - public static final String AUDIT_CLIENT_IP = "cliIP"; - public static final String AUDIT_CLIENT_TYPE = "cliType"; - public static final String AUDIT_REQEST_CONTEXT = "reqContext"; - public static final String AUDIT_ENFORCER = "enforcer"; - public static final String AUDIT_REASON = "reason"; - public static final String AUDIT_PROXY_USERS = "proxyUsers"; - public static final String AUDIT_REPO_TYPE = "repoType"; - public static final String AUDIT_REQEST_DATA = "reqData"; - public static final String AUDIT_RESPONSE_TYPE = "resType"; - public static final String AUDIT_SESSION = "sess"; - public static final String AUDIT_TEXT = "text"; - public static final String AUDIT_RESULT = "result"; - public static final String AUDIT_COMPONENT = "repo"; - public static final String AUDIT_EVTTIME = "evtTime"; - public static final String AUDIT_REQUEST_USER = "reqUser"; - public static final String AUDIT_RESOURCE = "resource"; - public static final String AUDIT_TAGS = "tags"; - public static final String AUDIT_TAGS_STR = "tags_str"; - } - - public class UserConfigConstants { - private UserConfigConstants() { - } - - public static final String ID = "id"; - public static final String USER_NAME = "username"; - public static final String VALUES = "jsons"; - public static final String FILTER_NAME = "filtername"; - public static final String ROW_TYPE = "rowtype"; - public static final String SHARE_NAME_LIST = "share_username_list"; - } -}