You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by yo...@apache.org on 2016/09/07 17:42:47 UTC

[51/52] [abbrv] incubator-eagle git commit: [EAGLE-520] Fix and decouple co-processor from eagle aggreation query service

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/base/taggedlog/TaggedLogAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/base/taggedlog/TaggedLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/base/taggedlog/TaggedLogAPIEntity.java
index b001955..b396b06 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/base/taggedlog/TaggedLogAPIEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/base/taggedlog/TaggedLogAPIEntity.java
@@ -16,6 +16,21 @@
  */
 package org.apache.eagle.log.base.taggedlog;
 
+import org.apache.eagle.common.DateTimeUtil;
+import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
+
+import com.fasterxml.jackson.annotation.JsonFilter;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.FilterProvider;
+import com.fasterxml.jackson.databind.ser.PropertyWriter;
+import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
+import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -26,210 +41,208 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializerProvider;
-import org.codehaus.jackson.map.annotate.JsonFilter;
-import org.codehaus.jackson.map.ser.BeanPropertyWriter;
-import org.codehaus.jackson.map.ser.FilterProvider;
-import org.codehaus.jackson.map.ser.impl.SimpleBeanPropertyFilter;
-import org.codehaus.jackson.map.ser.impl.SimpleFilterProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.eagle.common.DateTimeUtil;
-
 /**
  * rowkey: prefix + timestamp + tagNameValues
  * as of now, all tags will be persisted as a column in hbase table
  * tag name is column qualifier name
- * tag value is column value
+ * tag value is column value.
  */
 @JsonFilter(TaggedLogAPIEntity.PropertyBeanFilterName)
