ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject [3/9] ambari git commit: AMBARI-16034. Incremental changes to LogSearch to bring it up to date in the trunk (Dharmesh Makwana via oleewere)
Date Mon, 25 Apr 2016 15:14:38 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
index 348ca4a..8dd0fb9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
@@ -37,7 +37,6 @@ import org.apache.ambari.logsearch.view.VBarGraphData;
 import org.apache.ambari.logsearch.view.VHost;
 import org.apache.ambari.logsearch.view.VNameValue;
 import org.apache.ambari.logsearch.view.VSummary;
-import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
@@ -51,108 +50,141 @@ public class BizUtil {
 
   @Autowired
   RESTErrorUtil restErrorUtil;
+  
+  @Autowired
+  StringUtil stringUtil;
 
   public 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;
-    for (String field : fieldsForBlankCaculation) {
-      if (field.length() > maxLengthOfField)
+    if(fieldsForBlankCaculation == null){
+      return "no data";
+    }
+    for (String field : fieldsForBlankCaculation) {  
+      if (!stringUtil.isEmpty(field) && field.length() > maxLengthOfField){
         maxLengthOfField = field.length();
+      }
     }
 
     for (String field : fieldsForBlankCaculation) {
+      if(!stringUtil.isEmpty(field)){
       blankFieldsMap
         .put(field,
           addBlanksToString(
             maxLengthOfField - field.length(), field));
-    }
+      }
+    }   
 
     for (SolrDocument doc : docList) {
+      if (doc != null) {
+        StringBuffer textTowrite = new StringBuffer();
 
-      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");
-      if (textTowrite != null)
+        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 VSummary buildSummaryForLogFile(SolrDocumentList docList) {
     VSummary vsummary = new VSummary();
+    if(docList == null || docList.isEmpty()){
+      return vsummary;
+    }
     int numLogs = 0;
     List<VHost> vHosts = new ArrayList<VHost>();
     vsummary.setHosts(vHosts);
     String levels = "";
     for (SolrDocument doc : docList) {
-      // adding Host and Component appropriately
-      String hostname = (String) doc.getFieldValue("host");
-      String comp = (String) doc.getFieldValue("type");
-      String level = (String) doc.getFieldValue("level");
-      boolean newHost = true;
-      for (VHost host : vHosts) {
-        if (host.getName().equals(hostname)) {
-          newHost = false;
-          host.getComponents().add(comp);
-          break;
+      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 (stringUtil.isEmpty(level)) {
+          level = "";
         }
+        boolean newHost = true;
+        for (VHost host : vHosts) {
+          if (host != null && host.getName().equals(hostname)) {
+            newHost = false;
+            if (stringUtil.isEmpty(comp)) {
+              Set<String> compList = host.getComponents();
+              if (compList != null) {
+                compList.add(comp);
+              }
+            }
+            break;
+          }
+        }
+        if (newHost) {
+          VHost vHost = new VHost();
+          if (!stringUtil.isEmpty(hostname)) {
+            vHost.setName(hostname);
+          }
+          Set<String> component = new LinkedHashSet<String>();
+          if (stringUtil.isEmpty(comp)) {
+            component.add(comp);
+          }
+          vHost.setComponents(component);
+          vHosts.add(vHost);
+        }
+        // getting levels
+        if (!levels.contains(level)) {
+          levels = levels + ", " + level;
+        }
+        numLogs += 1;
       }
-      if (newHost) {
-        VHost vHost = new VHost();
-        vHost.setName(hostname);
-        Set<String> component = new LinkedHashSet<String>();
-        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);
@@ -160,16 +192,19 @@ public class BizUtil {
   }
 
   public String addBlanksToString(int count, String field) {
-    String temp = field;
-    for (int i = 0; i < count; i++) {
-      temp = temp + " ";
+    if (stringUtil.isEmpty(field)) {
+      return field;
+    }
+    if (count > 0) {
+      return String.format("%-" + count + "s", field);
     }
-    return temp;
+    return field;
+
   }
 
   @SuppressWarnings({"unchecked", "rawtypes"})
   public VBarDataList buildSummaryForTopCounts(
-    SimpleOrderedMap<Object> jsonFacetResponse) {
+    SimpleOrderedMap<Object> jsonFacetResponse,String innerJsonKey,String outerJsonKey) {
 
     VBarDataList vBarDataList = new VBarDataList();
 
@@ -178,7 +213,7 @@ public class BizUtil {
       logger.info("Solr document list in null");
       return vBarDataList;
     }
-    List<Object> userList = jsonFacetResponse.getAll("Users");
+    List<Object> userList = jsonFacetResponse.getAll(outerJsonKey);
     if (userList.isEmpty()) {
       return vBarDataList;
     }
@@ -190,93 +225,51 @@ public class BizUtil {
     }
     List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap
       .get("buckets");
-    for (SimpleOrderedMap usageMap : userUsageList) {
-      VBarGraphData vBarGraphData = new VBarGraphData();
-      String userName = (String) usageMap.get("val");
-      vBarGraphData.setName(userName);
-      SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get("Repo");
-      List<VNameValue> componetCountList = new ArrayList<VNameValue>();
-      List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap
-        .get("buckets");
-      for (SimpleOrderedMap repoUsageMap : repoUsageList) {
-        VNameValue componetCount = new VNameValue();
-        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);
-      }
-      vBarGraphData.setDataCounts(componetCountList);
-      dataList.add(vBarGraphData);
-
-    }
-    vBarDataList.setGraphData(dataList);
-    logger.info("getting graph data");
-
-    return vBarDataList;
-  }
-
-  @SuppressWarnings({"unchecked", "rawtypes"})
-  public VBarDataList buildSummaryForResourceCounts(
-    SimpleOrderedMap<Object> jsonFacetResponse) {
-
-    VBarDataList vBarDataList = new VBarDataList();
-
-    Collection<VBarGraphData> dataList = new ArrayList<VBarGraphData>();
-    if (jsonFacetResponse == null) {
-      logger.info("Solr document list in null");
+    if(userUsageList == null){
       return vBarDataList;
     }
-    List<Object> userList = jsonFacetResponse.getAll("x");
-    if (userList.isEmpty()) {
-      return vBarDataList;
-    }
-    SimpleOrderedMap<Map<String, Object>> userMap = (SimpleOrderedMap<Map<String, Object>>) userList
-      .get(0);
-    if (userMap == null) {
-      logger.info("No top user details found");
-      return vBarDataList;
-    }
-    List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap
-      .get("buckets");
     for (SimpleOrderedMap usageMap : userUsageList) {
-      VBarGraphData vBarGraphData = new VBarGraphData();
-      String userName = (String) usageMap.get("val");
-      vBarGraphData.setName(userName);
-      SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get("y");
-      List<VNameValue> componetCountList = new ArrayList<VNameValue>();
-      List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap
-        .get("buckets");
-      for (SimpleOrderedMap repoUsageMap : repoUsageList) {
-        VNameValue componetCount = new VNameValue();
-        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);
-      }
-      vBarGraphData.setDataCounts(componetCountList);
-      dataList.add(vBarGraphData);
+      if (usageMap != null) {
+        VBarGraphData vBarGraphData = new VBarGraphData();
+        String userName = (String) usageMap.get("val");
+        if (!stringUtil.isEmpty(userName)) {
+          vBarGraphData.setName(userName);
+        }
+        SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get(innerJsonKey);
+        List<VNameValue> componetCountList = new ArrayList<VNameValue>();
+        List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap
+            .get("buckets");
+        if (repoMap != null) {
+          for (SimpleOrderedMap repoUsageMap : repoUsageList) {
+            VNameValue componetCount = new VNameValue();
+            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);
+          }
+          vBarGraphData.setDataCounts(componetCountList);
+          dataList.add(vBarGraphData);
+        }
+      }}
     vBarDataList.setGraphData(dataList);
     logger.info("getting graph data");
 
     return vBarDataList;
   }
-
-  public HashMap<String, String> sortHashMapByValuesD(
+  
+  public HashMap<String, String> sortHashMapByValues(
     HashMap<String, String> passedMap) {
+    if(passedMap == null ){
+      return passedMap;
+    }
     HashMap<String, String> sortedMap = new LinkedHashMap<String, String>();
     List<String> mapValues = new ArrayList<String>(passedMap.values());
     HashMap<String, String> invertedKeyValue = new HashMap<String, String>();
@@ -291,7 +284,6 @@ public class BizUtil {
       @SuppressWarnings("rawtypes")
       Map.Entry pair = (Map.Entry) it.next();
       invertedKeyValue.put("" + pair.getValue(), "" + pair.getKey());
-      it.remove();
     }
 
     for (String valueOfKey : mapValues) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/ConfigUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/ConfigUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/ConfigUtil.java
index 036d5d1..36dcc96 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/ConfigUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/ConfigUtil.java
@@ -55,14 +55,16 @@ public class ConfigUtil {
     if (columnMappingArray != null && columnMappingArray.length > 0) {
       for (String columnMapping : columnMappingArray) {
         String mapping[] = columnMapping.split(":");
-        String solrField = mapping[0];
-        String uiField = mapping[1];
-        String modifiedUIField = getModifiedUIField(uiField);
-        columnMappingMap.put(
-          solrField + LogSearchConstants.SOLR_SUFFIX,
-          modifiedUIField);
-        columnMappingMap.put(modifiedUIField
-          + LogSearchConstants.UI_SUFFIX, solrField);
+        if (mapping.length > 1) {
+          String solrField = mapping[0];
+          String uiField = mapping[1];
+
+          String modifiedUIField = getModifiedUIField(uiField);
+          columnMappingMap.put(solrField + LogSearchConstants.SOLR_SUFFIX,
+              modifiedUIField);
+          columnMappingMap.put(modifiedUIField + LogSearchConstants.UI_SUFFIX,
+              solrField);
+        }
       }
     }
   }
@@ -71,9 +73,9 @@ public class ConfigUtil {
     String modifiedUIField = "";
     String temp = serviceLogsColumnMapping.get(uiField
       + LogSearchConstants.UI_SUFFIX);
-    if (temp == null)
+    if (temp == null){
       return uiField;
-    else {
+    }else {
       String lastChar = uiField.substring(uiField.length() - 1,
         uiField.length());
       int k = 1;
@@ -118,6 +120,10 @@ public class ConfigUtil {
     try {
       JSONObject jsonObject = new JSONObject(responseString);
       JSONArray jsonArrayList = jsonObject.getJSONArray("fields");
+      
+      if(jsonArrayList == null){
+        return;
+      }
 
       for (int i = 0; i < jsonArrayList.length(); i++) {
         JSONObject explrObject = jsonArrayList.getJSONObject(i);
@@ -167,8 +173,9 @@ public class ConfigUtil {
   private static boolean isExclude(String name, String excludeArray[]) {
     if (excludeArray != null && excludeArray.length > 0) {
       for (String exclude : excludeArray) {
-        if (name.equals(exclude))
+        if (name.equals(exclude)){
           return true;
+        }
       }
     }
     return false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 77dd536..7425aaa 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
@@ -46,29 +46,34 @@ public class DateUtil {
 
   }
 
-  public String addOffsetToDate(String date, Long utcOffset,
-                                String dateFormate) {
-    if (date == null || date.equals("")) {
+  public String addOffsetToDate(String date, Long utcOffset, String dateFormat) {
+    if (stringUtil.isEmpty(date)) {
+      logger.debug("input date is empty or null.");
       return null;
     }
     if (utcOffset == null) {
+      logger
+          .debug("Utc offset is null, Return input date without adding offset.");
+      return date;
+    }
+    if (stringUtil.isEmpty(dateFormat)) {
+      logger
+          .debug("dateFormat is null or empty, Return input date without adding offset.");
       return date;
     }
     String retDate = "";
-
     try {
       String modifiedDate = date;
       if (date.contains(".")) {
         modifiedDate = date.replace(".", ",");
       }
-      SimpleDateFormat formatter = new SimpleDateFormat(dateFormate, Locale.ENGLISH);
-      Date startDate = (Date) formatter.parse(modifiedDate);
-      long toWithOffset = getTimeWithOffset(startDate, utcOffset,
-        dateFormate);
+      SimpleDateFormat formatter = new SimpleDateFormat(dateFormat,
+          Locale.ENGLISH);
+      Date startDate = formatter.parse(modifiedDate);
+      long toWithOffset = getTimeWithOffset(startDate, utcOffset, dateFormat);
       Calendar calendar = Calendar.getInstance();
       calendar.setTimeInMillis(toWithOffset);
       retDate = formatter.format(calendar.getTime());
-
     } catch (Exception e) {
       logger.error(e);
     }
@@ -90,7 +95,6 @@ public class DateUtil {
       GregorianCalendar utc = new GregorianCalendar(gmtTimeZone);
       utc.setTimeInMillis(epoh);
       utc.add(Calendar.MILLISECOND, -offset);
-
       return utc.getTime();
     } catch (Exception ex) {
       return null;
@@ -124,6 +128,14 @@ public class DateUtil {
 
     return time;
   }
+  
+  public Date getTodayFromDate() {
+    Calendar c = new GregorianCalendar();
+    c.set(Calendar.HOUR_OF_DAY, 0); 
+    c.set(Calendar.MINUTE, 0);
+    c.set(Calendar.SECOND, 0);
+    return c.getTime();
+  }
 
   public Date addHoursToDate(Date date, int hours) {
     GregorianCalendar greorianCalendar = new GregorianCalendar();
@@ -168,6 +180,9 @@ public class DateUtil {
   }
 
   public String convertDateWithMillisecondsToSolrDate(Date date) {
+    if (date == null) {
+      return "";
+    }
     SimpleDateFormat formatter = new SimpleDateFormat(
       LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z, Locale.ENGLISH);
     TimeZone timeZone = TimeZone.getTimeZone("GMT");
@@ -190,12 +205,10 @@ public class DateUtil {
   }
 
   public Date convertStringToDate(String dateString) {
-
     SimpleDateFormat formatter = new SimpleDateFormat(
       LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z, Locale.ENGLISH);
     TimeZone timeZone = TimeZone.getTimeZone("GMT");
     formatter.setTimeZone(timeZone);
-
     try {
       return formatter.parse(dateString);
     } catch (ParseException e) {
@@ -203,4 +216,21 @@ public class DateUtil {
     }
     return null;
   }
+  
+  public boolean isDateValid(String value) {
+    if(stringUtil.isEmpty(value)){
+      return false;
+    }
+    Date date = null;
+    try {
+        SimpleDateFormat sdf = new SimpleDateFormat(LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
+        date = sdf.parse(value);
+        if (!value.equals(sdf.format(date))) {
+            date = null;
+        }
+    } catch (Exception ex) {
+      //do nothing
+    }
+    return date != null;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 7981cb1..ab52b06 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
@@ -29,7 +29,6 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.manager.UserConfigMgr;
 import org.apache.ambari.logsearch.view.VHost;
 import org.apache.ambari.logsearch.view.VSummary;
 import org.apache.log4j.Logger;
@@ -58,7 +57,7 @@ public class FileUtil {
         + vsummary.getTo() + "\n";
 
       List<VHost> hosts = vsummary.getHosts();
-      String blankCharacterForHost = "        ";
+      String blankCharacterForHost = String.format("%-8s", "");
       int numberHost = 0;
       for (VHost host : hosts) {
         numberHost += 1;
@@ -66,24 +65,27 @@ public class FileUtil {
         String c = "";
         Set<String> comp = host.getComponents();
         boolean zonetar = true;
-        for (String component : comp) {
-          if (zonetar) {
-            c = component;
-            zonetar = false;
-          } else {
-            c = c + ", " + component;
+        if (comp != null) {
+          for (String component : comp) {
+            if (zonetar) {
+              c = component;
+              zonetar = false;
+            } else {
+              c = c + ", " + component;
+            }
           }
         }
-        if (numberHost > 9)
-          blankCharacterForHost = "       ";
-        else if (numberHost > 99)
-          blankCharacterForHost = "      ";
-        else if (numberHost > 999)
-          blankCharacterForHost = "     ";
-        else if (numberHost > 9999)
-          blankCharacterForHost = "    ";
-        else if (numberHost > 99999)
-          blankCharacterForHost = "   ";
+        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
@@ -95,9 +97,9 @@ public class FileUtil {
         }
 
       }
-      mainExportedFile = mainExportedFile + "Levels         : "
+      mainExportedFile = mainExportedFile + "Levels"+String.format("%-9s", blankCharacterForHost)+": "
         + vsummary.getLevels() + "\n";
-      mainExportedFile = mainExportedFile + "Format         : "
+      mainExportedFile = mainExportedFile + "Format"+String.format("%-9s", blankCharacterForHost)+": "
         + vsummary.getFormat() + "\n";
       mainExportedFile = mainExportedFile + "\n";
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/JSONUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/JSONUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/JSONUtil.java
index 417a0b1..8535039 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/JSONUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/JSONUtil.java
@@ -131,6 +131,9 @@ public class JSONUtil {
 
   @SuppressWarnings("unchecked")
   public List<HashMap<String, Object>> jsonToMapObjectList(String jsonStr) {
+    if (stringUtil.isEmpty(jsonStr)) {
+      return null;
+    }
     ObjectMapper mapper = new ObjectMapper();
     try {
       Object tempObject = mapper.readValue(jsonStr,
@@ -211,7 +214,7 @@ public class JSONUtil {
    * @param outputFile
    * @param beautify
    */
-  public void writeJSONInFile(String jsonStr, File outputFile,
+  public synchronized void writeJSONInFile(String jsonStr, File outputFile,
                               boolean beautify) {
     FileWriter fileWriter = null;
     if (outputFile == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/QueryBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/QueryBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/QueryBase.java
index 4f65cf6..d1e0a86 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/QueryBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/QueryBase.java
@@ -19,22 +19,27 @@
 
 package org.apache.ambari.logsearch.util;
 
+import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.solr.client.solrj.SolrQuery;
+import org.springframework.beans.factory.annotation.Autowired;
 
 public class QueryBase {
+  
+  @Autowired
+  StringUtil stringUtil;
 
   //Solr Facet Methods
   public void setFacetField(SolrQuery solrQuery, String facetField) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
-    solrQuery.set("facet.field", facetField);
+    solrQuery.set(LogSearchConstants.FACET_FIELD, facetField);
     setFacetLimit(solrQuery, -1);
   }
 
   public void setJSONFacet(SolrQuery solrQuery, String jsonQuery) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
-    solrQuery.set("json.facet", jsonQuery);
+    solrQuery.set(LogSearchConstants.FACET_JSON_FIELD, jsonQuery);
     setFacetLimit(solrQuery, -1);
   }
 
@@ -47,8 +52,8 @@ public class QueryBase {
                             String... hirarchy) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
-    solrQuery.set("facet.pivot", hirarchy);
-    solrQuery.set("facet.pivot.mincount", mincount);
+    solrQuery.set(LogSearchConstants.FACET_PIVOT, hirarchy);
+    solrQuery.set(LogSearchConstants.FACET_PIVOT_MINCOUNT, mincount);
     setFacetLimit(solrQuery, -1);
   }
 
@@ -56,11 +61,11 @@ public class QueryBase {
                            String from, String to, String unit) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
-    solrQuery.set("facet.date", facetField);
-    solrQuery.set("facet.date.start", from);
-    solrQuery.set("facet.date.end", to);
-    solrQuery.set("facet.date.gap", unit);
-    solrQuery.set("facet.mincount", 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);
   }
 
@@ -68,11 +73,11 @@ public class QueryBase {
                             String from, String to, String unit) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
-    solrQuery.set("facet.range", facetField);
-    solrQuery.set("facet.range.start", from);
-    solrQuery.set("facet.range.end", to);
-    solrQuery.set("facet.range.gap", unit);
-    solrQuery.set("facet.mincount", 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);
   }
 
@@ -82,26 +87,28 @@ public class QueryBase {
 
   //Solr Group Mehtods
   public void setGroupField(SolrQuery solrQuery, String groupField, int rows) {
-    solrQuery.set("group", true);
-    solrQuery.set("group.field", groupField);
-    solrQuery.set("group.main", true);
+    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 void setMainQuery(SolrQuery solrQuery, String query) {
     String defalultQuery = "*:*";
-    if (query == null || query.isEmpty())
+    if (stringUtil.isEmpty(query)){
       solrQuery.setQuery(defalultQuery);
-    else
+    }else{
       solrQuery.setQuery(query);
+    }
   }
 
   public void setStart(SolrQuery solrQuery, int start) {
-    if (start > 0) {
+    int defaultStart = 0;
+    if (start > defaultStart) {
       solrQuery.setStart(start);
     } else {
-      solrQuery.setStart(0);
+      solrQuery.setStart(defaultStart);
     }
   }
 
@@ -111,17 +118,21 @@ public class QueryBase {
       solrQuery.setRows(rows);
     } else {
       solrQuery.setRows(0);
-      solrQuery.remove("sort");
+      solrQuery.remove(LogSearchConstants.SORT);
     }
   }
 
   //Solr Facet Methods
-  public void setFacetField(SolrQuery solrQuery, String facetField, int minCount) {
+  public void setFacetFieldWithMincount(SolrQuery solrQuery, String facetField, int minCount) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
-    solrQuery.set("facet.field", facetField);
-    solrQuery.set("facet.mincount", minCount);
+    solrQuery.set(LogSearchConstants.FACET_FIELD, facetField);
+    solrQuery.set(LogSearchConstants.FACET_MINCOUNT, minCount);
     setFacetLimit(solrQuery, -1);
   }
+  
+  public void setFl(SolrQuery solrQuery,String field){
+    solrQuery.set(LogSearchConstants.FL, field);
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 a3cb855..e64f742 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
@@ -34,9 +34,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class RESTErrorUtil {
 
-  static final Logger logger = Logger.getLogger("org.apache.ambari.logsearch");
-
-  public static final String TRUE = "true";
+  private static Logger logger = Logger.getLogger(RESTErrorUtil.class);
 
   public WebApplicationException createRESTException(VResponse response) {
     return createRESTException(response, HttpServletResponse.SC_BAD_REQUEST);

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 6fa513d..21b09d3 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
@@ -22,12 +22,17 @@ package org.apache.ambari.logsearch.util;
 import java.util.Collection;
 import java.util.Locale;
 
+import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
 public class SolrUtil {
   static final Logger logger = Logger.getLogger("org.apache.ambari.logsearch");
+  
+  @Autowired
+  StringUtil stringUtil;
 
   public String setField(String fieldName, String value) {
     if (value == null || value.trim().length() == 0) {
@@ -79,107 +84,199 @@ public class SolrUtil {
   }
 
   /**
-   * @param fuzzyStr
+   * @param wildCard
    * @param string
    * @param searchList
    * @return
    */
-  public String orList(String fieldName, String[] valueList, String fuzzyStr) {
+  public String orList(String fieldName, String[] valueList, String wildCard) {
     if (valueList == null || valueList.length == 0) {
       return "";
     }
-    String expr = "";
+    
+    if(stringUtil.isEmpty(wildCard)){
+      wildCard = "";
+    }
+    
+    StringBuilder expr = new StringBuilder();
     int count = -1;
     for (String value : valueList) {
       count++;
       if (count > 0) {
-        expr += " OR ";
+        expr.append(" OR ");
       }
-      expr += fieldName + ":*" + value + "*";
+      
+      expr.append( fieldName + ":"+ wildCard + value + wildCard);
 
     }
     if (valueList.length == 0) {
-      return expr;
+      return expr.toString();
     } else {
       return "(" + expr + ")";
     }
 
   }
-  
+
   /**
-   * @param fuzzyStr
+   * @param wildCard
    * @param string
    * @param searchList
    * @return
    */
-  public String orList(String fieldName, String[] valueList) {
+  public String andList(String fieldName, String[] valueList, String wildCard) {
     if (valueList == null || valueList.length == 0) {
       return "";
     }
-    String expr = "";
+    
+    if(stringUtil.isEmpty(wildCard)){
+      wildCard = "";
+    }
+    
+    StringBuilder expr = new StringBuilder();
     int count = -1;
     for (String value : valueList) {
       count++;
       if (count > 0) {
-        expr += " OR ";
+        expr.append(" AND ");
       }
-      expr += fieldName + ":" + value;
+      
+      expr.append( fieldName + ":"+ wildCard + value + wildCard);
 
     }
     if (valueList.length == 0) {
-      return expr;
+      return expr.toString();
     } else {
       return "(" + expr + ")";
     }
 
   }
-  
-  
 
   /**
-   * @param fuzzyStr
-   * @param string
-   * @param searchList
+   * Copied from Solr ClientUtils.escapeQueryChars and removed escaping *
+   * 
+   * @param s
    * @return
    */
-  public String andList(String fieldName, String[] valueList, String fuzzyStr) {
-    if (valueList == null || valueList.length == 0) {
-      return "";
+  public 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);
+          }
+        }
+        // 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)) {
+          sb.append('\\');
+        }
+        sb.append(c);
+      }
     }
-    String expr = "";
-    int count = -1;
-    for (String value : valueList) {
-      count++;
-      if (count > 0) {
-        expr += " AND ";
+    return sb.toString();
+  }
+
+  public 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;
       }
-      expr += fieldName + ":*" + value + "*";
     }
-    if (valueList.length == 0) {
-      return expr;
-    } else {
-      return "(" + expr + ")";
+    if (!isSingleWord) {
+      newSearch = "\"" + newSearch + "\"";
     }
 
+    return newSearch;
+  }
+
+  public String escapeForStandardTokenizer(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 String escapeForKeyTokenizer(String search) {
+    if (search.startsWith("*") && search.endsWith("*")
+        && !stringUtil.isEmpty(search)) {
+      // Remove the * from both the sides
+      if (search.length() > 1) {
+        search = search.substring(1, search.length() - 1);
+      }else{
+        //search string have only * 
+        search="";
+      }
+    }
+    // Escape the string
+    search = escapeQueryChars(search);
+
+    // Add the *
+    return "*" + search + "*";
+  }
+
+  /**
+   * This is a special case scenario to handle log_message for wild card
+   * scenarios
+   * 
+   * @param search
+   * @return
+   */
+  public String escapeForLogMessage(String field, 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);
+    }
+    return field + ":" + search;
   }
 
   public String makeSolrSearchString(String search) {
     String newString = search.trim();
     String newSearch = newString.replaceAll(
-        "(?=[]\\[+&|!(){}^~*=$@%?:.\\\\])", "\\\\");
+        "(?=[]\\[+&|!(){},:\"^~/=$@%?:.\\\\])", "\\\\");
     newSearch = newSearch.replace("\n", "*");
     newSearch = newSearch.replace("\t", "*");
     newSearch = newSearch.replace("\r", "*");
-    newSearch = newSearch.replace(" ", "\\ ");
     newSearch = newSearch.replace("**", "*");
     newSearch = newSearch.replace("***", "*");
     return "*" + newSearch + "*";
   }
-  
+
   public String makeSolrSearchStringWithoutAsterisk(String search) {
     String newString = search.trim();
     String newSearch = newString.replaceAll(
-        "(?=[]\\[+&|!(){}^\"~=$@%?:.\\\\])", "\\\\");
+        "(?=[]\\[+&|!(){}^\"~=/$@%?:.\\\\])", "\\\\");
     newSearch = newSearch.replace("\n", "*");
     newSearch = newSearch.replace("\t", "*");
     newSearch = newSearch.replace("\r", "*");
@@ -190,13 +287,13 @@ public class SolrUtil {
   }
 
   public String makeSearcableString(String search) {
-    if(search == null || search.isEmpty())
+    if (search == null || search.isEmpty()){
       return "";
+    }
     String newSearch = search.replaceAll("[\\t\\n\\r]", " ");
-    newSearch = newSearch.replaceAll(
-        "(?=[]\\[+&|!(){}^~*=$/@%?:.\\\\-])", "\\\\");
+    newSearch = newSearch.replaceAll("(?=[]\\[+&|!(){}^~*=$/@%?:.\\\\-])",
+        "\\\\");
 
     return newSearch.replace(" ", "\\ ");
   }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/StringUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/StringUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/StringUtil.java
index 9a21e6a..de83e7e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/StringUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/StringUtil.java
@@ -20,16 +20,12 @@
 package org.apache.ambari.logsearch.util;
 
 import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
 public class StringUtil {
   
-  static Logger logger = Logger.getLogger(StringUtil.class);
-  
-  @Autowired
-  RESTErrorUtil restErrorUtil;
+  private static  Logger logger = Logger.getLogger(StringUtil.class);
   
   public boolean isEmpty(String str) {
     return str == null || str.trim().length() == 0;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/XMLPropertiesUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/XMLPropertiesUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/XMLPropertiesUtil.java
index ea041dc..ff80e73 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/XMLPropertiesUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/XMLPropertiesUtil.java
@@ -41,45 +41,44 @@ public class XMLPropertiesUtil extends DefaultPropertiesPersister {
 
   @Override
   public void loadFromXml(Properties properties, InputStream inputStream)
-    throws IOException {
+      throws IOException {
     try {
       DocumentBuilderFactory xmlDocumentBuilderFactory = DocumentBuilderFactory
-        .newInstance();
+          .newInstance();
       xmlDocumentBuilderFactory.setIgnoringComments(true);
       xmlDocumentBuilderFactory.setNamespaceAware(true);
       DocumentBuilder xmlDocumentBuilder = xmlDocumentBuilderFactory
-        .newDocumentBuilder();
+          .newDocumentBuilder();
       Document xmlDocument = xmlDocumentBuilder.parse(inputStream);
-      xmlDocument.getDocumentElement().normalize();
-
-      NodeList nList = xmlDocument.getElementsByTagName("property");
-
-      for (int temp = 0; temp < nList.getLength(); temp++) {
-
-        Node nNode = nList.item(temp);
-
-        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
-
-          Element eElement = (Element) nNode;
-
-          String propertyName = "";
-          String propertyValue = "";
-          if (eElement.getElementsByTagName("name").item(0) != null) {
-            propertyName = eElement.getElementsByTagName("name")
-              .item(0).getTextContent().trim();
-          }
-          if (eElement.getElementsByTagName("value").item(0) != null) {
-            propertyValue = eElement.getElementsByTagName("value")
-              .item(0).getTextContent().trim();
+      if (xmlDocument != null) {
+        xmlDocument.getDocumentElement().normalize();
+        NodeList nList = xmlDocument.getElementsByTagName("property");
+        if (nList != null) {
+          for (int temp = 0; temp < nList.getLength(); temp++) {
+            Node nNode = nList.item(temp);
+            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
+              Element eElement = (Element) nNode;
+              String propertyName = "";
+              String propertyValue = "";
+              if (eElement.getElementsByTagName("name") != null
+                  && eElement.getElementsByTagName("name").item(0) != null) {
+                propertyName = eElement.getElementsByTagName("name").item(0)
+                    .getTextContent().trim();
+              }
+              if (eElement.getElementsByTagName("value") != null
+                  && eElement.getElementsByTagName("value").item(0) != null) {
+                propertyValue = eElement.getElementsByTagName("value").item(0)
+                    .getTextContent().trim();
+              }
+              if (propertyName != null && !propertyName.isEmpty()) {
+                properties.put(propertyName, propertyValue);
+              }
+            }
           }
-
-          properties.put(propertyName, propertyValue);
-
         }
-        // logger.info("ranger site properties loaded successfully.");
       }
     } catch (Exception e) {
-      logger.error("Error loading : ", e);
+      logger.error("Error loading xml properties ", e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
index 9e88bd5..b13946c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
@@ -29,7 +29,11 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.FIELD)
 public class VBarDataList {
-  Collection<VBarGraphData> graphData = new ArrayList<VBarGraphData>();
+  protected  Collection<VBarGraphData> graphData;
+
+  public VBarDataList() {
+    graphData = new ArrayList<VBarGraphData>();
+  }
 
   public Collection<VBarGraphData> getGraphData() {
     return graphData;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
index ed04db7..f105478 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
@@ -37,10 +37,11 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
 public class VCountList extends VList {
   private static final long serialVersionUID = 1L;
 
-  List<VCount> vCounts = new ArrayList<VCount>();
+  protected List<VCount> vCounts;
 
   public VCountList() {
     super();
+    vCounts = new ArrayList<VCount>();
   }
 
   public VCountList(List<VCount> logList) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
index 25f44fc..5e6c3fa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
@@ -35,10 +35,11 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
 public class VGroupList extends VList {
   private static final long serialVersionUID = 1L;
 
-  SolrDocumentList groupList = new SolrDocumentList();
+  protected SolrDocumentList groupList;
 
   public VGroupList() {
     super();
+    groupList = new SolrDocumentList();
   }
 
   public VGroupList(SolrDocumentList logList) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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
index b157adc..da2fbdd 100644
--- 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
@@ -22,8 +22,8 @@ package org.apache.ambari.logsearch.view;
 import java.util.Set;
 
 public class VHost {
-  String name;
-  Set<String> components;
+  protected String name;
+  protected Set<String> components;
 
   public String getName() {
     return name;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
index d8bdbfb..adbd6e0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
@@ -80,10 +80,11 @@ public class VNameValue implements java.io.Serializable {
    *            Value to set member attribute <b>value</b>
    */
   public void setValue(String value) {
-    if(value.contains(".") && (value.contains("e") || value.contains("E")))
+    if(value.contains(".") && (value.contains("e") || value.contains("E"))){
       this.value=getExponentialValueReplaced(value);
-    else
+    }else{
       this.value = value;
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
index dc5c86c..e95249d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
@@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.FIELD)
 public class VNameValueList extends VList {
   private static final long serialVersionUID = 1L;
-  List<VNameValue> vNameValues = new ArrayList<VNameValue>();
+  protected List<VNameValue> vNameValues = new ArrayList<VNameValue>();
 
   public VNameValueList() {
     super();

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
index 0cd10a2..78f32ce 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
@@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.FIELD)
 public class VNodeList extends VList {
   private static final long serialVersionUID = 1L;
-  List<VNode> vNodeList = new ArrayList<VNode>();
+  protected List<VNode> vNodeList = new ArrayList<VNode>();
 
   public List<VNode> getvNodeList() {
     return vNodeList;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
index 193b522..55cc089 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
@@ -35,10 +35,11 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
 public class VSolrLogList extends VList {
   private static final long serialVersionUID = 1L;
 
-  SolrDocumentList logList = new SolrDocumentList();
+  protected SolrDocumentList logList;
 
   public VSolrLogList() {
     super();
+    logList = new SolrDocumentList();
   }
 
   public VSolrLogList(SolrDocumentList logList) {
@@ -52,8 +53,9 @@ public class VSolrLogList extends VList {
 
   @Override
   public int getListSize() {
-    if (logList != null)
+    if (logList != null){
       return logList.size();
+    }
     return 0;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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
index 92b40b8..9aa696c 100644
--- 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
@@ -22,14 +22,14 @@ import java.util.List;
 
 public class VSummary {
 
-  List<VHost> hosts;
-  String levels;
-  String format;
-  String numberLogs;
-  String from;
-  String to;
-  String includeString;
-  String excludeString;
+  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 = "-";

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
index ad1ff5c..b8606d0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
@@ -23,13 +23,13 @@ import java.util.List;
 
 public class VSummaryCount {
 
-  String level;
+  protected String level;
 
-  List<String> cricticalMsg;
+  protected List<String> cricticalMsg;
 
-  List<String> compName;
+  protected List<String> compName;
 
-  List<Long> countMsg;
+  protected List<Long> countMsg;
 
   public String getLevel() {
     return level;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
index 3d8e262..fcab0b7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
@@ -24,7 +24,7 @@ import java.util.Collection;
 
 public class VSummaryCountList {
 
-  Collection<VSummaryCount> countList = new ArrayList<VSummaryCount>();
+  protected Collection<VSummaryCount> countList = new ArrayList<VSummaryCount>();
 
   public Collection<VSummaryCount> getCountList() {
     return countList;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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
index 075df65..55ec1c0 100644
--- 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
@@ -29,11 +29,11 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.FIELD)
 public class VUserConfig {
-  String id;
-  String userName;
 
-  String filterName;
-  String values;
+  protected String id;
+  protected String userName;
+  protected String filterName;
+  protected String values;
   
   List<String> shareNameList;
   String rowType;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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
index 3fc9d0d..f6d1662 100644
--- 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
@@ -34,8 +34,12 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.FIELD)
 public class VUserConfigList extends VList {
-  String name;
-  Collection<VUserConfig> userConfigList;
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+  protected String name;
+  protected Collection<VUserConfig> userConfigList;
 
   public String getName() {
     return name;

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
index c90f96d..9fe82ba 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
@@ -35,7 +35,7 @@ public class LogsearchLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler
     @Override
     public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
       throws IOException, ServletException {
-  logger.debug("AtlasLogoutSuccessHandler ::: onLogoutSuccess");
+  logger.debug("LogsearchLogoutSuccessHandler ::: onLogoutSuccess");
 //  super.onLogoutSuccess(request, response, authentication);
   response.sendRedirect("/login.jsp");
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
index ef6a410..fc6a594 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
@@ -27,6 +27,6 @@ public class SpringEventListener implements ApplicationListener<AbstractAuthenti
 
   @Override
   public void onApplicationEvent(AbstractAuthenticationEvent event) {
-    logger.info(" On Application onApplicationEvent  SpringEventListener");
+    logger.trace(" Inside onApplicationEvent  SpringEventListener");
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
index cc04821..157fdfc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
@@ -36,9 +36,7 @@ public abstract class LogsearchAbstractAuthenticationProvider implements Authent
 
   protected enum AUTH_METHOD {
     LDAP, FILE, SIMPLE
-  }
-
-  ;
+  };
 
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 453db61..f29d08f 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
@@ -127,11 +127,11 @@ public class LogsearchAuthenticationProvider extends
    * @return
    */
   public Authentication doAuth(Authentication authentication, AUTH_METHOD authMethod) {
-    if (authMethod.equals(AUTH_METHOD.LDAP) && ldapAuthenticationProvider.isEnable()) {
+    if (authMethod.equals(AUTH_METHOD.LDAP)) {
       authentication = ldapAuthenticationProvider.authenticate(authentication);
-    } else if (authMethod.equals(AUTH_METHOD.FILE) && fileAuthenticationProvider.isEnable()) {
+    } else if (authMethod.equals(AUTH_METHOD.FILE)) {
       authentication = fileAuthenticationProvider.authenticate(authentication);
-    } else if (authMethod.equals(AUTH_METHOD.SIMPLE) && simpleAuthenticationProvider.isEnable()) {
+    } else if (authMethod.equals(AUTH_METHOD.SIMPLE)) {
       authentication = simpleAuthenticationProvider.authenticate(authentication);
     } else {
       logger.error("Invalid authentication method :" + authMethod.name());

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 91cc556..a5ff295 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
@@ -50,6 +50,10 @@ public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthen
 
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+    if (!this.isEnable()) {
+      logger.debug("File auth is disabled.");
+      return authentication;
+    }
     String username = authentication.getName();
     String password = (String) authentication.getCredentials();
     if (stringUtil.isEmpty(username)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 9d9f7e4..2212a5a 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
@@ -53,6 +53,10 @@ public class LogsearchLdapAuthenticationProvider extends
   @Override
   public Authentication authenticate(Authentication authentication)
     throws AuthenticationException {
+    if (!this.isEnable()) {
+      logger.debug("Ldap auth is disabled");
+      return authentication;
+    }
     try {
       LdapAuthenticationProvider authProvider = loadLdapAuthenticationProvider();
       if (authProvider != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 88e41d2..4dfc30a 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
@@ -39,6 +39,10 @@ public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuth
 
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+    if (!this.isEnable()) {
+      logger.debug("Simple auth is disabled");
+      return authentication;
+    }
     String username = authentication.getName();
     String password = (String) authentication.getCredentials();
     username = StringEscapeUtils.unescapeHtml(username);

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 7ce120e..8400cad 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
@@ -35,6 +35,7 @@ servicelog.column.mapping=bundle_id:Bundle Id,thread_name:Thread,log_emessage:me
 auditlog.column.mapping=access:Access Type,reqUser:User,enforcer:Access Enfocer,ip:Client IP
 
 #login method
+#Note: Simple will be supported only if both file and ldap is disabled.
 logsearch.auth.file.enable=true
 logsearch.auth.ldap.enable=false
 logsearch.auth.simple.enable=false

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
index 02207df..ad96558 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
@@ -18,7 +18,7 @@
 		</layout>
 	</appender>
 
-	<appender name="rolling_file" class="org.apache.log4j.RollingFileAppender">
+	<!-- <appender name="rolling_file" class="org.apache.log4j.RollingFileAppender">
 		<param name="file" value="logs/logsearch-app.log" />
 		<param name="Threshold" value="info" />
 		<param name="append" value="true" />
@@ -51,7 +51,40 @@
 			<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
 		</layout>
 	</appender>
+ -->
 
+<!-- logsearch appender config for the all above appender -->
+
+ <appender name="rolling_file_json"
+  class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+  <param name="file" value="logs/logsearch-app.json" />
+  <param name="Threshold" value="info" />
+  <param name="append" value="true" />
+  <param name="maxFileSize" value="10MB" />
+  <param name="maxBackupIndex" value="10" />
+  <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+</appender>
+
+  <appender name="audit_rolling_file_json"
+    class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+    <param name="file" value="logs/logsearch-audit.json" />
+    <param name="Threshold" value="info" />
+    <param name="append" value="true" />
+    <param name="maxFileSize" value="10MB" />
+    <param name="maxBackupIndex" value="10" />
+    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+  </appender>
+
+  <appender name="performance_analyzer_json"
+    class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+    <param name="file" value="logs/logsearch-performance.json" />
+    <param name="Threshold" value="info" />
+    <param name="append" value="true" />
+    <param name="maxFileSize" value="10MB" />
+    <param name="maxBackupIndex" value="10" />
+    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+  </appender>
+ 
 	<!-- Logs to suppress BEGIN -->
 	<category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
 	  <priority value="error" />
@@ -62,24 +95,28 @@
 	<logger name="org.apache.ambari.logsearch.audit"
 		additivity="true">
 		<priority value="info" />
-		<appender-ref ref="audit_rolling_file" />
+		<!-- <appender-ref ref="audit_rolling_file" />-->
+        <appender-ref ref="audit_rolling_file_json" />
 	</logger>
 
 	<logger name="org.apache.ambari.logsearch.performance"
 		additivity="false">
 	  	<priority value="info" />
-		<appender-ref ref="performance_analyzer" />
+		<!-- <appender-ref ref="performance_analyzer" />-->
+        <appender-ref ref="performance_analyzer_json" />
 	</logger>
 
 	<logger name="org.apache.ambari.logsearch" additivity="false">
 	  	<priority value="info" />
 		<!-- <appender-ref ref="console" /> -->
-		<appender-ref ref="rolling_file" />
+		<!-- <appender-ref ref="rolling_file" />-->
+        <appender-ref ref="rolling_file_json" />
 	</logger>
 
 	<root>
 		<level value="warn" />
 		<!-- <appender-ref ref="console" /> -->
-		<appender-ref ref="rolling_file" />
+		<!--<appender-ref ref="rolling_file" />-->
+        <appender-ref ref="rolling_file_json" />
 	</root>
 </log4j:configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties
index 44f3bfd..b5b0b23 100755
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+#solr.url=http://host:port/solr
 solr.url=
 
 #Solr Core
@@ -26,11 +27,18 @@ solr.service_logs.replication_factor=1
 #If set, metrics will be sent to Ambari
 #metrics.collector.hosts=example.com
 metrics.collector.hosts=
-
-#Audit log solr url
 auditlog.solr.url=
-#auditlog.solr.core.logs=ranger_audits
+#auditlog.solr.core.logs=collection_name
 auditlog.solr.core.logs=ranger_audits
 solr.audit_logs.split_interval_mins=none
 solr.audit_logs.shards=1
 solr.audit_logs.replication_factor=1
+
+#Logfeeder Settings
+logfeeder.include.default.level=fatal,error,warn
+
+#Authentication settings
+#Note: Simple will be supported only if both file and ldap is disabled.
+logsearch.auth.file.enable=true
+logsearch.auth.ldap.enable=false
+logsearch.auth.simple.enable=false

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties.j2
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties.j2 b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties.j2
index ffe9e0c..82457b7 100755
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties.j2
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/logsearch.properties.j2
@@ -31,3 +31,8 @@ solr.audit_logs.split_interval_mins={{audit_logs_collection_splits_interval_mins
 solr.audit_logs.shards={{logsearch_numshards}}
 solr.audit_logs.replication_factor={{logsearch_repfactor}}
 
+#Authentication settings
+#Note: Simple will be supported only if both file and ldap is disabled.
+logsearch.auth.file.enable={{logsearch_auth_file_enable}}
+logsearch.auth.ldap.enable={{logsearch_auth_ldap_enable}}
+logsearch.auth.simple.enable={{logsearch_auth_simple_enable}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
index 256b227..99bc3df 100755
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
@@ -73,6 +73,11 @@ fi
 
 if [ -z "$LOGSEARCH_CONF_DIR" ]; then
   LOGSEARCH_CONF_DIR="/etc/logsearch/conf"
+  if [ ! -d $LOGSEARCH_CONF_DIR ]; then
+      if [ -d $script_dir/classes ]; then
+	  LOGSEARCH_CONF_DIR=$script_dir/classes
+      fi
+  fi
   echo "LOGSEARCH_CONF_DIR not found. Use default: $LOGSEARCH_CONF_DIR"
 fi
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/index.html b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/index.html
index 58f751b..88b6c22 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/index.html
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/index.html
@@ -123,14 +123,14 @@
 
 		</script>
 <!-- 		<script type="text/javascript" src="libs/other/d3/d3.min.js"></script> -->
-<div class="btn-group contextMenuBody" style="display:none;position:absolute;z-index:9999;">
+<div class="btn-group contextMenuBody dropup" style="display:none;position:absolute;z-index:9999;">
 	    <button type="button" class="btn btn-info btn-circle btn-app-sm btn-context dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 	        <i class="fa fa-info"></i>
 	    </button>
 	    <ul class="dropdown-menu">
 	        <li><a data-id="I" href="javascript:void(0);">Include</a></li>
-	        <li><a data-id="E" href="javascript:void(0);">Exclude</a></li>
-	        <li><a data-id="IA" href="javascript:void(0);">*Include*</a></li>
+	        <li><a data-id="E" href="javascript:void(0);">Exclude</a></li> 
+	     	<li><a data-id="IA" href="javascript:void(0);">*Include*</a></li>
 	        <li><a data-id="EA" href="javascript:void(0);">*Exclude*</a></li>
 	        <li role="separator" class="divider"></li>
 	        <li><a data-id="F" href="javascript:void(0);">Find</a></li>

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
index 8048ee2..5d55689 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
@@ -389,33 +389,53 @@ define(['require',
 		options = _.isUndefined(options) ? Opt : options;
 		$.msg(options);
 	};
-
+	var errorShown = false;
 	Utils.defaultErrorHandler = function(model, error) {
-		if (error.status == 404) {
-				// App.rContent.show(new vError({
-				// 	status : error.status
-				// }));
-			} else if (error.status == 401) {
-
-				window.location = 'login.jsp'+window.location.search;
-				// App.rContent.show(new vError({
-				// 	status : error.status
-				// }));
-				
-			}else if (error.status == 419) {
-				window.location = 'login.jsp'+window.location.search;
-
-			}else if (error.status == "0") {
-				var diffTime = (new Date().getTime() - prevNetworkErrorTime);
-				if (diffTime > 3000) {
-					prevNetworkErrorTime = new Date().getTime();
-					Utils.notifyError({
-						content : "Network Connection Failure : "+
-						"It seems you are not connected to the internet. Please check your internet connection and try again" 
-					})
-					
-				}
-			}
+		if (error.status == 500) {
+			try {
+		        if (!errorShown) {
+		            errorShown = true;
+		            Utils.notifyError({
+		                content: "Some issue on server, Please try again later."
+		            });
+		            setTimeout(function() {
+		                errorShown = false;
+		            }, 3000);
+		        }
+		    } catch (e) {}
+		}
+		else if (error.status == 400) {
+		    try {
+		        if (!errorShown) {
+		            errorShown = true;
+		            Utils.notifyError({
+		                content: JSON.parse(error.responseText).msgDesc
+		            });
+		            setTimeout(function() {
+		                errorShown = false;
+		            }, 3000);
+		        }
+		    } catch (e) {}
+		} else if (error.status == 401) {
+		    window.location = 'login.jsp' + window.location.search;
+		    // App.rContent.show(new vError({
+		    // 	status : error.status
+		    // }));
+
+		} else if (error.status == 419) {
+		    window.location = 'login.jsp' + window.location.search;
+
+		} else if (error.status == "0") {
+		    var diffTime = (new Date().getTime() - prevNetworkErrorTime);
+		    if (diffTime > 3000) {
+		        prevNetworkErrorTime = new Date().getTime();
+		        Utils.notifyError({
+		            content: "Network Connection Failure : " +
+		                "It seems you are not connected to the internet. Please check your internet connection and try again"
+		        })
+
+		    }
+		}
 		// require(['views/common/ErrorView','App'],function(vError,App){
 
 		// });

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/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 0603d5f..ba21b65 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
@@ -91,8 +91,11 @@ define(['require',
         if (params.host_name) {
             this.defaultParams['host_name'] = params.host_name;
         }
-        if (params.components_name) {
-            this.defaultParams['components_name'] = params.components_name;
+        if (params.component_name) {
+            this.defaultParams['component_name'] = params.component_name;
+        }
+        if (params.file_name) {
+            this.defaultParams['file_name'] = params.file_name;
         }
         if (startDateString && endDateString) {
             if (params.timezone) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
index 6785f4f..3916bff 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
@@ -118,7 +118,7 @@ define(['require',
                 require(['views/filter/CreateLogfeederFilterView'],function(CreateLogfeederFilter){
                     var view = new CreateLogfeederFilter({});
                     var options = {
-                        title: "Create Filter",
+                        title: "Logfeeder Filter",
                         content: view,
                         viewType: 'Filter',
                         resizable: false,
@@ -154,7 +154,7 @@ define(['require',
                         width: 650,
                         height: 350,
                         beforeClose: function(event, ui) {
-                            that.onDialogClosed();
+                            //that.onDialogClosed();
                         }
                     },options);
 
@@ -166,6 +166,9 @@ define(['require',
                             // dialog.trigger("toggle:okBtn",false);
                         });
                     }
+                    options.content.on("closeDialog",function(){
+                    	that.onDialogClosed();
+                    });
                     dialog.open();
                 });
             },

http://git-wip-us.apache.org/repos/asf/ambari/blob/888faf26/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/TableLayout.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/TableLayout.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/TableLayout.js
index 5b4229a..de5296c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/TableLayout.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/TableLayout.js
@@ -70,7 +70,7 @@ define(['require',
 			// the number of page handles to show. The sliding window
 			// will automatically show the next set of page handles when
 			// you click next at the end of a window.
-			windowSize: 5, // Default is 10
+			windowSize: 10, // Default is 10
 
 			// Used to multiple windowSize to yield a number of pages to slide,
 			// in the case the number is 5


Mime
View raw message