http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTreeRequestFacetQueryConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTreeRequestFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTreeRequestFacetQueryConverter.java new file mode 100644 index 0000000..e3da5c2 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTreeRequestFacetQueryConverter.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.query.converter; + +import com.google.common.base.Splitter; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest; +import org.springframework.data.solr.core.query.Criteria; +import org.springframework.data.solr.core.query.FacetOptions; +import org.springframework.data.solr.core.query.SimpleFacetQuery; +import org.springframework.data.solr.core.query.SimpleFilterQuery; + +import javax.inject.Named; + +import java.util.List; + +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT; +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST; +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL; +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME; + +@Named +public class ServiceLogTreeRequestFacetQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceLogHostComponentRequest>{ + + @Override + public FacetOptions.FacetSort getFacetSort() { + return FacetOptions.FacetSort.INDEX; + } + + @Override + public String getDateTimeField() { + return LOGTIME; + } + + @Override + public void appendFacetQuery(SimpleFacetQuery facetQuery, ServiceLogHostComponentRequest request) { + List<String> levels = Splitter.on(",").splitToList(request.getLevel()); + SimpleFilterQuery filterQuery = new SimpleFilterQuery(); + filterQuery.addCriteria(new Criteria(LEVEL).in(levels)); + facetQuery.addFilterQuery(filterQuery); + } + + @Override + public void appendFacetOptions(FacetOptions facetOptions, ServiceLogHostComponentRequest request) { + facetOptions.addFacetOnPivot(HOST, COMPONENT, LEVEL); + facetOptions.addFacetOnPivot(HOST, LEVEL); + } +}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java deleted file mode 100644 index 2154357..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest; -import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogTruncatedRequest, ServiceLogTruncatedSearchCriteria> { - - @Override - public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) { - ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria(); - criteria.setId(request.getId()); - criteria.setScrollType(request.getScrollType()); - criteria.setNumberRows(request.getNumberRows()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestQueryConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestQueryConverter.java new file mode 100644 index 0000000..ff2da1b --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestQueryConverter.java @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.query.converter; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.common.LogType; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest; +import org.springframework.data.domain.Sort; +import org.springframework.data.solr.core.query.SimpleQuery; + +import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.SEQUENCE_ID; +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT; +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST; +import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME; + +public class ServiceLogTruncatedRequestQueryConverter extends AbstractLogRequestQueryConverter<ServiceLogTruncatedRequest, SimpleQuery>{ + + private String sequenceId; + + private String logTime; + + @Override + public SimpleQuery extendLogQuery(ServiceLogTruncatedRequest request, SimpleQuery query) { + addEqualsFilterQuery(query, COMPONENT, request.getComponentName()); + addEqualsFilterQuery(query, HOST, request.getHostName()); + String scrollType = request.getScrollType(); + if (LogSearchConstants.SCROLL_TYPE_BEFORE.equals(scrollType)) { + Integer secuenceIdNum = Integer.parseInt(getSequenceId()) - 1; + addRangeFilter(query, LOGTIME, null, getLogTime()); + addRangeFilter(query, SEQUENCE_ID, null, secuenceIdNum.toString()); + } else if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) { + Integer secuenceIdNum = Integer.parseInt(getSequenceId()) + 1; + addRangeFilter(query, LOGTIME, getLogTime(), null); + addRangeFilter(query, SEQUENCE_ID, secuenceIdNum.toString(), null); + } + query.setRows(request.getNumberRows()); + return query; + } + + @Override + public Sort sort(ServiceLogTruncatedRequest request) { + String scrollType = request.getScrollType(); + Sort.Direction direction; + if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) { + direction = Sort.Direction.ASC; + } else { + direction = Sort.Direction.DESC; + } + Sort.Order logtimeSortOrder = new Sort.Order(direction, LOGTIME); + Sort.Order secuqnceIdSortOrder = new Sort.Order(direction, SEQUENCE_ID); + return new Sort(logtimeSortOrder, secuqnceIdSortOrder); + } + + @Override + public SimpleQuery createQuery() { + return new SimpleQuery(); + } + + @Override + public LogType getLogType() { + return LogType.SERVICE; + } + + public String getSequenceId() { + return sequenceId; + } + + public void setSequenceId(String sequenceId) { + this.sequenceId = sequenceId; + } + + public String getLogTime() { + return logTime; + } + + public void setLogTime(String logTime) { + this.logTime = logTime; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java deleted file mode 100644 index 1f084fd..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class SimpleQueryRequestConverter extends AbstractConverterAware<SimpleQueryRequest, CommonSearchCriteria> { - - @Override - public CommonSearchCriteria convert(SimpleQueryRequest simpleQueryRequest) { - CommonSearchCriteria searchCriteria = new CommonSearchCriteria(); - searchCriteria.addParam("q", simpleQueryRequest.getQuery()); - return searchCriteria; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/StringFieldFacetQueryConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/StringFieldFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/StringFieldFacetQueryConverter.java new file mode 100644 index 0000000..068fdb2 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/StringFieldFacetQueryConverter.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.query.converter; + +import org.springframework.data.solr.core.query.Criteria; +import org.springframework.data.solr.core.query.FacetOptions; +import org.springframework.data.solr.core.query.SimpleFacetQuery; +import org.springframework.data.solr.core.query.SimpleStringCriteria; + +import javax.inject.Named; + +@Named +public class StringFieldFacetQueryConverter extends AbstractConverterAware<String, SimpleFacetQuery> { + + @Override + public SimpleFacetQuery convert(String fieldName) { + Criteria criteria = new SimpleStringCriteria("*:*"); + SimpleFacetQuery facetQuery = new SimpleFacetQuery(); + facetQuery.addCriteria(criteria); + facetQuery.setRows(0); + FacetOptions facetOptions = new FacetOptions(); + facetOptions.setFacetMinCount(1); + facetOptions.addFacetOnField(fieldName); + facetOptions.setFacetLimit(-1); + facetQuery.setFacetOptions(facetOptions); + return facetQuery; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java deleted file mode 100644 index c7f738e..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.UserExportRequest; -import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class UserExportRequestConverter extends AbstractCommonAuditLogRequestConverter<UserExportRequest, UserExportSearchCriteria> { - - @Override - public UserExportSearchCriteria createCriteria(UserExportRequest request) { - UserExportSearchCriteria criteria = new UserExportSearchCriteria(); - criteria.setField(request.getField()); - criteria.setFormat(request.getFormat()); - return criteria; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestQueryConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestQueryConverter.java new file mode 100644 index 0000000..530108a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestQueryConverter.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.query.converter; + +import org.apache.ambari.logsearch.model.request.impl.UserExportRequest; +import org.springframework.data.solr.core.query.FacetOptions; + +import javax.inject.Named; + +import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT; +import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME; +import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_REQUEST_USER; +import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_RESOURCE; + +@Named +public class UserExportRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<UserExportRequest> { + + @Override + public void appendFacetOptions(FacetOptions facetOptions, UserExportRequest request) { + facetOptions.addFacetOnPivot(AUDIT_REQUEST_USER, AUDIT_COMPONENT); + facetOptions.addFacetOnPivot(AUDIT_RESOURCE, AUDIT_COMPONENT); + } + + @Override + public FacetOptions.FacetSort getFacetSort() { + return FacetOptions.FacetSort.COUNT; + } + + @Override + public String getDateTimeField() { + return AUDIT_EVTTIME; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java deleted file mode 100644 index aa61851..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FROM; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_TO; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS; - -public class AnyGraphSearchCriteria extends CommonSearchCriteria { - - public String getxAxis() { - return getParam(PARAM_X_AXIS, String.class); - } - - public void setxAxis(String xAxis) { - addParam(PARAM_X_AXIS, xAxis); - } - - public String getyAxis() { - return getParam(PARAM_Y_AXIS, String.class); - } - - public void setyAxis(String yAxis) { - addParam(PARAM_Y_AXIS, yAxis); - } - - public String getStackBy() { - return getParam(PARAM_STACK_BY, String.class); - } - - public void setStackBy(String stackBy) { - addParam(PARAM_STACK_BY, stackBy); - } - - public String getUnit() { - return getParam(PARAM_UNIT, String.class); - } - - public void setUnit(String unit) { - addParam(PARAM_UNIT, unit); - } - - public String getFrom() { - return getParam(PARAM_FROM, String.class); - } - - public void setFrom(String from) { - addParam(PARAM_FROM, from); - } - - public String getTo() { - return getParam(PARAM_TO, String.class); - } - - public void setTo(String to) { - addParam(PARAM_TO, to); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java deleted file mode 100644 index 49304c4..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT; - -public class AuditBarGraphSearchCriteria extends CommonSearchCriteria { - - public void setUnit(String unit) { - addParam(PARAM_UNIT, unit); - } - - public String getUnit() { - return getParam(PARAM_UNIT, String.class); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java deleted file mode 100644 index 03df3ad..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_IS_LAST_PAGE; - -public class AuditLogSearchCriteria extends CommonSearchCriteria { - - public void setLastPage(boolean lastPage) { - addParam(PARAM_IS_LAST_PAGE, lastPage); - } - - public boolean isLastPage() { - return getParam(PARAM_IS_LAST_PAGE, Boolean.class); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java deleted file mode 100644 index b02c234..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class CommonServiceLogSearchCriteria extends CommonSearchCriteria { - - public String getLevel() { - return getParam(SearchCriteriaConstants.PARAM_LEVEL, String.class); - } - - public void setLevel(String level) { - addParam(SearchCriteriaConstants.PARAM_LEVEL, level); - } - - public String getSelectComp() { - return getParam(SearchCriteriaConstants.PARAM_SELECT_COMP, String.class); - } - - public void setSelectComp(String selectComp) { - addParam(SearchCriteriaConstants.PARAM_SELECT_COMP, selectComp); - } - - public String getBundleId() { - return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class); - } - - public void setBundleId(String bunldeId) { - addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId); - } - - public String getFrom() { - return getParam(SearchCriteriaConstants.PARAM_FROM ,String.class); - } - - public void setFrom(String from) { - addParam(SearchCriteriaConstants.PARAM_FROM, from); - } - - public String getTo() { - return getParam(SearchCriteriaConstants.PARAM_TO ,String.class); - } - - public void setTo(String to) { - addParam(SearchCriteriaConstants.PARAM_TO, to); - } - - public String getHostName() { - return getParam(SearchCriteriaConstants.PARAM_HOST_NAME ,String.class); - } - - public void setHostName(String hostName) { - addParam(SearchCriteriaConstants.PARAM_HOST_NAME, hostName); - } - - public String getComponentName() { - return getParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME ,String.class); - } - - public void setComponentName(String componentName) { - addParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME, componentName); - } - - public String getFileName() { - return getParam(SearchCriteriaConstants.PARAM_FILE_NAME ,String.class); - } - - public void setFileName(String fileName) { - addParam(SearchCriteriaConstants.PARAM_FILE_NAME, fileName); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java deleted file mode 100644 index 381b3c2..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD; - -public class FieldAuditBarGraphSearchCriteria extends AuditBarGraphSearchCriteria { - - public String getField() { - return getParam(PARAM_FIELD, String.class); - } - - public void setField(String field) { - addParam(PARAM_FIELD, field); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java deleted file mode 100644 index 9d5d225..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD; - -public class FieldAuditLogSearchCriteria extends CommonSearchCriteria { - - public String getField() { - return getParam(PARAM_FIELD, String.class); - } - - public void setField(String field) { - addParam(PARAM_FIELD, field); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java deleted file mode 100644 index 0f4bb5a..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.common.Marker; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS; - -public class ServiceAnyGraphSearchCriteria extends ServiceLogSearchCriteria { - public String getxAxis() { - return getParam(PARAM_X_AXIS, String.class); - } - - public void setxAxis(String xAxis) { - addParam(PARAM_X_AXIS, xAxis); - } - - public String getyAxis() { - return getParam(PARAM_Y_AXIS, String.class); - } - - public void setyAxis(String yAxis) { - addParam(PARAM_Y_AXIS, yAxis); - } - - public String getStackBy() { - return getParam(PARAM_STACK_BY, String.class); - } - - public void setStackBy(String stackBy) { - addParam(PARAM_STACK_BY, stackBy); - } - - public String getUnit() { - return getParam(PARAM_UNIT, String.class); - } - - public void setUnit(String unit) { - addParam(PARAM_UNIT, unit); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java deleted file mode 100644 index d89ab3b..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class ServiceExtremeDatesCriteria extends CommonSearchCriteria { - - public String getBundleId() { - return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class); - } - - public void setBundleId(String bunldeId) { - addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java deleted file mode 100644 index 4173bac..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class ServiceGraphSearchCriteria extends ServiceLogSearchCriteria { - - public String getUnit() { - return getParam(SearchCriteriaConstants.PARAM_UNIT, String.class); - } - - public void setUnit(String unit) { - addParam(SearchCriteriaConstants.PARAM_UNIT, unit); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java deleted file mode 100644 index 6c757af..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class ServiceLogExportSearchCriteria extends ServiceLogSearchCriteria { - - public void setFormat(String format) { - addParam(SearchCriteriaConstants.PARAM_FORMAT, format); - } - - public String getFormat() { - return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class); - } - - public void setUtcOffset(String utcOffset) { - addParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, utcOffset); - } - - public String getUtcOffset() { - return getParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, String.class); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java deleted file mode 100644 index e469367..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class ServiceLogSearchCriteria extends CommonServiceLogSearchCriteria { - - public void setKeyword(String keyword) { - addParam(SearchCriteriaConstants.PARAM_KEYWORD, keyword); - } - - public String getKeyword() { - return getParam(SearchCriteriaConstants.PARAM_KEYWORD, String.class); - } - - public void setKeywordType(String keywordType) { - addParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, keywordType); - } - - public String getKeywordType() { - return getParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, String.class); - } - - public void setSourceLogId(String sourceLogId) { - addParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, sourceLogId); - } - - public String getSourceLogId() { - return getParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, String.class); - } - - public void setToken(String token) { - addParam(SearchCriteriaConstants.PARAM_TOKEN, token); - } - - public String getToken() { - return getParam(SearchCriteriaConstants.PARAM_TOKEN, String.class); - } - - public void setLastPage(boolean lastPage) { - addParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, lastPage); - } - - public boolean isLastPage() { - return getParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, Boolean.class); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java deleted file mode 100644 index 277aeb9..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class ServiceLogTruncatedSearchCriteria extends ServiceLogSearchCriteria { - - public String getId() { - return getParam(SearchCriteriaConstants.PARAM_ID, String.class); - } - - public void setId(String id) { - addParam(SearchCriteriaConstants.PARAM_ID, id); - } - - public String getScrollType() { - return getParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, String.class); - } - - public void setScrollType(String scrollType) { - addParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, scrollType); - } - - public String getNumberRows() { - return getParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, String.class); - } - - public void setNumberRows(String numberRows) { - addParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, numberRows); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java deleted file mode 100644 index 46d13cc..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.query.model; - -import org.apache.ambari.logsearch.query.SearchCriteriaConstants; - -public class UserExportSearchCriteria extends FieldAuditLogSearchCriteria { - public void setFormat(String format) { - addParam(SearchCriteriaConstants.PARAM_FORMAT, format); - } - - public String getFormat() { - return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java index 0bd326e..d5b6525 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java @@ -20,52 +20,39 @@ package org.apache.ambari.logsearch.rest; import javax.inject.Inject; +import javax.inject.Named; import javax.ws.rs.BeanParam; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; +import freemarker.template.TemplateException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest; import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest; -import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest; -import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest; +import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest; +import org.apache.ambari.logsearch.model.request.impl.AuditServiceLoadRequest; import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest; -import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest; import org.apache.ambari.logsearch.model.request.impl.UserExportRequest; import org.apache.ambari.logsearch.model.response.AuditLogResponse; import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse; import org.apache.ambari.logsearch.model.response.GroupListResponse; -import org.apache.ambari.logsearch.model.response.NameValueDataListResponse; -import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria; -import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria; -import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria; -import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria; import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest; import org.apache.ambari.logsearch.manager.AuditLogsManager; -import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria; import org.springframework.context.annotation.Scope; -import org.springframework.core.convert.ConversionService; -import org.springframework.stereotype.Component; import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*; @Api(value = "audit/logs", description = "Audit log operations") @Path("audit/logs") -@Component +@Named @Scope("request") public class AuditLogsResource { @Inject private AuditLogsManager auditLogsManager; - @Inject - private ConversionService conversionService; - @GET @Path("/schema/fields") @Produces({"application/json"}) @@ -78,15 +65,15 @@ public class AuditLogsResource { @Produces({"application/json"}) @ApiOperation(GET_AUDIT_LOGS_OD) public AuditLogResponse getAuditLogs(@BeanParam AuditLogRequest auditLogRequest) { - return auditLogsManager.getLogs(conversionService.convert(auditLogRequest, AuditLogSearchCriteria.class)); + return auditLogsManager.getLogs(auditLogRequest); } @GET @Path("/components") @Produces({"application/json"}) @ApiOperation(GET_AUDIT_COMPONENTS_OD) - public GroupListResponse getAuditComponents(@BeanParam SimpleQueryRequest request) { - return auditLogsManager.getAuditComponents(conversionService.convert(request, CommonSearchCriteria.class)); + public GroupListResponse getAuditComponents(@BeanParam AuditComponentRequest request) { + return auditLogsManager.getAuditComponents(request); } @GET @@ -94,63 +81,31 @@ public class AuditLogsResource { @Produces({"application/json"}) @ApiOperation(GET_AUDIT_LINE_GRAPH_DATA_OD) public BarGraphDataListResponse getAuditBarGraphData(@BeanParam AuditBarGraphRequest request) { - return auditLogsManager.getAuditBarGraphData(conversionService.convert(request, AuditBarGraphSearchCriteria.class)); + return auditLogsManager.getAuditBarGraphData(request); } @GET - @Path("/users") - @Produces({"application/json"}) - @ApiOperation(GET_TOP_AUDIT_USERS_OD) - public BarGraphDataListResponse getTopAuditUsers(@BeanParam FieldAuditBarGraphRequest request) { - return auditLogsManager.topTenUsers(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class)); - } - - @GET - @Path("/resources") + @Path("/resources/{top}") @Produces({"application/json"}) @ApiOperation(GET_TOP_AUDIT_RESOURCES_OD) - public BarGraphDataListResponse getTopAuditResources(@BeanParam FieldAuditLogRequest request) { - return auditLogsManager.topTenResources(conversionService.convert(request, FieldAuditLogSearchCriteria.class)); - } - - @GET - @Path("/live/count") - @Produces({"application/json"}) - @ApiOperation(GET_LIVE_LOGS_COUNT_OD) - public NameValueDataListResponse getLiveLogsCount() { - return auditLogsManager.getLiveLogCounts(); - } - - @GET - @Path("/request/user/bargraph") - @Produces({"application/json"}) - @ApiOperation(GET_REQUEST_USER_LINE_GRAPH_OD) - public BarGraphDataListResponse getRequestUserBarGraph(@BeanParam FieldAuditBarGraphRequest request) { - return auditLogsManager.getRequestUserLineGraph(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class)); - } - - @GET - @Path("/anygraph") - @Produces({"application/json"}) - @ApiOperation(GET_ANY_GRAPH_DATA_OD) - public BarGraphDataListResponse getAnyGraphData(@BeanParam AnyGraphRequest request) { - return auditLogsManager.getAnyGraphData(conversionService.convert(request, AnyGraphSearchCriteria.class)); + public BarGraphDataListResponse getResources(@BeanParam FieldAuditLogRequest request) { + return auditLogsManager.topResources(request); } @GET - @Path("/users/export") + @Path("/export") @Produces({"application/json"}) @ApiOperation(EXPORT_USER_TALBE_TO_TEXT_FILE_OD) - public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) { - return auditLogsManager.exportUserTableToTextFile(conversionService.convert(request, UserExportSearchCriteria.class)); + public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) throws TemplateException { + return auditLogsManager.export(request); } @GET @Path("/serviceload") @Produces({"application/json"}) @ApiOperation(GET_SERVICE_LOAD_OD) - public BarGraphDataListResponse getServiceLoad(@BeanParam BaseAuditLogRequest request) { - return auditLogsManager.getServiceLoad(conversionService.convert(request, CommonSearchCriteria.class)); + public BarGraphDataListResponse getServiceLoad(@BeanParam AuditServiceLoadRequest request) { + return auditLogsManager.getServiceLoad(request); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java index 94bf059..df83d44 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java @@ -19,6 +19,7 @@ package org.apache.ambari.logsearch.rest; import javax.inject.Inject; +import javax.inject.Named; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -26,13 +27,12 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.ambari.logsearch.manager.PublicManager; import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; import static org.apache.ambari.logsearch.doc.DocConstants.PublicOperationDescriptions.OBTAIN_GENERAL_CONFIG_OD; @Api(value = "public", description = "Public operations") @Path("public") -@Component +@Named @Scope("request") public class PublicResource { http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java index 5a17147..d6ceca5 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java @@ -19,21 +19,23 @@ package org.apache.ambari.logsearch.rest; import javax.inject.Inject; +import javax.inject.Named; import javax.ws.rs.BeanParam; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest; import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest; -import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest; import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogAggregatedInfoRequest; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentLevelRequest; import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest; +import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest; import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest; import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest; import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse; @@ -43,23 +45,15 @@ import org.apache.ambari.logsearch.model.response.GroupListResponse; import org.apache.ambari.logsearch.model.response.NameValueDataListResponse; import org.apache.ambari.logsearch.model.response.NodeListResponse; import org.apache.ambari.logsearch.model.response.ServiceLogResponse; -import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria; import org.apache.ambari.logsearch.manager.ServiceLogsManager; -import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria; -import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria; -import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria; -import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria; -import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria; -import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria; import org.springframework.context.annotation.Scope; import org.springframework.core.convert.ConversionService; -import org.springframework.stereotype.Component; import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*; @Api(value = "service/logs", description = "Service log operations") @Path("service/logs") -@Component +@Named @Scope("request") public class ServiceLogsResource { @@ -73,7 +67,7 @@ public class ServiceLogsResource { @Produces({"application/json"}) @ApiOperation(SEARCH_LOGS_OD) public ServiceLogResponse searchSolrData(@BeanParam ServiceLogRequest request) { - return serviceLogsManager.searchLogs(conversionService.convert(request, ServiceLogSearchCriteria.class)); + return serviceLogsManager.searchLogs(request); } @GET @@ -96,16 +90,8 @@ public class ServiceLogsResource { @Path("/aggregated") @Produces({"application/json"}) @ApiOperation(GET_AGGREGATED_INFO_OD) - public GraphDataListResponse getAggregatedInfo(@BeanParam BaseServiceLogRequest request) { - return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonServiceLogSearchCriteria.class)); - } - - @GET - @Path("/levels/count") - @Produces({"application/json"}) - @ApiOperation(GET_LOG_LEVELS_COUNT_OD) - public CountDataListResponse getLogLevelsCount() { - return serviceLogsManager.getLogLevelCount(); + public GraphDataListResponse getAggregatedInfo(@BeanParam ServiceLogAggregatedInfoRequest request) { + return serviceLogsManager.getAggregatedInfo(request); } @GET @@ -128,18 +114,16 @@ public class ServiceLogsResource { @Path("/tree") @Produces({"application/json"}) @ApiOperation(GET_TREE_EXTENSION_OD) - public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogRequest request) { - ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class); - searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change - return serviceLogsManager.getTreeExtension(searchCriteria); + public NodeListResponse getTreeExtension(@BeanParam ServiceLogHostComponentRequest request) { + return serviceLogsManager.getTreeExtension(request); } @GET - @Path("/levels/counts/namevalues") + @Path("/levels/counts") @Produces({"application/json"}) @ApiOperation(GET_LOG_LEVELS_COUNT_OD) - public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogRequest request) { - return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogSearchCriteria.class)); + public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogLevelCountRequest request) { + return serviceLogsManager.getLogsLevelCount(request); } @GET @@ -147,15 +131,7 @@ public class ServiceLogsResource { @Produces({"application/json"}) @ApiOperation(GET_HISTOGRAM_DATA_OD) public BarGraphDataListResponse getHistogramData(@BeanParam ServiceGraphRequest request) { - return serviceLogsManager.getHistogramData(conversionService.convert(request, ServiceGraphSearchCriteria.class)); - } - - @GET - @Path("/request/cancel") - @Produces({"application/json"}) - @ApiOperation(CANCEL_FIND_REQUEST_OD) - public String cancelFindRequest(@QueryParam("token") @ApiParam String token) { - return serviceLogsManager.cancelFindRequestByDate(token); + return serviceLogsManager.getHistogramData(request); } @GET @@ -163,36 +139,24 @@ public class ServiceLogsResource { @Produces({"application/json"}) @ApiOperation(EXPORT_TO_TEXT_FILE_OD) public Response exportToTextFile(@BeanParam ServiceLogExportRequest request) { - return serviceLogsManager.exportToTextFile(conversionService.convert(request, ServiceLogExportSearchCriteria.class)); - + return serviceLogsManager.export(request); } @GET @Path("/hosts/components") @Produces({"application/json"}) @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD) - public NodeListResponse getHostListByComponent(@BeanParam ServiceLogRequest request, @QueryParam("componentName") @ApiParam String componentName) { - ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class); - searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change - return serviceLogsManager.getHostListByComponent(searchCriteria); + public NodeListResponse getHostListByComponent(@BeanParam ServiceLogComponentHostRequest request) { + return serviceLogsManager.getHostListByComponent(request); } @GET @Path("/components/levels/counts") @Produces({"application/json"}) @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD) - public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogRequest request) { - return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogSearchCriteria.class)); + public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogComponentLevelRequest request) { + return serviceLogsManager.getComponentListWithLevelCounts(request); } - - @GET - @Path("/solr/boundarydates") - @Produces({"application/json"}) - @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD) - public NameValueDataListResponse getExtremeDatesForBundelId(@BeanParam ServiceExtremeDatesRequest request) { - return serviceLogsManager.getExtremeDatesForBundelId(conversionService.convert(request, ServiceExtremeDatesCriteria.class)); - } - @GET @Path("/schema/fields") @Produces({"application/json"}) @@ -202,11 +166,11 @@ public class ServiceLogsResource { } @GET - @Path("/anygraph") + @Path("/count/anygraph") @Produces({"application/json"}) - @ApiOperation(GET_ANY_GRAPH_DATA_OD) - public BarGraphDataListResponse getAnyGraphData(@BeanParam ServiceAnyGraphRequest request) { - return serviceLogsManager.getAnyGraphData(conversionService.convert(request, ServiceAnyGraphSearchCriteria.class)); + @ApiOperation(GET_ANY_GRAPH_COUNT_DATA_OD) + public BarGraphDataListResponse getAnyGraphCountData(@BeanParam ServiceAnyGraphRequest request) { + return serviceLogsManager.getAnyGraphCountData(request); } @GET @@ -214,7 +178,7 @@ public class ServiceLogsResource { @Produces({"application/json"}) @ApiOperation(GET_AFTER_BEFORE_LOGS_OD) public ServiceLogResponse getAfterBeforeLogs(@BeanParam ServiceLogTruncatedRequest request) { - return serviceLogsManager.getAfterBeforeLogs(conversionService.convert(request, ServiceLogTruncatedSearchCriteria.class)); + return serviceLogsManager.getAfterBeforeLogs(request); } @GET http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java index fd36978..1cfc8f8 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java @@ -20,6 +20,7 @@ package org.apache.ambari.logsearch.rest; import javax.inject.Inject; +import javax.inject.Named; import javax.ws.rs.BeanParam; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -37,13 +38,12 @@ import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria; import org.apache.ambari.logsearch.view.VUserConfig; import org.springframework.context.annotation.Scope; import org.springframework.core.convert.ConversionService; -import org.springframework.stereotype.Component; import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*; @Api(value = "userconfig", description = "User config operations") @Path("userconfig") -@Component +@Named @Scope("request") public class UserConfigResource { http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java new file mode 100644 index 0000000..1ea30bc --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.solr; + +public class SolrConstants { + + private SolrConstants() { + } + + + public class CommonLogConstants { + private CommonLogConstants() { + } + public static final String ID = "id"; + public static final String SEQUENCE_ID = "seq_num"; + } + + public class ServiceLogConstants { + + private ServiceLogConstants() { + } + + public static final String BUNDLE_ID = "bundle_id"; + public static final String LOGTIME = "logtime"; + public static final String COMPONENT = "type"; + public static final String LOG_MESSAGE = "log_message"; + public static final String KEY_LOG_MESSAGE = "key_log_message"; + public static final String HOST = "host"; + public static final String LEVEL = "level"; + public static final String THREAD_NAME = "thread_name"; + public static final String LOGGER_NAME = "logger_name"; + public static final String FILE = "file"; + public static final String LINE_NUMBER = "line_number"; + public static final String PATH = "path"; + } + + public class AuditLogConstants { + private AuditLogConstants() { + } + + public static final String AUDIT_COMPONENT = "repo"; + public static final String AUDIT_EVTTIME = "evtTime"; + public static final String AUDIT_REQUEST_USER = "reqUser"; + public static final String AUDIT_RESOURCE = "resource"; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java deleted file mode 100644 index 637a4d7..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ambari.logsearch.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.model.response.BarGraphData; -import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse; -import org.apache.ambari.logsearch.model.response.NameValueData; -import org.apache.ambari.logsearch.view.VHost; -import org.apache.ambari.logsearch.view.VSummary; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.apache.solr.common.SolrDocument; -import org.apache.solr.common.SolrDocumentList; -import org.apache.solr.common.util.SimpleOrderedMap; - -public class BizUtil { - private static final Logger logger = Logger.getLogger(BizUtil.class); - - private BizUtil() { - throw new UnsupportedOperationException(); - } - - public static String convertObjectToNormalText(SolrDocumentList docList) { - String textToSave = ""; - HashMap<String, String> blankFieldsMap = new HashMap<String, String>(); - if (docList == null){ - return "no data"; - } - if (docList.isEmpty()) { - return "no data"; - } - SolrDocument docForBlankCaculation = docList.get(0); - if(docForBlankCaculation == null){ - return "no data"; - } - Collection<String> fieldsForBlankCaculation = docForBlankCaculation.getFieldNames(); - - int maxLengthOfField = 0; - if (fieldsForBlankCaculation == null) { - return "no data"; - } - for (String field : fieldsForBlankCaculation) { - if (!StringUtils.isBlank(field) && field.length() > maxLengthOfField) { - maxLengthOfField = field.length(); - } - } - - for (String field : fieldsForBlankCaculation) { - if (!StringUtils.isBlank(field)) { - blankFieldsMap.put(field, StringUtils.rightPad(field, maxLengthOfField - field.length())); - } - } - - for (SolrDocument doc : docList) { - if (doc != null) { - StringBuffer textTowrite = new StringBuffer(); - - if (doc.getFieldValue(LogSearchConstants.LOGTIME) != null) { - textTowrite.append(doc.getFieldValue(LogSearchConstants.LOGTIME).toString() + " "); - } - if (doc.getFieldValue(LogSearchConstants.SOLR_LEVEL) != null) { - textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_LEVEL).toString()).append(" "); - } - if (doc.getFieldValue(LogSearchConstants.SOLR_THREAD_NAME) != null) { - textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_THREAD_NAME).toString().trim()).append(" "); - } - if (doc.getFieldValue(LogSearchConstants.SOLR_LOGGER_NAME) != null) { - textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_LOGGER_NAME).toString().trim()).append(" "); - } - if (doc.getFieldValue(LogSearchConstants.SOLR_FILE) != null && doc.getFieldValue(LogSearchConstants.SOLR_LINE_NUMBER) != null) { - textTowrite - .append(doc.getFieldValue(LogSearchConstants.SOLR_FILE).toString()) - .append(":") - .append(doc.getFieldValue(LogSearchConstants.SOLR_LINE_NUMBER).toString()) - .append(" "); - } - if (doc.getFieldValue(LogSearchConstants.SOLR_LOG_MESSAGE) != null) { - textTowrite.append("- ") - .append(doc.getFieldValue(LogSearchConstants.SOLR_LOG_MESSAGE).toString()); - } - textTowrite.append("\n"); - textToSave += textTowrite.toString(); - } - } - return textToSave; - } - - public static VSummary buildSummaryForLogFile(SolrDocumentList docList) { - VSummary vsummary = new VSummary(); - if (CollectionUtils.isEmpty(docList)) { - return vsummary; - } - int numLogs = 0; - List<VHost> vHosts = new ArrayList<VHost>(); - vsummary.setHosts(vHosts); - String levels = ""; - for (SolrDocument doc : docList) { - if (doc != null) { - // adding Host and Component appropriately - String hostname = (String) doc.getFieldValue("host"); - String comp = (String) doc.getFieldValue("type"); - String level = (String) doc.getFieldValue("level"); - if (StringUtils.isBlank(level)) { - level = ""; - } - boolean newHost = true; - for (VHost host : vHosts) { - if (host != null && host.getName().equals(hostname)) { - newHost = false; - if (StringUtils.isBlank(comp)) { - Set<String> compList = host.getComponents(); - if (compList != null) { - compList.add(comp); - } - } - break; - } - } - if (newHost) { - VHost vHost = new VHost(); - if (!StringUtils.isBlank(hostname)) { - vHost.setName(hostname); - } - Set<String> component = new LinkedHashSet<String>(); - if (StringUtils.isBlank(comp)) { - component.add(comp); - } - vHost.setComponents(component); - vHosts.add(vHost); - } - // getting levels - if (!levels.contains(level)) { - levels = levels + ", " + level; - } - numLogs += 1; - } - } - levels = levels.replaceFirst(", ", ""); - vsummary.setLevels(levels); - vsummary.setNumberLogs("" + numLogs); - return vsummary; - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - public static BarGraphDataListResponse buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse, String innerJsonKey, String outerJsonKey) { - - BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse(); - - Collection<BarGraphData> dataList = new ArrayList<>(); - if (jsonFacetResponse == null) { - logger.info("Solr document list in null"); - return barGraphDataListResponse; - } - List<Object> userList = jsonFacetResponse.getAll(outerJsonKey); - if (userList.isEmpty()) { - return barGraphDataListResponse; - } - SimpleOrderedMap<Map<String, Object>> userMap = (SimpleOrderedMap<Map<String, Object>>) userList.get(0); - if (userMap == null) { - logger.info("No top user details found"); - return barGraphDataListResponse; - } - List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap.get("buckets"); - if(userUsageList == null){ - return barGraphDataListResponse; - } - for (SimpleOrderedMap usageMap : userUsageList) { - if (usageMap != null) { - BarGraphData barGraphData = new BarGraphData(); - String userName = (String) usageMap.get("val"); - if (!StringUtils.isBlank(userName)) { - barGraphData.setName(userName); - } - SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get(innerJsonKey); - List<NameValueData> componetCountList = new ArrayList<NameValueData>(); - if (repoMap != null) { - List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets"); - for (SimpleOrderedMap repoUsageMap : repoUsageList) { - NameValueData componetCount = new NameValueData(); - if (repoUsageMap.get("val") != null) { - componetCount.setName(repoUsageMap.get("val").toString()); - } - String eventCount = ""; - if (repoUsageMap.get("eventCount") != null) { - eventCount = repoUsageMap.get("eventCount").toString(); - } - eventCount = eventCount.replace(".0", ""); - eventCount = eventCount.replace(".00", ""); - - componetCount.setValue(eventCount); - componetCountList.add(componetCount); - } - barGraphData.setDataCount(componetCountList); - dataList.add(barGraphData); - } - }} - barGraphDataListResponse.setGraphData(dataList); - logger.info("getting graph data"); - - return barGraphDataListResponse; - } - - public static HashMap<String, String> sortHashMapByValues(HashMap<String, String> passedMap) { - if (passedMap == null ) { - return null; - } - HashMap<String, String> sortedMap = new LinkedHashMap<String, String>(); - List<String> mapValues = new ArrayList<String>(passedMap.values()); - HashMap<String, String> invertedKeyValue = new HashMap<String, String>(); - Collections.sort(mapValues, new Comparator<String>() { - @Override - public int compare(String s1, String s2) { - return s1.compareToIgnoreCase(s2); - } - }); - Iterator<Entry<String, String>> it = passedMap.entrySet().iterator(); - while (it.hasNext()) { - @SuppressWarnings("rawtypes") - Map.Entry pair = (Map.Entry) it.next(); - invertedKeyValue.put("" + pair.getValue(), "" + pair.getKey()); - } - - for (String valueOfKey : mapValues) { - sortedMap.put(invertedKeyValue.get(valueOfKey), valueOfKey); - } - - return sortedMap; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ea644cc4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java index 0de0dbc..9b4f553 100644 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java @@ -114,6 +114,15 @@ public class DateUtil { } + public static Date convertStringToSolrDate(String dateStr) { + try { + SimpleDateFormat formatter = new SimpleDateFormat(LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z); + return formatter.parse(dateStr); + } catch (Exception e){ + throw new RuntimeException("Cannot parse date from request", e.getCause()); + } + } + public static boolean isDateValid(String value) { if (StringUtils.isBlank(value)) { return false;