-public class TaggedLogAPIEntity implements PropertyChangeListener, Serializable{
-	private static final Logger LOG = LoggerFactory.getLogger(TaggedLogAPIEntity.class);
-	private String prefix;
-	private long timestamp;
-	private Map<String, String> tags;
-
-	public void setExp(Map<String, Object> exp) {
-		this.exp = exp;
-	}
-
-	public Map<String,Object> getExp() {
-		return this.exp;
-	}
-
-	/**
-	 * Extra dynamic attributes. 
-	 * TODO: can we move exp, _serializeAlias, _serializeVerbose to a wrapper class? 
-	 */
-	private Map<String,Object> exp;
-
-	private String encodedRowkey;
-	// track what qualifiers are changed
-	private Set<String> _modifiedProperties = new HashSet<String>();
-	protected PropertyChangeSupport _pcs = new PropertyChangeSupport(this);
-
-
-	public Map<String, String> getSerializeAlias() {
-		return _serializeAlias;
-	}
-
-	public void setSerializeAlias(Map<String, String> _serializeAlias) {
-		this._serializeAlias = _serializeAlias;
-	}
-
-	private Map<String,String> _serializeAlias = null;
-
-	public boolean isSerializeVerbose() {
-		return _serializeVerbose;
-	}
-
-	public void setSerializeVerbose(boolean _serializeVerbose) {
-		this._serializeVerbose = _serializeVerbose;
-	}
-
-	private boolean _serializeVerbose = true;
-
-	public TaggedLogAPIEntity(){
-		_pcs.addPropertyChangeListener(this);
-	}
-	
-	public String getPrefix() {
-		return prefix;
-	}
-	public void setPrefix(String prefix) {
-		this.prefix = prefix;
-	}
-	public long getTimestamp() {
-		return timestamp;
-	}
-	public void setTimestamp(long timestamp) {
-		this.timestamp = timestamp;
-	}
-	public Map<String, String> getTags() {
-		return tags;
-	}
-	public void setTags(Map<String, String> tags) {
-		this.tags = tags;
-	}
-	public String getEncodedRowkey() {
-		return encodedRowkey;
-	}
-	public void setEncodedRowkey(String encodedRowkey) {
-		this.encodedRowkey = encodedRowkey;
-	}
-	
-	protected void valueChanged(String fieldModified){
-		_pcs.firePropertyChange(fieldModified, null, null);
-	}
-	
-	public void propertyChange(PropertyChangeEvent evt) {
-		_modifiedProperties.add(evt.getPropertyName());
-	}
-	
-	public Set<String> modifiedQualifiers(){
-		return this._modifiedProperties;
-	}
-	
-	public String toString(){
-		StringBuffer sb = new StringBuffer();
-		sb.append("prefix:");
-		sb.append(prefix);
-		sb.append(", timestamp:");
-		sb.append(timestamp);
-		sb.append(", humanReadableDate:");
-		sb.append(DateTimeUtil.millisecondsToHumanDateWithMilliseconds(timestamp));
-		sb.append(", tags: ");
-		if(tags != null){
-			for(Map.Entry<String, String> entry : tags.entrySet()){
-				sb.append(entry.toString());
-				sb.append(",");
-			}
-		}
-		sb.append(", encodedRowkey:");
-		sb.append(encodedRowkey);
-		return sb.toString();
-	}
-
-	private static Set<String> getPropertyNames(){
-		if(_propertyNames == null) {
-			Field[] fields = TaggedLogAPIEntity.class.getDeclaredFields();
-			Set<String> fieldName = new HashSet<String>();
-			for (Field f : fields) fieldName.add(f.getName());
-			_propertyNames = fieldName;
-		}
-		return _propertyNames;
-	}
-
-	private static class BeanPropertyFilter extends SimpleBeanPropertyFilter {
-		private final static String prefix = "prefix";
-		private final static String encodedRowkey = "encodedRowkey";
-		private final static String exp = "exp";
-		private final static String timestamp = "timestamp";
-		@SuppressWarnings("serial")
-		private final static Set<String> verboseFields = new HashSet<String>(){{
-			add(prefix);
-			add(encodedRowkey);
-		}};
-
-		@Override
-		public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider provider, BeanPropertyWriter writer) throws Exception {
-			if(bean instanceof TaggedLogAPIEntity){
-				TaggedLogAPIEntity entity = (TaggedLogAPIEntity) bean;
-				Set<String> modified = entity.modifiedQualifiers();
-				Set<String> basePropertyNames = getPropertyNames();
-				String writerName = writer.getName();
-				if(modified.contains(writerName) || basePropertyNames.contains(writerName)){
-					if((!entity.isSerializeVerbose() && verboseFields.contains(writerName))||							// skip verbose fields
-							(timestamp.equals(writerName) && !EntityDefinitionManager.isTimeSeries(entity.getClass()))	// skip timestamp for non-timeseries entity
-					){
-						// log skip
-						if(LOG.isDebugEnabled()) LOG.debug("skip field");
-					}else{
-						// if serializeAlias is not null and exp is not null
-						if (exp.equals(writerName) && entity.getSerializeAlias()!=null && entity.getExp()!=null) {
-							Map<String, Object> _exp = new HashMap<String, Object>();
-							for (Map.Entry<String, Object> entry : entity.getExp().entrySet()) {
-								String alias = entity.getSerializeAlias().get(entry.getKey());
-								if (alias != null) {
-									_exp.put(alias, entry.getValue());
-								} else {
-									_exp.put(entry.getKey(), entry.getValue());
-								}
-							}
-							entity.setExp(_exp);
-						}
-						// write included field into serialized json output
-						writer.serializeAsField(bean, jgen, provider);
-					}
-				}
-			}else{
-				writer.serializeAsField(bean, jgen, provider);
-			}
-		}
-	}
-
-	public static FilterProvider getFilterProvider(){
-		if(_filterProvider == null){
-			SimpleFilterProvider _provider = new SimpleFilterProvider();
-			_provider.addFilter(PropertyBeanFilterName,new BeanPropertyFilter());
-			_filterProvider = _provider;
-		}
-		return _filterProvider;
-	}
-
-	//////////////////////////////////////
-	// Static fields
-	//////////////////////////////////////
-	private static Set<String> _propertyNames = null;
-	private static FilterProvider _filterProvider = null;
-	final static String PropertyBeanFilterName = "TaggedLogPropertyBeanFilter";
-
-    public static ObjectMapper buildObjectMapper(){
+public class TaggedLogAPIEntity implements PropertyChangeListener, Serializable {
+    private static final Logger LOG = LoggerFactory.getLogger(TaggedLogAPIEntity.class);
+    private String prefix;
+    private long timestamp;
+    private Map<String, String> tags;
+
+    public void setExp(Map<String, Object> exp) {
+        this.exp = exp;
+    }
+
+    public Map<String, Object> getExp() {
+        return this.exp;
+    }
+
+    /**
+     * Extra dynamic attributes.
+     * TODO: can we move exp, serializeAlias, serializeVerbose to a wrapper class?
+     */
+    private Map<String, Object> exp;
+
+    private String encodedRowkey;
+    // track what qualifiers are changed
+    private Set<String> modifiedProperties = new HashSet<String>();
+    protected PropertyChangeSupport pcs
+            = new PropertyChangeSupport(this);
+
+
+    public Map<String, String> getSerializeAlias() {
+        return serializeAlias;
+    }
+
+    public void setSerializeAlias(Map<String, String> serializeAlias) {
+        this.serializeAlias = serializeAlias;
+    }
+
+    private Map<String, String> serializeAlias = null;
+
+    public boolean isSerializeVerbose() {
+        return serializeVerbose;
+    }
+
+    public void setSerializeVerbose(boolean serializeVerbose) {
+        this.serializeVerbose = serializeVerbose;
+    }
+
+    private boolean serializeVerbose = true;
+
+    public TaggedLogAPIEntity() {
+        pcs.addPropertyChangeListener(this);
+    }
+
+    public String getPrefix() {
+        return prefix;
+    }
+
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    public long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public Map<String, String> getTags() {
+        return tags;
+    }
+
+    public void setTags(Map<String, String> tags) {
+        this.tags = tags;
+    }
+
+    public String getEncodedRowkey() {
+        return encodedRowkey;
+    }
+
+    public void setEncodedRowkey(String encodedRowkey) {
+        this.encodedRowkey = encodedRowkey;
+    }
+
+    protected void valueChanged(String fieldModified) {
+        pcs.firePropertyChange(fieldModified, null, null);
+    }
+
+    public void propertyChange(PropertyChangeEvent evt) {
+        modifiedProperties.add(evt.getPropertyName());
+    }
+
+    public Set<String> modifiedQualifiers() {
+        return this.modifiedProperties;
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        sb.append("prefix:");
+        sb.append(prefix);
+        sb.append(", timestamp:");
+        sb.append(timestamp);
+        sb.append(", humanReadableDate:");
+        sb.append(DateTimeUtil.millisecondsToHumanDateWithMilliseconds(timestamp));
+        sb.append(", tags: ");
+        if (tags != null) {
+            for (Map.Entry<String, String> entry : tags.entrySet()) {
+                sb.append(entry.toString());
+                sb.append(",");
+            }
+        }
+        sb.append(", encodedRowkey:");
+        sb.append(encodedRowkey);
+        return sb.toString();
+    }
+
+    private static Set<String> getPropertyNames() {
+        if (_propertyNames == null) {
+            Field[] fields = TaggedLogAPIEntity.class.getDeclaredFields();
+            Set<String> fieldName = new HashSet<String>();
+            for (Field f : fields) {
+                fieldName.add(f.getName());
+            }
+            _propertyNames = fieldName;
+        }
+        return _propertyNames;
+    }
+
+    private static class BeanPropertyFilter extends SimpleBeanPropertyFilter {
+        private static final String prefix = "prefix";
+        private static final String encodedRowkey = "encodedRowkey";
+        private static final String exp = "exp";
+        private static final String timestamp = "timestamp";
+        @SuppressWarnings("serial")
+        private static final Set<String> verboseFields = new HashSet<String>() {
+            {
+                add(prefix);
+                add(encodedRowkey);
+            }
+        };
+
+        @Override
+        public void serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws Exception {
+            if (pojo instanceof TaggedLogAPIEntity) {
+                TaggedLogAPIEntity entity = (TaggedLogAPIEntity) pojo;
+                Set<String> modified = entity.modifiedQualifiers();
+                Set<String> basePropertyNames = getPropertyNames();
+                String writerName = writer.getName();
+                if (modified.contains(writerName) || basePropertyNames.contains(writerName)) {
+                    if ((!entity.isSerializeVerbose() && verboseFields.contains(writerName))
+                            || (timestamp.equals(writerName) && !EntityDefinitionManager.isTimeSeries(entity.getClass()))) {
+                        // log skip
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("skip field");
+                        }
+                    } else {
+                        // if serializeAlias is not null and exp is not null
+                        if (exp.equals(writerName) && entity.getSerializeAlias() != null && entity.getExp() != null) {
+                            Map<String, Object> _exp = new HashMap<String, Object>();
+                            for (Map.Entry<String, Object> entry : entity.getExp().entrySet()) {
+                                String alias = entity.getSerializeAlias().get(entry.getKey());
+                                if (alias != null) {
+                                    _exp.put(alias, entry.getValue());
+                                } else {
+                                    _exp.put(entry.getKey(), entry.getValue());
+                                }
+                            }
+                            entity.setExp(_exp);
+                        }
+                        // write included field into serialized json output
+                        writer.serializeAsField(pojo, jgen, provider);
+                    }
+                }
+            } else {
+                writer.serializeAsField(pojo, jgen, provider);
+            }
+        }
+    }
+
+    public static FilterProvider getFilterProvider() {
+        if (_filterProvider == null) {
+            SimpleFilterProvider _provider = new SimpleFilterProvider();
+            _provider.addFilter(PropertyBeanFilterName, new BeanPropertyFilter());
+            _filterProvider = _provider;
+        }
+        return _filterProvider;
+    }
+
+    //////////////////////////////////////
+    // Static fields
+    //////////////////////////////////////
+    private static Set<String> _propertyNames = null;
+    private static FilterProvider _filterProvider = null;
+    static final String PropertyBeanFilterName = "TaggedLogPropertyBeanFilter";
+
+    public static ObjectMapper buildObjectMapper() {
         final JsonFactory factory = new JsonFactory();
         final ObjectMapper mapper = new ObjectMapper(factory);
         mapper.setFilters(TaggedLogAPIEntity.getFilterProvider());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
index 90db780..b7260f8 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
@@ -48,6 +48,6 @@ public class GenericMetricEntity extends TaggedLogAPIEntity {
 
 	public void setValue(double[] value) {
 		this.value = value;
-		_pcs.firePropertyChange("value", null, null);
+		pcs.firePropertyChange("value", null, null);
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntity.java
index 2b37d25..6869c7c 100644
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntity.java
@@ -16,10 +16,10 @@
  */
 package org.apache.eagle.log.entity;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import org.apache.eagle.common.EagleExceptionWrapper;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonDeserialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -111,11 +111,8 @@ public class GenericServiceAPIResponseEntity<T>{
 	public String getException() {
 		return exception;
 	}
-//	public void setException(String exception) {
-//		this.exception = exception;
-//	}
 
     public void setException(Exception exceptionObj){
-        if(exception!=null) this.exception = EagleExceptionWrapper.wrap(exceptionObj);
+        this.exception = EagleExceptionWrapper.wrap(exceptionObj);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntityDeserializer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntityDeserializer.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntityDeserializer.java
index 940ee8a..836295b 100644
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntityDeserializer.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericServiceAPIResponseEntityDeserializer.java
@@ -16,14 +16,15 @@
  */
 package org.apache.eagle.log.entity;
 
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.DeserializationContext;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.type.TypeFactory;
-import org.codehaus.jackson.type.JavaType;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.google.common.base.Preconditions;
 
 import java.io.IOException;
 import java.util.*;
@@ -45,20 +46,20 @@ public class GenericServiceAPIResponseEntityDeserializer extends JsonDeserialize
 
         JsonNode rootNode = jp.getCodec().readTree(jp);
         if(rootNode.isObject()){
-            Iterator<Map.Entry<String,JsonNode>> fields = rootNode.getFields();
+            Iterator<Map.Entry<String,JsonNode>> fields = rootNode.fields();
             JsonNode objNode = null;
             while(fields.hasNext()){
                 Map.Entry<String,JsonNode> field = fields.next();
                 if (META_FIELD.equals(field.getKey()) && field.getValue() != null)
                     entity.setMeta(objectCodec.readValue(field.getValue().traverse(), Map.class));
                 else if(SUCCESS_FIELD.equals(field.getKey()) && field.getValue() != null){
-                    entity.setSuccess(field.getValue().getValueAsBoolean(false));
+                    entity.setSuccess(field.getValue().booleanValue());
                 }else if(EXCEPTION_FIELD.equals(field.getKey()) && field.getValue() != null){
-//                    entity.setException(field.getValue().getTextValue());
-                    entity.setException(new Exception(field.getValue().getTextValue()));
+                    entity.setException(new Exception(field.getValue().textValue()));
                 }else if(TYPE_FIELD.endsWith(field.getKey())  && field.getValue() != null){
+                    Preconditions.checkNotNull(field.getValue().textValue(),"Response type class is null");
                     try {
-                        entity.setType(Class.forName(field.getValue().getTextValue()));
+                        entity.setType(Class.forName(field.getValue().textValue()));
                     } catch (ClassNotFoundException e) {
                         throw new IOException(e);
                     }
@@ -82,4 +83,4 @@ public class GenericServiceAPIResponseEntityDeserializer extends JsonDeserialize
         }
         return entity;
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
index f655ba0..9a58d35 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/MetricMetadataEntity.java
@@ -62,56 +62,56 @@ public class MetricMetadataEntity extends TaggedLogAPIEntity {
 	}
 	public void setStoreType(String storeType) {
 		this.storeType = storeType;
-		_pcs.firePropertyChange("storeType", null, null);
+		pcs.firePropertyChange("storeType", null, null);
 	}
 	public String getDisplayName() {
 		return displayName;
 	}
 	public void setDisplayName(String displayName) {
 		this.displayName = displayName;
-		_pcs.firePropertyChange("displayName", null, null);
+		pcs.firePropertyChange("displayName", null, null);
 	}
 	public String getDefaultDownSamplingFunction() {
 		return defaultDownSamplingFunction;
 	}
 	public void setDefaultDownSamplingFunction(String defaultDownSamplingFunction) {
 		this.defaultDownSamplingFunction = defaultDownSamplingFunction;
-		_pcs.firePropertyChange("defaultDownSamplingFunction", null, null);
+		pcs.firePropertyChange("defaultDownSamplingFunction", null, null);
 	}
 	public String getDefaultAggregateFunction() {
 		return defaultAggregateFunction;
 	}
 	public void setDefaultAggregateFunction(String defaultAggregateFunction) {
 		this.defaultAggregateFunction = defaultAggregateFunction;
-		_pcs.firePropertyChange("defaultAggregateFunction", null, null);
+		pcs.firePropertyChange("defaultAggregateFunction", null, null);
 	}
 	public String getAggFunctions() {
 		return aggFunctions;
 	}
 	public void setAggFunctions(String aggFunctions) {
 		this.aggFunctions = aggFunctions;
-		_pcs.firePropertyChange("aggFunctions", null, null);
+		pcs.firePropertyChange("aggFunctions", null, null);
 	}
 	public String getDownSamplingFunctions() {
 		return downSamplingFunctions;
 	}
 	public void setDownSamplingFunctions(String downSamplingFunctions) {
 		this.downSamplingFunctions = downSamplingFunctions;
-		_pcs.firePropertyChange("downSamplingFunctions", null, null);
+		pcs.firePropertyChange("downSamplingFunctions", null, null);
 	}
 	public String getResolutions() {
 		return resolutions;
 	}
 	public void setResolutions(String resolutions) {
 		this.resolutions = resolutions;
-		_pcs.firePropertyChange("resolutions", null, null);
+		pcs.firePropertyChange("resolutions", null, null);
 	}
 	public String getDrillDownPaths() {
 		return drillDownPaths;
 	}
 	public void setDrillDownPaths(String drillDownPaths) {
 		this.drillDownPaths = drillDownPaths;
-		_pcs.firePropertyChange("drillDownPaths", null, null);
+		pcs.firePropertyChange("drillDownPaths", null, null);
 	}
 	
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestEntity.java
index 402e170..af635ec 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestEntity.java
@@ -56,7 +56,7 @@ public class TestEntity extends TaggedLogAPIEntity {
 
 	public void setNumClusters(Long numClusters) {
 		this.numClusters = numClusters;
-		_pcs.firePropertyChange("numClusters", null, null);
+		pcs.firePropertyChange("numClusters", null, null);
 	}
 
 	public int getNumHosts() {
@@ -65,7 +65,7 @@ public class TestEntity extends TaggedLogAPIEntity {
 
 	public void setNumHosts(int numHosts) {
 		this.numHosts = numHosts;
-		_pcs.firePropertyChange("numHosts", null, null);
+		pcs.firePropertyChange("numHosts", null, null);
 	}
 
 	public long getCount() {
@@ -74,7 +74,7 @@ public class TestEntity extends TaggedLogAPIEntity {
 
 	public void setCount(long count) {
 		this.count = count;
-		_pcs.firePropertyChange("count", null, null);
+		pcs.firePropertyChange("count", null, null);
 	}
 
 	public String getRemediationID() {
@@ -83,7 +83,7 @@ public class TestEntity extends TaggedLogAPIEntity {
 
 	public void setRemediationID(String remediationID) {
 		this.remediationID = remediationID;
-		_pcs.firePropertyChange("remediationID", null, null);
+		pcs.firePropertyChange("remediationID", null, null);
 	}
 
 	public String getRemediationStatus() {
@@ -92,7 +92,7 @@ public class TestEntity extends TaggedLogAPIEntity {
 
 	public void setRemediationStatus(String remediationStatus) {
 		this.remediationStatus = remediationStatus;
-		_pcs.firePropertyChange("remediationStatus", null, null);
+		pcs.firePropertyChange("remediationStatus", null, null);
 	}
 	
 	public String toString(){

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestLogAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestLogAPIEntity.java
index ea73f81..d126421 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestLogAPIEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestLogAPIEntity.java
@@ -52,48 +52,48 @@ public class TestLogAPIEntity extends TaggedLogAPIEntity {
 	}
 	public void setField1(int field1) {
 		this.field1 = field1;
-		_pcs.firePropertyChange("field1", null, null);
+		pcs.firePropertyChange("field1", null, null);
 	}
 	public Integer getField2() {
 		return field2;
 	}
 	public void setField2(Integer field2) {
 		this.field2 = field2;
-		_pcs.firePropertyChange("field2", null, null);
+		pcs.firePropertyChange("field2", null, null);
 	}
 	public long getField3() {
 		return field3;
 	}
 	public void setField3(long field3) {
 		this.field3 = field3;
-		_pcs.firePropertyChange("field3", null, null);
+		pcs.firePropertyChange("field3", null, null);
 	}
 	public Long getField4() {
 		return field4;
 	}
 	public void setField4(Long field4) {
 		this.field4 = field4;
-		_pcs.firePropertyChange("field4", null, null);
+		pcs.firePropertyChange("field4", null, null);
 	}
 	public double getField5() {
 		return field5;
 	}
 	public void setField5(double field5) {
 		this.field5 = field5;
-		_pcs.firePropertyChange("field5", null, null);
+		pcs.firePropertyChange("field5", null, null);
 	}
 	public Double getField6() {
 		return field6;
 	}
 	public void setField6(Double field6) {
 		this.field6 = field6;
-		_pcs.firePropertyChange("field6", null, null);
+		pcs.firePropertyChange("field6", null, null);
 	}
 	public String getField7() {
 		return field7;
 	}
 	public void setField7(String field7) {
 		this.field7 = field7;
-		_pcs.firePropertyChange("field7", null, null);
+		pcs.firePropertyChange("field7", null, null);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestTimeSeriesAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestTimeSeriesAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestTimeSeriesAPIEntity.java
index 6d5f560..eaa9fd2 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestTimeSeriesAPIEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/test/TestTimeSeriesAPIEntity.java
@@ -50,48 +50,48 @@ public class TestTimeSeriesAPIEntity extends TaggedLogAPIEntity {
 	}
 	public void setField1(int field1) {
 		this.field1 = field1;
-		_pcs.firePropertyChange("field1", null, null);
+		pcs.firePropertyChange("field1", null, null);
 	}
 	public Integer getField2() {
 		return field2;
 	}
 	public void setField2(Integer field2) {
 		this.field2 = field2;
-		_pcs.firePropertyChange("field2", null, null);
+		pcs.firePropertyChange("field2", null, null);
 	}
 	public long getField3() {
 		return field3;
 	}
 	public void setField3(long field3) {
 		this.field3 = field3;
-		_pcs.firePropertyChange("field3", null, null);
+		pcs.firePropertyChange("field3", null, null);
 	}
 	public Long getField4() {
 		return field4;
 	}
 	public void setField4(Long field4) {
 		this.field4 = field4;
-		_pcs.firePropertyChange("field4", null, null);
+		pcs.firePropertyChange("field4", null, null);
 	}
 	public double getField5() {
 		return field5;
 	}
 	public void setField5(double field5) {
 		this.field5 = field5;
-		_pcs.firePropertyChange("field5", null, null);
+		pcs.firePropertyChange("field5", null, null);
 	}
 	public Double getField6() {
 		return field6;
 	}
 	public void setField6(Double field6) {
 		this.field6 = field6;
-		_pcs.firePropertyChange("field6", null, null);
+		pcs.firePropertyChange("field6", null, null);
 	}
 	public String getField7() {
 		return field7;
 	}
 	public void setField7(String field7) {
 		this.field7 = field7;
-		_pcs.firePropertyChange("field7", null, null);
+		pcs.firePropertyChange("field7", null, null);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/TestGenericServiceAPIResponseEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/TestGenericServiceAPIResponseEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/TestGenericServiceAPIResponseEntity.java
index 6ef9365..092ef75 100644
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/TestGenericServiceAPIResponseEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/TestGenericServiceAPIResponseEntity.java
@@ -16,10 +16,10 @@
  */
 package org.apache.eagle.log;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
 import org.junit.Assert;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
index 3b14bff..d6db6a2 100755
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
@@ -17,18 +17,32 @@
 package org.apache.eagle.log.entity.base.taggedlog;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.apache.eagle.log.base.taggedlog.EntityJsonModule;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.apache.eagle.log.entity.meta.Column;
 import org.junit.Assert;
 
-import org.codehaus.jackson.map.ObjectMapper;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestTaggedLogAPIEntity {
-    ObjectMapper objectMapper = new ObjectMapper();
+    private static ObjectMapper objectMapper;
+
+    @BeforeClass
+    public static void setUp(){
+        objectMapper = new ObjectMapper();
+        objectMapper.setFilters(TaggedLogAPIEntity.getFilterProvider());
+        objectMapper.registerModule(new EntityJsonModule());
+    }
 
     @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
     private class MockSubTaggedLogAPIEntity extends TaggedLogAPIEntity {
@@ -38,7 +52,7 @@ public class TestTaggedLogAPIEntity {
 
         public void setField1(double value) {
             this.field1 = value;
-            _pcs.firePropertyChange("field1", null, null);
+            pcs.firePropertyChange("field1", null, null);
         }
 
         @Column("a")
@@ -50,14 +64,14 @@ public class TestTaggedLogAPIEntity {
 
         public void setField2(String field2) {
             this.field2 = field2;
-            _pcs.firePropertyChange("field2", null, null);
+            pcs.firePropertyChange("field2", null, null);
         }
 
         @Column("b")
         private String field2;
     }
 
-    @SuppressWarnings("serial")
+    @SuppressWarnings("unchecked")
 	@Test
     public void testJsonSerializeFilter() throws IOException {
         MockSubTaggedLogAPIEntity mock = new MockSubTaggedLogAPIEntity();
@@ -68,7 +82,7 @@ public class TestTaggedLogAPIEntity {
         mock.setEncodedRowkey("test_encoded_row_key");
         mock.setPrefix("mock");
         mock.setField2("ok");
-        String json = objectMapper.filteredWriter(TaggedLogAPIEntity.getFilterProvider()).writeValueAsString(mock);
+        String json = objectMapper.writeValueAsString(mock);
         System.out.println(json);
         Assert.assertTrue(json.contains("field2"));
         Assert.assertTrue(!json.contains("field1"));
@@ -83,9 +97,21 @@ public class TestTaggedLogAPIEntity {
         mock.setExp(new HashMap<String, Object>() {{
             put("extra_field", 3.14);
         }});
-        json = objectMapper.filteredWriter(TaggedLogAPIEntity.getFilterProvider()).writeValueAsString(mock);
+        json = objectMapper.writeValueAsString(mock);
         System.out.println(json);
         Assert.assertTrue(json.contains("field2"));
         Assert.assertTrue(json.contains("field1"));
     }
+
+    @Test
+    public void testJsonSerializeMap() throws JsonProcessingException {
+        Map<List<String>,List<Object>> entries = new HashMap<List<String>,List<Object>>(){
+            {
+                put(Arrays.asList("a","b"),Arrays.asList(1,2,3));
+            }
+        };
+        String json = objectMapper.writeValueAsString(entries.entrySet());
+        Assert.assertNotNull(json);
+        System.out.print(json);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/raw/GroupbyKey.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/raw/GroupbyKey.java b/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/raw/GroupbyKey.java
index 3a54d70..c8ed260 100755
--- a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/raw/GroupbyKey.java
+++ b/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/raw/GroupbyKey.java
@@ -16,12 +16,15 @@
  */
 package org.apache.eagle.query.aggregate.raw;
 
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.io.ByteWritable;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.Writable;
 
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.ListIterator;
@@ -90,8 +93,6 @@ public class GroupbyKey implements Writable {
 			return false;
 		}
 		GroupbyKey that = (GroupbyKey)obj;
-//		ListIterator<byte[]> e1 = this.value.listIterator();
-//		ListIterator<byte[]> e2 = that.value.listIterator();
 		ListIterator<BytesWritable> e1 = this.value.listIterator();
 		ListIterator<BytesWritable> e2 = that.value.listIterator();
 		while(e1.hasNext() && e2.hasNext()){
@@ -102,6 +103,16 @@ public class GroupbyKey implements Writable {
 	}
 
 	@Override
+	public String toString() {
+		List<String> items = new ArrayList<>(this.value.size());
+		ListIterator<BytesWritable> iterator = this.value.listIterator();
+		while(iterator.hasNext()){
+			items.add(iterator.next().toString());
+		}
+		return String.format("%s(%s)",this.getClass().getSimpleName(),StringUtils.join(items,","));
+	}
+
+	@Override
 	public int hashCode(){
 		ListIterator<BytesWritable> e1 = this.value.listIterator();
 		int hash = 0xFFFFFFFF;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/aggregate/test/TestBucketQuery.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/aggregate/test/TestBucketQuery.java b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/aggregate/test/TestBucketQuery.java
index e2e83ec..e44d73b 100755
--- a/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/aggregate/test/TestBucketQuery.java
+++ b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/aggregate/test/TestBucketQuery.java
@@ -16,11 +16,11 @@
  */
 package org.apache.eagle.query.aggregate.test;
 
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.apache.eagle.query.aggregate.BucketQuery;
 import org.junit.Assert;
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.map.ObjectMapper;
 import org.junit.Test;
 
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-service-base/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/pom.xml b/eagle-core/eagle-query/eagle-service-base/pom.xml
index 92a705a..a3fc2e7 100755
--- a/eagle-core/eagle-query/eagle-service-base/pom.xml
+++ b/eagle-core/eagle-query/eagle-service-base/pom.xml
@@ -69,9 +69,9 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-mapper-asl</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.codehaus.jackson</groupId>-->
+            <!--<artifactId>jackson-mapper-asl</artifactId>-->
+        <!--</dependency>-->
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericEntityServiceResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericEntityServiceResource.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericEntityServiceResource.java
index b7f27f5..a0d8143 100644
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericEntityServiceResource.java
+++ b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericEntityServiceResource.java
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
 import javax.ws.rs.*;
 import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
@@ -456,6 +457,10 @@ public class GenericEntityServiceResource {
         } catch (Exception e) {
             response.setException(e);
             LOG.error(e.getMessage(),e);
+            throw new WebApplicationException(e,
+                    Response.status(Response.Status.BAD_REQUEST)
+                    .type(MediaType.APPLICATION_JSON_TYPE)
+                    .entity(response).build());
         }finally {
             stopWatch.stop();
         }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
index 35dd4b7..35b04d1 100755
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
+++ b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
@@ -16,10 +16,10 @@
  */
 package org.apache.eagle.service.generic;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ser.FilterProvider;
 import com.google.inject.Singleton;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.ser.FilterProvider;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/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
index f108bd5..2db13f5 100644
--- 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
@@ -33,32 +33,33 @@ 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);
-	}
+    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/21187b55/eagle-core/eagle-query/eagle-storage-base/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-base/pom.xml b/eagle-core/eagle-query/eagle-storage-base/pom.xml
index 536e497..de5d59d 100644
--- a/eagle-core/eagle-query/eagle-storage-base/pom.xml
+++ b/eagle-core/eagle-query/eagle-storage-base/pom.xml
@@ -33,4 +33,4 @@
             <version>${project.version}</version>
         </dependency>
     </dependencies>
-</project>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-base/src/test/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-base/src/test/resources/application.conf b/eagle-core/eagle-query/eagle-storage-base/src/test/resources/application.conf
index dbaac1d..77093bc 100644
--- a/eagle-core/eagle-query/eagle-storage-base/src/test/resources/application.conf
+++ b/eagle-core/eagle-query/eagle-storage-base/src/test/resources/application.conf
@@ -13,8 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-eagle{
-	service{
+storage {
 		env="dev"
 		host="localhost"
 		port=8080
@@ -24,5 +23,4 @@ eagle{
 		hbase-zookeeper-quorum="localhost"
 		hbase-zookeeper-property-clientPort=2181
 		zookeeper-znode-parent="/hbase-unsecure"
-	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-hbase/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-hbase/pom.xml b/eagle-core/eagle-query/eagle-storage-hbase/pom.xml
index 774684c..406494e 100644
--- a/eagle-core/eagle-query/eagle-storage-hbase/pom.xml
+++ b/eagle-core/eagle-query/eagle-storage-hbase/pom.xml
@@ -22,7 +22,7 @@
         <artifactId>eagle-query-parent</artifactId>
         <groupId>org.apache.eagle</groupId>
         <version>0.5.0-incubating-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <relativePath>..</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-hbase/src/assembly/hbase-coprocessor.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-hbase/src/assembly/hbase-coprocessor.xml b/eagle-core/eagle-query/eagle-storage-hbase/src/assembly/hbase-coprocessor.xml
index fa80c64..e27fcd4 100644
--- a/eagle-core/eagle-query/eagle-storage-hbase/src/assembly/hbase-coprocessor.xml
+++ b/eagle-core/eagle-query/eagle-storage-hbase/src/assembly/hbase-coprocessor.xml
@@ -44,6 +44,7 @@
                 <exclude>org.slf4j:slf4j-api</exclude>
                 <exclude>org.slf4j:log4j-over-slf4j</exclude>
                 <exclude>org.slf4j:slf4j-log4j12</exclude>
+                <exclude>com.google.protobuf:protobuf-java</exclude>
             </excludes>
         </dependencySet>
     </dependencySets>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseEntitySchemaManager.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseEntitySchemaManager.java b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseEntitySchemaManager.java
index 03c0ec2..d7483f5 100644
--- a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseEntitySchemaManager.java
+++ b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseEntitySchemaManager.java
@@ -40,9 +40,10 @@ public class HBaseEntitySchemaManager {
     private static HBaseEntitySchemaManager instance;
     private volatile HBaseAdmin admin;
 
-    private final int DEFAULT_MAX_VERSIONS = 1;
+    private static final int DEFAULT_MAX_VERSIONS = 1;
 
-    private HBaseEntitySchemaManager() {}
+    private HBaseEntitySchemaManager() {
+    }
 
     public static HBaseEntitySchemaManager getInstance() {
         if (instance == null) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorage.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorage.java b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorage.java
index 1810401..74c90bc 100644
--- a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorage.java
+++ b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorage.java
@@ -16,6 +16,11 @@
  */
 package org.apache.eagle.storage.hbase;
 
+import static org.apache.eagle.audit.common.AuditConstants.AUDIT_EVENT_CREATE;
+import static org.apache.eagle.audit.common.AuditConstants.AUDIT_EVENT_DELETE;
+import static org.apache.eagle.audit.common.AuditConstants.AUDIT_EVENT_UPDATE;
+
+import org.apache.eagle.common.EagleBase64Wrapper;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.apache.eagle.log.entity.GenericEntityWriter;
 import org.apache.eagle.log.entity.HBaseInternalLogHelper;
@@ -29,7 +34,7 @@ import org.apache.eagle.storage.hbase.query.GenericQueryBuilder;
 import org.apache.eagle.storage.operation.CompiledQuery;
 import org.apache.eagle.storage.result.ModifyResult;
 import org.apache.eagle.storage.result.QueryResult;
-import org.apache.eagle.common.EagleBase64Wrapper;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,19 +42,13 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_EVENT_CREATE;
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_EVENT_UPDATE;
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_EVENT_DELETE;
-
-/**
- * @since 3/18/15
- */
 public class HBaseStorage extends DataStorageBase {
 
-    private final static Logger LOG = LoggerFactory.getLogger(HBaseStorage.class);
+    private static final Logger LOG = LoggerFactory.getLogger(HBaseStorage.class);
     private HBaseStorageAudit audit = new HBaseStorageAudit();
-    
+
     @Override
     public void init() throws IOException {
         HBaseEntitySchemaManager.getInstance().init();
@@ -58,9 +57,9 @@ public class HBaseStorage extends DataStorageBase {
 
     @Override
     public <E extends TaggedLogAPIEntity> ModifyResult<String> update(List<E> entities, EntityDefinition entityDefinition) throws IOException {
-    	ModifyResult<String> result = create(entities, entityDefinition);
-    	audit.auditOperation(AUDIT_EVENT_UPDATE, entities, null, entityDefinition); // added for jira: EAGLE-47
-    	return result;
+        ModifyResult<String> result = create(entities, entityDefinition);
+        audit.auditOperation(AUDIT_EVENT_UPDATE, entities, null, entityDefinition); // added for jira: EAGLE-47
+        return result;
     }
 
     @Override
@@ -71,118 +70,85 @@ public class HBaseStorage extends DataStorageBase {
             result.setIdentifiers(entityWriter.write(entities));
             result.setSuccess(true);
         } catch (Exception e) {
-            LOG.error(e.getMessage(),e);
+            LOG.error(e.getMessage(), e);
             throw new IOException(e);
         }
 
         audit.auditOperation(AUDIT_EVENT_CREATE, entities, null, entityDefinition); // added for jira: EAGLE-47
         return result;
     }
-    
-    /**
-     * @param entities
-     * @param entityDefinition
-     * @param <E>
-     *
-     * @return ModifyResult
-     *
-     * @throws IOException
-     */
+
+
     @Override
-    public <E extends TaggedLogAPIEntity> ModifyResult<String> delete(List<E> entities, EntityDefinition entityDefinition) throws IOException {
+    public ModifyResult<String> deleteByID(List<String> ids, EntityDefinition entityDefinition) throws IOException {
         ModifyResult<String> result = new ModifyResult<String>();
-        try{
+        try {
             GenericDeleter deleter = new GenericDeleter(entityDefinition.getTable(), entityDefinition.getColumnFamily());
-            result.setIdentifiers(deleter.delete(entities));
-        }catch(Exception ex){
-            LOG.error(ex.getMessage(),ex);
+            deleter.deleteByEncodedRowkeys(ids);
+            result.setIdentifiers(ids);
+        } catch (Exception ex) {
+            LOG.error(ex.getMessage(), ex);
             result.setSuccess(false);
             throw new IOException(ex);
         }
-        
-        audit.auditOperation(AUDIT_EVENT_DELETE, entities, null, entityDefinition); // added for jira: EAGLE-47
+
+        audit.auditOperation(AUDIT_EVENT_DELETE, null, ids, entityDefinition); // added for jira: EAGLE-47
         result.setSuccess(true);
         return result;
     }
 
-    /**
-     * TODO:
-     *
-     * @param ids
-     * @param entityDefinition
-     * @return
-     * @throws IOException
-     */
     @Override
-    public ModifyResult<String> deleteByID(List<String> ids, EntityDefinition entityDefinition) throws IOException {
+    public <E extends TaggedLogAPIEntity> ModifyResult<String> delete(List<E> entities, EntityDefinition entityDefinition) throws IOException {
         ModifyResult<String> result = new ModifyResult<String>();
-        try{
+        try {
             GenericDeleter deleter = new GenericDeleter(entityDefinition.getTable(), entityDefinition.getColumnFamily());
-            deleter.deleteByEncodedRowkeys(ids);
-            result.setIdentifiers(ids);
-        }catch(Exception ex){
-            LOG.error(ex.getMessage(),ex);
+            result.setIdentifiers(deleter.delete(entities));
+        } catch (Exception ex) {
+            LOG.error(ex.getMessage(), ex);
             result.setSuccess(false);
             throw new IOException(ex);
         }
-        
-        audit.auditOperation(AUDIT_EVENT_DELETE, null, ids, entityDefinition); // added for jira: EAGLE-47
+
+        audit.auditOperation(AUDIT_EVENT_DELETE, entities, null, entityDefinition); // added for jira: EAGLE-47
         result.setSuccess(true);
         return result;
     }
 
-    /**
-     * TODO:
-     *
-     * @param query
-     * @param entityDefinition
-     * @return
-     * @throws IOException
-     */
     @Override
     public ModifyResult<String> delete(CompiledQuery query, EntityDefinition entityDefinition) throws IOException {
-        if(query.isHasAgg()){
+        if (query.isHasAgg()) {
             throw new IOException("delete by aggregation query is not supported");
         }
         ModifyResult<String> result;
 
         try {
-            LOG.info("Querying for deleting: "+query);
+            LOG.info("Querying for deleting: " + query);
             GenericQuery reader = GenericQueryBuilder
                     .select(query.getSearchCondition().getOutputFields())
-                    .from(query.getServiceName(),query.getRawQuery().getMetricName()).where(query.getSearchCondition())
+                    .from(query.getServiceName(), query.getRawQuery().getMetricName()).where(query.getSearchCondition())
                     .groupBy(query.isHasAgg(), query.getGroupByFields(), query.getAggregateFunctionTypes(), query.getAggregateFields())
-                    .timeSeries(query.getRawQuery().isTimeSeries(),query.getRawQuery().getIntervalmin())
+                    .timeSeries(query.getRawQuery().isTimeSeries(), query.getRawQuery().getIntervalmin())
                     .treeAgg(query.getRawQuery().isTreeAgg())
-                    .orderBy(query.getSortOptions(),query.getSortFunctions(),query.getSortFields())
+                    .orderBy(query.getSortOptions(), query.getSortFunctions(), query.getSortFields())
                     .top(query.getRawQuery().getTop())
                     .parallel(query.getRawQuery().getParallel())
                     .build();
             List<? extends TaggedLogAPIEntity> entities = reader.result();
-            if(entities != null){
-                LOG.info("Deleting "+entities.size()+" entities");
-                result =  delete(entities,entityDefinition);
-            }else{
+            if (entities != null) {
+                LOG.info("Deleting " + entities.size() + " entities");
+                result = delete(entities, entityDefinition);
+            } else {
                 LOG.info("Deleting 0 entities");
                 result = new ModifyResult<String>();
                 result.setSuccess(true);
             }
         } catch (Exception e) {
-            LOG.error(e.getMessage(),e);
+            LOG.error(e.getMessage(), e);
             throw new IOException(e);
         }
         return result;
     }
 
-    /**
-     * TODO:
-     *
-     * @param query
-     * @param entityDefinition
-     * @param <E>
-     * @return
-     * @throws IOException
-     */
     @Override
     @SuppressWarnings("unchecked")
     public <E extends Object> QueryResult<E> query(CompiledQuery query, EntityDefinition entityDefinition) throws IOException {
@@ -190,52 +156,53 @@ public class HBaseStorage extends DataStorageBase {
         try {
             GenericQuery reader = GenericQueryBuilder
                     .select(query.getSearchCondition().getOutputFields())
-                    .from(query.getServiceName(),query.getRawQuery().getMetricName()).where(query.getSearchCondition())
+                    .from(query.getServiceName(), query.getRawQuery().getMetricName()).where(query.getSearchCondition())
                     .groupBy(query.isHasAgg(), query.getGroupByFields(), query.getAggregateFunctionTypes(), query.getAggregateFields())
-                    .timeSeries(query.getRawQuery().isTimeSeries(),query.getRawQuery().getIntervalmin())
+                    .timeSeries(query.getRawQuery().isTimeSeries(), query.getRawQuery().getIntervalmin())
                     .treeAgg(query.getRawQuery().isTreeAgg())
-                    .orderBy(query.getSortOptions(),query.getSortFunctions(),query.getSortFields())
+                    .orderBy(query.getSortOptions(), query.getSortFunctions(), query.getSortFields())
                     .top(query.getRawQuery().getTop())
                     .parallel(query.getRawQuery().getParallel())
                     .build();
-            List<E> entities =  reader.result();
+            List<E> entities = reader.result();
             result.setData(entities);
             result.setFirstTimestamp(reader.getFirstTimeStamp());
             result.setLastTimestamp(reader.getLastTimestamp());
             result.setSize(entities.size());
-            if(!query.isHasAgg()) result.setEntityType((Class<E>) entityDefinition.getEntityClass());
+            if (!query.isHasAgg()) {
+                result.setEntityType((Class<E>) entityDefinition.getEntityClass());
+            } else {
+                result.setEntityType((Class<E>) Map.class);
+            }
             result.setSuccess(true);
         } catch (Exception e) {
-            LOG.error(e.getMessage(),e);
+            LOG.error(e.getMessage(), e);
             throw new IOException(e);
         }
         return result;
     }
 
     /**
-     * Query by HBase rowkey
-     *
-     * @param ids hbase rowkey list
-     * @param entityDefinition entity definition
-     * @param <E> entity type
-     * @return QueryResult with entity type <E>
-     *
-     * @throws IOException
+     * Query by HBase rowkey.
      */
     @Override
     public <E> QueryResult<E> queryById(List<String> ids, EntityDefinition entityDefinition) throws IOException {
         List<byte[]> rowkeys = new ArrayList<>(ids.size());
         QueryResult<E> result = new QueryResult<E>();
-        for(String id:ids) rowkeys.add(EagleBase64Wrapper.decode(id));
+        for (String id : ids) {
+            rowkeys.add(EagleBase64Wrapper.decode(id));
+        }
         RowKeyLogReader reader = null;
         try {
-            reader = new RowKeyLogReader(entityDefinition, rowkeys,null);
+            reader = new RowKeyLogReader(entityDefinition, rowkeys, null);
             reader.open();
             List<TaggedLogAPIEntity> entities = new LinkedList<>();
 
-            while(true) {
+            while (true) {
                 InternalLog log = reader.read();
-                if(log == null) break;
+                if (log == null) {
+                    break;
+                }
                 TaggedLogAPIEntity entity = HBaseInternalLogHelper.buildEntity(log, entityDefinition);
                 entities.add(entity);
             }
@@ -247,8 +214,10 @@ public class HBaseStorage extends DataStorageBase {
         } catch (Exception e) {
             LOG.error(e.getMessage(), e);
             throw new IOException(e);
-        } finally{
-            if(reader != null) reader.close();
+        } finally {
+            if (reader != null) {
+                reader.close();
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorageAudit.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorageAudit.java b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorageAudit.java
index f6a6180..74a9dc7 100644
--- a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorageAudit.java
+++ b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/HBaseStorageAudit.java
@@ -17,11 +17,7 @@
 
 package org.apache.eagle.storage.hbase;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import static org.apache.eagle.audit.common.AuditConstants.*;
 
 import org.apache.eagle.audit.common.AuditEvent;
 import org.apache.eagle.audit.entity.GenericAuditEntity;
@@ -33,132 +29,138 @@ import org.apache.eagle.log.entity.meta.EntityDefinition;
 import org.apache.eagle.storage.DataStorageManager;
 import org.apache.eagle.storage.exception.IllegalDataStorageTypeException;
 import org.apache.eagle.storage.operation.CreateStatement;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_SERVICE_ENDPOINT;
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_COLUMN_SERVICE_NAME;
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_COLUMN_USER_ID;
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_COLUMN_OPERATION;
-import static org.apache.eagle.audit.common.AuditConstants.AUDIT_COLUMN_TIMESTAMP;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
- * Implementation of AuditListener class. 
+ * Implementation of AuditListener class.
  * Used in HBaseStorage class for auditing HBase operations performed.
  */
 public class HBaseStorageAudit implements AuditListener {
-	
-	private final static Logger LOG = LoggerFactory.getLogger(HBaseStorageAudit.class);
-	private AuditSupport auditSupport = new AuditSupport(this);
-	
-	public HBaseStorageAudit() {
-		auditSupport.addAuditListener(this);
-	}
-	
-	@Override
-	public void auditEvent(AuditEvent event) {
-			LOG.info("firing audit event: " + event.toString());
-			persistAuditEntity(event.getAuditEntities());
-	}
-	
-	/**
-	 * Method to be invoked for firing audit event.
-	 * @param operation: HBase operation. Values like CREATE/UPDATE/DELETE.
-	 * @param entities: List of entities used in HBase operation.
-	 * @param encodedRowKeys: List of encodededRowKeys returned from successful HBase operation. To be passed only from deletebyID method. 
-	 * @param entityDefinition: EntityDefinition object used in the HBaseOperation.
-	 */
+
+    private static final Logger LOG = LoggerFactory.getLogger(HBaseStorageAudit.class);
+    private AuditSupport auditSupport = new AuditSupport(this);
+
+    public HBaseStorageAudit() {
+        auditSupport.addAuditListener(this);
+    }
+
+    @Override
+    public void auditEvent(AuditEvent event) {
+        LOG.info("firing audit event: " + event.toString());
+        persistAuditEntity(event.getAuditEntities());
+    }
+
+    /**
+     * Method to be invoked for firing audit event.
+     *
+     * @param operation        HBase operation. Values like CREATE/UPDATE/DELETE.
+     * @param entities         List of entities used in HBase operation.
+     * @param encodedRowKeys   List of encodededRowKeys returned from successful HBase operation. To be passed only from deletebyID method.
+     * @param entityDefinition EntityDefinition object used in the HBaseOperation.
+     */
     public void auditOperation(String operation, List<? extends TaggedLogAPIEntity> entities, List<String> encodedRowKeys, EntityDefinition entityDefinition) {
-    	if (isAuditingRequired(entityDefinition.getService())) {
-    		List<GenericAuditEntity> auditEntities = buildAuditEntities(operation, entities, encodedRowKeys, entityDefinition);
-    		if (null != auditEntities && 0 != auditEntities.size())
-    			auditSupport.fireAudit(entityDefinition.getService(), auditEntities);
-    	}
+        if (isAuditingRequired(entityDefinition.getService())) {
+            List<GenericAuditEntity> auditEntities = buildAuditEntities(operation, entities, encodedRowKeys, entityDefinition);
+            if (null != auditEntities && 0 != auditEntities.size()) {
+                auditSupport.fireAudit(entityDefinition.getService(), auditEntities);
+            }
+        }
     }
-    
+
     /**
      * Check if audit is required based on the service names and audit configuration.
+     *
      * @param serviceName: Name of the service call.
      * @return
      */
-    private boolean isAuditingRequired (String serviceName) {
-    	if (EagleConfigFactory.load().isServiceAuditingEnabled()
-    			// As per jira EAGLE-47, HBase operation level audit is done only for Policy, Site and DataSource definitions. 
-    			&& ("AlertDefinitionService".equals(serviceName) || "AlertDataSourceService".equals(serviceName))) {
-    		return true;
-    	}
-
-    	return false;
+    private boolean isAuditingRequired(String serviceName) {
+        if (EagleConfigFactory.load().isServiceAuditingEnabled()
+            // As per jira EAGLE-47, HBase operation level audit is done only for Policy, Site and DataSource definitions.
+            && ("AlertDefinitionService".equals(serviceName) || "AlertDataSourceService".equals(serviceName))) {
+            return true;
+        }
+
+        return false;
     }
-    
+
     /**
      * Build Audit entities based on the available infomration.
-     * @param operation: HBase operation performed.
-     * @param entities: List of entities used in HBase operation.
-     * @param encodedRowKeys: List of encodededRowKeys returned from successful HBase operation. To be passed only from deletebyID method.
+     *
+     * @param operation:        HBase operation performed.
+     * @param entities:         List of entities used in HBase operation.
+     * @param encodedRowKeys:   List of encodededRowKeys returned from successful HBase operation. To be passed only from deletebyID method.
      * @param entityDefinition: EntityDefinition object used in the HBaseOperation.
      * @return
      */
     private List<GenericAuditEntity> buildAuditEntities(String operation, List<? extends TaggedLogAPIEntity> entities, List<String> encodedRowKeys, EntityDefinition entityDefinition) {
-    	String serviceName = entityDefinition.getService();
-    	long timestamp = System.currentTimeMillis()/1000L;
-    	
-    	Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-    	String userID = null != authentication.getName() ? authentication.getName() : "data not available"; // empty user
-
-    	List<GenericAuditEntity> auditEntities = new ArrayList<GenericAuditEntity>();
-    	GenericAuditEntity auditEntity = new GenericAuditEntity();
-    	
-		if (null != entities && 0 != entities.size())  {
-			Map<String, String> auditTags;
-			for (TaggedLogAPIEntity entity : entities) {
-	    		auditTags = entity.getTags();
-	    		auditTags.put(AUDIT_COLUMN_SERVICE_NAME, serviceName);
-	    		auditTags.put(AUDIT_COLUMN_USER_ID, userID);
-	    		auditTags.put(AUDIT_COLUMN_OPERATION, operation);
-	    		auditTags.put(AUDIT_COLUMN_TIMESTAMP, timestamp + "");
-	    		
-	    		auditEntity = new GenericAuditEntity();
-	    		auditEntity.setTags(auditTags);
-	    		auditEntities.add(auditEntity);
-	    	}
-			
-			return auditEntities;
-		} else if (null != encodedRowKeys && 0 != encodedRowKeys.size()) { // conditions yields true only in case of deleteByID 
-			Map<String, String> auditTags;
-			for (String encodedRowKey : encodedRowKeys) {
-				auditTags = new HashMap<String, String>();
-				auditTags.put("encodedRowKey", encodedRowKey);
-				auditTags.put(AUDIT_COLUMN_SERVICE_NAME, serviceName);
-	    		auditTags.put(AUDIT_COLUMN_USER_ID, userID);
-	    		auditTags.put(AUDIT_COLUMN_OPERATION, operation);
-	    		auditTags.put(AUDIT_COLUMN_TIMESTAMP, timestamp + "");
-	    		
-	    		auditEntity = new GenericAuditEntity();
-	    		auditEntity.setTags(auditTags);
-	    		auditEntities.add(auditEntity);
-			}
-
-			return auditEntities;
-		} else {
-			return null;
-		}
+        String serviceName = entityDefinition.getService();
+        long timestamp = System.currentTimeMillis() / 1000L;
+
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+        String userID = null != authentication.getName() ? authentication.getName() : "data not available"; // empty user
+
+        List<GenericAuditEntity> auditEntities = new ArrayList<GenericAuditEntity>();
+        GenericAuditEntity auditEntity = new GenericAuditEntity();
+
+        if (null != entities && 0 != entities.size()) {
+            Map<String, String> auditTags;
+            for (TaggedLogAPIEntity entity : entities) {
+                auditTags = entity.getTags();
+                auditTags.put(AUDIT_COLUMN_SERVICE_NAME, serviceName);
+                auditTags.put(AUDIT_COLUMN_USER_ID, userID);
+                auditTags.put(AUDIT_COLUMN_OPERATION, operation);
+                auditTags.put(AUDIT_COLUMN_TIMESTAMP, timestamp + "");
+
+                auditEntity = new GenericAuditEntity();
+                auditEntity.setTags(auditTags);
+                auditEntities.add(auditEntity);
+            }
+
+            return auditEntities;
+        } else if (null != encodedRowKeys && 0 != encodedRowKeys.size()) { // conditions yields true only in case of deleteByID
+            Map<String, String> auditTags;
+            for (String encodedRowKey : encodedRowKeys) {
+                auditTags = new HashMap<String, String>();
+                auditTags.put("encodedRowKey", encodedRowKey);
+                auditTags.put(AUDIT_COLUMN_SERVICE_NAME, serviceName);
+                auditTags.put(AUDIT_COLUMN_USER_ID, userID);
+                auditTags.put(AUDIT_COLUMN_OPERATION, operation);
+                auditTags.put(AUDIT_COLUMN_TIMESTAMP, timestamp + "");
+
+                auditEntity = new GenericAuditEntity();
+                auditEntity.setTags(auditTags);
+                auditEntities.add(auditEntity);
+            }
+
+            return auditEntities;
+        } else {
+            return null;
+        }
     }
 
     /**
      * Persists audit entries into HBase.
+     *
      * @param entityList
      */
     private void persistAuditEntity(List<? extends TaggedLogAPIEntity> entityList) {
-    	try {
-	    	if (null != entityList && 0 != entityList.size()) {
-		    	CreateStatement createStatement = new CreateStatement(entityList, AUDIT_SERVICE_ENDPOINT);
-		        createStatement.execute(DataStorageManager.newDataStorage("hbase"));
-	    	}
-    	} catch (IOException | IllegalDataStorageTypeException exception) {
-			LOG.error("exception in auditing storage event", exception.getMessage());
-		}
+        try {
+            if (null != entityList && 0 != entityList.size()) {
+                CreateStatement createStatement = new CreateStatement(entityList, AUDIT_SERVICE_ENDPOINT);
+                createStatement.execute(DataStorageManager.newDataStorage("hbase"));
+            }
+        } catch (IOException | IllegalDataStorageTypeException exception) {
+            LOG.error("exception in auditing storage event", exception.getMessage());
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/21187b55/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/GenericQueryBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/GenericQueryBuilder.java b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/GenericQueryBuilder.java
index 3dd83cf..961a762 100755
--- a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/GenericQueryBuilder.java
+++ b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/GenericQueryBuilder.java
@@ -16,143 +16,149 @@
  */
 package org.apache.eagle.storage.hbase.query;
 
-import java.util.List;
 
+import org.apache.eagle.common.config.EagleConfigFactory;
+import org.apache.eagle.log.entity.SearchCondition;
 import org.apache.eagle.query.GenericEntityQuery;
 import org.apache.eagle.query.GenericQuery;
-import org.apache.eagle.storage.hbase.query.aggregate.GenericAggregateQuery;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.eagle.log.entity.SearchCondition;
 import org.apache.eagle.query.aggregate.AggregateCondition;
 import org.apache.eagle.query.aggregate.AggregateFunctionType;
 import org.apache.eagle.query.aggregate.timeseries.SortOption;
+import org.apache.eagle.storage.hbase.query.aggregate.GenericCoprocessorAggregateQuery;
+import org.apache.eagle.storage.hbase.query.aggregate.GenericInMemoryAggregateQuery;
 
-/**
- * TODO: decouple into eagle-query-base module
- *
- * @since : 10/30/14,2014
- */
-public class GenericQueryBuilder{
-	private Logger LOG = LoggerFactory.getLogger(GenericQueryBuilder.class);
-
-	private List<String> outputFields;
-	private String serviceName;
-	private String metricName;
-	private SearchCondition searchCondition;
-	@Deprecated
-	private int parallel;
-	private boolean hasAgg;
-	private List<String> groupByFields;
-	private List<AggregateFunctionType> aggregateFuncTypes;
-	private List<String> aggregateFields;
-	@Deprecated
-	private boolean treeAgg=false;
-	private boolean timeSeries=false;
-	private long intervalmin;
-	private List<SortOption> sortOptions;
-	private int top;
-	private List<AggregateFunctionType> sortFunctionTypes;
-	private List<String> sortFields;
-
-	public static GenericQueryBuilder select(List<String> outputFields) {
-		GenericQueryBuilder builder = new GenericQueryBuilder();
-		builder.output(outputFields);
-		return builder;
-	}
-
-	public GenericQueryBuilder output(List<String> outputFields) {
-		this.outputFields = outputFields;
-		return this;
-	}
-	public GenericQueryBuilder from(String serviceName, String metricName) {
-		this.serviceName = serviceName;
-		this.metricName = metricName;
-		return this;
-	}
-
-	public GenericQueryBuilder where(SearchCondition condition) {
-		this.searchCondition = condition;
-		return this;
-	}
-
-	/**
-	 * TODO: Parameter "parallel" no longer supported, ignore
-	 *
-	 * @param parallel
-	 * @return
-	 */
-	@Deprecated
-	public GenericQueryBuilder parallel(int parallel) {
-//		throw new IllegalArgumentException("Parameter \"parallel\" no longer supported");
-		if(parallel > 0) LOG.warn("Parameter \"parallel\" is deprecated, ignore");
-		return this;
-	}
-
-	/**
-	 * @param hasAgg
-	 * @param groupByFields
-	 * @param aggregateFunctionTypes
-	 * @param aggregateFields
-	 * @return
-	 */
-	public GenericQueryBuilder groupBy(boolean hasAgg, List<String> groupByFields, List<AggregateFunctionType> aggregateFunctionTypes, List<String> aggregateFields) {
-		this.hasAgg = hasAgg;
-		this.groupByFields = groupByFields;
-		this.aggregateFuncTypes = aggregateFunctionTypes;
-		this.aggregateFields = aggregateFields;
-		return this;
-	}
-
-	public GenericQueryBuilder timeSeries(boolean timeSeries, long intervalMin) {
-		this.timeSeries = timeSeries;
-		this.intervalmin = intervalMin;
-		return this;
-	}
-
-	public GenericQueryBuilder orderBy(List<SortOption> sortOptions, List<AggregateFunctionType> sortFunctionTypes, List<String> sortFields) {
-		this.sortOptions = sortOptions;
-		this.sortFunctionTypes = sortFunctionTypes;
-		this.sortFields = sortFields;
-		return this;
-	}
-
-	public GenericQueryBuilder top(int top) {
-		this.top = top;
-		return this;
-	}
-
-	/**
-	 * TODO: Parameter "treeAgg" no longer supported, ignore
-	 *
-	 * @param treeAgg
-	 * @return
-	 */
-	@Deprecated
-	public GenericQueryBuilder treeAgg(boolean treeAgg){
-		if(treeAgg) LOG.warn("Parameter \"treeAgg\" is deprecated, ignore");
-		return this;
-	}
-
-	public GenericQuery build() throws Exception {
-		if(hasAgg){
-			if(LOG.isDebugEnabled()) LOG.debug("Build GroupAggregateQuery");
-			AggregateCondition aggregateCondition = new AggregateCondition();
-			aggregateCondition.setGroupbyFields(this.groupByFields);
-			aggregateCondition.setAggregateFunctionTypes(this.aggregateFuncTypes);
-			aggregateCondition.setAggregateFields(this.aggregateFields);
-			aggregateCondition.setTimeSeries(this.timeSeries);
-			aggregateCondition.setIntervalMS(this.intervalmin * 60 * 1000);
-			return new GenericAggregateQuery(this.serviceName,
-					this.searchCondition,
-					aggregateCondition,
-					this.metricName,
-					this.sortOptions,this.sortFunctionTypes,this.sortFields,
-					this.top);
-		} else {
-			if(LOG.isDebugEnabled()) LOG.debug("Build GenericBatchQuery");
-			return new GenericEntityQuery(this.serviceName,this.searchCondition,this.metricName);
-		}
-	}
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class GenericQueryBuilder {
+    private static final Logger LOG = LoggerFactory.getLogger(GenericQueryBuilder.class);
+
+    private List<String> outputFields;
+    private String serviceName;
+    private String metricName;
+    private SearchCondition searchCondition;
+    @Deprecated
+    private int parallel;
+    private boolean hasAgg;
+    private List<String> groupByFields;
+    private List<AggregateFunctionType> aggregateFuncTypes;
+    private List<String> aggregateFields;
+    @Deprecated
+    private boolean treeAgg = false;
+    private boolean timeSeries = false;
+    private long intervalmin;
+    private List<SortOption> sortOptions;
+    private int top;
+    private List<AggregateFunctionType> sortFunctionTypes;
+    private List<String> sortFields;
+
+    public static GenericQueryBuilder select(List<String> outputFields) {
+        GenericQueryBuilder builder = new GenericQueryBuilder();
+        builder.output(outputFields);
+        return builder;
+    }
+
+    public GenericQueryBuilder output(List<String> outputFields) {
+        this.outputFields = outputFields;
+        return this;
+    }
+
+    public GenericQueryBuilder from(String serviceName, String metricName) {
+        this.serviceName = serviceName;
+        this.metricName = metricName;
+        return this;
+    }
+
+    public GenericQueryBuilder where(SearchCondition condition) {
+        this.searchCondition = condition;
+        return this;
+    }
+
+    /**
+     * @deprecated Parameter "parallel" no longer supported, ignore.
+     */
+    @Deprecated
+    public GenericQueryBuilder parallel(int parallel) {
+        if (parallel > 0) {
+            LOG.warn("Parameter \"parallel\" is deprecated, ignore");
+        }
+        return this;
+    }
+
+    public GenericQueryBuilder groupBy(boolean hasAgg, List<String> groupByFields, List<AggregateFunctionType> aggregateFunctionTypes, List<String> aggregateFields) {
+        this.hasAgg = hasAgg;
+        this.groupByFields = groupByFields;
+        this.aggregateFuncTypes = aggregateFunctionTypes;
+        this.aggregateFields = aggregateFields;
+        return this;
+    }
+
+    public GenericQueryBuilder timeSeries(boolean timeSeries, long intervalMin) {
+        this.timeSeries = timeSeries;
+        this.intervalmin = intervalMin;
+        return this;
+    }
+
+    public GenericQueryBuilder orderBy(List<SortOption> sortOptions, List<AggregateFunctionType> sortFunctionTypes, List<String> sortFields) {
+        this.sortOptions = sortOptions;
+        this.sortFunctionTypes = sortFunctionTypes;
+        this.sortFields = sortFields;
+        return this;
+    }
+
+    public GenericQueryBuilder top(int top) {
+        this.top = top;
+        return this;
+    }
+
+    /**
+     * @deprecated Parameter "treeAgg" no longer supported, ignore.
+     */
+    @Deprecated
+    public GenericQueryBuilder treeAgg(boolean treeAgg) {
+        if (treeAgg) {
+            LOG.warn("Parameter \"treeAgg\" is deprecated, ignore");
+        }
+        return this;
+    }
+
+    public GenericQuery build() throws Exception {
+        if (hasAgg) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Build GroupAggregateQuery");
+            }
+            AggregateCondition aggregateCondition = new AggregateCondition();
+            aggregateCondition.setGroupbyFields(this.groupByFields);
+            aggregateCondition.setAggregateFunctionTypes(this.aggregateFuncTypes);
+            aggregateCondition.setAggregateFields(this.aggregateFields);
+            aggregateCondition.setTimeSeries(this.timeSeries);
+            aggregateCondition.setIntervalMS(this.intervalmin * 60 * 1000);
+            if (EagleConfigFactory.load().isCoprocessorEnabled()) {
+                return new GenericCoprocessorAggregateQuery(this.serviceName,
+                        this.searchCondition,
+                        aggregateCondition,
+                        this.metricName,
+                        this.sortOptions,
+                        this.sortFunctionTypes,
+                        this.sortFields,
+                        this.top);
+            } else {
+                return new GenericInMemoryAggregateQuery(this.serviceName,
+                        this.searchCondition,
+                        aggregateCondition,
+                        this.metricName,
+                        this.sortOptions,
+                        this.sortFunctionTypes,
+                        this.sortFields,
+                        this.top);
+            }
+        } else {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Build GenericBatchQuery");
+            }
+            return new GenericEntityQuery(this.serviceName, this.searchCondition, this.metricName);
+        }
+    }
 }