You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2016/10/03 14:36:08 UTC
[05/16] ambari git commit: AMBARI-18310. Logsearch - Refactor solr
query layer (oleewere)
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
deleted file mode 100644
index ffdb2c7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
+++ /dev/null
@@ -1,95 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_END_TIME;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_EXCLUDE_MESSAGE;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_EXCLUDE_QUERY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_INCLUDE_MESSAGE;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_INCLUDE_QUERY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_MUST_BE_STRING;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_MUST_NOT_STRING;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_START_TIME;
-
-public class CommonSearchCriteria extends SearchCriteria {
-
- public String getIncludeMessage() {
- return getParam(PARAM_INCLUDE_MESSAGE, String.class);
- }
-
- public void setIncludeMessage(String includeMessage) {
- addParam(PARAM_INCLUDE_MESSAGE, includeMessage);
- }
-
- public String getExcludeMessage() {
- return getParam(PARAM_EXCLUDE_MESSAGE, String.class);
- }
-
- public void setExcludeMessage(String excludeMessage) {
- addParam(PARAM_EXCLUDE_MESSAGE, excludeMessage);
- }
-
- public String getMustBe() {
- return getParam(PARAM_MUST_BE_STRING, String.class);
- }
-
- public void setMustBe(String mustHave) {
- addParam(PARAM_MUST_BE_STRING, mustHave);
- }
-
- public String getMustNot() {
- return getParam(PARAM_MUST_NOT_STRING, String.class);
- }
-
- public void setMustNot(String mustNot) {
- addParam(PARAM_MUST_NOT_STRING, mustNot);
- }
-
- public String getIncludeQuery() {
- return getParam(PARAM_INCLUDE_QUERY, String.class);
- }
-
- public void setIncludeQuery(String includeQuery) {
- addParam(PARAM_INCLUDE_QUERY, includeQuery);
- }
-
- public String getExcludeQuery() {
- return getParam(PARAM_EXCLUDE_QUERY, String.class);
- }
-
- public void setExcludeQuery(String excludeQuery) {
- addParam(PARAM_EXCLUDE_QUERY, excludeQuery);
- }
-
- public String getStartTime() {
- return getParam(PARAM_START_TIME, String.class);
- }
-
- public void setStartTime(String startTime) {
- addParam(PARAM_START_TIME, startTime);
- }
-
- public String getEndTime() {
- return getParam(PARAM_END_TIME, String.class);
- }
-
- public void setEndTime(String endTime) {
- addParam(PARAM_END_TIME, endTime);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
deleted file mode 100644
index b02c234..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
+++ /dev/null
@@ -1,88 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class CommonServiceLogSearchCriteria extends CommonSearchCriteria {
-
- public String getLevel() {
- return getParam(SearchCriteriaConstants.PARAM_LEVEL, String.class);
- }
-
- public void setLevel(String level) {
- addParam(SearchCriteriaConstants.PARAM_LEVEL, level);
- }
-
- public String getSelectComp() {
- return getParam(SearchCriteriaConstants.PARAM_SELECT_COMP, String.class);
- }
-
- public void setSelectComp(String selectComp) {
- addParam(SearchCriteriaConstants.PARAM_SELECT_COMP, selectComp);
- }
-
- public String getBundleId() {
- return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class);
- }
-
- public void setBundleId(String bunldeId) {
- addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId);
- }
-
- public String getFrom() {
- return getParam(SearchCriteriaConstants.PARAM_FROM ,String.class);
- }
-
- public void setFrom(String from) {
- addParam(SearchCriteriaConstants.PARAM_FROM, from);
- }
-
- public String getTo() {
- return getParam(SearchCriteriaConstants.PARAM_TO ,String.class);
- }
-
- public void setTo(String to) {
- addParam(SearchCriteriaConstants.PARAM_TO, to);
- }
-
- public String getHostName() {
- return getParam(SearchCriteriaConstants.PARAM_HOST_NAME ,String.class);
- }
-
- public void setHostName(String hostName) {
- addParam(SearchCriteriaConstants.PARAM_HOST_NAME, hostName);
- }
-
- public String getComponentName() {
- return getParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME ,String.class);
- }
-
- public void setComponentName(String componentName) {
- addParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME, componentName);
- }
-
- public String getFileName() {
- return getParam(SearchCriteriaConstants.PARAM_FILE_NAME ,String.class);
- }
-
- public void setFileName(String fileName) {
- addParam(SearchCriteriaConstants.PARAM_FILE_NAME, fileName);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
deleted file mode 100644
index 381b3c2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD;
-
-public class FieldAuditBarGraphSearchCriteria extends AuditBarGraphSearchCriteria {
-
- public String getField() {
- return getParam(PARAM_FIELD, String.class);
- }
-
- public void setField(String field) {
- addParam(PARAM_FIELD, field);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
deleted file mode 100644
index 9d5d225..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD;
-
-public class FieldAuditLogSearchCriteria extends CommonSearchCriteria {
-
- public String getField() {
- return getParam(PARAM_FIELD, String.class);
- }
-
- public void setField(String field) {
- addParam(PARAM_FIELD, field);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
deleted file mode 100644
index 8e397ac..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
+++ /dev/null
@@ -1,135 +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.query.model;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-
-public class 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;
-
- private HashMap<String, Object> paramList = new HashMap<String, Object>();
-
- private Map<String, Object> urlParamMap = new HashMap<String, Object>();
-
- public SearchCriteria() {
- // Auto-generated constructor stub
- }
-
-
- public void addParam(String name, Object value) {
- paramList.put(name, value);
- }
-
- public Object getParamValue(String name) {
- return paramList.get(name);
- }
-
- public <T> T getParam(String key, Class<T> type) {
- if (getParamValue(key) != null) {
- return (T) getParamValue(key);
- }
- return null;
- }
-
- public Map<String, Object> getUrlParamMap() {
- return urlParamMap;
- }
-
- public void setUrlParamMap(Map<String, Object> urlParamMap) {
- this.urlParamMap = urlParamMap;
- }
-
- public int getStartIndex() {
- return startIndex;
- }
-
- public void setStartIndex(int startIndex) {
- this.startIndex = startIndex;
- }
-
- public int getMaxRows() {
- return maxRows;
- }
-
- public void setMaxRows(int maxRows) {
- this.maxRows = maxRows;
- }
-
- public String getSortType() {
- return sortType;
- }
-
- public String getSortBy() {
- return sortBy;
- }
-
- public void setSortBy(String sortBy) {
- this.sortBy = sortBy;
- }
-
- public void setSortType(String sortType) {
- this.sortType = sortType;
- }
-
- public int getPage() {
- return page;
- }
-
- public void setPage(int page) {
- this.page = page;
- }
-
- public String getGlobalStartTime() {
- return globalStartTime;
- }
-
- public void setGlobalStartTime(String globalStartTime) {
- this.globalStartTime = globalStartTime;
- }
-
- public String getGlobalEndTime() {
- return globalEndTime;
- }
-
- public void setGlobalEndTime(String globalEndTime) {
- this.globalEndTime = globalEndTime;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- for (Map.Entry<String, Object> entry : paramList.entrySet()) {
- sb.append(entry.getKey() + " : " + entry.getValue() + ";");
- }
- return sb.toString();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
deleted file mode 100644
index 0f4bb5a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
+++ /dev/null
@@ -1,60 +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.query.model;
-
-import org.apache.ambari.logsearch.common.Marker;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS;
-
-public class ServiceAnyGraphSearchCriteria extends ServiceLogSearchCriteria {
- public String getxAxis() {
- return getParam(PARAM_X_AXIS, String.class);
- }
-
- public void setxAxis(String xAxis) {
- addParam(PARAM_X_AXIS, xAxis);
- }
-
- public String getyAxis() {
- return getParam(PARAM_Y_AXIS, String.class);
- }
-
- public void setyAxis(String yAxis) {
- addParam(PARAM_Y_AXIS, yAxis);
- }
-
- public String getStackBy() {
- return getParam(PARAM_STACK_BY, String.class);
- }
-
- public void setStackBy(String stackBy) {
- addParam(PARAM_STACK_BY, stackBy);
- }
-
- public String getUnit() {
- return getParam(PARAM_UNIT, String.class);
- }
-
- public void setUnit(String unit) {
- addParam(PARAM_UNIT, unit);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
deleted file mode 100644
index d89ab3b..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceExtremeDatesCriteria extends CommonSearchCriteria {
-
- public String getBundleId() {
- return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class);
- }
-
- public void setBundleId(String bunldeId) {
- addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
deleted file mode 100644
index 4173bac..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceGraphSearchCriteria extends ServiceLogSearchCriteria {
-
- public String getUnit() {
- return getParam(SearchCriteriaConstants.PARAM_UNIT, String.class);
- }
-
- public void setUnit(String unit) {
- addParam(SearchCriteriaConstants.PARAM_UNIT, unit);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
deleted file mode 100644
index 6c757af..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
+++ /dev/null
@@ -1,40 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogExportSearchCriteria extends ServiceLogSearchCriteria {
-
- public void setFormat(String format) {
- addParam(SearchCriteriaConstants.PARAM_FORMAT, format);
- }
-
- public String getFormat() {
- return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class);
- }
-
- public void setUtcOffset(String utcOffset) {
- addParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, utcOffset);
- }
-
- public String getUtcOffset() {
- return getParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, String.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
deleted file mode 100644
index e469367..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
+++ /dev/null
@@ -1,65 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogSearchCriteria extends CommonServiceLogSearchCriteria {
-
- public void setKeyword(String keyword) {
- addParam(SearchCriteriaConstants.PARAM_KEYWORD, keyword);
- }
-
- public String getKeyword() {
- return getParam(SearchCriteriaConstants.PARAM_KEYWORD, String.class);
- }
-
- public void setKeywordType(String keywordType) {
- addParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, keywordType);
- }
-
- public String getKeywordType() {
- return getParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, String.class);
- }
-
- public void setSourceLogId(String sourceLogId) {
- addParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, sourceLogId);
- }
-
- public String getSourceLogId() {
- return getParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, String.class);
- }
-
- public void setToken(String token) {
- addParam(SearchCriteriaConstants.PARAM_TOKEN, token);
- }
-
- public String getToken() {
- return getParam(SearchCriteriaConstants.PARAM_TOKEN, String.class);
- }
-
- public void setLastPage(boolean lastPage) {
- addParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, lastPage);
- }
-
- public boolean isLastPage() {
- return getParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, Boolean.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
deleted file mode 100644
index 277aeb9..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogTruncatedSearchCriteria extends ServiceLogSearchCriteria {
-
- public String getId() {
- return getParam(SearchCriteriaConstants.PARAM_ID, String.class);
- }
-
- public void setId(String id) {
- addParam(SearchCriteriaConstants.PARAM_ID, id);
- }
-
- public String getScrollType() {
- return getParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, String.class);
- }
-
- public void setScrollType(String scrollType) {
- addParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, scrollType);
- }
-
- public String getNumberRows() {
- return getParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, String.class);
- }
-
- public void setNumberRows(String numberRows) {
- addParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, numberRows);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
deleted file mode 100644
index eafff69..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class UserConfigSearchCriteria extends CommonSearchCriteria {
-
- public String getUserName() {
- return getParam(SearchCriteriaConstants.PARAM_USER_NAME, String.class);
- }
-
- public void setUserName(String userName) {
- addParam(SearchCriteriaConstants.PARAM_USER_NAME, userName);
- }
-
- public String getFilterName() {
- return getParam(SearchCriteriaConstants.PARAM_FILTER_NAME, String.class);
- }
-
- public void setFilterName(String filterName) {
- addParam(SearchCriteriaConstants.PARAM_FILTER_NAME, filterName);
- }
-
- public String getRowType() {
- return getParam(SearchCriteriaConstants.PARAM_ROW_TYPE, String.class);
- }
-
- public void setRowType(String rowType) {
- addParam(SearchCriteriaConstants.PARAM_ROW_TYPE, rowType);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
deleted file mode 100644
index 46d13cc..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
+++ /dev/null
@@ -1,31 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class UserExportSearchCriteria extends FieldAuditLogSearchCriteria {
- public void setFormat(String format) {
- addParam(SearchCriteriaConstants.PARAM_FORMAT, format);
- }
-
- public String getFormat() {
- return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
index 0bd326e..d5b6525 100644
--- 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
@@ -20,52 +20,39 @@
package org.apache.ambari.logsearch.rest;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.ws.rs.BeanParam;
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.model.request.impl.AnyGraphRequest;
import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
-import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
-import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest;
+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.SimpleQueryRequest;
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.response.NameValueDataListResponse;
-import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
import org.apache.ambari.logsearch.manager.AuditLogsManager;
-import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
import org.springframework.context.annotation.Scope;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*;
@Api(value = "audit/logs", description = "Audit log operations")
@Path("audit/logs")
-@Component
+@Named
@Scope("request")
public class AuditLogsResource {
@Inject
private AuditLogsManager auditLogsManager;
- @Inject
- private ConversionService conversionService;
-
@GET
@Path("/schema/fields")
@Produces({"application/json"})
@@ -78,15 +65,15 @@ public class AuditLogsResource {
@Produces({"application/json"})
@ApiOperation(GET_AUDIT_LOGS_OD)
public AuditLogResponse getAuditLogs(@BeanParam AuditLogRequest auditLogRequest) {
- return auditLogsManager.getLogs(conversionService.convert(auditLogRequest, AuditLogSearchCriteria.class));
+ return auditLogsManager.getLogs(auditLogRequest);
}
@GET
@Path("/components")
@Produces({"application/json"})
@ApiOperation(GET_AUDIT_COMPONENTS_OD)
- public GroupListResponse getAuditComponents(@BeanParam SimpleQueryRequest request) {
- return auditLogsManager.getAuditComponents(conversionService.convert(request, CommonSearchCriteria.class));
+ public GroupListResponse getAuditComponents(@BeanParam AuditComponentRequest request) {
+ return auditLogsManager.getAuditComponents(request);
}
@GET
@@ -94,63 +81,31 @@ public class AuditLogsResource {
@Produces({"application/json"})
@ApiOperation(GET_AUDIT_LINE_GRAPH_DATA_OD)
public BarGraphDataListResponse getAuditBarGraphData(@BeanParam AuditBarGraphRequest request) {
- return auditLogsManager.getAuditBarGraphData(conversionService.convert(request, AuditBarGraphSearchCriteria.class));
+ return auditLogsManager.getAuditBarGraphData(request);
}
@GET
- @Path("/users")
- @Produces({"application/json"})
- @ApiOperation(GET_TOP_AUDIT_USERS_OD)
- public BarGraphDataListResponse getTopAuditUsers(@BeanParam FieldAuditBarGraphRequest request) {
- return auditLogsManager.topTenUsers(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class));
- }
-
- @GET
- @Path("/resources")
+ @Path("/resources/{top}")
@Produces({"application/json"})
@ApiOperation(GET_TOP_AUDIT_RESOURCES_OD)
- public BarGraphDataListResponse getTopAuditResources(@BeanParam FieldAuditLogRequest request) {
- return auditLogsManager.topTenResources(conversionService.convert(request, FieldAuditLogSearchCriteria.class));
- }
-
- @GET
- @Path("/live/count")
- @Produces({"application/json"})
- @ApiOperation(GET_LIVE_LOGS_COUNT_OD)
- public NameValueDataListResponse getLiveLogsCount() {
- return auditLogsManager.getLiveLogCounts();
- }
-
- @GET
- @Path("/request/user/bargraph")
- @Produces({"application/json"})
- @ApiOperation(GET_REQUEST_USER_LINE_GRAPH_OD)
- public BarGraphDataListResponse getRequestUserBarGraph(@BeanParam FieldAuditBarGraphRequest request) {
- return auditLogsManager.getRequestUserLineGraph(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class));
- }
-
- @GET
- @Path("/anygraph")
- @Produces({"application/json"})
- @ApiOperation(GET_ANY_GRAPH_DATA_OD)
- public BarGraphDataListResponse getAnyGraphData(@BeanParam AnyGraphRequest request) {
- return auditLogsManager.getAnyGraphData(conversionService.convert(request, AnyGraphSearchCriteria.class));
+ public BarGraphDataListResponse getResources(@BeanParam FieldAuditLogRequest request) {
+ return auditLogsManager.topResources(request);
}
@GET
- @Path("/users/export")
+ @Path("/export")
@Produces({"application/json"})
@ApiOperation(EXPORT_USER_TALBE_TO_TEXT_FILE_OD)
- public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) {
- return auditLogsManager.exportUserTableToTextFile(conversionService.convert(request, UserExportSearchCriteria.class));
+ 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 BaseAuditLogRequest request) {
- return auditLogsManager.getServiceLoad(conversionService.convert(request, CommonSearchCriteria.class));
+ public BarGraphDataListResponse getServiceLoad(@BeanParam AuditServiceLoadRequest request) {
+ return auditLogsManager.getServiceLoad(request);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
index 94bf059..df83d44 100644
--- 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
@@ -19,6 +19,7 @@
package org.apache.ambari.logsearch.rest;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -26,13 +27,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ambari.logsearch.manager.PublicManager;
import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
import static org.apache.ambari.logsearch.doc.DocConstants.PublicOperationDescriptions.OBTAIN_GENERAL_CONFIG_OD;
@Api(value = "public", description = "Public operations")
@Path("public")
-@Component
+@Named
@Scope("request")
public class PublicResource {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
index 5a17147..d6ceca5 100644
--- 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
@@ -19,21 +19,23 @@
package org.apache.ambari.logsearch.rest;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.ws.rs.BeanParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
-import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.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;
@@ -43,23 +45,15 @@ import org.apache.ambari.logsearch.model.response.GroupListResponse;
import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
import org.apache.ambari.logsearch.model.response.NodeListResponse;
import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
-import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
import org.apache.ambari.logsearch.manager.ServiceLogsManager;
-import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
import org.springframework.context.annotation.Scope;
import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*;
@Api(value = "service/logs", description = "Service log operations")
@Path("service/logs")
-@Component
+@Named
@Scope("request")
public class ServiceLogsResource {
@@ -73,7 +67,7 @@ public class ServiceLogsResource {
@Produces({"application/json"})
@ApiOperation(SEARCH_LOGS_OD)
public ServiceLogResponse searchSolrData(@BeanParam ServiceLogRequest request) {
- return serviceLogsManager.searchLogs(conversionService.convert(request, ServiceLogSearchCriteria.class));
+ return serviceLogsManager.searchLogs(request);
}
@GET
@@ -96,16 +90,8 @@ public class ServiceLogsResource {
@Path("/aggregated")
@Produces({"application/json"})
@ApiOperation(GET_AGGREGATED_INFO_OD)
- public GraphDataListResponse getAggregatedInfo(@BeanParam BaseServiceLogRequest request) {
- return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonServiceLogSearchCriteria.class));
- }
-
- @GET
- @Path("/levels/count")
- @Produces({"application/json"})
- @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
- public CountDataListResponse getLogLevelsCount() {
- return serviceLogsManager.getLogLevelCount();
+ public GraphDataListResponse getAggregatedInfo(@BeanParam ServiceLogAggregatedInfoRequest request) {
+ return serviceLogsManager.getAggregatedInfo(request);
}
@GET
@@ -128,18 +114,16 @@ public class ServiceLogsResource {
@Path("/tree")
@Produces({"application/json"})
@ApiOperation(GET_TREE_EXTENSION_OD)
- public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogRequest request) {
- ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class);
- searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change
- return serviceLogsManager.getTreeExtension(searchCriteria);
+ public NodeListResponse getTreeExtension(@BeanParam ServiceLogHostComponentRequest request) {
+ return serviceLogsManager.getTreeExtension(request);
}
@GET
- @Path("/levels/counts/namevalues")
+ @Path("/levels/counts")
@Produces({"application/json"})
@ApiOperation(GET_LOG_LEVELS_COUNT_OD)
- public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogRequest request) {
- return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogSearchCriteria.class));
+ public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogLevelCountRequest request) {
+ return serviceLogsManager.getLogsLevelCount(request);
}
@GET
@@ -147,15 +131,7 @@ public class ServiceLogsResource {
@Produces({"application/json"})
@ApiOperation(GET_HISTOGRAM_DATA_OD)
public BarGraphDataListResponse getHistogramData(@BeanParam ServiceGraphRequest request) {
- return serviceLogsManager.getHistogramData(conversionService.convert(request, ServiceGraphSearchCriteria.class));
- }
-
- @GET
- @Path("/request/cancel")
- @Produces({"application/json"})
- @ApiOperation(CANCEL_FIND_REQUEST_OD)
- public String cancelFindRequest(@QueryParam("token") @ApiParam String token) {
- return serviceLogsManager.cancelFindRequestByDate(token);
+ return serviceLogsManager.getHistogramData(request);
}
@GET
@@ -163,36 +139,24 @@ public class ServiceLogsResource {
@Produces({"application/json"})
@ApiOperation(EXPORT_TO_TEXT_FILE_OD)
public Response exportToTextFile(@BeanParam ServiceLogExportRequest request) {
- return serviceLogsManager.exportToTextFile(conversionService.convert(request, ServiceLogExportSearchCriteria.class));
-
+ return serviceLogsManager.export(request);
}
@GET
@Path("/hosts/components")
@Produces({"application/json"})
@ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
- public NodeListResponse getHostListByComponent(@BeanParam ServiceLogRequest request, @QueryParam("componentName") @ApiParam String componentName) {
- ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class);
- searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change
- return serviceLogsManager.getHostListByComponent(searchCriteria);
+ 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 ServiceLogRequest request) {
- return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogSearchCriteria.class));
+ public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogComponentLevelRequest request) {
+ return serviceLogsManager.getComponentListWithLevelCounts(request);
}
-
- @GET
- @Path("/solr/boundarydates")
- @Produces({"application/json"})
- @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD)
- public NameValueDataListResponse getExtremeDatesForBundelId(@BeanParam ServiceExtremeDatesRequest request) {
- return serviceLogsManager.getExtremeDatesForBundelId(conversionService.convert(request, ServiceExtremeDatesCriteria.class));
- }
-
@GET
@Path("/schema/fields")
@Produces({"application/json"})
@@ -202,11 +166,11 @@ public class ServiceLogsResource {
}
@GET
- @Path("/anygraph")
+ @Path("/count/anygraph")
@Produces({"application/json"})
- @ApiOperation(GET_ANY_GRAPH_DATA_OD)
- public BarGraphDataListResponse getAnyGraphData(@BeanParam ServiceAnyGraphRequest request) {
- return serviceLogsManager.getAnyGraphData(conversionService.convert(request, ServiceAnyGraphSearchCriteria.class));
+ @ApiOperation(GET_ANY_GRAPH_COUNT_DATA_OD)
+ public BarGraphDataListResponse getAnyGraphCountData(@BeanParam ServiceAnyGraphRequest request) {
+ return serviceLogsManager.getAnyGraphCountData(request);
}
@GET
@@ -214,7 +178,7 @@ public class ServiceLogsResource {
@Produces({"application/json"})
@ApiOperation(GET_AFTER_BEFORE_LOGS_OD)
public ServiceLogResponse getAfterBeforeLogs(@BeanParam ServiceLogTruncatedRequest request) {
- return serviceLogsManager.getAfterBeforeLogs(conversionService.convert(request, ServiceLogTruncatedSearchCriteria.class));
+ return serviceLogsManager.getAfterBeforeLogs(request);
}
@GET
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
index fd36978..31f584d 100644
--- 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
@@ -20,6 +20,7 @@
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;
@@ -32,39 +33,37 @@ 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.query.model.UserConfigSearchCriteria;
-import org.apache.ambari.logsearch.view.VUserConfig;
+import org.apache.ambari.logsearch.model.response.UserConfigData;
+import org.apache.ambari.logsearch.model.response.UserConfigDataListResponse;
import org.springframework.context.annotation.Scope;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
+
+import java.util.List;
import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*;
@Api(value = "userconfig", description = "User config operations")
@Path("userconfig")
-@Component
+@Named
@Scope("request")
public class UserConfigResource {
@Inject
private UserConfigManager userConfigManager;
- @Inject
- private ConversionService conversionService;
-
@POST
@Produces({"application/json"})
@ApiOperation(SAVE_USER_CONFIG_OD)
- public String saveUserConfig(VUserConfig vhist) {
- return userConfigManager.saveUserConfig(vhist);
+ public String saveUserConfig(UserConfigData userConfig) {
+ return userConfigManager.saveUserConfig(userConfig);
}
@PUT
@Produces({"application/json"})
@ApiOperation(UPDATE_USER_CONFIG_OD)
- public String updateUserConfig(VUserConfig vhist) {
- return userConfigManager.updateUserConfig(vhist);
+ public String updateUserConfig(UserConfigData userConfig) {
+ return userConfigManager.updateUserConfig(userConfig);
}
@DELETE
@@ -77,15 +76,15 @@ public class UserConfigResource {
@GET
@Produces({"application/json"})
@ApiOperation(GET_USER_CONFIG_OD)
- public String getUserConfig(@BeanParam UserConfigRequest request) {
- return userConfigManager.getUserConfig(conversionService.convert(request, UserConfigSearchCriteria.class));
+ public UserConfigDataListResponse getUserConfig(@BeanParam UserConfigRequest request) {
+ return userConfigManager.getUserConfig(request);
}
@GET
@Path("/filters")
@Produces({"application/json"})
@ApiOperation(GET_USER_FILTER_OD)
- public String getUserFilter() {
+ public LogFeederDataMap getUserFilter() {
return userConfigManager.getUserFilter();
}
@@ -93,23 +92,23 @@ public class UserConfigResource {
@Path("/filters")
@Produces({"application/json"})
@ApiOperation(UPDATE_USER_FILTER_OD)
- public String createUserFilter(String json) {
- return userConfigManager.saveUserFiter(json);
+ public LogFeederDataMap createUserFilter(LogFeederDataMap request) {
+ return userConfigManager.saveUserFiter(request);
}
@PUT
@Path("/filters/{id}")
@Produces({"application/json"})
@ApiOperation(GET_USER_FILTER_BY_ID_OD)
- public String updateUserFilter(String json) {
- return userConfigManager.saveUserFiter(json);
+ public LogFeederDataMap updateUserFilter(LogFeederDataMap request) {
+ return userConfigManager.saveUserFiter(request);
}
@GET
@Path("/names")
@Produces({"application/json"})
@ApiOperation(GET_ALL_USER_NAMES_OD)
- public String getAllUserName() {
+ public List<String> getAllUserName() {
return userConfigManager.getAllUserName();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/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
new file mode 100644
index 0000000..85554bc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
@@ -0,0 +1,113 @@
+/*
+ * 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 COMPOSITE_KEY = "composite_filtername-username";
+ public static final String SHARE_NAME_LIST = "share_username_list";
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
index 0cf05a6..0fd65a3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
@@ -23,79 +23,82 @@ import org.apache.solr.client.solrj.beans.Field;
import java.util.Date;
import java.util.List;
+import java.util.Map;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.*;
public class SolrAuditLogData extends SolrCommonLogData implements AuditLogData {
- @Field("logType")
+ @Field(AUDIT_LOG_TYPE)
private String logType;
- @Field("policy")
+ @Field(AUDIT_POLICY)
private String policy;
- @Field("access")
+ @Field(AUDIT_ACCESS)
private String access;
- @Field("action")
+ @Field(AUDIT_ACTION)
private String action;
- @Field("agent")
+ @Field(AUDIT_AGENT)
private String agent;
- @Field("agentHost")
+ @Field(AUDIT_AGENT_HOST)
private String agentHost;
- @Field("cliIP")
+ @Field(AUDIT_CLIENT_IP)
private String clientIp;
- @Field("cliType")
+ @Field(AUDIT_CLIENT_TYPE)
private String clientType;
- @Field("reqContext")
+ @Field(AUDIT_REQEST_CONTEXT)
private String requestContext;
- @Field("enforcer")
+ @Field(AUDIT_ENFORCER)
private String enforcer;
- @Field("evtTime")
+ @Field(AUDIT_EVTTIME)
private Date eventTime;
- @Field("reason")
+ @Field(AUDIT_REASON)
private String reason;
- @Field("proxyUsers")
+ @Field(AUDIT_PROXY_USERS)
private List<String> proxyUsers;
- @Field("repo")
+ @Field(AUDIT_COMPONENT)
private String repo;
- @Field("repoType")
+ @Field(AUDIT_REPO_TYPE)
private Integer repoType;
- @Field("reqData")
+ @Field(AUDIT_REQEST_DATA)
private String requestData;
- @Field("reqUser")
+ @Field(AUDIT_REQUEST_USER)
private String requestUser;
- @Field("resType")
+ @Field(AUDIT_RESPONSE_TYPE)
private String responseType;
- @Field("resource")
+ @Field(AUDIT_RESOURCE)
private String resource;
- @Field("result")
+ @Field(AUDIT_RESULT)
private Integer result;
- @Field("sess")
+ @Field(AUDIT_SESSION)
private String session;
- @Field("tags")
+ @Field(AUDIT_TAGS)
private List<String> tags;
- @Field("tags_str")
+ @Field(AUDIT_TAGS_STR)
private String tagsStr;
- @Field("text")
+ @Field(AUDIT_TEXT)
private String text;
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
index d68279d..bac5080 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
@@ -23,57 +23,59 @@ import org.apache.solr.client.solrj.beans.Field;
import java.util.Date;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.*;
+
public class SolrCommonLogData implements CommonLogData {
- @Field("id")
+ @Field(ID)
private String id;
- @Field("bundle_id")
+ @Field(BUNDLE_ID)
private String bundleId;
- @Field("case_id")
+ @Field(CASE_ID)
private String caseId;
- @Field("cluster")
+ @Field(CLUSTER)
private String cluster;
- @Field("seq_num")
+ @Field(SEQUENCE_ID)
private Long seqNum;
- @Field("log_message")
+ @Field(LOG_MESSAGE)
private String logMessage;
- @Field("logfile_line_number")
+ @Field(LOGFILE_LINE_NUMBER)
private Integer logFileLineNumber;
- @Field("event_dur_m5")
+ @Field(EVENT_DURATION_MD5)
private Long eventDurationMs;
- @Field("file")
+ @Field(FILE)
private String file;
- @Field("type")
+ @Field(TYPE)
private String type;
- @Field("event_count")
+ @Field(EVENT_COUNT)
private Long eventCount;
- @Field("event_md5")
+ @Field(EVENT_MD5)
private String eventMd5;
- @Field("message_md5")
+ @Field(MESSAGE_MD5)
private String messageMd5;
- @Field("_ttl_")
+ @Field(TTL)
private String ttl;
- @Field("_expire_at_")
+ @Field(EXPIRE_AT)
private Date expire;
- @Field("_version_")
+ @Field(VERSION)
private Long version;
- @Field("_router_field_")
+ @Field(ROUTER_FIELD)
private Integer routerField;
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
index 988c878..1a63700 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
@@ -21,9 +21,11 @@ package org.apache.ambari.logsearch.solr.model;
import org.apache.ambari.logsearch.model.response.ComponentTypeLogData;
import org.apache.solr.client.solrj.beans.Field;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+
public class SolrComponentTypeLogData implements ComponentTypeLogData {
- @Field("type")
+ @Field(COMPONENT)
private String type;
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
index 215b22c..8391815 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
@@ -21,9 +21,11 @@ package org.apache.ambari.logsearch.solr.model;
import org.apache.ambari.logsearch.model.response.HostLogData;
import org.apache.solr.client.solrj.beans.Field;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+
public class SolrHostLogData implements HostLogData {
- @Field("host")
+ @Field(HOST)
private String host;
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
index 890dc7d..1d4cecf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
@@ -22,30 +22,42 @@ import org.apache.ambari.logsearch.model.response.ServiceLogData;
import org.apache.solr.client.solrj.beans.Field;
import java.util.Date;
+import java.util.Map;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.*;
public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogData {
- @Field("level")
+ @Field(LEVEL)
private String level;
- @Field("line_number")
+ @Field(LINE_NUMBER)
private Integer lineNumber;
- @Field("logtime")
+ @Field(LOGTIME)
private Date logTime;
- @Field("type")
+ @Field(COMPONENT)
private String type;
- @Field("ip")
+ @Field(IP)
private String ip;
- @Field("path")
+ @Field(PATH)
private String path;
- @Field("host")
+ @Field(HOST)
private String host;
+ @Field(STORED_TOKEN_DYNAMIC_FIELDS)
+ private Map<String, Object> stdDynamicFields;
+
+ @Field(KEY_DYNAMIC_FIELDS)
+ private Map<String, Object> keyDynamicFields;
+
+ @Field(WS_DYNAMIC_FIELDS)
+ private Map<String, Object> wsDynamicFields;
+
@Override
public String getPath() {
return path;
@@ -115,4 +127,28 @@ public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogD
public void setLevel(String level) {
this.level = level;
}
+
+ public Map<String, Object> getStdDynamicFields() {
+ return stdDynamicFields;
+ }
+
+ public void setStdDynamicFields(Map<String, Object> stdDynamicFields) {
+ this.stdDynamicFields = stdDynamicFields;
+ }
+
+ public Map<String, Object> getKeyDynamicFields() {
+ return keyDynamicFields;
+ }
+
+ public void setKeyDynamicFields(Map<String, Object> keyDynamicFields) {
+ this.keyDynamicFields = keyDynamicFields;
+ }
+
+ public Map<String, Object> getWsDynamicFields() {
+ return wsDynamicFields;
+ }
+
+ public void setWsDynamicFields(Map<String, Object> wsDynamicFields) {
+ this.wsDynamicFields = wsDynamicFields;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
deleted file mode 100644
index 637a4d7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
+++ /dev/null
@@ -1,261 +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.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
-import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
-import org.apache.ambari.logsearch.model.response.NameValueData;
-import org.apache.ambari.logsearch.view.VHost;
-import org.apache.ambari.logsearch.view.VSummary;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-
-public class BizUtil {
- private static final Logger logger = Logger.getLogger(BizUtil.class);
-
- private BizUtil() {
- throw new UnsupportedOperationException();
- }
-
- public static String convertObjectToNormalText(SolrDocumentList docList) {
- String textToSave = "";
- HashMap<String, String> blankFieldsMap = new HashMap<String, String>();
- if (docList == null){
- return "no data";
- }
- if (docList.isEmpty()) {
- return "no data";
- }
- SolrDocument docForBlankCaculation = docList.get(0);
- if(docForBlankCaculation == null){
- return "no data";
- }
- Collection<String> fieldsForBlankCaculation = docForBlankCaculation.getFieldNames();
-
- int maxLengthOfField = 0;
- if (fieldsForBlankCaculation == null) {
- return "no data";
- }
- for (String field : fieldsForBlankCaculation) {
- if (!StringUtils.isBlank(field) && field.length() > maxLengthOfField) {
- maxLengthOfField = field.length();
- }
- }
-
- for (String field : fieldsForBlankCaculation) {
- if (!StringUtils.isBlank(field)) {
- blankFieldsMap.put(field, StringUtils.rightPad(field, maxLengthOfField - field.length()));
- }
- }
-
- for (SolrDocument doc : docList) {
- if (doc != null) {
- StringBuffer textTowrite = new StringBuffer();
-
- if (doc.getFieldValue(LogSearchConstants.LOGTIME) != null) {
- textTowrite.append(doc.getFieldValue(LogSearchConstants.LOGTIME).toString() + " ");
- }
- if (doc.getFieldValue(LogSearchConstants.SOLR_LEVEL) != null) {
- textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_LEVEL).toString()).append(" ");
- }
- if (doc.getFieldValue(LogSearchConstants.SOLR_THREAD_NAME) != null) {
- textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_THREAD_NAME).toString().trim()).append(" ");
- }
- if (doc.getFieldValue(LogSearchConstants.SOLR_LOGGER_NAME) != null) {
- textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_LOGGER_NAME).toString().trim()).append(" ");
- }
- if (doc.getFieldValue(LogSearchConstants.SOLR_FILE) != null && doc.getFieldValue(LogSearchConstants.SOLR_LINE_NUMBER) != null) {
- textTowrite
- .append(doc.getFieldValue(LogSearchConstants.SOLR_FILE).toString())
- .append(":")
- .append(doc.getFieldValue(LogSearchConstants.SOLR_LINE_NUMBER).toString())
- .append(" ");
- }
- if (doc.getFieldValue(LogSearchConstants.SOLR_LOG_MESSAGE) != null) {
- textTowrite.append("- ")
- .append(doc.getFieldValue(LogSearchConstants.SOLR_LOG_MESSAGE).toString());
- }
- textTowrite.append("\n");
- textToSave += textTowrite.toString();
- }
- }
- return textToSave;
- }
-
- public static VSummary buildSummaryForLogFile(SolrDocumentList docList) {
- VSummary vsummary = new VSummary();
- if (CollectionUtils.isEmpty(docList)) {
- return vsummary;
- }
- int numLogs = 0;
- List<VHost> vHosts = new ArrayList<VHost>();
- vsummary.setHosts(vHosts);
- String levels = "";
- for (SolrDocument doc : docList) {
- if (doc != null) {
- // adding Host and Component appropriately
- String hostname = (String) doc.getFieldValue("host");
- String comp = (String) doc.getFieldValue("type");
- String level = (String) doc.getFieldValue("level");
- if (StringUtils.isBlank(level)) {
- level = "";
- }
- boolean newHost = true;
- for (VHost host : vHosts) {
- if (host != null && host.getName().equals(hostname)) {
- newHost = false;
- if (StringUtils.isBlank(comp)) {
- Set<String> compList = host.getComponents();
- if (compList != null) {
- compList.add(comp);
- }
- }
- break;
- }
- }
- if (newHost) {
- VHost vHost = new VHost();
- if (!StringUtils.isBlank(hostname)) {
- vHost.setName(hostname);
- }
- Set<String> component = new LinkedHashSet<String>();
- if (StringUtils.isBlank(comp)) {
- component.add(comp);
- }
- vHost.setComponents(component);
- vHosts.add(vHost);
- }
- // getting levels
- if (!levels.contains(level)) {
- levels = levels + ", " + level;
- }
- numLogs += 1;
- }
- }
- levels = levels.replaceFirst(", ", "");
- vsummary.setLevels(levels);
- vsummary.setNumberLogs("" + numLogs);
- return vsummary;
- }
-
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static BarGraphDataListResponse buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse, String innerJsonKey, String outerJsonKey) {
-
- BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
-
- Collection<BarGraphData> dataList = new ArrayList<>();
- if (jsonFacetResponse == null) {
- logger.info("Solr document list in null");
- return barGraphDataListResponse;
- }
- List<Object> userList = jsonFacetResponse.getAll(outerJsonKey);
- if (userList.isEmpty()) {
- return barGraphDataListResponse;
- }
- SimpleOrderedMap<Map<String, Object>> userMap = (SimpleOrderedMap<Map<String, Object>>) userList.get(0);
- if (userMap == null) {
- logger.info("No top user details found");
- return barGraphDataListResponse;
- }
- List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap.get("buckets");
- if(userUsageList == null){
- return barGraphDataListResponse;
- }
- for (SimpleOrderedMap usageMap : userUsageList) {
- if (usageMap != null) {
- BarGraphData barGraphData = new BarGraphData();
- String userName = (String) usageMap.get("val");
- if (!StringUtils.isBlank(userName)) {
- barGraphData.setName(userName);
- }
- SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get(innerJsonKey);
- List<NameValueData> componetCountList = new ArrayList<NameValueData>();
- if (repoMap != null) {
- List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets");
- for (SimpleOrderedMap repoUsageMap : repoUsageList) {
- NameValueData componetCount = new NameValueData();
- if (repoUsageMap.get("val") != null) {
- componetCount.setName(repoUsageMap.get("val").toString());
- }
- String eventCount = "";
- if (repoUsageMap.get("eventCount") != null) {
- eventCount = repoUsageMap.get("eventCount").toString();
- }
- eventCount = eventCount.replace(".0", "");
- eventCount = eventCount.replace(".00", "");
-
- componetCount.setValue(eventCount);
- componetCountList.add(componetCount);
- }
- barGraphData.setDataCount(componetCountList);
- dataList.add(barGraphData);
- }
- }}
- barGraphDataListResponse.setGraphData(dataList);
- logger.info("getting graph data");
-
- return barGraphDataListResponse;
- }
-
- public static HashMap<String, String> sortHashMapByValues(HashMap<String, String> passedMap) {
- if (passedMap == null ) {
- return null;
- }
- HashMap<String, String> sortedMap = new LinkedHashMap<String, String>();
- List<String> mapValues = new ArrayList<String>(passedMap.values());
- HashMap<String, String> invertedKeyValue = new HashMap<String, String>();
- Collections.sort(mapValues, new Comparator<String>() {
- @Override
- public int compare(String s1, String s2) {
- return s1.compareToIgnoreCase(s2);
- }
- });
- Iterator<Entry<String, String>> it = passedMap.entrySet().iterator();
- while (it.hasNext()) {
- @SuppressWarnings("rawtypes")
- Map.Entry pair = (Map.Entry) it.next();
- invertedKeyValue.put("" + pair.getValue(), "" + pair.getKey());
- }
-
- for (String valueOfKey : mapValues) {
- sortedMap.put(invertedKeyValue.get(valueOfKey), valueOfKey);
- }
-
- return sortedMap;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
index 0de0dbc..9b4f553 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
@@ -114,6 +114,15 @@ public class DateUtil {
}
+ public static Date convertStringToSolrDate(String dateStr) {
+ try {
+ SimpleDateFormat formatter = new SimpleDateFormat(LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
+ return formatter.parse(dateStr);
+ } catch (Exception e){
+ throw new RuntimeException("Cannot parse date from request", e.getCause());
+ }
+ }
+
public static boolean isDateValid(String value) {
if (StringUtils.isBlank(value)) {
return false;