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/04/11 18:14:47 UTC
[33/51] [partial] ambari git commit: AMBARI-15679. Initial commit for
LogSearch module (oleewre)
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..b157adc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java
@@ -0,0 +1,44 @@
+/*
+ * 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 {
+ String name;
+ 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/39c85bb8/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
new file mode 100644
index 0000000..97226d2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
@@ -0,0 +1,243 @@
+/*
+ * 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/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java
new file mode 100644
index 0000000..57e32d2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ambari.logsearch.view;
+
+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 VLogFile {
+
+ private String name;
+
+ private String path;
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java
new file mode 100644
index 0000000..a79dae7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java
@@ -0,0 +1,70 @@
+/*
+ * 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 VLogFileList extends VList {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private List<VLogFile> logFiles;
+
+ public VLogFileList() {
+ logFiles = new ArrayList<VLogFile>();
+ }
+
+ @Override
+ public int getListSize() {
+ if (logFiles == null) {
+ return 0;
+ }
+ return logFiles.size();
+ }
+
+ @Override
+ public List<?> getList() {
+ return logFiles;
+ }
+
+ public List<VLogFile> getLogFiles() {
+ return logFiles;
+ }
+
+ public void setLogFiles(List<VLogFile> logFiles) {
+ this.logFiles = logFiles;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..1836c4a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java
@@ -0,0 +1,91 @@
+/*
+ * 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/39c85bb8/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
new file mode 100644
index 0000000..727de69
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * 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/39c85bb8/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
new file mode 100644
index 0000000..bc52981
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
@@ -0,0 +1,165 @@
+/*
+* 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/39c85bb8/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
new file mode 100644
index 0000000..d8bdbfb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
@@ -0,0 +1,122 @@
+/*
+ * 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 VNameValue implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Name
+ */
+ protected String name;
+ /**
+ * Value
+ */
+ protected String value;
+
+ /**
+ * Default constructor. This will set all the attributes to default value.
+ */
+ public VNameValue() {
+ }
+
+ /**
+ * @param name
+ * the key
+ * @param value
+ * the value
+ */
+ public VNameValue(String name, String value) {
+
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * 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>value</b>. You
+ * cannot set null to the attribute.
+ *
+ * @param value
+ * Value to set member attribute <b>value</b>
+ */
+ public void setValue(String value) {
+ if(value.contains(".") && (value.contains("e") || value.contains("E")))
+ this.value=getExponentialValueReplaced(value);
+ else
+ this.value = value;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>value</b>
+ *
+ * @return String - value of member attribute <b>value</b>.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * This return the bean content in string format
+ *
+ * @return formatedStr
+ */
+ public String toString() {
+ String str = "VNameValue={";
+ str += super.toString();
+ str += "name={" + name + "} ";
+ str += "value={" + value + "} ";
+ str += "}";
+ return str;
+ }
+
+ private String getExponentialValueReplaced(String value) {
+ try{
+ Double number = Double.parseDouble(value);
+ String newValue = String.format("%.0f", number);
+ return newValue;
+
+ }catch(Exception e){
+ return value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..dc5c86c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
@@ -0,0 +1,78 @@
+/*
+ * 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;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class VNameValueList extends VList {
+ private static final long serialVersionUID = 1L;
+ List<VNameValue> vNameValues = new ArrayList<VNameValue>();
+
+ public VNameValueList() {
+ super();
+ }
+
+ public VNameValueList(List<VNameValue> objList) {
+ super(objList);
+ this.vNameValues = objList;
+ }
+
+ /**
+ * @return the vNameValues
+ */
+ public List<VNameValue> getVNameValues() {
+ return vNameValues;
+ }
+
+ /**
+ * @param vNameValues
+ * the vNameValues to set
+ */
+ public void setVNameValues(List<VNameValue> vNameValues) {
+ this.vNameValues = vNameValues;
+ }
+
+ @Override
+ public int getListSize() {
+ if (vNameValues != null) {
+ return vNameValues.size();
+ }
+ return 0;
+ }
+
+ @Override
+ public List<?> getList() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+// @Override
+// public List<VNameValue> getList() {
+// return vNameValues;
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java
new file mode 100644
index 0000000..a16ded8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java
@@ -0,0 +1,122 @@
+/*
+ * 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 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 VNode {
+
+ private String name;
+
+ private String type;
+
+ private String value;
+
+ private boolean isRoot;
+
+ private Collection<VNode> childs;
+
+ private Collection<VNameValue> logLevelCount;
+
+ private boolean isParent;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public boolean isRoot() {
+ return isRoot;
+ }
+
+ public void setRoot(boolean isRoot) {
+ this.isRoot = isRoot;
+ }
+
+ public Collection<VNode> getChilds() {
+ return childs;
+ }
+
+ public void setChilds(Collection<VNode> childs) {
+ this.childs = childs;
+ }
+
+ public boolean isParent() {
+ return isParent;
+ }
+
+ public void setParent(boolean isParent) {
+ this.isParent = isParent;
+ }
+
+ public Collection<VNameValue> getLogLevelCount() {
+ return logLevelCount;
+ }
+
+ public void setLogLevelCount(Collection<VNameValue> logLevelCount) {
+ this.logLevelCount = logLevelCount;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ String str = "VNode={";
+ str += "name={" + name + "} ";
+ str += "value={" + value + "} ";
+ str += "type={" + type + "} ";
+ str += "isRoot={" + isRoot + "} ";
+ str += "isParent={" + isParent + "} ";
+ str += "logLevelCount={" + logLevelCount + "} ";
+ str += "childs={" + childs + "} ";
+ str += "}";
+ return str;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..0cd10a2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class VNodeList extends VList {
+ private static final long serialVersionUID = 1L;
+ List<VNode> vNodeList = new ArrayList<VNode>();
+
+ public List<VNode> getvNodeList() {
+ return vNodeList;
+ }
+
+ public void setvNodeList(List<VNode> vNodeList) {
+ this.vNodeList = vNodeList;
+ }
+
+ @Override
+ public int getListSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public List<VNode> getList() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..b35c29b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
@@ -0,0 +1,164 @@
+/*
+ * 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/39c85bb8/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
new file mode 100644
index 0000000..193b522
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
@@ -0,0 +1,65 @@
+/*
+ * 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.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.solr.common.SolrDocumentList;
+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 VSolrLogList extends VList {
+ private static final long serialVersionUID = 1L;
+
+ SolrDocumentList logList = new SolrDocumentList();
+
+ public VSolrLogList() {
+ super();
+ }
+
+ public VSolrLogList(SolrDocumentList logList) {
+ super(logList);
+ this.logList = logList;
+ }
+
+ public void setSolrDocuments(SolrDocumentList list) {
+ this.logList = list;
+ }
+
+ @Override
+ public int getListSize() {
+ if (logList != null)
+ return logList.size();
+ return 0;
+ }
+
+ @Override
+ public SolrDocumentList getList() {
+ return logList;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java
new file mode 100644
index 0000000..bda7565
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java
@@ -0,0 +1,52 @@
+/*
+ * 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 VString {
+
+ /**
+ * Value
+ */
+ protected String value;
+
+ /**
+ * Default constructor. This will set all the attributes to default value.
+ */
+ public VString() {
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ String str = "VString={";
+ str += super.toString();
+ str += "value={" + value + "} ";
+ str += "}";
+ return str;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..92b40b8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
@@ -0,0 +1,103 @@
+/*
+ * 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 {
+
+ List<VHost> hosts;
+ String levels;
+ String format;
+ String numberLogs;
+ String from;
+ String to;
+ String includeString;
+ 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/39c85bb8/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
new file mode 100644
index 0000000..ad1ff5c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
@@ -0,0 +1,66 @@
+/*
+ * 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 VSummaryCount {
+
+ String level;
+
+ List<String> cricticalMsg;
+
+ List<String> compName;
+
+ List<Long> countMsg;
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public List<String> getCricticalMsg() {
+ return cricticalMsg;
+ }
+
+ public void setCricticalMsg(List<String> cricticalMsg) {
+ this.cricticalMsg = cricticalMsg;
+ }
+
+ public List<String> getCompName() {
+ return compName;
+ }
+
+ public void setCompName(List<String> compName) {
+ this.compName = compName;
+ }
+
+ public List<Long> getCountMsg() {
+ return countMsg;
+ }
+
+ public void setCountMsg(List<Long> countMsg) {
+ this.countMsg = countMsg;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..3d8e262
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ambari.logsearch.view;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class VSummaryCountList {
+
+ Collection<VSummaryCount> countList = new ArrayList<VSummaryCount>();
+
+ public Collection<VSummaryCount> getCountList() {
+ return countList;
+ }
+
+ public void setCountList(Collection<VSummaryCount> countList) {
+ this.countList = countList;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..075df65
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
@@ -0,0 +1,105 @@
+/*
+ * 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 {
+ String id;
+ String userName;
+
+ String filterName;
+ 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/39c85bb8/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
new file mode 100644
index 0000000..3fc9d0d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java
@@ -0,0 +1,66 @@
+/*
+ * 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 {
+ String name;
+ 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/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthFailureHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthFailureHandler.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthFailureHandler.java
new file mode 100644
index 0000000..d706beb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthFailureHandler.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.web.authenticate;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler;
+
+public class LogsearchAuthFailureHandler extends ExceptionMappingAuthenticationFailureHandler {
+
+ private static final Logger logger = Logger.getLogger(LogsearchAuthFailureHandler.class);
+
+ @Autowired
+ RESTErrorUtil restErrorUtil;
+
+ public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
+ AuthenticationException exception) throws IOException, ServletException {
+ logger.debug(" AuthFailureHandler + onAuthenticationFailure");
+ // TODO UI side handle status and redirect to login page with proper
+ response.setContentType("application/json");
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ response.getOutputStream().println("{ \"error\": \"" + "login failed !!" + "\" }");
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
new file mode 100644
index 0000000..d400858
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchAuthSuccessHandler.java
@@ -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.
+ */
+package org.apache.ambari.logsearch.web.authenticate;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
+
+public class LogsearchAuthSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
+ private static final Logger logger = Logger.getLogger(LogsearchAuthSuccessHandler.class);
+
+ private String HOME_PAGE = "/index.html";
+
+ @Override
+ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
+ Authentication authentication) throws ServletException, IOException {
+ logger.debug("Login successfully !!!!!! Redirecting to home page :" + HOME_PAGE);
+ response.sendRedirect(HOME_PAGE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..c90f96d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
@@ -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.
+ */
+package org.apache.ambari.logsearch.web.authenticate;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
+import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
+
+public class LogsearchLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler implements LogoutSuccessHandler {
+ private static final Logger logger = Logger.getLogger(LogsearchLogoutSuccessHandler.class);
+
+ @Override
+ public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
+ throws IOException, ServletException {
+ logger.debug("AtlasLogoutSuccessHandler ::: onLogoutSuccess");
+// super.onLogoutSuccess(request, response, authentication);
+ response.sendRedirect("/login.jsp");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
new file mode 100644
index 0000000..62f762c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.web.filters;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
+
+class LogsearchAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
+
+ @Autowired
+ RESTErrorUtil restErrorUtil;
+
+ public LogsearchAuthenticationEntryPoint(String loginFormUrl) {
+ super(loginFormUrl);
+ }
+
+ private static final Logger logger = Logger.getLogger(LogsearchAuthenticationEntryPoint.class);
+
+ @Override
+ public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
+ throws IOException, ServletException {
+ String ajaxRequestHeader = request.getHeader("X-Requested-With");
+ if (ajaxRequestHeader != null && ajaxRequestHeader.equalsIgnoreCase("XMLHttpRequest")) {
+ logger.debug("AJAX request. Authentication required. Returning URL=" + request.getRequestURI());
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Session Timeout");
+ } else {
+ logger.debug("Redirecting to login page :" + this.getLoginFormUrl());
+ response.sendRedirect(this.getLoginFormUrl() + ((request.getQueryString() != null) ? "?" + request.getQueryString() : ""));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
new file mode 100644
index 0000000..69132e8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
@@ -0,0 +1,119 @@
+/*
+ * 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.web.filters;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.ambari.logsearch.common.RequestContext;
+import org.apache.ambari.logsearch.common.UserSessionInfo;
+import org.apache.ambari.logsearch.manager.SessionMgr;
+import org.apache.ambari.logsearch.security.context.LogsearchContextHolder;
+import org.apache.ambari.logsearch.security.context.LogsearchSecurityContext;
+import org.apache.ambari.logsearch.util.CommonUtil;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.web.filter.GenericFilterBean;
+
+public class LogsearchSecurityContextFormationFilter extends GenericFilterBean {
+
+ static Logger logger = Logger.getLogger(LogsearchSecurityContextFormationFilter.class);
+
+ public static final String LOGSEARCH_SC_SESSION_KEY = "LOGSEARCH_SECURITY_CONTEXT";
+ public static final String USER_AGENT = "User-Agent";
+
+ @Autowired
+ SessionMgr sessionMgr;
+
+ public LogsearchSecurityContextFormationFilter() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
+ * javax.servlet.ServletResponse, javax.servlet.FilterChain)
+ */
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
+ ServletException {
+
+ try {
+ Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+
+ if (auth instanceof AnonymousAuthenticationToken) {
+ // ignore
+ } else {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpSession httpSession = httpRequest.getSession(false);
+ Cookie[] cookieList = httpRequest.getCookies();
+ String msaCookie = null;
+ for (int i = 0; cookieList != null && i < cookieList.length; i++) {
+ if (cookieList[i].getName().equalsIgnoreCase("msa")) {
+ msaCookie = cookieList[i].getValue();
+ }
+ }
+ if (msaCookie == null) {
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ msaCookie = CommonUtil.genGUI();
+ Cookie cookie = new Cookie("msa", msaCookie);
+ // TODO: Need to revisit this
+ cookie.setMaxAge(Integer.MAX_VALUE);
+ httpResponse.addCookie(cookie);
+ }
+ // [1]get the context from session
+ LogsearchSecurityContext context = (LogsearchSecurityContext) httpSession
+ .getAttribute(LOGSEARCH_SC_SESSION_KEY);
+ if (context == null) {
+ context = new LogsearchSecurityContext();
+ httpSession.setAttribute(LOGSEARCH_SC_SESSION_KEY, context);
+ }
+ String userAgent = httpRequest.getHeader(USER_AGENT);
+ // Get the request specific info
+ RequestContext requestContext = new RequestContext();
+ String reqIP = httpRequest.getRemoteAddr();
+ requestContext.setIpAddress(reqIP);
+ requestContext.setMsaCookie(msaCookie);
+ requestContext.setUserAgent(userAgent);
+ requestContext.setServerRequestId(CommonUtil.genGUI());
+ requestContext.setRequestURL(httpRequest.getRequestURI());
+ context.setRequestContext(requestContext);
+ LogsearchContextHolder.setSecurityContext(context);
+ UserSessionInfo userSession = sessionMgr.processSuccessLogin(0, userAgent);
+ context.setUserSession(userSession);
+ }
+ chain.doFilter(request, response);
+
+ } finally {
+ // [4]remove context from thread-local
+ LogsearchContextHolder.resetSecurityContext();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
new file mode 100644
index 0000000..2c83001
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
@@ -0,0 +1,46 @@
+/*
+ * 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.web.filters;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.RememberMeServices;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+public class LogsearchUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
+ private static final Logger logger = Logger.getLogger(LogsearchUsernamePasswordAuthenticationFilter.class);
+
+ public void setRememberMeServices(RememberMeServices rememberMeServices) {
+ super.setRememberMeServices(rememberMeServices);
+
+ }
+
+ @Override
+ protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
+ AuthenticationException failed) throws IOException, ServletException {
+ logger.info("login failed :::::" + failed.getMessage());
+ super.unsuccessfulAuthentication(request, response, failed);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/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
new file mode 100644
index 0000000..ef6a410
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.web.listeners;
+
+import org.apache.log4j.Logger;
+import org.springframework.context.ApplicationListener;
+import org.springframework.security.authentication.event.AbstractAuthenticationEvent;
+
+public class SpringEventListener implements ApplicationListener<AbstractAuthenticationEvent> {
+ private static final Logger logger = Logger.getLogger(SpringEventListener.class);
+
+ @Override
+ public void onApplicationEvent(AbstractAuthenticationEvent event) {
+ logger.info(" On Application onApplicationEvent SpringEventListener");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Privilege.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Privilege.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Privilege.java
new file mode 100644
index 0000000..949a1ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Privilege.java
@@ -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.
+ */
+package org.apache.ambari.logsearch.web.model;
+
+public class Privilege {
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Privilege [name=");
+ builder.append(name);
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Role.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Role.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Role.java
new file mode 100644
index 0000000..9b08424
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/model/Role.java
@@ -0,0 +1,64 @@
+/*
+ * 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.web.model;
+
+import java.util.List;
+
+import org.springframework.security.core.GrantedAuthority;
+
+public class Role implements GrantedAuthority {
+
+ private static final long serialVersionUID = 1L;
+ private String name;
+
+ private List<Privilege> privileges;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getAuthority() {
+ return this.name;
+ }
+
+ public List<Privilege> getPrivileges() {
+ return privileges;
+ }
+
+ public void setPrivileges(List<Privilege> privileges) {
+ this.privileges = privileges;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Role [name=");
+ builder.append(name);
+ builder.append(", privileges=");
+ builder.append(privileges);
+ builder.append("]");
+ return builder.toString();
+ }
+
+}