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:07 UTC
[04/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/util/DownloadUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java
new file mode 100644
index 0000000..debe131
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java
@@ -0,0 +1,176 @@
+/*
+ * 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.List;
+import java.util.Map;
+
+import com.google.common.base.Splitter;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+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.model.response.TemplateData;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LINE_NUMBER;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOG_MESSAGE;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGGER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.THREAD_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.FILE;
+
+
+public class DownloadUtil {
+
+ private DownloadUtil() {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void fillModelsForLogFile(SolrDocumentList docList, Map<String, Object> models, ServiceLogExportRequest request,
+ String format, String from, String to) {
+ long numLogs = docList.getNumFound();
+ List<String> hosts = new ArrayList<>();
+ List<String> components = new ArrayList<>();
+ List<String> levels = new ArrayList<>();
+ List<TemplateData> logData = new ArrayList<>();
+ for (SolrDocument doc : docList) {
+ if (doc != null) {
+ String hostname = (String) doc.getFieldValue(HOST);
+ String comp = (String) doc.getFieldValue(COMPONENT);
+ String level = (String) doc.getFieldValue(LEVEL);
+
+ if (!hosts.contains(hostname)) {
+ hosts.add(hostname);
+ }
+
+ if (!components.contains(comp)) {
+ components.add(comp);
+ }
+
+ if (!levels.contains(level)) {
+ levels.add(level);
+ }
+
+ StringBuffer textToWrite = new StringBuffer();
+
+ if (doc.getFieldValue(LOGTIME) != null) {
+ textToWrite.append(doc.getFieldValue(LOGTIME).toString() + " ");
+ }
+ if (doc.getFieldValue(LEVEL) != null) {
+ textToWrite.append(doc.getFieldValue(LEVEL).toString()).append(" ");
+ }
+ if (doc.getFieldValue(THREAD_NAME) != null) {
+ textToWrite.append(doc.getFieldValue(THREAD_NAME).toString().trim()).append(" ");
+ }
+ if (doc.getFieldValue(LOGGER_NAME) != null) {
+ textToWrite.append(doc.getFieldValue(LOGGER_NAME).toString().trim()).append(" ");
+ }
+ if (doc.getFieldValue(FILE) != null && doc.getFieldValue(LINE_NUMBER) != null) {
+ textToWrite
+ .append(doc.getFieldValue(FILE).toString())
+ .append(":")
+ .append(doc.getFieldValue(LINE_NUMBER).toString())
+ .append(" ");
+ }
+ if (doc.getFieldValue(LOG_MESSAGE) != null) {
+ textToWrite.append("- ")
+ .append(doc.getFieldValue(LOG_MESSAGE).toString());
+ }
+ logData.add(new TemplateData((textToWrite.toString())));
+ }
+ }
+ models.put("numberOfLogs", numLogs);
+ models.put("logs", logData);
+ models.put("hosts", "[ " + StringUtils.join(hosts, " ; ") + " ]");
+ models.put("components", "[ " + StringUtils.join(components, " ; ") + " ]");
+ models.put("format", format);
+ models.put("from", from);
+ models.put("levels", StringUtils.join(levels, ", "));
+ models.put("to", to);
+ String includeString = request.getiMessage();
+ if (StringUtils.isBlank(includeString)) {
+ includeString = "\"\"";
+ } else {
+ List<String> include = Splitter.on(request.getiMessage()).splitToList(LogSearchConstants.I_E_SEPRATOR);
+ includeString = "\"" + StringUtils.join(include, "\", \"") + "\"";
+ }
+ models.put("iString", includeString);
+
+ String excludeString = request.geteMessage();
+ if (StringUtils.isBlank(excludeString)) {
+ excludeString = "\"\"";
+ } else {
+ List<String> exclude = Splitter.on(request.getiMessage()).splitToList(LogSearchConstants.I_E_SEPRATOR);
+ excludeString = "\"" + StringUtils.join(exclude, "\", \"") + "\"";
+ }
+ models.put("eString", excludeString);
+ }
+
+ public static void fillUserResourcesModel(Map<String, Object> models, BarGraphDataListResponse vBarUserDataList, BarGraphDataListResponse vBarResourceDataList) {
+ List<TemplateData> usersDataList = new ArrayList<>();
+ List<TemplateData> resourceDataList = new ArrayList<>();
+ Collection<BarGraphData> tableUserData = vBarUserDataList.getGraphData();
+ for (BarGraphData graphData : tableUserData) {
+ String userName = graphData.getName().length() > 45 ? graphData.getName().substring(0, 45) : graphData.getName();
+ Collection<NameValueData> vnameValueList = graphData.getDataCount();
+ usersDataList.add(new TemplateData(appendNameValueData(addBlank(userName), vnameValueList)));
+ }
+ Collection<BarGraphData> tableResourceData = vBarResourceDataList.getGraphData();
+ for (BarGraphData graphData : tableResourceData) {
+ String resourceName = graphData.getName().length() > 45 ? graphData.getName().substring(0, 45) : graphData.getName();
+ Collection<NameValueData> vnameValueList = graphData.getDataCount();
+ resourceDataList.add(new TemplateData(appendNameValueData(addBlank(resourceName), vnameValueList)));
+ }
+ models.put("users", usersDataList);
+ models.put("resources", resourceDataList);
+ models.put("usersSummary", vBarUserDataList.getGraphData().size());
+ models.put("resourcesSummary", vBarResourceDataList.getGraphData().size());
+ }
+
+ private static String appendNameValueData(String data, Collection<NameValueData> vnameValueList) {
+ int count = 0;
+ String blank = "";
+ for (NameValueData vNameValue : vnameValueList) {
+ data += blank + vNameValue.getName() + " " + vNameValue.getValue();
+ if (count == 0)
+ blank = addBlank(blank);
+ count++;
+ }
+ return data;
+ }
+
+ private static String addBlank(String field) {
+ int blanks = 50;
+ int strSize = field.length();
+ String fieldWithBlank = field;
+ for (int i = 0; i < blanks - strSize; i++) {
+ fieldWithBlank += " ";
+ }
+ return fieldWithBlank;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
index 505b74d..f7330fa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
@@ -19,19 +19,9 @@
package org.apache.ambari.logsearch.util;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
import java.net.URL;
-import java.util.List;
-import java.util.Set;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.view.VHost;
-import org.apache.ambari.logsearch.view.VSummary;
import org.apache.log4j.Logger;
public class FileUtil {
@@ -40,80 +30,6 @@ public class FileUtil {
private FileUtil() {
throw new UnsupportedOperationException();
}
-
- public static Response saveToFile(String text, String fileName, VSummary vsummary) {
- String mainExportedFile = "";
- FileOutputStream fis = null;
- try {
- mainExportedFile = mainExportedFile + "**********************Summary**********************\n";
- mainExportedFile = mainExportedFile + "Number of Logs : " + vsummary.getNumberLogs() + "\n";
- mainExportedFile = mainExportedFile + "From : " + vsummary.getFrom() + "\n";
- mainExportedFile = mainExportedFile + "To : " + vsummary.getTo() + "\n";
-
- List<VHost> hosts = vsummary.getHosts();
- String blankCharacterForHost = String.format("%-8s", "");
- int numberHost = 0;
- for (VHost host : hosts) {
- numberHost += 1;
- String h = host.getName();
- String c = "";
- Set<String> comp = host.getComponents();
- boolean zonetar = true;
- if (comp != null) {
- for (String component : comp) {
- if (zonetar) {
- c = component;
- zonetar = false;
- } else {
- c = c + ", " + component;
- }
- }
- }
- if (numberHost > 9){
- blankCharacterForHost = String.format("%-7s", blankCharacterForHost);
- }else if (numberHost > 99){
- blankCharacterForHost = String.format("%-6s", blankCharacterForHost);
- }else if (numberHost > 999){
- blankCharacterForHost = String.format("%-5s", blankCharacterForHost);
- }else if (numberHost > 9999){
- blankCharacterForHost = String.format("%-4s", blankCharacterForHost);
- }else if (numberHost > 99999){
- blankCharacterForHost = String.format("%-3s", blankCharacterForHost);
- }
- if (numberHost == 1) {
- mainExportedFile = mainExportedFile + "Host" + blankCharacterForHost + " : " + h + " [" + c + "] " + "\n";
- } else if (numberHost > 1) {
- mainExportedFile = mainExportedFile + "Host_" + numberHost + blankCharacterForHost + " : " + h + " [" + c + "] " + "\n";
- }
-
- }
- mainExportedFile = mainExportedFile + "Levels"+String.format("%-9s", blankCharacterForHost)+": " + vsummary.getLevels() + "\n";
- mainExportedFile = mainExportedFile + "Format"+String.format("%-9s", blankCharacterForHost)+": " + vsummary.getFormat() + "\n";
- mainExportedFile = mainExportedFile + "\n";
-
- mainExportedFile = mainExportedFile + "Included String: [" + vsummary.getIncludeString() + "]\n\n";
- mainExportedFile = mainExportedFile + "Excluded String: [" + vsummary.getExcludeString() + "]\n\n";
- mainExportedFile = mainExportedFile + "************************Logs***********************" + "\n";
- mainExportedFile = mainExportedFile + text + "\n";
- File file = File.createTempFile(fileName, vsummary.getFormat());
- fis = new FileOutputStream(file);
- fis.write(mainExportedFile.getBytes());
- return Response
- .ok(file, MediaType.APPLICATION_OCTET_STREAM)
- .header("Content-Disposition", "attachment;filename=" + fileName + vsummary.getFormat())
- .build();
- } catch (Exception e) {
- logger.error(e.getMessage());
- throw RESTErrorUtil.createRESTException(e.getMessage(), MessageEnums.ERROR_SYSTEM);
- } finally {
- if (fis != null) {
- try {
- fis.close();
- } catch (IOException e) {
- }
- }
- }
- }
public static File getFileFromClasspath(String filename) {
URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(filename);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
index 88fb0d5..532428b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
@@ -26,8 +26,8 @@ import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.view.VMessage;
-import org.apache.ambari.logsearch.view.VResponse;
+import org.apache.ambari.logsearch.common.MessageData;
+import org.apache.ambari.logsearch.common.VResponse;
import org.apache.log4j.Logger;
public class RESTErrorUtil {
@@ -42,7 +42,7 @@ public class RESTErrorUtil {
}
public static WebApplicationException createRESTException(String errorMessage, MessageEnums messageEnum) {
- List<VMessage> messageList = new ArrayList<VMessage>();
+ List<MessageData> messageList = new ArrayList<MessageData>();
messageList.add(messageEnum.getMessage());
VResponse response = new VResponse();
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
index 33262f3..51a0dda 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
@@ -19,146 +19,45 @@
package org.apache.ambari.logsearch.util;
-import java.util.Collection;
import java.util.HashMap;
-import java.util.Locale;
+import java.util.Map;
import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
+import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
+import org.apache.lucene.analysis.path.PathHierarchyTokenizerFactory;
+import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.schema.TrieDoubleField;
import org.apache.solr.schema.TrieFloatField;
import org.apache.solr.schema.TrieIntField;
import org.apache.solr.schema.TrieLongField;
-import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
-import org.springframework.util.CollectionUtils;
public class SolrUtil {
private SolrUtil() {
throw new UnsupportedOperationException();
}
-
- public static String setField(String fieldName, String value) {
- if (value == null || value.trim().length() == 0) {
- return "";
- }
- return fieldName + ":" + value.trim().toLowerCase(Locale.ENGLISH);
- }
-
- public static String inList(String fieldName, int[] values) {
- if (ArrayUtils.isEmpty(values)) {
- return "";
- }
- String expr = "";
- // Add the filter queries
- for (int i : values) {
- expr += i + " ";
- }
- if (values.length == 0) {
- return fieldName + ":" + expr;
- } else {
- return fieldName + ":(" + expr + ")";
- }
- }
-
- public static String inList(Collection<Long> values) {
- if (CollectionUtils.isEmpty(values)) {
- return "";
- }
- String expr = "";
- for (Long value : values) {
- expr += value.toString() + " ";
- }
-
- if (values.isEmpty()) {
- return expr.trim();
- } else {
- return "(" + expr.trim() + ")";
- }
-
- }
-
- public static String orList(String fieldName, String[] valueList, String wildCard) {
- if (ArrayUtils.isEmpty(valueList)) {
- return "";
- }
-
- if (StringUtils.isBlank(wildCard)) {
- wildCard = "";
- }
-
- StringBuilder expr = new StringBuilder();
- int count = -1;
- for (String value : valueList) {
- count++;
- if (count > 0) {
- expr.append(" OR ");
- }
-
- expr.append( fieldName + ":"+ wildCard + value + wildCard);
-
- }
- if (valueList.length == 0) {
- return expr.toString();
- } else {
- return "(" + expr + ")";
- }
-
- }
-
- public static String andList(String fieldName, String[] valueList, String wildCard) {
- if (ArrayUtils.isEmpty(valueList)) {
- return "";
- }
-
- if (StringUtils.isBlank(wildCard)) {
- wildCard = "";
- }
-
- StringBuilder expr = new StringBuilder();
- int count = -1;
- for (String value : valueList) {
- count++;
- if (count > 0) {
- expr.append(" AND ");
- }
-
- expr.append( fieldName + ":"+ wildCard + value + wildCard);
-
- }
- if (valueList.length == 0) {
- return expr.toString();
- } else {
- return "(" + expr + ")";
- }
-
- }
/**
* Copied from Solr ClientUtils.escapeQueryChars and removed escaping *
*/
public static String escapeQueryChars(String s) {
StringBuilder sb = new StringBuilder();
- int prev = 0;
if (s != null) {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
- int ic = (int)c;
- if( ic == 10 ) {
- if( prev != 13) {
- //Let's insert \r
- sb.append('\\');
- sb.append((char)13);
- }
+ int ic = (int) c;
+ if (ic == 10) {
+ sb.append('\\');
+ sb.append((char) 13);
}
// Note: Remove || c == '*'
// These characters are part of the query syntax and must be escaped
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '('
- || c == ')' || c == ':' || c == '^' || c == '[' || c == ']'
- || c == '\"' || c == '{' || c == '}' || c == '~' || c == '?'
- || c == '|' || c == '&' || c == ';' || c == '/'
- || Character.isWhitespace(c)) {
+ || c == ')' || c == ':' || c == '^' || c == '[' || c == ']'
+ || c == '\"' || c == '{' || c == '}' || c == '~' || c == '?'
+ || c == '|' || c == '&' || c == ';' || c == '/'
+ || Character.isWhitespace(c)) {
sb.append('\\');
}
sb.append(c);
@@ -167,25 +66,6 @@ public class SolrUtil {
return sb.toString();
}
- private static String escapeForWhiteSpaceTokenizer(String search) {
- if (search == null) {
- return null;
- }
- String newString = search.trim();
- String newSearch = escapeQueryChars(newString);
- boolean isSingleWord = true;
- for (int i = 0; i < search.length(); i++) {
- if (Character.isWhitespace(search.charAt(i))) {
- isSingleWord = false;
- }
- }
- if (!isSingleWord) {
- newSearch = "\"" + newSearch + "\"";
- }
-
- return newSearch;
- }
-
public static String escapeForStandardTokenizer(String search) {
if (search == null) {
return null;
@@ -206,7 +86,7 @@ public class SolrUtil {
}
private static String escapeForKeyTokenizer(String search) {
- if (search.startsWith("*") && search.endsWith("*") && !StringUtils.isBlank(search)) {
+ if (search.startsWith("*") && search.endsWith("*") && StringUtils.isNotBlank(search)) {
// Remove the * from both the sides
if (search.length() > 1) {
search = search.substring(1, search.length() - 1);
@@ -224,16 +104,14 @@ public class SolrUtil {
* This is a special case scenario to handle log_message for wild card
* scenarios
*/
- public static String escapeForLogMessage(String field, String search) {
+ public static String escapeForLogMessage(String search) {
if (search.startsWith("*") && search.endsWith("*")) {
- field = LogSearchConstants.SOLR_KEY_LOG_MESSAGE;
search = escapeForKeyTokenizer(search);
} else {
// Use whitespace index
- field = LogSearchConstants.SOLR_LOG_MESSAGE;
- search = escapeForWhiteSpaceTokenizer(search);
+ search = escapeForStandardTokenizer(search);
}
- return field + ":" + search;
+ return search;
}
public static String makeSolrSearchString(String search) {
@@ -270,11 +148,11 @@ public class SolrUtil {
}
- public static boolean isSolrFieldNumber(String fieldType,SolrDaoBase solrDaoBase) {
+ public static boolean isSolrFieldNumber(String fieldType, Map<String, String> schemaFieldsMap) {
if (StringUtils.isBlank(fieldType)) {
return false;
} else {
- HashMap<String, Object> typeInfoMap = getFieldTypeInfoMap(fieldType,solrDaoBase);
+ HashMap<String, Object> typeInfoMap = getFieldTypeInfoMap(fieldType, schemaFieldsMap);
if (typeInfoMap == null || typeInfoMap.isEmpty()) {
return false;
}
@@ -294,15 +172,66 @@ public class SolrUtil {
return false;
}
}
+
+ public static String putWildCardByType(String str, String key, Map<String, String> schemaFieldsMap) {
+ String fieldType = schemaFieldsMap.get(key);
+ if (StringUtils.isNotBlank(fieldType)) {
+ if (isSolrFieldNumber(fieldType, schemaFieldsMap)) {
+ String value = putEscapeCharacterForNumber(str, fieldType, schemaFieldsMap);
+ if (StringUtils.isNotBlank(value)) {
+ return value;
+ } else {
+ return null;
+ }
+ } else if (checkTokenizer(fieldType, StandardTokenizerFactory.class, schemaFieldsMap)) {
+ return escapeForStandardTokenizer(str);
+ } else if (checkTokenizer(fieldType, KeywordTokenizerFactory.class, schemaFieldsMap)|| "string".equalsIgnoreCase(fieldType)) {
+ return makeSolrSearchStringWithoutAsterisk(str);
+ } else if (checkTokenizer(fieldType, PathHierarchyTokenizerFactory.class, schemaFieldsMap)) {
+ return str;
+ }
+ }
+ return str;
+ }
+
+ private static String putEscapeCharacterForNumber(String str,String fieldType, Map<String, String> schemaFieldsMap) {
+ if (StringUtils.isNotEmpty(str)) {
+ str = str.replace("*", "");
+ }
+ String escapeCharSting = parseInputValueAsPerFieldType(str,fieldType, schemaFieldsMap);
+ if (escapeCharSting == null || escapeCharSting.isEmpty()) {
+ return null;
+ }
+ escapeCharSting = escapeCharSting.replace("-", "\\-");
+ return escapeCharSting;
+ }
+
+ private static String parseInputValueAsPerFieldType(String str,String fieldType, Map<String, String> schemaFieldsMap) {
+ try {
+ HashMap<String, Object> fieldTypeInfoMap = SolrUtil.getFieldTypeInfoMap(fieldType, schemaFieldsMap);
+ String className = (String) fieldTypeInfoMap.get("class");
+ if (className.equalsIgnoreCase(TrieDoubleField.class.getSimpleName())) {
+ return "" + Double.parseDouble(str);
+ } else if (className.equalsIgnoreCase(TrieFloatField.class.getSimpleName())) {
+ return "" + Float.parseFloat(str);
+ } else if (className.equalsIgnoreCase(TrieLongField.class.getSimpleName())) {
+ return "" + Long.parseLong(str);
+ } else {
+ return "" + Integer.parseInt(str);
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ }
- public static HashMap<String, Object> getFieldTypeInfoMap(String fieldType,SolrDaoBase solrDaoBase) {
- String fieldTypeMetaData = solrDaoBase.schemaFieldTypeMap.get(fieldType);
+ public static HashMap<String, Object> getFieldTypeInfoMap(String fieldType, Map<String, String> schemaFieldsTypeMap) {
+ String fieldTypeMetaData = schemaFieldsTypeMap.get(fieldType);
HashMap<String, Object> fieldTypeMap = JSONUtil.jsonToMapObject(fieldTypeMetaData);
if (fieldTypeMap == null) {
- return new HashMap<String, Object>();
+ return new HashMap<>();
}
String classname = (String) fieldTypeMap.get("class");
- if (!StringUtils.isBlank(classname)) {
+ if (StringUtils.isNotBlank(classname)) {
classname = classname.replace("solr.", "");
fieldTypeMap.put("class", classname);
}
@@ -310,8 +239,7 @@ public class SolrUtil {
}
//=============================================================================================================
-
- //Solr Facet Methods
+
public static void setFacetField(SolrQuery solrQuery, String facetField) {
solrQuery.setFacet(true);
setRowCount(solrQuery, 0);
@@ -319,13 +247,6 @@ public class SolrUtil {
setFacetLimit(solrQuery, -1);
}
- public static void setJSONFacet(SolrQuery solrQuery, String jsonQuery) {
- solrQuery.setFacet(true);
- setRowCount(solrQuery, 0);
- solrQuery.set(LogSearchConstants.FACET_JSON_FIELD, jsonQuery);
- setFacetLimit(solrQuery, -1);
- }
-
public static void setFacetSort(SolrQuery solrQuery, String sortType) {
solrQuery.setFacet(true);
solrQuery.setFacetSort(sortType);
@@ -339,60 +260,10 @@ public class SolrUtil {
setFacetLimit(solrQuery, -1);
}
- public static void setFacetDate(SolrQuery solrQuery, String facetField, String from, String to, String unit) {
- solrQuery.setFacet(true);
- setRowCount(solrQuery, 0);
- solrQuery.set(LogSearchConstants.FACET_DATE, facetField);
- solrQuery.set(LogSearchConstants.FACET_DATE_START, from);
- solrQuery.set(LogSearchConstants.FACET_DATE_END, to);
- solrQuery.set(LogSearchConstants.FACET_DATE_GAP, unit);
- solrQuery.set(LogSearchConstants.FACET_MINCOUNT, 0);
- setFacetLimit(solrQuery, -1);
- }
-
- public static void setFacetRange(SolrQuery solrQuery, String facetField, String from, String to, String unit) {
- solrQuery.setFacet(true);
- setRowCount(solrQuery, 0);
- solrQuery.set(LogSearchConstants.FACET_RANGE, facetField);
- solrQuery.set(LogSearchConstants.FACET_RANGE_START, from);
- solrQuery.set(LogSearchConstants.FACET_RANGE_END, to);
- solrQuery.set(LogSearchConstants.FACET_RANGE_GAP, unit);
- solrQuery.set(LogSearchConstants.FACET_MINCOUNT, 0);
- setFacetLimit(solrQuery, -1);
- }
-
public static void setFacetLimit(SolrQuery solrQuery, int limit) {
solrQuery.set("facet.limit", limit);
}
- //Solr Group Mehtods
- public static void setGroupField(SolrQuery solrQuery, String groupField, int rows) {
- solrQuery.set(LogSearchConstants.FACET_GROUP, true);
- solrQuery.set(LogSearchConstants.FACET_GROUP_FIELD, groupField);
- solrQuery.set(LogSearchConstants.FACET_GROUP_MAIN, true);
- setRowCount(solrQuery, rows);
- }
-
- //Main Query
- public static void setMainQuery(SolrQuery solrQuery, String query) {
- String defalultQuery = "*:*";
- if (StringUtils.isBlank(query)){
- solrQuery.setQuery(defalultQuery);
- }else{
- solrQuery.setQuery(query);
- }
- }
-
- public static void setStart(SolrQuery solrQuery, int start) {
- int defaultStart = 0;
- if (start > defaultStart) {
- solrQuery.setStart(start);
- } else {
- solrQuery.setStart(defaultStart);
- }
- }
-
- //Set Number of Rows
public static void setRowCount(SolrQuery solrQuery, int rows) {
if (rows > 0) {
solrQuery.setRows(rows);
@@ -402,17 +273,23 @@ public class SolrUtil {
}
}
- //Solr Facet Methods
- public static void setFacetFieldWithMincount(SolrQuery solrQuery, String facetField, int minCount) {
- solrQuery.setFacet(true);
- setRowCount(solrQuery, 0);
- solrQuery.set(LogSearchConstants.FACET_FIELD, facetField);
- solrQuery.set(LogSearchConstants.FACET_MINCOUNT, minCount);
- setFacetLimit(solrQuery, -1);
- }
-
- public static void setFl(SolrQuery solrQuery,String field){
- solrQuery.set(LogSearchConstants.FL, field);
+ private static boolean checkTokenizer(String fieldType, Class tokenizerFactoryClass, Map<String, String> schemaFieldsMap) {
+ HashMap<String, Object> fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType ,schemaFieldsMap);
+ HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeMap.get("analyzer");
+ if (analyzer != null) {
+ HashMap<String, Object> tokenizerMap = (HashMap<String, Object>) analyzer.get("tokenizer");
+ if (tokenizerMap != null) {
+ String tokenizerClass = (String) tokenizerMap.get("class");
+ if (!StringUtils.isEmpty(tokenizerClass)) {
+ tokenizerClass =tokenizerClass.replace("solr.", "");
+ if (tokenizerClass.equalsIgnoreCase(tokenizerFactoryClass
+ .getSimpleName())) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
}
\ 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/view/VHost.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java
deleted file mode 100644
index da2fbdd..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.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.view;
-
-import java.util.Set;
-
-public class VHost {
- protected String name;
- protected Set<String> components;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Set<String> getComponents() {
- return components;
- }
-
- public void setComponents(Set<String> components) {
- this.components = components;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
deleted file mode 100644
index 97226d2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ambari.logsearch.view;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public abstract class VList implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * Start index for the result
- */
- protected int startIndex;
- /**
- * Page size used for the result
- */
- protected int pageSize;
- /**
- * Total records in the database for the given search conditions
- */
- protected long totalCount;
- /**
- * Number of rows returned for the search condition
- */
- protected int resultSize;
- /**
- * // * Sort type. Either desc or asc //
- */
- protected String sortType;
- // /**
- // * Comma seperated list of the fields for sorting
- // */
- protected String sortBy;
-
- protected long queryTimeMS = System.currentTimeMillis();
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VList() {
- }
-
- /**
- * Initialize with existing list
- *
- * @param size
- */
- public VList(@SuppressWarnings("rawtypes") List objectList) {
- int size = 0;
- if (objectList != null) {
- size = objectList.size();
- }
-
- startIndex = 0;
- pageSize = size;
- totalCount = size;
- resultSize = size;
- sortType = null;
- sortBy = null;
- }
-
- abstract public int getListSize();
-
- abstract public List<?> getList();
-
- /**
- * This method sets the value to the member attribute <b>startIndex</b>. You
- * cannot set null to the attribute.
- *
- * @param startIndex
- * Value to set member attribute <b>startIndex</b>
- */
- public void setStartIndex(int startIndex) {
- this.startIndex = startIndex;
- }
-
- /**
- * Returns the value for the member attribute <b>startIndex</b>
- *
- * @return int - value of member attribute <b>startIndex</b>.
- */
- public int getStartIndex() {
- return startIndex;
- }
-
- /**
- * This method sets the value to the member attribute <b>pageSize</b>. You
- * cannot set null to the attribute.
- *
- * @param pageSize
- * Value to set member attribute <b>pageSize</b>
- */
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
-
- /**
- * Returns the value for the member attribute <b>pageSize</b>
- *
- * @return int - value of member attribute <b>pageSize</b>.
- */
- public int getPageSize() {
- return pageSize;
- }
-
- /**
- * This method sets the value to the member attribute <b>totalCount</b>. You
- * cannot set null to the attribute.
- *
- * @param totalCount
- * Value to set member attribute <b>totalCount</b>
- */
- public void setTotalCount(long totalCount) {
- this.totalCount = totalCount;
- }
-
- /**
- * Returns the value for the member attribute <b>totalCount</b>
- *
- * @return long - value of member attribute <b>totalCount</b>.
- */
- public long getTotalCount() {
- return totalCount;
- }
-
- /**
- * This method sets the value to the member attribute <b>resultSize</b>. You
- * cannot set null to the attribute.
- *
- * @param resultSize
- * Value to set member attribute <b>resultSize</b>
- */
- public void setResultSize(int resultSize) {
- this.resultSize = resultSize;
- }
-
- /**
- * Returns the value for the member attribute <b>resultSize</b>
- *
- * @return int - value of member attribute <b>resultSize</b>.
- */
- public int getResultSize() {
- return getListSize();
- }
-
- /**
- * This method sets the value to the member attribute <b>sortType</b>. You
- * cannot set null to the attribute.
- *
- * @param sortType
- * Value to set member attribute <b>sortType</b>
- */
- public void setSortType(String sortType) {
- this.sortType = sortType;
- }
-
- /**
- * Returns the value for the member attribute <b>sortType</b>
- *
- * @return String - value of member attribute <b>sortType</b>.
- */
- public String getSortType() {
- return sortType;
- }
-
- /**
- * This method sets the value to the member attribute <b>sortBy</b>. You
- * cannot set null to the attribute.
- *
- * @param sortBy
- * Value to set member attribute <b>sortBy</b>
- */
- public void setSortBy(String sortBy) {
- this.sortBy = sortBy;
- }
-
- /**
- * Returns the value for the member attribute <b>sortBy</b>
- *
- * @return String - value of member attribute <b>sortBy</b>.
- */
- public String getSortBy() {
- return sortBy;
- }
-
- /**
- * This method sets the value to the member attribute <b>sortBy</b>. You
- * cannot set null to the attribute.
- *
- * @param sortBy
- * Value to set member attribute <b>sortBy</b>
- */
-
- /**
- * @return the queryTimeMS
- */
- public long getQueryTimeMS() {
- return queryTimeMS;
- }
-
- /**
- * @param queryTimeMS
- * the queryTimeMS to set
- */
- public void setQueryTimeMS(long queryTimeMS) {
- this.queryTimeMS = queryTimeMS;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "VList [startIndex=" + startIndex + ", pageSize=" + pageSize
- + ", totalCount=" + totalCount + ", resultSize=" + resultSize
- + ","
- // + " sortType=" + sortType + ", "
- + "sortBy=" + sortBy + ", queryTimeMS=" + queryTimeMS + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java
deleted file mode 100644
index 1836c4a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.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.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogfeederFilter {
-
- private String label;
- private List<String> hosts;
- private List<String> defaultLevels;
- private List<String> overrideLevels;
- private String expiryTime;
-
- public VLogfeederFilter() {
- hosts = new ArrayList<String>();
- defaultLevels = new ArrayList<String>();
- overrideLevels = new ArrayList<String>();
- }
-
- public String getLabel() {
- return label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public List<String> getHosts() {
- return hosts;
- }
-
- public void setHosts(List<String> hosts) {
- this.hosts = hosts;
- }
-
- public List<String> getDefaultLevels() {
- return defaultLevels;
- }
-
- public void setDefaultLevels(List<String> defaultLevels) {
- this.defaultLevels = defaultLevels;
- }
-
- public List<String> getOverrideLevels() {
- return overrideLevels;
- }
-
- public void setOverrideLevels(List<String> overrideLevels) {
- this.overrideLevels = overrideLevels;
- }
-
- public String getExpiryTime() {
- return expiryTime;
- }
-
- public void setExpiryTime(String expiryTime) {
- this.expiryTime = expiryTime;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java
deleted file mode 100644
index 727de69..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.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.view;
-
-import java.util.HashMap;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogfeederFilterWrapper {
-
- private HashMap<String, VLogfeederFilter> filter;
- private String id;
-
- public HashMap<String, VLogfeederFilter> getFilter() {
- return filter;
- }
-
- public void setFilter(HashMap<String, VLogfeederFilter> filter) {
- this.filter = filter;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
deleted file mode 100644
index bc52981..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-package org.apache.ambari.logsearch.view;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VMessage implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * Message key
- */
- protected String name;
- /**
- * Resource bundle key
- */
- protected String rbKey;
- /**
- * Message description. Use rbKey for doing localized lookup
- */
- protected String message;
- /**
- * Id of the object to which this message is related to
- */
- protected Long objectId;
- /**
- * Name of the field or attribute to which this message is related to
- */
- protected String fieldName;
-
- /**
- * This method sets the value to the member attribute <b>name</b>. You
- * cannot set null to the attribute.
- *
- * @param name
- * Value to set member attribute <b>name</b>
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the value for the member attribute <b>name</b>
- *
- * @return String - value of member attribute <b>name</b>.
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * This method sets the value to the member attribute <b>rbKey</b>. You
- * cannot set null to the attribute.
- *
- * @param rbKey
- * Value to set member attribute <b>rbKey</b>
- */
- public void setRbKey(String rbKey) {
- this.rbKey = rbKey;
- }
-
- /**
- * Returns the value for the member attribute <b>rbKey</b>
- *
- * @return String - value of member attribute <b>rbKey</b>.
- */
- public String getRbKey() {
- return this.rbKey;
- }
-
- /**
- * This method sets the value to the member attribute <b>message</b>. You
- * cannot set null to the attribute.
- *
- * @param message
- * Value to set member attribute <b>message</b>
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * Returns the value for the member attribute <b>message</b>
- *
- * @return String - value of member attribute <b>message</b>.
- */
- public String getMessage() {
- return this.message;
- }
-
- /**
- * This method sets the value to the member attribute <b>objectId</b>. You
- * cannot set null to the attribute.
- *
- * @param objectId
- * Value to set member attribute <b>objectId</b>
- */
- public void setObjectId(Long objectId) {
- this.objectId = objectId;
- }
-
- /**
- * Returns the value for the member attribute <b>objectId</b>
- *
- * @return Long - value of member attribute <b>objectId</b>.
- */
- public Long getObjectId() {
- return this.objectId;
- }
-
- /**
- * This method sets the value to the member attribute <b>fieldName</b>. You
- * cannot set null to the attribute.
- *
- * @param fieldName
- * Value to set member attribute <b>fieldName</b>
- */
- public void setFieldName(String fieldName) {
- this.fieldName = fieldName;
- }
-
- /**
- * Returns the value for the member attribute <b>fieldName</b>
- *
- * @return String - value of member attribute <b>fieldName</b>.
- */
- public String getFieldName() {
- return this.fieldName;
- }
-
- /**
- * This return the bean content in string format
- *
- * @return formatedStr
- */
- public String toString() {
- String str = "VMessage={";
- str += super.toString();
- str += "name={" + name + "} ";
- str += "rbKey={" + rbKey + "} ";
- str += "message={" + message + "} ";
- str += "objectId={" + objectId + "} ";
- str += "fieldName={" + fieldName + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
deleted file mode 100644
index b35c29b..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ambari.logsearch.view;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VResponse implements
- java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * Enum values for ResponseStatus
- */
- /**
- * STATUS_SUCCESS is an element of enum ResponseStatus. Its value is
- * "STATUS_SUCCESS".
- */
- public static final int STATUS_SUCCESS = 0;
- /**
- * STATUS_ERROR is an element of enum ResponseStatus. Its value is
- * "STATUS_ERROR".
- */
- public static final int STATUS_ERROR = 1;
- /**
- * STATUS_VALIDATION is an element of enum ResponseStatus. Its value is
- * "STATUS_VALIDATION".
- */
- public static final int STATUS_VALIDATION = 2;
- /**
- * STATUS_WARN is an element of enum ResponseStatus. Its value is
- * "STATUS_WARN".
- */
- public static final int STATUS_WARN = 3;
- /**
- * STATUS_INFO is an element of enum ResponseStatus. Its value is
- * "STATUS_INFO".
- */
- public static final int STATUS_INFO = 4;
- /**
- * STATUS_PARTIAL_SUCCESS is an element of enum ResponseStatus. Its value is
- * "STATUS_PARTIAL_SUCCESS".
- */
- public static final int STATUS_PARTIAL_SUCCESS = 5;
-
- /**
- * Max value for enum ResponseStatus_MAX
- */
- public static final int ResponseStatus_MAX = 5;
-
- /**
- * Status code This attribute is of type enum Response::ResponseStatus
- */
- protected int statusCode;
- /**
- * Message description
- */
- protected String msgDesc;
- /**
- * List of messages
- */
- protected List<VMessage> messageList;
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VResponse() {
- statusCode = 0;
- }
-
- /**
- * This method sets the value to the member attribute <b>statusCode</b>. You
- * cannot set null to the attribute.
- *
- * @param statusCode
- * Value to set member attribute <b>statusCode</b>
- */
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
-
- /**
- * Returns the value for the member attribute <b>statusCode</b>
- *
- * @return int - value of member attribute <b>statusCode</b>.
- */
- public int getStatusCode() {
- return this.statusCode;
- }
-
- /**
- * This method sets the value to the member attribute <b>msgDesc</b>. You
- * cannot set null to the attribute.
- *
- * @param msgDesc
- * Value to set member attribute <b>msgDesc</b>
- */
- public void setMsgDesc(String msgDesc) {
- this.msgDesc = msgDesc;
- }
-
- /**
- * Returns the value for the member attribute <b>msgDesc</b>
- *
- * @return String - value of member attribute <b>msgDesc</b>.
- */
- public String getMsgDesc() {
- return this.msgDesc;
- }
-
- /**
- * This method sets the value to the member attribute <b>messageList</b>.
- * You cannot set null to the attribute.
- *
- * @param messageList
- * Value to set member attribute <b>messageList</b>
- */
- public void setMessageList(List<VMessage> messageList) {
- this.messageList = messageList;
- }
-
- /**
- * Returns the value for the member attribute <b>messageList</b>
- *
- * @return List<VMessage> - value of member attribute <b>messageList</b>.
- */
- public List<VMessage> getMessageList() {
- return this.messageList;
- }
-
- /**
- * This return the bean content in string format
- *
- * @return formatedStr
- */
- public String toString() {
- String str = "VResponse={";
- str += super.toString();
- str += "statusCode={" + statusCode + "} ";
- str += "msgDesc={" + msgDesc + "} ";
- str += "messageList={" + messageList + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
deleted file mode 100644
index 9aa696c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.view;
-
-import java.util.List;
-
-public class VSummary {
-
- protected List<VHost> hosts;
- protected String levels;
- protected String format;
- protected String numberLogs;
- protected String from;
- protected String to;
- protected String includeString;
- protected String excludeString;
-
- public VSummary(){
- includeString = "-";
- excludeString = "-";
- }
-
- public String getIncludeString() {
- return includeString;
- }
-
- public void setIncludeString(String includeString) {
- this.includeString = includeString;
- }
-
- public String getExcludeString() {
- return excludeString;
- }
-
- public void setExcludeString(String excludeString) {
- this.excludeString = excludeString;
- }
-
- public String getFrom() {
- return from;
- }
-
- public void setFrom(String from) {
- this.from = from;
- }
-
- public String getTo() {
- return to;
- }
-
- public void setTo(String to) {
- this.to = to;
- }
-
- public List<VHost> getHosts() {
- return hosts;
- }
-
- public void setHosts(List<VHost> hosts) {
- this.hosts = hosts;
- }
-
- public String getLevels() {
- return levels;
- }
-
- public void setLevels(String levels) {
- this.levels = levels;
- }
-
- public String getFormat() {
- return format;
- }
-
- public void setFormat(String format) {
- this.format = format;
- }
-
- public String getNumberLogs() {
- return numberLogs;
- }
-
- public void setNumberLogs(String numberLogs) {
- this.numberLogs = numberLogs;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
deleted file mode 100644
index 6487f91..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ambari.logsearch.view;
-
-import java.util.Date;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VUserConfig {
-
- protected String id;
- protected String userName;
- protected String filtername;
- protected String values;
-
- List<String> shareNameList;
- String rowType;
-
- boolean isOverwrite;
-
- public VUserConfig(){
- setId(""+new Date().getTime());
- isOverwrite=false;
- }
-
- 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 String getValues() {
- return values;
- }
-
- public void setValues(String values) {
- this.values = values;
- }
-
-
- public List<String> getShareNameList() {
- return shareNameList;
- }
-
- public void setShareNameList(List<String> shareNameList) {
- this.shareNameList = shareNameList;
- }
-
- public String getRowType() {
- return rowType;
- }
-
- public void setRowType(String rowType) {
- this.rowType = rowType;
- }
-
- public boolean isOverwrite() {
- return isOverwrite;
- }
-
- public void setOverwrite(boolean isOverwrite) {
- this.isOverwrite = isOverwrite;
- }
-}
\ 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/view/VUserConfigList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java
deleted file mode 100644
index f6d1662..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.view;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VUserConfigList extends VList {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- protected String name;
- protected Collection<VUserConfig> userConfigList;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Collection<VUserConfig> getUserConfigList() {
- return userConfigList;
- }
-
- public void setUserConfigList(Collection<VUserConfig> historyList) {
- this.userConfigList = historyList;
- }
-
- @Override
- public int getListSize() {
- return userConfigList.size();
- }
-
- @Override
- public List<VUserConfig> getList() {
- return (List<VUserConfig>) userConfigList;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
index 8cd435b..29fd5b2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
@@ -61,7 +61,6 @@ import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHa
import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
import org.apache.hadoop.security.authentication.util.KerberosName;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import org.springframework.stereotype.Component;
public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
private static final Logger logger = LoggerFactory.getLogger(LogsearchKRBAuthenticationFilter.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
index 05104b4..d37e545 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
@@ -27,11 +27,11 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import org.springframework.stereotype.Component;
import javax.inject.Inject;
+import javax.inject.Named;
-@Component
+@Named
public class LogsearchAuthenticationProvider extends
LogsearchAbstractAuthenticationProvider {
private static final Logger logger = Logger
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
index a89b5dd..7e146ac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
+import javax.inject.Named;
import org.apache.ambari.logsearch.common.ExternalServerClient;
import org.apache.ambari.logsearch.common.PropertiesHelper;
@@ -34,14 +35,13 @@ import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
-import org.springframework.stereotype.Component;
/**
*
* Authentication provider to authenticate user from external-server using REST
* call
*/
-@Component
+@Named
public class LogsearchExternalServerAuthenticationProvider extends
LogsearchAbstractAuthenticationProvider {
@@ -152,10 +152,9 @@ public class LogsearchExternalServerAuthenticationProvider extends
*/
@SuppressWarnings("static-access")
private boolean isAllowedRole(String responseJson) {
- String allowedRoleList[] = PropertiesHelper
- .getPropertyStringList(ALLOWED_ROLE_PROP);
+ String allowedRoleList[] = PropertiesHelper.getPropertyStringList(ALLOWED_ROLE_PROP);
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
JSONUtil.getValuesOfKey(responseJson,
PRIVILEGE_INFO.PERMISSION_NAME.toString(), values);
if (values.isEmpty())
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
index dc70b82..51b3547 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
@@ -32,11 +32,11 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.stereotype.Component;
import javax.inject.Inject;
+import javax.inject.Named;
-@Component
+@Named
public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
private static Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
index 52dd66e..ed4d7ef 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
@@ -30,12 +30,12 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.authentication.LdapAuthenticationProvider;
import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
-import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import javax.inject.Named;
-@Component
+@Named
public class LogsearchLdapAuthenticationProvider extends
LogsearchAbstractAuthenticationProvider {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
index 17d099b..400361b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
@@ -27,11 +27,11 @@ import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
-import org.springframework.stereotype.Component;
import javax.inject.Inject;
+import javax.inject.Named;
-@Component
+@Named
public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
private static Logger logger = Logger.getLogger(LogsearchSimpleAuthenticationProvider.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
index 9a44761..c98a482 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
@@ -24,4 +24,3 @@ logsearch.logfeeder.include.default.level=FATAL,ERROR,WARN,INFO,DEBUG,TRACE
#login config
logsearch.login.credentials.file=user_pass.json
logsearch.login.ldap.config=logsearch-admin-site.xml
-logsearch.solr.warming.cron=0 0/10 * * * ?
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl
new file mode 100644
index 0000000..587e366
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl
@@ -0,0 +1,42 @@
+<#--
+ 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.
+-->
+--------------------------------SUMMARY-----------------------------------
+Users = ${usersSummary}
+Resources = ${resourcesSummary}
+
+
+
+
+Users Components/Access
+--------------------------------------------------------------------------
+<#if users??>
+ <#list users as user>
+${user.data}
+ </#list>
+</#if>
+
+
+
+
+
+Resources Components/Access
+--------------------------------------------------------------------------
+<#if resources??>
+ <#list resources as resource>
+${resource.data}
+ </#list>
+</#if>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl
new file mode 100644
index 0000000..8a5e19d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl
@@ -0,0 +1,36 @@
+<#--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+**********************Summary**********************
+Number of Logs : ${numberOfLogs}
+From : ${from}
+To : ${to}
+Host : ${hosts}
+Component : ${components}
+Levels : ${levels}
+Format : ${format}
+
+Included String: [${iString}]
+
+Excluded String: [${eString}]
+
+************************Logs***********************
+2016-09-26 11:49:19,723 WARN MainThread lock.py:60 - Releasing the lock.
+<#if logs??>
+ <#list logs as log>
+${log.data}
+ </#list>
+</#if>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
index 08a8271..5fc4bac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
@@ -89,7 +89,7 @@ define(['require',
return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
},
- getTruncatedLogs : function(token, options){
+ getTruncatedLogs : function(token, options){
var url = Globals.baseURL + 'service/logs/truncated';
options = _.extend({
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
index 4c23290..6d587cd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
@@ -57,7 +57,7 @@ define(['require',
if (params.bundle_id && !params.start_time && !params.end_time) {
var collection = new VNameValueList();
- collection.url = Globals.baseURL + "service/logs/solr/boundarydates";
+ collection.url = Globals.baseURL + "service/logs/boundarydates";
collection.modelAttrName = "vNameValues";
_.extend(collection.queryParams, {
"bundle_id": params.bundle_id
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
index ef6dce5..0822051 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
@@ -98,7 +98,7 @@ define(['require',
pageSize: 9999
}
});
- this.topUsers.url = Globals.baseURL + "audit/logs/users";
+ this.topUsers.url = Globals.baseURL + "audit/logs/resources/10";
this.topUsers.modelAttrName = "graphData";
this.topResources = new VNameValueList([],{
state: {
@@ -106,7 +106,7 @@ define(['require',
pageSize: 9999
}
});
- this.topResources.url = Globals.baseURL + "audit/logs/resources";
+ this.topResources.url = Globals.baseURL + "audit/logs/resources/10";
this.topResources.modelAttrName = "graphData";
//initialize colors
this.colors = (new d3.scale.category20c().range().slice().reverse()).concat(new d3.scale.category20b().range().slice().reverse());
@@ -408,7 +408,7 @@ define(['require',
obj.utcOffset = moment().utcOffset();
obj.startIndex = this.topUsers.state.currentPage * this.topUsers.state.pageSize;
var params = $.param(_.extend({},this.topUsers.queryParams,obj));
- var url = "api/v1/audit/logs/users/export?"+ params;
+ var url = "api/v1/audit/logs/export?"+ params;
window.open(url);
this.onDialogClosed();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
index 4e09e88..371edd2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
@@ -193,7 +193,7 @@ define(['require',
var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
return {
includeQuery: JSON.stringify(obj),
- query: query
+ iMessage: query
}
}
}));
@@ -207,7 +207,7 @@ define(['require',
var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
return {
excludeQuery: JSON.stringify(obj),
- query: query
+ eMessage: query
}
}
}));
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
index 2d3b289..029c25d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
@@ -181,7 +181,7 @@ define(['require',
this.lastComponentLI = $el.data("name");
this.ui.componentsList.find("li").removeClass("active");
$el.addClass("active");
- this.fetchComponentsHost(_.extend({componentName:$el.data("name")},this.searchParams));
+ this.fetchComponentsHost(_.extend({component_name:$el.data("name")},this.searchParams));
},
onNewTabIconClick : function(e){
var $el = $(e.currentTarget),host,component,that=this;
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
index 0e7f1b8..eb73fb8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
@@ -62,7 +62,7 @@ define(['require',
initialize: function(options) {
_.extend(this, _.pick(options,'vent','globalVent','params'));
this.logLevelList = new VLogLevelList();
- this.logLevelList.url = Globals.baseURL + "service/logs/levels/counts/namevalues";
+ this.logLevelList.url = Globals.baseURL + "service/logs/levels/counts";
this.logLevelList.modelAttrName = "vNameValues";
this.bindEvents();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/c7f1e707/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
index 2c7f0aa..9bdf0fa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
@@ -211,10 +211,10 @@ define(['require',
onEditHost : function(e){
var $el = $(e.currentTarget);
$el.hide();
- if($el.data("type") == "host_name"){
- this.showHostSelect2($el.data("component_name"));
+ if($el.data("type") == "host"){
+ this.showHostSelect2($el.data("component"));
}else{
- this.showExpiry($el.data("component_name"));
+ this.showExpiry($el.data("component"));
}
},
hideHostSelect2 : function(forComponent){