You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ha...@apache.org on 2016/03/03 19:09:45 UTC

[12/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
deleted file mode 100755
index b14dc22..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
+++ /dev/null
@@ -1,504 +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.eagle.service.generic;
-
-import org.apache.eagle.common.config.EagleConfigFactory;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.*;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.query.GenericQuery;
-import org.apache.eagle.query.ListQueryCompiler;
-import org.apache.eagle.service.common.EagleExceptionWrapper;
-import org.apache.eagle.storage.hbase.query.GenericQueryBuilder;
-import org.apache.eagle.common.DateTimeUtil;
-import com.sun.jersey.api.json.JSONWithPadding;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.eagle.query.aggregate.timeseries.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import java.util.*;
-
-@Path("list")
-public class ListQueryResource {
-	private static final Logger LOG = LoggerFactory.getLogger(ListQueryResource.class);
-
-	/**
-	 * Support old interface without verbose parameter
-	 */
-	public ListQueryAPIResponseEntity listQuery(@QueryParam("query") String query,
-												@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime,
-												@QueryParam("pageSize") int pageSize, @QueryParam("startRowkey") String startRowkey,
-												@QueryParam("treeAgg") boolean treeAgg, @QueryParam("timeSeries") boolean timeSeries,
-												@QueryParam("intervalmin") long intervalmin, @QueryParam("top") int top,
-												@QueryParam("filterIfMissing") boolean filterIfMissing,
-												@QueryParam("parallel") int parallel,
-												@QueryParam("metricName") String metricName){
-		return listQuery(query, startTime, endTime, pageSize, startRowkey, treeAgg, timeSeries, intervalmin, top, filterIfMissing, parallel, metricName,true);
-	}
-
-	/**
-	 * TODO refactor the code structure,  now it's messy
-	 * @param query
-	 * @param startTime
-	 * @param endTime
-	 * @param pageSize
-	 * @param startRowkey
-	 * @param treeAgg
-	 * @param timeSeries
-	 * @param intervalmin
-	 * @return
-	 */
-	@GET
-	@Produces({MediaType.APPLICATION_JSON})
-	public ListQueryAPIResponseEntity listQuery(@QueryParam("query") String query, 
-			@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime,
-			@QueryParam("pageSize") int pageSize, @QueryParam("startRowkey") String startRowkey, 
-			@QueryParam("treeAgg") boolean treeAgg, @QueryParam("timeSeries") boolean timeSeries, 
-			@QueryParam("intervalmin") long intervalmin, @QueryParam("top") int top,
-			@QueryParam("filterIfMissing") boolean filterIfMissing,
-			@QueryParam("parallel") int parallel,
-			@QueryParam("metricName") String metricName,
-			@QueryParam("verbose") Boolean verbose) {
-		if(!EagleConfigFactory.load().isCoprocessorEnabled())
-			return listQueryWithoutCoprocessor(query,startTime,endTime,pageSize,startRowkey,treeAgg,timeSeries,intervalmin,top,filterIfMissing,parallel,metricName,verbose);
-
-		StopWatch watch = new StopWatch();
-		watch.start();
-		ListQueryAPIResponseEntity result = new ListQueryAPIResponseEntity();
-		try{
-			validateQueryParameters(startRowkey, pageSize);
-
-			// 1. Compile query to parse parameters and HBase Filter
-			ListQueryCompiler comp = new ListQueryCompiler(query, filterIfMissing);
-			String serviceName = comp.serviceName();
-			
-			SearchCondition condition = new SearchCondition();
-			condition.setOutputVerbose(verbose == null || verbose);
-			condition.setOutputAlias(comp.getOutputAlias());
-			condition.setFilter(comp.filter());
-			condition.setQueryExpression(comp.getQueryExpression());
-			if(comp.sortOptions() == null && top > 0) {
-				LOG.warn("Parameter \"top\" is only used for sort query! Ignore top parameter this time since it's not a sort query");
-			}
-
-			// 2. Initialize partition values if set
-			// TODO: For now we don't support one query to query multiple partitions. In future 
-			// if partition is defined for the entity, internally We need to spawn multiple
-			// queries and send one query for each search condition for each partition
-			final List<String[]> partitionValues = comp.getQueryPartitionValues();
-			if (partitionValues != null) {
-				condition.setPartitionValues(Arrays.asList(partitionValues.get(0)));
-			}
-
-			// 3. Set time range if it's timeseries service
-			EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName(serviceName);
-			if(ed.isTimeSeries()){
-				// TODO check timestamp exists for timeseries or topology data
-				condition.setStartTime(startTime);
-				condition.setEndTime(endTime);
-			}
-
-			// 4. Set HBase start scanning rowkey if given
-			condition.setStartRowkey(startRowkey);
-
-			// 5. Set page size
-			condition.setPageSize(pageSize);
-
-			// 6. Generate output,group-by,aggregated fields
-			List<String> outputFields = comp.outputFields();
-			List<String> groupbyFields = comp.groupbyFields();
-			List<String> aggregateFields = comp.aggregateFields();
-			Set<String> filterFields = comp.getFilterFields();
-
-			// Start to generate output fields list {
-			condition.setOutputAll(comp.isOutputAll());
-			if(outputFields == null) outputFields = new ArrayList<String>();
-			if(comp.hasAgg()){
-				if(groupbyFields != null) outputFields.addAll(groupbyFields);
-				if(aggregateFields != null) outputFields.addAll(aggregateFields);
-				if(GenericMetricEntity.GENERIC_METRIC_SERVICE.equals(serviceName) && !outputFields.contains(GenericMetricEntity.VALUE_FIELD)){
-					outputFields.add(GenericMetricEntity.VALUE_FIELD);
-				}
-			}
-			if(filterFields!=null) outputFields.addAll(filterFields);
-			condition.setOutputFields(outputFields);
-			if(comp.isOutputAll()){
-				LOG.info("Output fields: ALL");
-			}else{
-				LOG.info("Output fields: " + StringUtils.join(outputFields, ","));
-			}
-			// } END
-
-			// 7. Build GenericQuery
-			GenericQuery reader = GenericQueryBuilder
-									.select(outputFields)
-									.from(serviceName, metricName).where(condition)
-									.groupBy(
-											comp.hasAgg(),
-											groupbyFields,
-											comp.aggregateFunctionTypes(),
-											aggregateFields)
-									.timeSeries(timeSeries, intervalmin)
-									.treeAgg(treeAgg)
-									.orderBy(comp.sortOptions(),comp.sortFunctions(),comp.sortFields()).top(top)
-									.parallel(parallel)								
-									.build();
-			
-			// 8. Fill response object
-			List entities = reader.result();
-			result.setObj(entities);
-			result.setTotalResults(entities.size());
-			result.setSuccess(true);
-			result.setLastTimestamp(reader.getLastTimestamp());
-			result.setFirstTimestamp(reader.getFirstTimeStamp());
-		}catch(Exception ex){
-			LOG.error("Fail executing list query", ex);
-			result.setException(EagleExceptionWrapper.wrap(ex));
-			result.setSuccess(false);
-			return result;
-		}finally{
-			watch.stop();
-			result.setElapsedms(watch.getTime());
-		}
-		LOG.info("Query done " + watch.getTime() + " ms");
-		return result;
-	}
-	
-	/**
-	 * <b>TODO</b> remove the legacy deprecated implementation of listQueryWithoutCoprocessor
-	 *
-	 * @see #listQuery(String, String, String, int, String, boolean, boolean, long, int, boolean, int, String,Boolean)
-	 *
-	 * @param query
-	 * @param startTime
-	 * @param endTime
-	 * @param pageSize
-	 * @param startRowkey
-	 * @param treeAgg
-	 * @param timeSeries
-	 * @param intervalmin
-	 * @return
-	 */
-	@GET
-	@Path("/legacy")
-	@Produces({MediaType.APPLICATION_JSON})
-	@Deprecated
-	public ListQueryAPIResponseEntity listQueryWithoutCoprocessor(@QueryParam("query") String query,
-	                                                              @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime,
-	                                                              @QueryParam("pageSize") int pageSize, @QueryParam("startRowkey") String startRowkey,
-	                                                              @QueryParam("treeAgg") boolean treeAgg, @QueryParam("timeSeries") boolean timeSeries,
-	                                                              @QueryParam("intervalmin") long intervalmin, @QueryParam("top") int top,
-	                                                              @QueryParam("filterIfMissing") boolean filterIfMissing,
-	                                                              @QueryParam("parallel") int parallel,
-	                                                              @QueryParam("metricName") String metricName,
-																  @QueryParam("verbose") Boolean verbose) {
-		StopWatch watch = new StopWatch();
-		watch.start();
-		ListQueryAPIResponseEntity result = new ListQueryAPIResponseEntity();
-		try{
-			validateQueryParameters(startRowkey, pageSize);
-			ListQueryCompiler comp = new ListQueryCompiler(query, filterIfMissing);
-			String serviceName = comp.serviceName();
-
-			SearchCondition condition = new SearchCondition();
-			condition.setFilter(comp.filter());
-			condition.setQueryExpression(comp.getQueryExpression());
-			if(comp.sortOptions() == null && top > 0) {
-				LOG.warn("Parameter \"top\" is only used for sort query! Ignore top parameter this time since it's not a sort query");
-			}
-
-			// TODO: For now we don't support one query to query multiple partitions. In future
-			// if partition is defined for the entity, internally We need to spawn multiple
-			// queries and send one query for each search condition for each partition
-			final List<String[]> partitionValues = comp.getQueryPartitionValues();
-			if (partitionValues != null) {
-				condition.setPartitionValues(Arrays.asList(partitionValues.get(0)));
-			}
-			EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName(serviceName);
-			if(ed.isTimeSeries()){
-				// TODO check timestamp exists for timeseries or topology data
-				condition.setStartTime(startTime);
-				condition.setEndTime(endTime);
-			}
-			condition.setOutputVerbose(verbose==null || verbose );
-			condition.setOutputAlias(comp.getOutputAlias());
-			condition.setOutputAll(comp.isOutputAll());
-			condition.setStartRowkey(startRowkey);
-			condition.setPageSize(pageSize);
-
-			List<String> outputFields = comp.outputFields();
-			if(outputFields == null) outputFields = new ArrayList<String>();
-
-			/**
-			 * TODO ugly logic, waiting for refactoring
-			 */
-			if(!comp.hasAgg() && !serviceName.equals(GenericMetricEntity.GENERIC_METRIC_SERVICE)){ // pure list query
-//				List<String> outputFields = comp.outputFields();
-				Set<String> filterFields = comp.getFilterFields();
-				if(filterFields != null) outputFields.addAll(filterFields);
-				condition.setOutputFields(outputFields);
-				if(condition.isOutputAll()){
-					LOG.info("Output: ALL");
-				}else{
-					LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", "));
-				}
-				GenericEntityBatchReader reader = new GenericEntityBatchReader(serviceName, condition);
-				List<? extends TaggedLogAPIEntity> entityList = reader.read();
-				result.setObj(entityList);
-				result.setTotalResults(entityList.size());
-				result.setSuccess(true);
-				result.setLastTimestamp(reader.getLastTimestamp());
-				result.setFirstTimestamp(reader.getFirstTimestamp());
-			}else if(!comp.hasAgg() && serviceName.equals(GenericMetricEntity.GENERIC_METRIC_SERVICE)){
-				// validate metric name
-				if(metricName == null || metricName.isEmpty()){
-					throw new IllegalArgumentException("metricName should not be empty for metric list query");
-				}
-//				List<String> outputFields = comp.outputFields();
-				Set<String> filterFields = comp.getFilterFields();
-				if(filterFields != null) outputFields.addAll(filterFields);
-				condition.setOutputFields(outputFields);
-				if(condition.isOutputAll()){
-					LOG.info("Output: ALL");
-				}else{
-					LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", "));
-				}
-				GenericMetricEntityBatchReader reader = new GenericMetricEntityBatchReader(metricName, condition);
-				List<? extends TaggedLogAPIEntity> entityList = reader.read();
-				result.setObj(entityList);
-				result.setTotalResults(entityList.size());
-				result.setSuccess(true);
-				result.setLastTimestamp(reader.getLastTimestamp());
-				result.setFirstTimestamp(reader.getFirstTimestamp());
-			}
-			else if(!treeAgg && !timeSeries && parallel <= 0 ){ // non time-series based aggregate query, not hierarchical
-				List<String> groupbyFields = comp.groupbyFields();
-				List<String> aggregateFields = comp.aggregateFields();
-				Set<String> filterFields = comp.getFilterFields();
-//				List<String> outputFields = new ArrayList<String>();
-				if(groupbyFields != null) outputFields.addAll(groupbyFields);
-				if(filterFields != null) outputFields.addAll(filterFields);
-				outputFields.addAll(aggregateFields);
-
-				if(GenericMetricEntity.GENERIC_METRIC_SERVICE.equals(serviceName) && !outputFields.contains(GenericMetricEntity.VALUE_FIELD)){
-					outputFields.add(GenericMetricEntity.VALUE_FIELD);
-				}
-
-				FlatAggregator agg = new FlatAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields());
-				StreamReader reader = null;
-				if(ed.getMetricDefinition() == null){
-					reader = new GenericEntityStreamReader(serviceName, condition);
-				}else{ // metric aggregation need metric reader
-					reader = new GenericMetricEntityDecompactionStreamReader(metricName, condition);
-				}
-				condition.setOutputFields(outputFields);
-				if(condition.isOutputAll()){
-					LOG.info("Output: ALL");
-				}else{
-					LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", "));
-				}
-				reader.register(agg);
-				reader.readAsStream();
-				ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<Map.Entry<List<String>, List<Double>>>();
-				obj.addAll(agg.result().entrySet());
-				if(comp.sortOptions() == null){
-					result.setObj(obj);
-				}else{ // has sort options
-					result.setObj(PostFlatAggregateSort.sort(agg.result(), comp.sortOptions(), top));
-				}
-				result.setTotalResults(0);
-				result.setSuccess(true);
-				result.setLastTimestamp(reader.getLastTimestamp());
-				result.setFirstTimestamp(reader.getFirstTimestamp());
-			}else if(!treeAgg && !timeSeries && parallel > 0){ // TODO ugly branch, let us refactor
-				List<String> groupbyFields = comp.groupbyFields();
-				List<String> aggregateFields = comp.aggregateFields();
-				Set<String> filterFields = comp.getFilterFields();
-//				List<String> outputFields = new ArrayList<String>();
-				if(groupbyFields != null) outputFields.addAll(groupbyFields);
-				if(filterFields != null) outputFields.addAll(filterFields);
-				outputFields.addAll(aggregateFields);
-				if(GenericMetricEntity.GENERIC_METRIC_SERVICE.equals(serviceName) && !outputFields.contains(GenericMetricEntity.VALUE_FIELD)){
-					outputFields.add(GenericMetricEntity.VALUE_FIELD);
-				}
-				condition.setOutputFields(outputFields);
-				if(condition.isOutputAll()){
-					LOG.info("Output: ALL");
-				}else{
-					LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", "));
-				}
-				FlatAggregator agg = new FlatAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields());
-				EntityCreationListener listener = EntityCreationListenerFactory.synchronizedEntityCreationListener(agg);
-				StreamReader reader = new GenericEntityStreamReaderMT(serviceName, condition, parallel);
-				reader.register(listener);
-				reader.readAsStream();
-				ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<Map.Entry<List<String>, List<Double>>>();
-				obj.addAll(agg.result().entrySet());
-				if(comp.sortOptions() == null){
-					result.setObj(obj);
-				}else{ // has sort options
-					result.setObj(PostFlatAggregateSort.sort(agg.result(), comp.sortOptions(), top));
-				}
-				result.setTotalResults(0);
-				result.setSuccess(true);
-				result.setLastTimestamp(reader.getLastTimestamp());
-				result.setFirstTimestamp(reader.getFirstTimestamp());
-			}else if(!treeAgg && timeSeries){ // time-series based aggregate query, not hierarchical
-				List<String> groupbyFields = comp.groupbyFields();
-				List<String> sortFields = comp.sortFields();
-				List<String> aggregateFields = comp.aggregateFields();
-				Set<String> filterFields = comp.getFilterFields();
-//				List<String> outputFields = new ArrayList<String>();
-				if(groupbyFields != null) outputFields.addAll(groupbyFields);
-				if(filterFields != null) outputFields.addAll(filterFields);
-				if (sortFields != null) outputFields.addAll(sortFields);
-				outputFields.addAll(aggregateFields);
-				if(GenericMetricEntity.GENERIC_METRIC_SERVICE.equals(serviceName) && !outputFields.contains(GenericMetricEntity.VALUE_FIELD)){
-					outputFields.add(GenericMetricEntity.VALUE_FIELD);
-				}
-				StreamReader reader = null;
-				if(ed.getMetricDefinition() == null){
-					if(parallel <= 0){ // TODO ugly quick win
-						reader = new GenericEntityStreamReader(serviceName, condition);
-					}else{
-						reader = new GenericEntityStreamReaderMT(serviceName, condition, parallel);
-					}
-				}else{ // metric aggregation need metric reader
-					reader = new GenericMetricEntityDecompactionStreamReader(metricName, condition);
-					if(!outputFields.contains(GenericMetricEntity.VALUE_FIELD)){
-						outputFields.add(GenericMetricEntity.VALUE_FIELD);
-					}
-				}
-				condition.setOutputFields(outputFields);
-				if(condition.isOutputAll()){
-					LOG.info("Output: ALL");
-				}else{
-					LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", "));
-				}
-				TimeSeriesAggregator tsAgg = new TimeSeriesAggregator(groupbyFields, comp.aggregateFunctionTypes(), aggregateFields,
-						DateTimeUtil.humanDateToDate(condition.getStartTime()).getTime(), DateTimeUtil.humanDateToDate(condition.getEndTime()).getTime(), intervalmin*60*1000);
-				if(parallel <= 0){
-					reader.register(tsAgg);
-				}else{
-					EntityCreationListener listener = EntityCreationListenerFactory.synchronizedEntityCreationListener(tsAgg);
-					reader.register(listener);
-				}
-				// for sorting
-				FlatAggregator sortAgg = null;
-				if (comp.sortOptions() != null) {
-					sortAgg = new FlatAggregator(groupbyFields, comp.sortFunctions(), comp.sortFields());
-					if(parallel <= 0){
-						reader.register(sortAgg);
-					}else{
-						EntityCreationListener listener = EntityCreationListenerFactory.synchronizedEntityCreationListener(sortAgg);
-						reader.register(listener);
-					}
-				}
-				reader.readAsStream();
-				ArrayList<Map.Entry<List<String>, List<double[]>>> obj = new ArrayList<Map.Entry<List<String>, List<double[]>>>();
-				obj.addAll(tsAgg.getMetric().entrySet());
-				if(comp.sortOptions() == null){
-					result.setObj(obj);
-				}else{ // has sort options
-					result.setObj(TimeSeriesPostFlatAggregateSort.sort(sortAgg.result(), tsAgg.getMetric(), comp.sortOptions(), top));
-				}
-				result.setTotalResults(0);
-				result.setSuccess(true);
-				result.setLastTimestamp(reader.getLastTimestamp());
-				result.setFirstTimestamp(reader.getFirstTimestamp());
-			}
-			else{ // use hierarchical aggregate mode
-				List<String> groupbyFields = comp.groupbyFields();
-				List<String> aggregateFields = comp.aggregateFields();
-				Set<String> filterFields = comp.getFilterFields();
-//				List<String> outputFields = new ArrayList<String>();
-				if(groupbyFields != null) outputFields.addAll(groupbyFields);
-				if(filterFields != null) outputFields.addAll(filterFields);
-				outputFields.addAll(aggregateFields);
-				if(GenericMetricEntity.GENERIC_METRIC_SERVICE.equals(serviceName) && !outputFields.contains(GenericMetricEntity.VALUE_FIELD)){
-					outputFields.add(GenericMetricEntity.VALUE_FIELD);
-				}
-				condition.setOutputFields(outputFields);
-				if(condition.isOutputAll()){
-					LOG.info("Output: ALL");
-				}else{
-					LOG.info("Output: " + StringUtils.join(condition.getOutputFields(), ", "));
-				}
-				GenericEntityStreamReader reader = new GenericEntityStreamReader(serviceName, condition);
-				HierarchicalAggregator agg = new HierarchicalAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields());
-				reader.register(agg);
-				reader.readAsStream();
-				if(comp.sortOptions() == null){
-					result.setObj(agg.result());
-				}else{ // has sort options
-					result.setObj(PostHierarchicalAggregateSort.sort(agg.result(), comp.sortOptions()));
-				}
-				result.setTotalResults(0);
-				result.setSuccess(true);
-				result.setLastTimestamp(reader.getLastTimestamp());
-				result.setFirstTimestamp(reader.getFirstTimestamp());
-			}
-		}catch(Exception ex){
-			LOG.error("Fail executing list query: " + query, ex);
-			result.setException(EagleExceptionWrapper.wrap(ex));
-			result.setSuccess(false);
-			return result;
-		}finally{
-			watch.stop();
-			result.setElapsedms(watch.getTime());
-		}
-		LOG.info("Query done " + watch.getTime() + " ms");
-		return result;
-	}
-
-
-	@GET
-	@Path("/jsonp")
-	@Produces({"application/x-javascript", "application/json", "application/xml"})
-	public JSONWithPadding listQueryWithJsonp(@QueryParam("query") String query, 
-			@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime,
-			@QueryParam("pageSize") int pageSize, @QueryParam("startRowkey") String startRowkey, 
-			@QueryParam("treeAgg") boolean treeAgg, @QueryParam("timeSeries") boolean timeSeries, 
-			@QueryParam("intervalmin") long intervalmin, @QueryParam("top") int top,
-			@QueryParam("filterIfMissing") boolean filterIfMissing,
-			@QueryParam("parallel") int parallel,
-			@QueryParam("update") String callback,
-			@QueryParam("verbose") boolean verbose) {
-		ListQueryAPIResponseEntity result = listQuery(query, startTime, endTime, pageSize, startRowkey, treeAgg, timeSeries, intervalmin, top, filterIfMissing, parallel, null,verbose);
-		return new JSONWithPadding(new GenericEntity<ListQueryAPIResponseEntity>(result){}, callback);		
-	}
-	
-	private void validateQueryParameters(String startRowkey, int pageSize){
-		if(pageSize <= 0){
-			throw new IllegalArgumentException("Positive pageSize value should be always provided. The list query format is:\n" + "eagle-service/rest/list?query=<querystring>&pageSize=10&startRowkey=xyz&startTime=xxx&endTime=xxx");
-		}
-		
-		if(startRowkey != null && startRowkey.equals("null")){
-			LOG.warn("startRowkey being null string is not same to startRowkey == null");
-		}
-		return;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/MetadataResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/MetadataResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/MetadataResource.java
deleted file mode 100755
index d5ab87f..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/MetadataResource.java
+++ /dev/null
@@ -1,198 +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.eagle.service.generic;
-
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.log.entity.meta.IndexDefinition;
-import org.apache.eagle.log.entity.meta.MetricDefinition;
-import com.sun.jersey.api.model.AbstractResource;
-import com.sun.jersey.api.model.AbstractResourceMethod;
-import com.sun.jersey.api.model.AbstractSubResourceMethod;
-import com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller;
-
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.node.ArrayNode;
-import org.codehaus.jackson.node.JsonNodeFactory;
-import org.codehaus.jackson.node.ObjectNode;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import java.util.Map;
-
-/**
- * @since : 7/3/14,2014
- */
-@Path(MetadataResource.PATH_META)
-public class MetadataResource {
-	final static String PATH_META = "meta";
-	final static String PATH_RESOURCE = "resource";
-	final static String PATH_SERVICE = "service";
-
-	@GET
-	@Produces(MediaType.APPLICATION_JSON)
-	public Response index(@Context Application application,
-                        @Context HttpServletRequest request){
-		String basePath = request.getRequestURL().toString();
-		ObjectNode root = JsonNodeFactory.instance.objectNode();
-
-		root.put(PATH_RESOURCE,joinUri(basePath,PATH_RESOURCE));
-		root.put(PATH_SERVICE,joinUri(basePath,PATH_SERVICE));
-		return Response.ok().entity(root).build();
-	}
-
-	@GET
-	@Path(PATH_RESOURCE)
-	@Produces(MediaType.APPLICATION_JSON)
-	public Response listAllResourcesRoutes(@Context Application application,
-	                                       @Context HttpServletRequest request){
-		String basePath = request.getRequestURL().toString();
-		basePath = basePath.substring(0,basePath.length() - PATH_META.length() - PATH_RESOURCE.length() -1);
-		ObjectNode root = JsonNodeFactory.instance.objectNode();
-		root.put("base",basePath);
-		ArrayNode resources = JsonNodeFactory.instance.arrayNode();
-		root.put( "resources", resources );
-
-		for ( Class<?> aClass : application.getClasses()){
-			if ( isAnnotatedResourceClass(aClass)){
-				AbstractResource resource = IntrospectionModeller.createResource(aClass);
-				ObjectNode resourceNode = JsonNodeFactory.instance.objectNode();
-				String uriPrefix = resource.getPath().getValue();
-
-				for ( AbstractSubResourceMethod srm : resource.getSubResourceMethods() ) {
-					String uri = uriPrefix + "/" + srm.getPath().getValue();
-					addTo( resourceNode, uri, srm, joinUri(basePath, uri) );
-				}
-
-				for ( AbstractResourceMethod srm : resource.getResourceMethods() ) {
-					addTo( resourceNode, uriPrefix, srm, joinUri( basePath, uriPrefix ) );
-				}
-				resources.add( resourceNode );
-			}
-		}
-
-		return Response.ok().entity( root ).build();
-	}
-
-	private String joinUri(String basePath, String uriPrefix) {
-		if(basePath.endsWith("/") && uriPrefix.startsWith("/")){
-			return basePath.substring(0,basePath.length()-2)+uriPrefix;
-		}else if(basePath.endsWith("/") || uriPrefix.startsWith("/")){
-			return basePath+ uriPrefix;
-		}
-		return basePath+"/"+uriPrefix;
-	}
-
-	private void addTo( ObjectNode resourceNode, String uriPrefix, AbstractResourceMethod srm, String path ){
-		if(resourceNode.get( uriPrefix ) == null){
-			ObjectNode inner = JsonNodeFactory.instance.objectNode();
-			inner.put("path", path);
-			inner.put("methods", JsonNodeFactory.instance.arrayNode());
-			resourceNode.put( uriPrefix, inner );
-		}
-
-		((ArrayNode) resourceNode.get( uriPrefix ).get("methods")).add( srm.getHttpMethod() );
-	}
-
-	@SuppressWarnings({ "rawtypes", "unchecked" })
-	private boolean isAnnotatedResourceClass( Class rc ){
-		if ( rc.isAnnotationPresent( Path.class ) ) {
-			return true;
-		}
-
-		for ( Class i : rc.getInterfaces() ) {
-			if ( i.isAnnotationPresent( Path.class ) ) {
-				return true;
-			}
-		}
-
-		return false;
-	}
-
-	@GET
-	@Path(PATH_SERVICE)
-	@Produces(MediaType.APPLICATION_JSON)
-	public Response listAllEntities(@Context Application application,
-                                     @Context HttpServletRequest request) throws Exception {
-		Map<String,EntityDefinition> entities = EntityDefinitionManager.entities();
-		ObjectNode root = JsonNodeFactory.instance.objectNode();
-
-		ArrayNode services = JsonNodeFactory.instance.arrayNode();
-
-		for(Map.Entry<String,EntityDefinition> entry : entities.entrySet()){
-//			ObjectNode serviceNode = JsonNodeFactory.instance.objectNode();
-//			serviceNode.put(entry.getKey(),entityDefationitionAsJson(entry.getValue()));
-			services.add(entityDefationitionAsJson(entry.getValue()));
-		}
-		root.put("count",entities.keySet().size());
-		root.put("services",services);
-		return Response.ok().entity(root).build();
-	}
-
-	private JsonNode entityDefationitionAsJson(EntityDefinition def) {
-		ObjectNode node = JsonNodeFactory.instance.objectNode();
-		node.put("service",def.getService());
-		node.put("entityClass",def.getEntityClass().getName());
-		node.put("table",def.getTable());
-		node.put("columnFamily",def.getColumnFamily());
-		node.put("prefix",def.getPrefix());
-		if(def.getPartitions()!=null){
-			node.put("partitions",arrayNode(def.getPartitions()));
-		}
-		node.put("isTimeSeries",def.isTimeSeries());
-
-		MetricDefinition mdf = def.getMetricDefinition();
-		if(mdf!=null){
-			node.put("interval", mdf.getInterval());
-		}
-
-		IndexDefinition[] indexDef = def.getIndexes();
-		if(indexDef!=null){
-			ArrayNode indexDefArray = JsonNodeFactory.instance.arrayNode();
-			for(IndexDefinition idef : indexDef){
-				ObjectNode idn = JsonNodeFactory.instance.objectNode();
-				idn.put("indexPrefix",idef.getIndexPrefix());
-
-				if(idef.getIndex()!=null){
-					ObjectNode index = JsonNodeFactory.instance.objectNode();
-					index.put("name",idef.getIndex().name());
-					index.put("columns",arrayNode(idef.getIndex().columns()));
-					idn.put("index",index);
-				}
-
-				indexDefArray.add(idn);
-			}
-			node.put("indexs",indexDefArray);
-		}
-		return node;
-	}
-
-	private ArrayNode arrayNode(String[] values){
-		ArrayNode an = JsonNodeFactory.instance.arrayNode();
-		for(String v:values){
-			an.add(v);
-		}
-		return an;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/metric/EagleMetricResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/metric/EagleMetricResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/metric/EagleMetricResource.java
deleted file mode 100644
index f3ff420..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/metric/EagleMetricResource.java
+++ /dev/null
@@ -1,58 +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.eagle.service.metric;
-
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.eagle.log.entity.GenericCreateAPIResponseEntity;
-import org.apache.eagle.log.entity.GenericEntityWriter;
-import org.apache.eagle.log.entity.GenericMetricEntity;
-
-@Path(EagleMetricResource.METRIC_URL_PATH)
-public class EagleMetricResource {
-	private static final Logger LOG = LoggerFactory.getLogger(EagleMetricResource.class);
-	public static final String METRIC_URL_PATH = "/metric";
-	
-	@POST
-	@Consumes(MediaType.APPLICATION_JSON)
-	@Produces(MediaType.APPLICATION_JSON)
-	public GenericCreateAPIResponseEntity createGenericMetricEntity(List<GenericMetricEntity> entities) {
-		GenericCreateAPIResponseEntity result = new GenericCreateAPIResponseEntity();
-		try{
-			GenericEntityWriter writer = new GenericEntityWriter(GenericMetricEntity.GENERIC_METRIC_SERVICE);
-			List<String> rowkeys = null;
-			rowkeys = writer.write(entities);
-			result.setEncodedRowkeys(rowkeys);
-			result.setSuccess(true);
-			return result;
-		}catch(Exception ex){
-			LOG.error("Fail writing Generic Metric entity", ex);
-			result.setSuccess(false);
-			result.setException(ex.getMessage());
-			return result;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowKeyQueryResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowKeyQueryResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowKeyQueryResource.java
deleted file mode 100644
index 9480695..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowKeyQueryResource.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.eagle.service.rowkey;
-
-import java.io.IOException;
-
-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.MediaType;
-
-import org.apache.eagle.service.common.EagleExceptionWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.eagle.log.base.taggedlog.NoSuchRowException;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.HBaseInternalLogHelper;
-import org.apache.eagle.log.entity.InternalLog;
-import org.apache.eagle.log.entity.RowkeyQueryAPIResponseEntity;
-import org.apache.eagle.log.entity.index.RowKeyLogReader;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.common.EagleBase64Wrapper;
-
-/**
- * @since Jan 26, 2015
- */
-@Path("/rowkeyquery")
-public class RowKeyQueryResource {
-	private static final Logger LOG = LoggerFactory.getLogger(RowKeyQueryResource.class);
-
-	@GET
-	@Produces({MediaType.APPLICATION_JSON})
-	public RowkeyQueryAPIResponseEntity getEntityByRowkey(@QueryParam("query") String query, @QueryParam("rowkey") String rowkey){
-		RowkeyQueryAPIResponseEntity result = new RowkeyQueryAPIResponseEntity();
-		RowKeyLogReader reader = null;
-
-		try {
-			EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName(query);
-			reader = new RowKeyLogReader(ed, EagleBase64Wrapper.decode(rowkey));
-			reader.open();
-			InternalLog log = reader.read();
-			TaggedLogAPIEntity entity;
-			entity = HBaseInternalLogHelper.buildEntity(log, ed);
-			result.setObj(entity);			
-			result.setSuccess(true);
-			return result;
-		}
-		catch(NoSuchRowException ex){
-			LOG.error("rowkey " + ex.getMessage() + " does not exist!", ex);
-			result.setSuccess(false);
-			result.setException(EagleExceptionWrapper.wrap(ex));
-			return result;
-		}
-		catch(Exception ex){
-			LOG.error("Cannot read alert by rowkey", ex);
-			result.setSuccess(false);
-			result.setException(EagleExceptionWrapper.wrap(ex));
-			return result;
-		}
-		finally{
-			try {
-				if(reader != null)
-					reader.close();
-			} catch (IOException e) {
-			}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowkeyResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowkeyResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowkeyResource.java
deleted file mode 100644
index d4a6a42..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/rowkey/RowkeyResource.java
+++ /dev/null
@@ -1,133 +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.eagle.service.rowkey;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-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.MediaType;
-
-import org.apache.eagle.service.common.EagleExceptionWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.eagle.log.base.taggedlog.RowkeyAPIEntity;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.InternalLog;
-import org.apache.eagle.log.entity.old.GenericDeleter;
-import org.apache.eagle.log.entity.old.HBaseLogByRowkeyReader;
-import org.apache.eagle.common.ByteUtil;
-import org.apache.eagle.common.DateTimeUtil;
-import org.apache.eagle.common.EagleBase64Wrapper;
-import org.apache.eagle.common.service.POSTResultEntityBase;
-
-@Deprecated
-@Path("rowkey")
-public class RowkeyResource {
-	private static final Logger LOG = LoggerFactory.getLogger(RowkeyResource.class);
-	
-	@GET
-	@Produces(MediaType.APPLICATION_JSON)
-	public RowkeyAPIEntity inspectRowkey(@QueryParam("table") String table, @QueryParam("cf") String columnFamily, 
-			@QueryParam("key") String key, @QueryParam("all") String all, @QueryParam("field") List<String> fields){
-		RowkeyAPIEntity entity = new RowkeyAPIEntity();
-		byte[] row = null;
-		boolean includingAllQualifiers = false;
-		if(all != null && all.equals("true"))
-			includingAllQualifiers = true;
-		HBaseLogByRowkeyReader getter = new HBaseLogByRowkeyReader(table, columnFamily, includingAllQualifiers, fields);
-		InternalLog log = null;
-		try{
-			getter.open();
-			row = EagleBase64Wrapper.decode(key);
-			log = getter.get(row);
-		}catch(Exception ex){
-			LOG.error("Cannot get rowkey", ex);
-			entity.setSuccess(false);
-			entity.setException(EagleExceptionWrapper.wrap(ex));
-			return entity;
-		}finally{
-			try{
-				getter.close();
-			}catch(Exception ex){}
-		}
-		
-		Map<String, String> fieldNameValueMap = new TreeMap<String, String>();
-		entity.setFieldNameValueMap(fieldNameValueMap);
-		// populate qualifiers
-		Map<String, byte[]> qualifierValues = log.getQualifierValues();
-		for(Map.Entry<String, byte[]> qualifier : qualifierValues.entrySet()){
-			if(qualifier.getValue() != null){
-				fieldNameValueMap.put(qualifier.getKey(), new String(qualifier.getValue()));
-			}
-		}
-		
-		// decode rowkey
-		// the first integer is prefix hashcode
-		entity.setPrefixHashCode(ByteUtil.bytesToInt(row, 0));
-		long ts = Long.MAX_VALUE-ByteUtil.bytesToLong(row, 4);
-		entity.setTimestamp(ts);
-		entity.setHumanTime(DateTimeUtil.millisecondsToHumanDateWithMilliseconds(ts));
-		int offset = 4+8;
-		int len = row.length;
-		Map<Integer, Integer> tagNameHashValueHashMap = new HashMap<Integer, Integer>();
-		// TODO boundary check please
-		while(offset < len){
-			int tagNameHash = ByteUtil.bytesToInt(row, offset);
-			offset += 4;
-			int tagValueHash = ByteUtil.bytesToInt(row, offset);
-			offset += 4;
-			tagNameHashValueHashMap.put(tagNameHash, tagValueHash);
-		}
-		
-		entity.setSuccess(true);
-		return entity;
-	}
-	
-	/**
-	 * for entities, the only required field is encodedRowkey
-	 * @param table
-	 * @param columnFamily
-	 * @param entities
-	 */
-	@DELETE
-	@Consumes(MediaType.APPLICATION_JSON)
-	@Produces(MediaType.APPLICATION_JSON)
-	public POSTResultEntityBase deleteEntityByEncodedRowkey(@QueryParam("table") String table, @QueryParam("cf") String columnFamily,
-			List<TaggedLogAPIEntity> entities){
-		GenericDeleter deleter = new GenericDeleter(table, columnFamily);
-		POSTResultEntityBase result = new POSTResultEntityBase();
-		try{
-			deleter.delete(entities);
-		}catch(Exception ex){
-			LOG.error("Fail deleting entity " + table + ":" + columnFamily, ex);
-			result.setSuccess(false);
-			result.setException(ex.getMessage());
-			return result;
-		}
-		result.setSuccess(true);
-		return result;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckAPIEntity.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckAPIEntity.java
deleted file mode 100644
index 0e52a2e..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckAPIEntity.java
+++ /dev/null
@@ -1,47 +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.eagle.service.selfcheck;
-
-/**
- * expose internal configuration or metrics
- */
-//@XmlRootElement
-//@XmlAccessorType(XmlAccessType.FIELD)
-//@XmlType(propOrder = {"env", "hbaseZookeeperQuorum", "hbaseZookeeperClientPort"})
-public class EagleServiceSelfCheckAPIEntity {
-	private String env;
-	private String hbaseZookeeperQuorum;
-	private String hbaseZookeeperClientPort;
-	public String getEnv() {
-		return env;
-	}
-	public void setEnv(String env) {
-		this.env = env;
-	}
-	public String getHbaseZookeeperQuorum() {
-		return hbaseZookeeperQuorum;
-	}
-	public void setHbaseZookeeperQuorum(String hbaseZookeeperQuorum) {
-		this.hbaseZookeeperQuorum = hbaseZookeeperQuorum;
-	}
-	public String getHbaseZookeeperClientPort() {
-		return hbaseZookeeperClientPort;
-	}
-	public void setHbaseZookeeperClientPort(String hbaseZookeeperClientPort) {
-		this.hbaseZookeeperClientPort = hbaseZookeeperClientPort;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckResource.java
deleted file mode 100644
index 88ab613..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/EagleServiceSelfCheckResource.java
+++ /dev/null
@@ -1,38 +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.eagle.service.selfcheck;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.apache.eagle.common.config.EagleConfigFactory;
-
-@Path("ValidateInternals")
-public class EagleServiceSelfCheckResource {
-	
-	@GET
-	@Produces(MediaType.APPLICATION_JSON)
-	public EagleServiceSelfCheckAPIEntity selfCheck(){
-		EagleServiceSelfCheckAPIEntity entity = new EagleServiceSelfCheckAPIEntity();
-		entity.setHbaseZookeeperQuorum(EagleConfigFactory.load().getZKQuorum());
-		entity.setHbaseZookeeperClientPort(EagleConfigFactory.load().getZKPort());
-		entity.setEnv(EagleConfigFactory.load().getEnv());
-		return entity;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/ServiceResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/ServiceResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/ServiceResource.java
deleted file mode 100644
index f108bd5..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/selfcheck/ServiceResource.java
+++ /dev/null
@@ -1,64 +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.eagle.service.selfcheck;
-
-import java.util.Map;
-
-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.GenericEntity;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import com.sun.jersey.api.json.JSONWithPadding;
-
-@Path("services")
-public class ServiceResource {
-	private static final Logger LOG = LoggerFactory.getLogger(ServiceResource.class);
-	
-	@GET
-	@Produces({"application/json", "application/xml"})
-	public Map<String, EntityDefinition> getServiceDefinitions(){
-		Map<String, EntityDefinition> result = null;
-		try{
-			 result = EntityDefinitionManager.entities();
-		}catch(Exception ex){
-			LOG.error("Error in getting entity definitions", ex);
-		}
-		
-		return result;
-	}
-	
-	@GET
-	@Path("/jsonp")
-	@Produces({"application/x-javascript", "application/json", "application/xml"})
-	public JSONWithPadding getServiceDefinitionsWithJsonp(@QueryParam("callback") String callback){
-		Map<String, EntityDefinition> result = null;
-		try{
-			 result = EntityDefinitionManager.entities();
-		}catch(Exception ex){
-			LOG.error("Error in getting entity definitions", ex);
-		}
-		
-		return new JSONWithPadding(new GenericEntity<Map<String, EntityDefinition>>(result){}, callback);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/webapp/WEB-INF/web.xml b/eagle-core/eagle-query/eagle-service-base/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index c6c7a8e..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-~ 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.
-~
-~ This web.xml file is not required when using Servlet 3.0 container,
-~ see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html
--->
-<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-    <servlet>
-        <servlet-name>Jersey Web Application</servlet-name>
-        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
-        <init-param>
-            <param-name>com.sun.jersey.config.property.packages</param-name>
-            <param-value>org.apache.eagle.service;org.codehaus.jackson.jaxrs</param-value>
-        </init-param>
-        <!--init-param>
-            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
-            <param-value>true</param-value>
-        </init-param-->
-		<!-- probably the following parameter should not be in production -->
-        <!-- init-param>
-			<param-name>com.sun.jersey.config.feature.Trace</param-name>
-			<param-value>true</param-value>
-		</init-param -->
-        <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
-            <param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
-        </init-param>
-        <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
-            <param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
-        </init-param>		
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>Jersey Web Application</servlet-name>
-        <url-pattern>/rest/*</url-pattern>
-    </servlet-mapping>
-</web-app>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java b/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java
deleted file mode 100755
index 432cbdb..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java
+++ /dev/null
@@ -1,162 +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.eagle.service.generic;
-
-import org.apache.eagle.common.ByteUtil;
-import org.apache.eagle.common.DateTimeUtil;
-import org.apache.eagle.log.entity.GenericEntityBatchReader;
-import org.apache.eagle.log.entity.GenericEntityWriter;
-import org.apache.eagle.log.entity.SearchCondition;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.log.entity.test.TestTimeSeriesAPIEntity;
-import org.apache.eagle.query.ListQueryCompiler;
-import org.apache.eagle.service.hbase.EmbeddedHbase;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-public class TestHBaseLogReader2 {
-	private final static Logger LOG = LoggerFactory.getLogger(TestHBaseLogReader2.class);
-    private static EmbeddedHbase hbase = EmbeddedHbase.getInstance();
-	
-	@SuppressWarnings("serial")
-	@Test
-	public void testStartTimeInclusiveEndTimeExclusive() throws IOException, IllegalAccessException, InstantiationException {
-		EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestTimeSeriesAPIEntity.class);
-		hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
-
-		EntityDefinitionManager.registerEntity(TestTimeSeriesAPIEntity.class);
-		try{
-			final String cluster = "cluster1";
-			final String datacenter = "dc1";
-			String serviceName = "TestTimeSeriesAPIEntity";
-			GenericEntityWriter writer = new GenericEntityWriter(serviceName);
-			List<TestTimeSeriesAPIEntity> entities = new ArrayList<TestTimeSeriesAPIEntity>();
-			TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity();
-			long timestamp1 = DateTimeUtil.humanDateToSeconds("2014-04-08 03:00:00")*1000;
-			LOG.info("First entity timestamp:" + timestamp1);
-			entity.setTimestamp(timestamp1);
-			entity.setTags(new HashMap<String, String>(){{
-				put("cluster", cluster);
-				put("datacenter", datacenter);
-			}});
-			entity.setField7("field7");
-			entities.add(entity);
-			
-			entity = new TestTimeSeriesAPIEntity();
-			long timestamp2 = DateTimeUtil.humanDateToSeconds("2014-05-08 04:00:00")*1000;
-			LOG.info("Second entity timestamp:" + timestamp2);
-			entity.setTimestamp(timestamp2);
-			entity.setTags(new HashMap<String, String>(){{
-				put("cluster", cluster);
-				put("datacenter", datacenter);
-			}});
-			entity.setField7("field7_2");
-			entities.add(entity);
-			writer.write(entities);
-
-			// for timezone difference between UTC & localtime, enlarge the search range
-			long queryStartTimestamp = timestamp1-24*60*60*1000;
-			long queryEndTimestamp = timestamp1+24*60*60*1000;
-			LOG.info("Query start timestamp:" + queryStartTimestamp);
-			LOG.info("Query end  timestamp:" + queryEndTimestamp);
-			
-			String format = "%s[@cluster=\"%s\" AND @datacenter=\"%s\"]{%s}";
-			String query = String.format(format, serviceName, cluster, datacenter, "@field7");
-			ListQueryCompiler comp = new ListQueryCompiler(query);
-			SearchCondition condition = new SearchCondition();
-			condition.setFilter(comp.filter());
-			condition.setQueryExpression(comp.getQueryExpression());
-			condition.setOutputFields(comp.outputFields());
-			
-			final List<String[]> partitionValues = comp.getQueryPartitionValues();
-			if (partitionValues != null) {
-				condition.setPartitionValues(Arrays.asList(partitionValues.get(0)));
-			}
-
-			condition.setStartRowkey(null);
-			condition.setPageSize(Integer.MAX_VALUE);
-			condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(0));
-			condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp));
-			
-			GenericEntityBatchReader reader = new GenericEntityBatchReader(serviceName, condition); 
-			List<TestTimeSeriesAPIEntity> list = reader.read();
-
-			Assert.assertEquals(1, list.size());
-			Assert.assertEquals(timestamp1, list.get(0).getTimestamp());
-			Assert.assertEquals("field7", list.get(0).getField7());
-
-			// for timezone difference between UTC & localtime, enlarge the search range
-			queryStartTimestamp = timestamp1-24*60*60*1000;
-			queryEndTimestamp = timestamp2+24*60*60*1000;  // eagle timestamp is rounded to seconds
-			condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp));
-			condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp));
-			reader = new GenericEntityBatchReader(serviceName, condition); 
-			list = reader.read();
-			Assert.assertEquals(2, list.size());
-			
-			queryStartTimestamp = timestamp1;
-			queryEndTimestamp = timestamp1;  // eagle timestamp is rounded to seconds
-			condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp));
-			condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp));
-			reader = new GenericEntityBatchReader(serviceName, condition); 
-			list = reader.read();
-			Assert.assertEquals(0, list.size());
-			hbase.deleteTable(entityDefinition.getTable());
-		}catch(Exception ex){
-			LOG.error("error", ex);
-			Assert.fail();
-		}
-	}
-	
-	@Test
-	public void testByteComparison(){
-		byte[] byte1 = new byte[]{-23, 12, 63};
-		byte[] byte2 = ByteUtil.concat(byte1, new byte[]{0});
-		Assert.assertTrue(Bytes.compareTo(byte1, byte2) < 0);
-		byte[] byte3 = ByteUtil.concat(byte1, new byte[]{127});
-		Assert.assertTrue(Bytes.compareTo(byte2, byte3) < 0);
-		byte[] byte4 = ByteUtil.concat(byte1, new byte[]{-128});
-		Assert.assertTrue(Bytes.compareTo(byte4, byte3) > 0);
-	}
-	
-	@Test
-	public void testMaxByteInBytesComparision(){
-		int max = -1000000;
-//		int maxb = -1000000;
-		System.out.println("Byte MaxValue: " + Byte.MAX_VALUE);
-		System.out.println("Byte MaxValue: " + Byte.MIN_VALUE);
-		for(int i=-128; i<128; i++){
-			byte b = (byte)i;
-			int tmp = b & 0xff;
-			max = Math.max(max, tmp);
-		}
-		System.out.println(max);
-		
-		byte b = -1;
-		System.out.println(b & 0xff);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java b/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java
deleted file mode 100755
index 9610e54..0000000
--- a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 
- */
-package org.apache.eagle.service.generic;
-
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.log.entity.test.TestLogAPIEntity;
-import org.apache.eagle.query.parser.ORExpression;
-import org.apache.eagle.query.aggregate.AggregateFunctionType;
-import org.apache.eagle.query.ListQueryCompiler;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-/**
- * @since Nov 10, 2014
- */
-public class TestListQueryCompiler {
-
-	private static final Logger LOG = LoggerFactory.getLogger(TestListQueryCompiler.class);
-	
-	@Before 
-	public void prepare() throws Exception{
-		String[] partitions =  new String[2];
-		partitions[0] = "cluster";
-		partitions[1] = "datacenter";
-		EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
-		EntityDefinition entityDef = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity");
-		entityDef.setPartitions(partitions);
-		entityDef.setTimeSeries(true);
-	}
-	
-	 /**************************************************************************************************/
-	 /*********************************** Test Expression In List Query*********************************/
-	 /**************************************************************************************************/
-	
-	@Test
-	public void testListQueryWithoutExpression() throws Exception{	
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND @field5 > 0.05]{@cluster, @field1}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND @field5>0.05)");
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertTrue(aggFields == null);
-		List<String> outputFields = compiler.outputFields();
-		Assert.assertEquals(outputFields.size(), 2);
-		Assert.assertTrue(outputFields.contains("cluster"));
-		Assert.assertTrue(outputFields.contains("field1"));
-	}
-	
-	@Test
-	public void testListQueryWithExpressionEndWithNumberInFilter() throws Exception{	
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@field5 + @field6} > 0.05]{@cluster, @field1}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)");
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertTrue(aggFields == null);
-		List<String> outputFields = compiler.outputFields();
-		Assert.assertEquals(outputFields.size(), 2);
-		Assert.assertTrue(outputFields.contains("cluster"));
-		Assert.assertTrue(outputFields.contains("field1"));
-	}
-	
-	@Test
-	public void testListQueryWithExpressionEndWithRPARENInFilter() throws Exception{	
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND (EXP{@field5 + @field6} > 0.05)]{@cluster, @field1}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		LOG.info(filter.toString());
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)");
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertTrue(aggFields == null);
-		List<String> outputFields = compiler.outputFields();
-		Assert.assertEquals(outputFields.size(), 2);
-		Assert.assertTrue(outputFields.contains("cluster"));
-		Assert.assertTrue(outputFields.contains("field1"));
-		
-		query = "TestLogAPIEntity[(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND (EXP{@field5 + @field6} > 0.05))]{@cluster, @field1}";
-		compiler = new ListQueryCompiler(query, false);
-		filter = compiler.getQueryExpression();
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)");
-		aggFields = compiler.aggregateFields();
-		Assert.assertTrue(aggFields == null);
-		outputFields = compiler.outputFields();
-		Assert.assertEquals(outputFields.size(), 2);
-		Assert.assertTrue(outputFields.contains("cluster"));
-		Assert.assertTrue(outputFields.contains("field1"));
-	}
-	
-	@Test
-	public void testListQueryWithExpressionEndWithRBRACEInFilter() throws Exception{			
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{0.05 + @c + @d}]{@cluster, EXP{@a + @b}}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>0.05 + c + d)");
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertTrue(aggFields == null);
-		List<String> outputFields = compiler.outputFields();
-//		Assert.assertEquals(outputFields.size(), 2);
-		Assert.assertTrue(outputFields.contains("cluster"));
-		Assert.assertTrue(outputFields.contains("EXP{a + b}"));
-	}
-	
-	/**************************************************************************************************/
-	/*********************************** Test Expression In Group By Query*********************************/	
-	/**************************************************************************************************/
-	
-	@Test
-	public void testGroupByQueryAggWithoutExpressionInAggFunc() throws Exception{
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.05}]<@cluster, @datacenter>{sum(@a), avg(@b)}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		LOG.info(filter.toString());
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.05)");
-		
-		List<String> groupByFields = compiler.groupbyFields();
-		Assert.assertEquals(groupByFields.size(), 2);		
-		Assert.assertTrue(groupByFields.contains("cluster"));
-		Assert.assertTrue(groupByFields.contains("datacenter"));
-		
-		List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes();
-		Assert.assertEquals(functions.size(), 2);		
-		Assert.assertTrue(functions.contains(AggregateFunctionType.sum));
-		Assert.assertTrue(functions.contains(AggregateFunctionType.avg));
-	
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertEquals(aggFields.size(), 2);
-		Assert.assertTrue(aggFields.contains("a"));
-		Assert.assertTrue(aggFields.contains("b"));
-	}
-	
-	@Test
-	public void testGroupByQueryAggWithExpressionInAggFunc() throws Exception{
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.07}]<@cluster, @datacenter>{sum(EXP{@a+@b+20.0}), avg(EXP{(@a+@c + 2.5)/@d}), count}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		LOG.info(filter.toString());
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.07)");
-		
-		List<String> groupByFields = compiler.groupbyFields();
-		Assert.assertEquals(groupByFields.size(), 2);		
-		Assert.assertTrue(groupByFields.contains("cluster"));
-		Assert.assertTrue(groupByFields.contains("datacenter"));
-		
-		List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes();
-		Assert.assertEquals(functions.size(), 3);		
-		Assert.assertTrue(functions.contains(AggregateFunctionType.sum));
-		Assert.assertTrue(functions.contains(AggregateFunctionType.avg));
-		Assert.assertTrue(functions.contains(AggregateFunctionType.count));
-				
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertEquals(aggFields.size(), 3);
-		Assert.assertTrue(aggFields.contains("EXP{a+b+20.0}"));
-		Assert.assertTrue(aggFields.contains("EXP{(a+c + 2.5)/d}"));
-		Assert.assertTrue(aggFields.contains("count"));
-	}
-	
-	/**************************************************************************************************/
-	/*********************************** Test Expression In Sort Query*********************************/	
-	/**************************************************************************************************/
-	
-	@Test
-	public void testSortQueryWithoutExpressionInSort() throws Exception{
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d}]<@cluster, @datacenter>"
-				+ "{sum(@a), count}.{sum(@a) asc}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		LOG.info(filter.toString());
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d)");
-		
-		List<String> groupByFields = compiler.groupbyFields();
-		Assert.assertEquals(groupByFields.size(), 2);		
-		Assert.assertTrue(groupByFields.contains("cluster"));
-		Assert.assertTrue(groupByFields.contains("datacenter"));
-		
-		List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes();
-		Assert.assertEquals(functions.size(), 2);		
-		Assert.assertTrue(functions.contains(AggregateFunctionType.sum));
-		Assert.assertTrue(functions.contains(AggregateFunctionType.count));
-		
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertEquals(aggFields.size(), 2);
-		Assert.assertTrue(aggFields.contains("a"));
-		Assert.assertTrue(aggFields.contains("count"));
-		
-		List<String> sortFields = compiler.sortFields();
-		Assert.assertEquals(sortFields.size(), 1);
-		Assert.assertTrue(sortFields.contains("a"));
-	}
-	
-	@Test
-	public void testSortQuerySortWithExpressionInSort() throws Exception{
-		String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.05}]<@cluster, @datacenter>"
-				+ "{sum(EXP{@a+@b+0.07}), max(EXP{(@a+@c)/@d}), min(EXP{@a+@b})}.{sum(EXP{@a+@b+0.07}) asc}";
-		ListQueryCompiler compiler = new ListQueryCompiler(query, false);
-		ORExpression filter = compiler.getQueryExpression();
-		LOG.info(filter.toString());
-		Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.05)");
-		
-		List<String> groupByFields = compiler.groupbyFields();
-		Assert.assertEquals(groupByFields.size(), 2);		
-		Assert.assertTrue(groupByFields.contains("cluster"));
-		Assert.assertTrue(groupByFields.contains("datacenter"));
-		
-		List<String> aggFields = compiler.aggregateFields();
-		Assert.assertEquals(aggFields.size(), 3);
-		Assert.assertTrue(aggFields.contains("EXP{a+b+0.07}"));
-		Assert.assertTrue(aggFields.contains("EXP{(a+c)/d}"));
-		Assert.assertTrue(aggFields.contains("EXP{a+b}"));
-		
-		List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes();
-		Assert.assertEquals(functions.size(), 3);		
-		Assert.assertTrue(functions.contains(AggregateFunctionType.sum));
-		Assert.assertTrue(functions.contains(AggregateFunctionType.max));
-		Assert.assertTrue(functions.contains(AggregateFunctionType.min));
-		
-		List<String> sortFields = compiler.sortFields();
-		Assert.assertEquals(sortFields.size(), 1);
-		Assert.assertTrue(sortFields.contains("EXP{a+b+0.07}"));
-	}
-}