helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [45/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:58 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/ZNRecord.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecord.java b/helix-core/src/main/java/org/apache/helix/ZNRecord.java
index 4884b92..56a6cf2 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecord.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecord.java
@@ -35,15 +35,13 @@ import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
 
-
 /**
  * Generic Record Format to store data at a Node This can be used to store
  * simpleFields mapFields listFields
  */
 @JsonIgnoreProperties(ignoreUnknown = true)
 @JsonSerialize(include = Inclusion.NON_NULL)
-public class ZNRecord
-{
+public class ZNRecord {
   static Logger _logger = Logger.getLogger(ZNRecord.class);
   private final String id;
 
@@ -51,7 +49,7 @@ public class ZNRecord
   public static final String LIST_FIELD_BOUND = "listField.bound";
 
   @JsonIgnore(true)
-  public static final int SIZE_LIMIT = 1000 * 1024;  // leave a margin out of 1M
+  public static final int SIZE_LIMIT = 1000 * 1024; // leave a margin out of 1M
 
   // We don't want the _deltaList to be serialized and deserialized
   private List<ZNRecordDelta> _deltaList = new ArrayList<ZNRecordDelta>();
@@ -75,8 +73,7 @@ public class ZNRecord
    * @param id
    */
   @JsonCreator
-  public ZNRecord(@JsonProperty("id") String id)
-  {
+  public ZNRecord(@JsonProperty("id") String id) {
     this.id = id;
     simpleFields = new TreeMap<String, String>();
     mapFields = new TreeMap<String, Map<String, String>>();
@@ -89,8 +86,7 @@ public class ZNRecord
    * Initialize with a pre-populated ZNRecord
    * @param record
    */
-  public ZNRecord(ZNRecord record)
-  {
+  public ZNRecord(ZNRecord record) {
     this(record, record.getId());
   }
 
@@ -99,19 +95,15 @@ public class ZNRecord
    * @param record
    * @param id
    */
-  public ZNRecord(ZNRecord record, String id)
-  {
+  public ZNRecord(ZNRecord record, String id) {
     this(id);
     simpleFields.putAll(record.getSimpleFields());
     mapFields.putAll(record.getMapFields());
     listFields.putAll(record.getListFields());
-    if (record.rawPayload != null)
-    {
+    if (record.rawPayload != null) {
       rawPayload = new byte[record.rawPayload.length];
       System.arraycopy(record.rawPayload, 0, rawPayload, 0, record.rawPayload.length);
-    }
-    else
-    {
+    } else {
       rawPayload = null;
     }
     _version = record.getVersion();
@@ -124,8 +116,7 @@ public class ZNRecord
    * @param serializer
    */
   @JsonIgnore(true)
-  public void setPayloadSerializer(PayloadSerializer serializer)
-  {
+  public void setPayloadSerializer(PayloadSerializer serializer) {
     _serializer = serializer;
   }
 
@@ -134,8 +125,7 @@ public class ZNRecord
    * @param deltaList
    */
   @JsonIgnore(true)
-  public void setDeltaList(List<ZNRecordDelta> deltaList)
-  {
+  public void setDeltaList(List<ZNRecordDelta> deltaList) {
     _deltaList = deltaList;
   }
 
@@ -144,8 +134,7 @@ public class ZNRecord
    * @return list of {@link ZNRecordDelta}
    */
   @JsonIgnore(true)
-  public List<ZNRecordDelta> getDeltaList()
-  {
+  public List<ZNRecordDelta> getDeltaList() {
     return _deltaList;
   }
 
@@ -154,8 +143,7 @@ public class ZNRecord
    * @return Map of simple fields
    */
   @JsonProperty
-  public Map<String, String> getSimpleFields()
-  {
+  public Map<String, String> getSimpleFields() {
     return simpleFields;
   }
 
@@ -164,8 +152,7 @@ public class ZNRecord
    * @param simpleFields
    */
   @JsonProperty
-  public void setSimpleFields(Map<String, String> simpleFields)
-  {
+  public void setSimpleFields(Map<String, String> simpleFields) {
     this.simpleFields = simpleFields;
   }
 
@@ -174,8 +161,7 @@ public class ZNRecord
    * @return all map fields
    */
   @JsonProperty
-  public Map<String, Map<String, String>> getMapFields()
-  {
+  public Map<String, Map<String, String>> getMapFields() {
     return mapFields;
   }
 
@@ -184,8 +170,7 @@ public class ZNRecord
    * @param mapFields
    */
   @JsonProperty
-  public void setMapFields(Map<String, Map<String, String>> mapFields)
-  {
+  public void setMapFields(Map<String, Map<String, String>> mapFields) {
     this.mapFields = mapFields;
   }
 
@@ -194,8 +179,7 @@ public class ZNRecord
    * @return all list fields
    */
   @JsonProperty
-  public Map<String, List<String>> getListFields()
-  {
+  public Map<String, List<String>> getListFields() {
     return listFields;
   }
 
@@ -204,8 +188,7 @@ public class ZNRecord
    * @param listFields
    */
   @JsonProperty
-  public void setListFields(Map<String, List<String>> listFields)
-  {
+  public void setListFields(Map<String, List<String>> listFields) {
     this.listFields = listFields;
   }
 
@@ -215,14 +198,12 @@ public class ZNRecord
    * @param v
    */
   @JsonProperty
-  public void setSimpleField(String k, String v)
-  {
+  public void setSimpleField(String k, String v) {
     simpleFields.put(k, v);
   }
 
   @JsonProperty
-  public String getId()
-  {
+  public String getId() {
     return id;
   }
 
@@ -232,8 +213,7 @@ public class ZNRecord
    * @param payload
    */
   @JsonProperty
-  public void setRawPayload(byte[] payload)
-  {
+  public void setRawPayload(byte[] payload) {
     rawPayload = payload;
   }
 
@@ -243,8 +223,7 @@ public class ZNRecord
    * @return
    */
   @JsonProperty
-  public byte[] getRawPayload()
-  {
+  public byte[] getRawPayload() {
     return rawPayload;
   }
 
@@ -253,14 +232,10 @@ public class ZNRecord
    * @param payload
    */
   @JsonIgnore(true)
-  public <T> void setPayload(T payload)
-  {
-    if (_serializer != null && payload != null)
-    {
+  public <T> void setPayload(T payload) {
+    if (_serializer != null && payload != null) {
       rawPayload = _serializer.serialize(payload);
-    }
-    else
-    {
+    } else {
       rawPayload = null;
     }
   }
@@ -271,14 +246,10 @@ public class ZNRecord
    * @return
    */
   @JsonIgnore(true)
-  public <T> T getPayload(Class<T> clazz)
-  {
-    if (_serializer != null && rawPayload != null)
-    {
+  public <T> T getPayload(Class<T> clazz) {
+    if (_serializer != null && rawPayload != null) {
       return _serializer.deserialize(clazz, rawPayload);
-    }
-    else
-    {
+    } else {
       return null;
     }
   }
@@ -288,8 +259,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public void setMapField(String k, Map<String, String> v)
-  {
+  public void setMapField(String k, Map<String, String> v) {
     mapFields.put(k, v);
   }
 
@@ -298,8 +268,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public void setListField(String k, List<String> v)
-  {
+  public void setListField(String k, List<String> v) {
     listFields.put(k, v);
   }
 
@@ -308,8 +277,7 @@ public class ZNRecord
    * @param k
    * @return String field
    */
-  public String getSimpleField(String k)
-  {
+  public String getSimpleField(String k) {
     return simpleFields.get(k);
   }
 
@@ -318,8 +286,7 @@ public class ZNRecord
    * @param k
    * @return String --> String map
    */
-  public Map<String, String> getMapField(String k)
-  {
+  public Map<String, String> getMapField(String k) {
     return mapFields.get(k);
   }
 
@@ -328,8 +295,7 @@ public class ZNRecord
    * @param k
    * @return String list
    */
-  public List<String> getListField(String k)
-  {
+  public List<String> getListField(String k) {
     return listFields.get(k);
   }
 
@@ -338,8 +304,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public void setIntField(String k, int v)
-  {
+  public void setIntField(String k, int v) {
     setSimpleField(k, Integer.toString(v));
   }
 
@@ -349,18 +314,13 @@ public class ZNRecord
    * @param defaultValue
    * @return the int value, or defaultValue if not present
    */
-  public int getIntField(String k, int defaultValue)
-  {
+  public int getIntField(String k, int defaultValue) {
     int v = defaultValue;
     String valueStr = getSimpleField(k);
-    if (valueStr != null)
-    {
-      try
-      {
+    if (valueStr != null) {
+      try {
         v = Integer.parseInt(valueStr);
-      }
-      catch (NumberFormatException e)
-      {
+      } catch (NumberFormatException e) {
         _logger.warn("", e);
       }
     }
@@ -372,8 +332,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public void setLongField(String k, long v)
-  {
+  public void setLongField(String k, long v) {
     setSimpleField(k, Long.toString(v));
   }
 
@@ -383,18 +342,13 @@ public class ZNRecord
    * @param defaultValue
    * @return the long value, or defaultValue if not present
    */
-  public long getLongField(String k, long defaultValue)
-  {
+  public long getLongField(String k, long defaultValue) {
     long v = defaultValue;
     String valueStr = getSimpleField(k);
-    if (valueStr != null)
-    {
-      try
-      {
+    if (valueStr != null) {
+      try {
         v = Long.parseLong(valueStr);
-      }
-      catch (NumberFormatException e)
-      {
+      } catch (NumberFormatException e) {
         _logger.warn("", e);
       }
     }
@@ -406,8 +360,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public void setDoubleField(String k, double v)
-  {
+  public void setDoubleField(String k, double v) {
     setSimpleField(k, Double.toString(v));
   }
 
@@ -417,18 +370,13 @@ public class ZNRecord
    * @param defaultValue
    * @return the double value, or defaultValue if not present
    */
-  public double getDoubleField(String k, double defaultValue)
-  {
+  public double getDoubleField(String k, double defaultValue) {
     double v = defaultValue;
     String valueStr = getSimpleField(k);
-    if (valueStr != null)
-    {
-      try
-      {
+    if (valueStr != null) {
+      try {
         v = Double.parseDouble(valueStr);
-      }
-      catch (NumberFormatException e)
-      {
+      } catch (NumberFormatException e) {
         _logger.warn("", e);
       }
     }
@@ -440,8 +388,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public void setBooleanField(String k, boolean v)
-  {
+  public void setBooleanField(String k, boolean v) {
     setSimpleField(k, Boolean.toString(v));
   }
 
@@ -451,21 +398,16 @@ public class ZNRecord
    * @param defaultValue
    * @return the boolean field, or defaultValue if not present
    */
-  public boolean getBooleanField(String k, boolean defaultValue)
-  {
+  public boolean getBooleanField(String k, boolean defaultValue) {
     boolean v = defaultValue;
     String valueStr = getSimpleField(k);
-    if (valueStr != null)
-    {
+    if (valueStr != null) {
       // Boolean.parseBoolean() doesn't throw an exception if the string isn't a valid boolean.
       // Thus, a direct comparison is necessary to make sure the value is actually "true" or
       // "false"
-      if (valueStr.equalsIgnoreCase(Boolean.TRUE.toString()))
-      {
+      if (valueStr.equalsIgnoreCase(Boolean.TRUE.toString())) {
         v = true;
-      }
-      else if (valueStr.equalsIgnoreCase(Boolean.FALSE.toString()))
-      {
+      } else if (valueStr.equalsIgnoreCase(Boolean.FALSE.toString())) {
         v = false;
       }
     }
@@ -477,8 +419,7 @@ public class ZNRecord
    * @param k
    * @param v
    */
-  public <T extends Enum<T>> void setEnumField(String k, T v)
-  {
+  public <T extends Enum<T>> void setEnumField(String k, T v) {
     setSimpleField(k, v.toString());
   }
 
@@ -489,22 +430,15 @@ public class ZNRecord
    * @param defaultValue
    * @return the Enum field of enumType, or defaultValue if not present
    */
-  public <T extends Enum<T>> T getEnumField(String k, Class<T> enumType, T defaultValue)
-  {
+  public <T extends Enum<T>> T getEnumField(String k, Class<T> enumType, T defaultValue) {
     T v = defaultValue;
     String valueStr = getSimpleField(k);
-    if (valueStr != null)
-    {
-      try
-      {
+    if (valueStr != null) {
+      try {
         v = Enum.valueOf(enumType, valueStr);
-      }
-      catch (NullPointerException e)
-      {
+      } catch (NullPointerException e) {
         _logger.warn("", e);
-      }
-      catch (IllegalArgumentException e)
-      {
+      } catch (IllegalArgumentException e) {
         _logger.warn("", e);
       }
     }
@@ -517,32 +451,26 @@ public class ZNRecord
    * @param defaultValue
    * @return the String value, or defaultValue if not present
    */
-  public String getStringField(String k, String defaultValue)
-  {
+  public String getStringField(String k, String defaultValue) {
     String v = defaultValue;
     String valueStr = getSimpleField(k);
-    if (valueStr != null)
-    {
+    if (valueStr != null) {
       v = valueStr;
     }
     return v;
   }
 
   @Override
-  public String toString()
-  {
+  public String toString() {
     StringBuffer sb = new StringBuffer();
     sb.append(id + ", ");
-    if (simpleFields != null)
-    {
+    if (simpleFields != null) {
       sb.append(simpleFields);
     }
-    if (mapFields != null)
-    {
+    if (mapFields != null) {
       sb.append(mapFields);
     }
-    if (listFields != null)
-    {
+    if (listFields != null) {
       sb.append(listFields);
     }
     return sb.toString();
@@ -552,43 +480,32 @@ public class ZNRecord
    * merge functionality is used to merge multiple znrecord into a single one.
    * This will make use of the id of each ZNRecord and append it to every key
    * thus making key unique. This is needed to optimize on the watches.
-   *
    * @param record
    */
-  public void merge(ZNRecord record)
-  {
-    if (record == null)
-    {
+  public void merge(ZNRecord record) {
+    if (record == null) {
       return;
     }
 
-    if (record.getDeltaList().size() > 0)
-    {
-      _logger.info("Merging with delta list, recordId = " + id + " other:"
-          + record.getId());
+    if (record.getDeltaList().size() > 0) {
+      _logger.info("Merging with delta list, recordId = " + id + " other:" + record.getId());
       merge(record.getDeltaList());
       return;
     }
     simpleFields.putAll(record.simpleFields);
-    for (String key : record.mapFields.keySet())
-    {
+    for (String key : record.mapFields.keySet()) {
       Map<String, String> map = mapFields.get(key);
-      if (map != null)
-      {
+      if (map != null) {
         map.putAll(record.mapFields.get(key));
-      } else
-      {
+      } else {
         mapFields.put(key, record.mapFields.get(key));
       }
     }
-    for (String key : record.listFields.keySet())
-    {
+    for (String key : record.listFields.keySet()) {
       List<String> list = listFields.get(key);
-      if (list != null)
-      {
+      if (list != null) {
         list.addAll(record.listFields.get(key));
-      } else
-      {
+      } else {
         listFields.put(key, record.listFields.get(key));
       }
     }
@@ -598,13 +515,10 @@ public class ZNRecord
    * Merge in a {@link ZNRecordDelta} corresponding to its merge policy
    * @param delta
    */
-  void merge(ZNRecordDelta delta)
-  {
-    if (delta.getMergeOperation() == MergeOperation.ADD)
-    {
+  void merge(ZNRecordDelta delta) {
+    if (delta.getMergeOperation() == MergeOperation.ADD) {
       merge(delta.getRecord());
-    } else if (delta.getMergeOperation() == MergeOperation.SUBTRACT)
-    {
+    } else if (delta.getMergeOperation() == MergeOperation.SUBTRACT) {
       subtract(delta.getRecord());
     }
   }
@@ -614,44 +528,34 @@ public class ZNRecord
    * @see #merge(ZNRecordDelta)
    * @param deltaList
    */
-  void merge(List<ZNRecordDelta> deltaList)
-  {
-    for (ZNRecordDelta delta : deltaList)
-    {
+  void merge(List<ZNRecordDelta> deltaList) {
+    for (ZNRecordDelta delta : deltaList) {
       merge(delta);
     }
   }
 
   @Override
-  public boolean equals(Object obj)
-  {
-    if (!(obj instanceof ZNRecord))
-    {
+  public boolean equals(Object obj) {
+    if (!(obj instanceof ZNRecord)) {
       return false;
     }
     ZNRecord that = (ZNRecord) obj;
-    if (this.getSimpleFields().size() != that.getSimpleFields().size())
-    {
+    if (this.getSimpleFields().size() != that.getSimpleFields().size()) {
       return false;
     }
-    if (this.getMapFields().size() != that.getMapFields().size())
-    {
+    if (this.getMapFields().size() != that.getMapFields().size()) {
       return false;
     }
-    if (this.getListFields().size() != that.getListFields().size())
-    {
+    if (this.getListFields().size() != that.getListFields().size()) {
       return false;
     }
-    if (!this.getSimpleFields().equals(that.getSimpleFields()))
-    {
+    if (!this.getSimpleFields().equals(that.getSimpleFields())) {
       return false;
     }
-    if (!this.getMapFields().equals(that.getMapFields()))
-    {
+    if (!this.getMapFields().equals(that.getMapFields())) {
       return false;
     }
-    if (!this.getListFields().equals(that.getListFields()))
-    {
+    if (!this.getListFields().equals(that.getListFields())) {
       return false;
     }
 
@@ -664,28 +568,21 @@ public class ZNRecord
    * mapFields
    * @param value
    */
-  public void subtract(ZNRecord value)
-  {
-    for (String key : value.getSimpleFields().keySet())
-    {
-      if (simpleFields.containsKey(key))
-      {
+  public void subtract(ZNRecord value) {
+    for (String key : value.getSimpleFields().keySet()) {
+      if (simpleFields.containsKey(key)) {
         simpleFields.remove(key);
       }
     }
 
-    for (String key : value.getListFields().keySet())
-    {
-      if (listFields.containsKey(key))
-      {
+    for (String key : value.getListFields().keySet()) {
+      if (listFields.containsKey(key)) {
         listFields.remove(key);
       }
     }
 
-    for (String key : value.getMapFields().keySet())
-    {
-      if (mapFields.containsKey(key))
-      {
+    for (String key : value.getMapFields().keySet()) {
+      if (mapFields.containsKey(key)) {
         mapFields.remove(key);
       }
     }
@@ -696,8 +593,7 @@ public class ZNRecord
    * @return version number
    */
   @JsonIgnore(true)
-  public int getVersion()
-  {
+  public int getVersion() {
     return _version;
   }
 
@@ -706,8 +602,7 @@ public class ZNRecord
    * @param version
    */
   @JsonIgnore(true)
-  public void setVersion(int version)
-  {
+  public void setVersion(int version) {
     _version = version;
   }
 
@@ -716,8 +611,7 @@ public class ZNRecord
    * @return UNIX timestamp
    */
   @JsonIgnore(true)
-  public long getCreationTime()
-  {
+  public long getCreationTime() {
     return _creationTime;
   }
 
@@ -726,8 +620,7 @@ public class ZNRecord
    * @param creationTime
    */
   @JsonIgnore(true)
-  public void setCreationTime(long creationTime)
-  {
+  public void setCreationTime(long creationTime) {
     _creationTime = creationTime;
   }
 
@@ -736,8 +629,7 @@ public class ZNRecord
    * @return UNIX timestamp
    */
   @JsonIgnore(true)
-  public long getModifiedTime()
-  {
+  public long getModifiedTime() {
     return _modifiedTime;
   }
 
@@ -746,8 +638,7 @@ public class ZNRecord
    * @param modifiedTime
    */
   @JsonIgnore(true)
-  public void setModifiedTime(long modifiedTime)
-  {
+  public void setModifiedTime(long modifiedTime) {
     _modifiedTime = modifiedTime;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/ZNRecordAssembler.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecordAssembler.java b/helix-core/src/main/java/org/apache/helix/ZNRecordAssembler.java
index d2f3bdf..87231cd 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecordAssembler.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecordAssembler.java
@@ -24,27 +24,21 @@ import java.util.List;
 /**
  * Constructs ZNRecords from collections of ZNRecords
  */
-public class ZNRecordAssembler
-{
+public class ZNRecordAssembler {
   /**
    * Merge a list of ZNRecords into a single ZNRecord
    * @param records
    * @return {@link ZNRecord}
    */
-  public ZNRecord assemble(List<ZNRecord> records)
-  {
+  public ZNRecord assemble(List<ZNRecord> records) {
     ZNRecord assembledRecord = null;
-    if (records != null && records.size() > 0)
-    {
-      for (ZNRecord record : records)
-      {
-        if (record == null)
-        {
+    if (records != null && records.size() > 0) {
+      for (ZNRecord record : records) {
+        if (record == null) {
           continue;
         }
 
-        if (assembledRecord == null)
-        {
+        if (assembledRecord == null) {
           assembledRecord = new ZNRecord(record.getId());
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java b/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
index 7780a81..f699908 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
@@ -27,19 +27,16 @@ import org.apache.log4j.Logger;
 /**
  * Operations to divide a ZNRecord into specified buckets
  */
-public class ZNRecordBucketizer
-{
+public class ZNRecordBucketizer {
   private static Logger LOG = Logger.getLogger(ZNRecordBucketizer.class);
-  final int             _bucketSize;
+  final int _bucketSize;
 
   /**
    * Instantiate a bucketizer with the number of buckets
    * @param bucketSize
    */
-  public ZNRecordBucketizer(int bucketSize)
-  {
-    if (bucketSize <= 0)
-    {
+  public ZNRecordBucketizer(int bucketSize) {
+    if (bucketSize <= 0) {
       LOG.debug("bucketSize <= 0 (was " + bucketSize
           + "). Set to 0 to use non-bucketized HelixProperty.");
       bucketSize = 0;
@@ -50,37 +47,30 @@ public class ZNRecordBucketizer
 
   /**
    * Calculate bucketName in form of "resourceName_p{startPartition}-p{endPartition}
-   * 
    * @param partitionName
    * @return the bucket name
    */
-  public String getBucketName(String key)
-  {
-    if (_bucketSize == 0)
-    {
+  public String getBucketName(String key) {
+    if (_bucketSize == 0) {
       // no bucketize
       return null;
     }
 
     int idx = key.lastIndexOf('_');
-    if (idx < 0)
-    {
+    if (idx < 0) {
       throw new IllegalArgumentException("Could NOT find partition# in " + key
           + ". partitionName should be in format of resourceName_partition#");
     }
 
-    try
-    {
+    try {
       int partitionNb = Integer.parseInt(key.substring(idx + 1));
       int bucketNb = partitionNb / _bucketSize;
       int startPartition = bucketNb * _bucketSize;
       int endPartition = bucketNb * _bucketSize + (_bucketSize - 1);
       return key.substring(0, idx) + "_p" + startPartition + "-p" + endPartition;
-    }
-    catch (NumberFormatException e)
-    {
-      throw new IllegalArgumentException("Could NOT parse partition# ("
-          + key.substring(idx + 1) + ") in " + key);
+    } catch (NumberFormatException e) {
+      throw new IllegalArgumentException("Could NOT parse partition# (" + key.substring(idx + 1)
+          + ") in " + key);
     }
   }
 
@@ -89,56 +79,43 @@ public class ZNRecordBucketizer
    * @param record
    * @return A map of bucket names to bucketized records
    */
-  public Map<String, ZNRecord> bucketize(ZNRecord record)
-  {
+  public Map<String, ZNRecord> bucketize(ZNRecord record) {
     Map<String, ZNRecord> map = new HashMap<String, ZNRecord>();
-    if (_bucketSize == 0)
-    {
+    if (_bucketSize == 0) {
       map.put(record.getId(), record);
       return map;
     }
-    
+
     // bucketize list field
-    for (String partitionName : record.getListFields().keySet())
-    {
+    for (String partitionName : record.getListFields().keySet()) {
       String bucketName = getBucketName(partitionName);
-      if (bucketName != null)
-      {
-        if (!map.containsKey(bucketName))
-        {
+      if (bucketName != null) {
+        if (!map.containsKey(bucketName)) {
           map.put(bucketName, new ZNRecord(bucketName));
         }
         ZNRecord bucketizedRecord = map.get(bucketName);
         bucketizedRecord.setListField(partitionName, record.getListField(partitionName));
-      }
-      else
-      {
+      } else {
         LOG.error("Can't bucketize " + partitionName + " in list field");
       }
     }
 
     // bucketize map field
-    for (String partitionName : record.getMapFields().keySet())
-    {
+    for (String partitionName : record.getMapFields().keySet()) {
       String bucketName = getBucketName(partitionName);
-      if (bucketName != null)
-      {
-        if (!map.containsKey(bucketName))
-        {
+      if (bucketName != null) {
+        if (!map.containsKey(bucketName)) {
           map.put(bucketName, new ZNRecord(bucketName));
         }
         ZNRecord bucketizedRecord = map.get(bucketName);
         bucketizedRecord.setMapField(partitionName, record.getMapField(partitionName));
-      }
-      else
-      {
+      } else {
         LOG.error("Can't bucketize " + partitionName + " in map field");
       }
     }
-    
+
     // copy all simple fields
-    for (ZNRecord bucketizedRecord : map.values())
-    {
+    for (ZNRecord bucketizedRecord : map.values()) {
       bucketizedRecord.setSimpleFields(record.getSimpleFields());
     }
     return map;

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/ZNRecordDelta.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecordDelta.java b/helix-core/src/main/java/org/apache/helix/ZNRecordDelta.java
index d1e9cdf..eff725d 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecordDelta.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecordDelta.java
@@ -22,12 +22,14 @@ package org.apache.helix;
 /**
  * A ZNRecord container that specifies how it should be merged with another ZNRecord
  */
-public class ZNRecordDelta
-{
+public class ZNRecordDelta {
   /**
    * Supported methods of updating a ZNRecord
    */
-  public enum MergeOperation {ADD, SUBTRACT};
+  public enum MergeOperation {
+    ADD,
+    SUBTRACT
+  };
 
   /**
    * Backing ZNRecord containing updates
@@ -44,8 +46,7 @@ public class ZNRecordDelta
    * @param record
    * @param _mergeOperation
    */
-  public ZNRecordDelta(ZNRecord record, MergeOperation mergeOperation)
-  {
+  public ZNRecordDelta(ZNRecord record, MergeOperation mergeOperation) {
     _record = new ZNRecord(record);
     _mergeOperation = mergeOperation;
   }
@@ -54,16 +55,14 @@ public class ZNRecordDelta
    * Initialize the delta with a record and a default update mode of add
    * @param record
    */
-  public ZNRecordDelta(ZNRecord record)
-  {
+  public ZNRecordDelta(ZNRecord record) {
     this(record, MergeOperation.ADD);
   }
 
   /**
    * Initialize with an empty ZNRecord and a default update mode of add
    */
-  public ZNRecordDelta()
-  {
+  public ZNRecordDelta() {
     this(new ZNRecord(""), MergeOperation.ADD);
   }
 
@@ -71,8 +70,7 @@ public class ZNRecordDelta
    * Get the backing ZNRecord
    * @return the ZNRecord containing the changes
    */
-  public ZNRecord getRecord()
-  {
+  public ZNRecord getRecord() {
     return _record;
   }
 
@@ -80,8 +78,7 @@ public class ZNRecordDelta
    * Get the selected update mode
    * @return MergeOperation currently in effect
    */
-  public MergeOperation getMergeOperation()
-  {
+  public MergeOperation getMergeOperation() {
     return _mergeOperation;
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/ZNRecordUpdater.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecordUpdater.java b/helix-core/src/main/java/org/apache/helix/ZNRecordUpdater.java
index 20a8c82..6b74dd1 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecordUpdater.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecordUpdater.java
@@ -24,24 +24,20 @@ import org.I0Itec.zkclient.DataUpdater;
 /**
  * Class that specifies how a ZNRecord should be updated with another ZNRecord
  */
-public class ZNRecordUpdater implements DataUpdater<ZNRecord>
-{
+public class ZNRecordUpdater implements DataUpdater<ZNRecord> {
   final ZNRecord _record;
 
   /**
    * Initialize with the record that will be updated
    * @param record
    */
-  public ZNRecordUpdater(ZNRecord record)
-  {
+  public ZNRecordUpdater(ZNRecord record) {
     _record = record;
   }
 
   @Override
-  public ZNRecord update(ZNRecord current)
-  {
-    if (current != null)
-    {
+  public ZNRecord update(ZNRecord current) {
+    if (current != null) {
       current.merge(_record);
       return current;
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/AccumulateAggregator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/AccumulateAggregator.java b/helix-core/src/main/java/org/apache/helix/alerts/AccumulateAggregator.java
index d9330f2..2967f05 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/AccumulateAggregator.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/AccumulateAggregator.java
@@ -21,53 +21,47 @@ package org.apache.helix.alerts;
 
 import org.apache.helix.HelixException;
 
-
 public class AccumulateAggregator extends Aggregator {
 
-	
-	public AccumulateAggregator() 
-	{
-		_numArgs = 0;
-	}
-	
-	@Override
-	public void merge(Tuple<String> currValTup, Tuple<String> newValTup,
-			Tuple<String> currTimeTup, Tuple<String> newTimeTup, String... args) {
-	
-		double currVal = 0;
-		double currTime = -1;
-		double newVal;
-		double newTime;
-		double mergedVal;
-		double mergedTime;
-		
-		if (currValTup == null || newValTup == null || currTimeTup == null ||
-				newTimeTup == null) {
-			throw new HelixException("Tuples cannot be null");
-		}
-		
-		//old tuples may be empty, indicating no value/time exist
-		if (currValTup.size() > 0 && currTimeTup.size() > 0) {
-			currVal = Double.parseDouble(currValTup.iterator().next());
-			currTime = Double.parseDouble(currTimeTup.iterator().next());
-		}
-		newVal = Double.parseDouble(newValTup.iterator().next());
-		newTime = Double.parseDouble(newTimeTup.iterator().next());
-		
-		if (newTime > currTime) { //if old doesn't exist, we end up here
-			mergedVal = currVal+newVal; //if old doesn't exist, it has value "0"
-			mergedTime = newTime;
-		}
-		else {
-			mergedVal = currVal;
-			mergedTime = currTime;
-		}
-	
-		currValTup.clear();
-		currValTup.add(Double.toString(mergedVal));
-		currTimeTup.clear();
-		currTimeTup.add(Double.toString(mergedTime));
-	}
+  public AccumulateAggregator() {
+    _numArgs = 0;
+  }
+
+  @Override
+  public void merge(Tuple<String> currValTup, Tuple<String> newValTup, Tuple<String> currTimeTup,
+      Tuple<String> newTimeTup, String... args) {
+
+    double currVal = 0;
+    double currTime = -1;
+    double newVal;
+    double newTime;
+    double mergedVal;
+    double mergedTime;
+
+    if (currValTup == null || newValTup == null || currTimeTup == null || newTimeTup == null) {
+      throw new HelixException("Tuples cannot be null");
+    }
+
+    // old tuples may be empty, indicating no value/time exist
+    if (currValTup.size() > 0 && currTimeTup.size() > 0) {
+      currVal = Double.parseDouble(currValTup.iterator().next());
+      currTime = Double.parseDouble(currTimeTup.iterator().next());
+    }
+    newVal = Double.parseDouble(newValTup.iterator().next());
+    newTime = Double.parseDouble(newTimeTup.iterator().next());
+
+    if (newTime > currTime) { // if old doesn't exist, we end up here
+      mergedVal = currVal + newVal; // if old doesn't exist, it has value "0"
+      mergedTime = newTime;
+    } else {
+      mergedVal = currVal;
+      mergedTime = currTime;
+    }
+
+    currValTup.clear();
+    currValTup.add(Double.toString(mergedVal));
+    currTimeTup.clear();
+    currTimeTup.add(Double.toString(mergedTime));
+  }
 
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/Aggregator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/Aggregator.java b/helix-core/src/main/java/org/apache/helix/alerts/Aggregator.java
index a433bbb..65a4285 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/Aggregator.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/Aggregator.java
@@ -21,22 +21,20 @@ package org.apache.helix.alerts;
 
 public abstract class Aggregator {
 
-	int _numArgs;
-	
-	public Aggregator()
-	{
-		
-	}
-	
-	/*
-	 * Take curr and new values.  Update curr.
-	 */
-	public abstract void merge(Tuple<String> currVal, Tuple<String> newVal, 
-			Tuple<String> currTime, Tuple<String> newTime, String... args);
-	
-	public int getRequiredNumArgs()
-	{
-		return _numArgs;
-	}
-	
+  int _numArgs;
+
+  public Aggregator() {
+
+  }
+
+  /*
+   * Take curr and new values. Update curr.
+   */
+  public abstract void merge(Tuple<String> currVal, Tuple<String> newVal, Tuple<String> currTime,
+      Tuple<String> newTime, String... args);
+
+  public int getRequiredNumArgs() {
+    return _numArgs;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/Alert.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/Alert.java b/helix-core/src/main/java/org/apache/helix/alerts/Alert.java
index 6c94a2d..17af060 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/Alert.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/Alert.java
@@ -20,38 +20,33 @@ package org.apache.helix.alerts;
  */
 
 public class Alert {
-	
-	String _name;
-	
-	String _expression;
-	String _comparator;
-	Tuple<String> _constant;
-	
-	public Alert(String name, String expression, String comparator, Tuple<String> constant)
-	{
-		_name=name;
-		_expression=expression;
-		_comparator=comparator;
-		_constant=constant;
-	}
-	
-	public String getName()
-	{
-		return _name;
-	}
-	
-	public String getExpression()
-	{
-		return _expression;
-	}
-	
-	public String getComparator()
-	{
-		return _comparator;
-	}
-	
-	public Tuple<String> getConstant() 
-	{
-		return _constant;
-	}
+
+  String _name;
+
+  String _expression;
+  String _comparator;
+  Tuple<String> _constant;
+
+  public Alert(String name, String expression, String comparator, Tuple<String> constant) {
+    _name = name;
+    _expression = expression;
+    _comparator = comparator;
+    _constant = constant;
+  }
+
+  public String getName() {
+    return _name;
+  }
+
+  public String getExpression() {
+    return _expression;
+  }
+
+  public String getComparator() {
+    return _comparator;
+  }
+
+  public Tuple<String> getConstant() {
+    return _constant;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/AlertComparator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/AlertComparator.java b/helix-core/src/main/java/org/apache/helix/alerts/AlertComparator.java
index 1e40a56..c0330c5 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/AlertComparator.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/AlertComparator.java
@@ -21,11 +21,10 @@ package org.apache.helix.alerts;
 
 public abstract class AlertComparator {
 
-	public AlertComparator()
-	{
-		
-	}
-	
-	public abstract boolean evaluate(Tuple<String> leftTup, Tuple<String> rightTup);
-	
+  public AlertComparator() {
+
+  }
+
+  public abstract boolean evaluate(Tuple<String> leftTup, Tuple<String> rightTup);
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/AlertParser.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/AlertParser.java b/helix-core/src/main/java/org/apache/helix/alerts/AlertParser.java
index 33170ad..ceb4d2e 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/AlertParser.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/AlertParser.java
@@ -26,126 +26,113 @@ import org.apache.helix.HelixException;
 import org.apache.helix.manager.zk.DefaultParticipantErrorMessageHandlerFactory.ActionOnError;
 import org.apache.log4j.Logger;
 
-
 public class AlertParser {
-	private static Logger logger = Logger.getLogger(AlertParser.class);
-	
-	public static final String EXPRESSION_NAME = "EXP";
-	public static final String COMPARATOR_NAME = "CMP";
-	public static final String CONSTANT_NAME = "CON";
-	public static final String ACTION_NAME = "ACTION";
-	
-	static Map<String, AlertComparator> comparatorMap = new HashMap<String, AlertComparator>();
-	
-	static
-	  {
-		  
-		  addComparatorEntry("GREATER", new GreaterAlertComparator());
-	  }
-	
-	 private static void addComparatorEntry(String label, AlertComparator comp)
-	  {
-		  if (!comparatorMap.containsKey(label))
-		    {
-		      comparatorMap.put(label, comp);
-		    }
-		    logger.info("Adding comparator: "+comp);
-	  }
-	
-	public static AlertComparator getComparator(String compName)
-	{
-		compName = compName.replaceAll("\\s+", ""); //remove white space
-		if (!comparatorMap.containsKey(compName)) {
-			throw new HelixException("Comparator type <"+compName+"> unknown");
-		}
-		return comparatorMap.get(compName);
-	}
-	 
-	public static String getComponent(String component, String alert) throws HelixException
-	{
-		//find EXP and keep going until paren are closed
-		int expStartPos = alert.indexOf(component);
-		if (expStartPos < 0) {
-			throw new HelixException(alert+" does not contain component "+component);
-		}
-		expStartPos += (component.length()+1); //advance length of string and one for open paren
-		int expEndPos = expStartPos;
-		int openParenCount = 1;
-		while (openParenCount > 0) {
-			if (alert.charAt(expEndPos) == '(') {
-				openParenCount++;
-			}
-			else if (alert.charAt(expEndPos) == ')') {
-				openParenCount--;
-			}
-			expEndPos++;
-		}
-		if (openParenCount != 0) {
-			throw new HelixException(alert+" does not contain valid "+component+" component, " +
-					"parentheses do not close");
-		}
-		//return what is in between paren
-		return alert.substring(expStartPos, expEndPos-1);
-	}
-	
-	public static boolean validateAlert(String alert) throws HelixException
-	{
-		//TODO: decide if toUpperCase is going to cause problems with stuff like db name
-		alert = alert.replaceAll("\\s+", ""); //remove white space
-		String exp = getComponent(EXPRESSION_NAME, alert);
-		String cmp = getComponent(COMPARATOR_NAME, alert);
-		String val = getComponent(CONSTANT_NAME, alert);
-		logger.debug("exp: "+exp);
-		logger.debug("cmp: "+cmp);
-		logger.debug("val: "+val);
-		
-		//separately validate each portion
-		ExpressionParser.validateExpression(exp);
-		
-		//validate comparator
-		if (!comparatorMap.containsKey(cmp.toUpperCase())) {
-			throw new HelixException("Unknown comparator type "+cmp);
-		}
-		String actionValue = null;
-    try
-    {
-      actionValue = AlertParser.getComponent(AlertParser.ACTION_NAME, alert);
+  private static Logger logger = Logger.getLogger(AlertParser.class);
+
+  public static final String EXPRESSION_NAME = "EXP";
+  public static final String COMPARATOR_NAME = "CMP";
+  public static final String CONSTANT_NAME = "CON";
+  public static final String ACTION_NAME = "ACTION";
+
+  static Map<String, AlertComparator> comparatorMap = new HashMap<String, AlertComparator>();
+
+  static {
+
+    addComparatorEntry("GREATER", new GreaterAlertComparator());
+  }
+
+  private static void addComparatorEntry(String label, AlertComparator comp) {
+    if (!comparatorMap.containsKey(label)) {
+      comparatorMap.put(label, comp);
     }
-    catch(Exception e)
-    {
+    logger.info("Adding comparator: " + comp);
+  }
+
+  public static AlertComparator getComparator(String compName) {
+    compName = compName.replaceAll("\\s+", ""); // remove white space
+    if (!comparatorMap.containsKey(compName)) {
+      throw new HelixException("Comparator type <" + compName + "> unknown");
+    }
+    return comparatorMap.get(compName);
+  }
+
+  public static String getComponent(String component, String alert) throws HelixException {
+    // find EXP and keep going until paren are closed
+    int expStartPos = alert.indexOf(component);
+    if (expStartPos < 0) {
+      throw new HelixException(alert + " does not contain component " + component);
+    }
+    expStartPos += (component.length() + 1); // advance length of string and one for open paren
+    int expEndPos = expStartPos;
+    int openParenCount = 1;
+    while (openParenCount > 0) {
+      if (alert.charAt(expEndPos) == '(') {
+        openParenCount++;
+      } else if (alert.charAt(expEndPos) == ')') {
+        openParenCount--;
+      }
+      expEndPos++;
+    }
+    if (openParenCount != 0) {
+      throw new HelixException(alert + " does not contain valid " + component + " component, "
+          + "parentheses do not close");
+    }
+    // return what is in between paren
+    return alert.substring(expStartPos, expEndPos - 1);
+  }
+
+  public static boolean validateAlert(String alert) throws HelixException {
+    // TODO: decide if toUpperCase is going to cause problems with stuff like db name
+    alert = alert.replaceAll("\\s+", ""); // remove white space
+    String exp = getComponent(EXPRESSION_NAME, alert);
+    String cmp = getComponent(COMPARATOR_NAME, alert);
+    String val = getComponent(CONSTANT_NAME, alert);
+    logger.debug("exp: " + exp);
+    logger.debug("cmp: " + cmp);
+    logger.debug("val: " + val);
+
+    // separately validate each portion
+    ExpressionParser.validateExpression(exp);
+
+    // validate comparator
+    if (!comparatorMap.containsKey(cmp.toUpperCase())) {
+      throw new HelixException("Unknown comparator type " + cmp);
+    }
+    String actionValue = null;
+    try {
+      actionValue = AlertParser.getComponent(AlertParser.ACTION_NAME, alert);
+    } catch (Exception e) {
       logger.info("No action specified in " + alert);
     }
 
-    if(actionValue != null)
-    {
+    if (actionValue != null) {
       validateActionValue(actionValue);
     }
-		//ValParser.  Probably don't need this.  Just make sure it's a valid tuple.  But would also be good
-		//to validate that the tuple is same length as exp's output...maybe leave that as future todo
-		//not sure we can really do much here though...anything can be in a tuple.
-		
-		//TODO: try to compare tuple width of CON against tuple width of agg type!  Not a good idea, what if
-		//is not at full width yet, like with window  
-		
-		//if all of this passes, then we can safely record the alert in zk.  still need to implement zk location
-		
-		return false;
-	}
-	
-  public static void validateActionValue(String actionValue)
-  {
-    try
-    {
+    // ValParser. Probably don't need this. Just make sure it's a valid tuple. But would also be
+    // good
+    // to validate that the tuple is same length as exp's output...maybe leave that as future todo
+    // not sure we can really do much here though...anything can be in a tuple.
+
+    // TODO: try to compare tuple width of CON against tuple width of agg type! Not a good idea,
+    // what if
+    // is not at full width yet, like with window
+
+    // if all of this passes, then we can safely record the alert in zk. still need to implement zk
+    // location
+
+    return false;
+  }
+
+  public static void validateActionValue(String actionValue) {
+    try {
       ActionOnError actionVal = ActionOnError.valueOf(actionValue);
-    }
-    catch(Exception e)
-    {
+    } catch (Exception e) {
       String validActions = "";
-      for (ActionOnError action : ActionOnError.values())
-      {
+      for (ActionOnError action : ActionOnError.values()) {
         validActions = validActions + action + " ";
       }
-      throw new HelixException("Unknown cmd type " + actionValue + ", valid types : " + validActions);
+      throw new HelixException("Unknown cmd type " + actionValue + ", valid types : "
+          + validActions);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/AlertProcessor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/AlertProcessor.java b/helix-core/src/main/java/org/apache/helix/alerts/AlertProcessor.java
index 2fc973c..2bb1976 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/AlertProcessor.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/AlertProcessor.java
@@ -32,9 +32,7 @@ import org.apache.helix.HelixException;
 import org.apache.helix.healthcheck.StatHealthReportProvider;
 import org.apache.log4j.Logger;
 
-
-public class AlertProcessor
-{
+public class AlertProcessor {
   private static Logger logger = Logger.getLogger(AlertProcessor.class);
 
   private static final String bindingDelim = ",";
@@ -46,23 +44,19 @@ public class AlertProcessor
 
   /*
    * public AlertProcessor(StatHealthReportProvider statProvider) {
-   * 
    * }
    */
 
-  public AlertProcessor(StatsHolder sh)
-  {
+  public AlertProcessor(StatsHolder sh) {
     _statsHolder = sh;
   }
 
-  public static Map<String, List<Tuple<String>>> initAlertStatTuples(Alert alert)
-  {
+  public static Map<String, List<Tuple<String>>> initAlertStatTuples(Alert alert) {
     // get the stats out of the alert
     String[] alertStats = ExpressionParser.getBaseStats(alert.getExpression());
     // init a tuple list for each alert stat
     Map<String, List<Tuple<String>>> alertStatTuples = new HashMap<String, List<Tuple<String>>>();
-    for (String currAlertStat : alertStats)
-    {
+    for (String currAlertStat : alertStats) {
       List<Tuple<String>> currList = new ArrayList<Tuple<String>>();
       alertStatTuples.put(currAlertStat, currList);
     }
@@ -87,18 +81,14 @@ public class AlertProcessor
    * tupleLists.get(currAlertStat).add(persistentStat.getValue()); } } } }
    */
 
-  public static String formAlertKey(ArrayList<String> bindings)
-  {
-    if (bindings.size() == 0)
-    {
+  public static String formAlertKey(ArrayList<String> bindings) {
+    if (bindings.size() == 0) {
       return null;
     }
     StringBuilder alertKey = new StringBuilder();
     boolean emptyKey = true;
-    for (String binding : bindings)
-    {
-      if (!emptyKey)
-      {
+    for (String binding : bindings) {
+      if (!emptyKey) {
         alertKey.append(bindingDelim);
       }
       alertKey.append(binding);
@@ -109,46 +99,36 @@ public class AlertProcessor
 
   // XXX: major change here. return ArrayList of Stats instead of ArrayList of
   // Tuple<String>'s
-  public static Map<String, ArrayList<Tuple<String>>> populateAlertStatTuples(
-      String[] alertStats, List<Stat> persistentStats)
-  {
-    Map<String, ArrayList<Tuple<String>>> tupleSets = new HashMap<String, ArrayList<Tuple<String>>>();
+  public static Map<String, ArrayList<Tuple<String>>> populateAlertStatTuples(String[] alertStats,
+      List<Stat> persistentStats) {
+    Map<String, ArrayList<Tuple<String>>> tupleSets =
+        new HashMap<String, ArrayList<Tuple<String>>>();
 
     // check each persistentStat, alertStat pair
-    for (Stat persistentStat : persistentStats)
-    {
+    for (Stat persistentStat : persistentStats) {
       // ignore stats with wildcards, they don't have values...they are just
       // there to catch new actual stats
-      if (ExpressionParser.statContainsWildcards(persistentStat.getName()))
-      {
+      if (ExpressionParser.statContainsWildcards(persistentStat.getName())) {
         continue;
       }
-      for (int i = 0; i < alertStats.length; i++)
-      {
+      for (int i = 0; i < alertStats.length; i++) {
         String alertStat = alertStats[i];
         ArrayList<String> wildcardBindings = new ArrayList<String>();
         // if match, then proceed. If the match is wildcard, additionally fill
         // in the wildcard bindings
-        if (ExpressionParser.isAlertStatExactMatch(alertStat,
-            persistentStat.getName())
-            || ExpressionParser.isAlertStatWildcardMatch(alertStat,
-                persistentStat.getName(), wildcardBindings))
-        {
+        if (ExpressionParser.isAlertStatExactMatch(alertStat, persistentStat.getName())
+            || ExpressionParser.isAlertStatWildcardMatch(alertStat, persistentStat.getName(),
+                wildcardBindings)) {
           String alertKey;
-          if (wildcardBindings.size() == 0)
-          {
+          if (wildcardBindings.size() == 0) {
             alertKey = noWildcardAlertKey;
-          }
-          else
-          {
+          } else {
             alertKey = formAlertKey(wildcardBindings);
           }
-          if (!tupleSets.containsKey(alertKey))
-          { // don't have an entry for alertKey yet, create one
-            ArrayList<Tuple<String>> tuples = new ArrayList<Tuple<String>>(
-                alertStats.length);
-            for (int j = 0; j < alertStats.length; j++)
-            { // init all entries to null
+          if (!tupleSets.containsKey(alertKey)) { // don't have an entry for alertKey yet, create
+                                                  // one
+            ArrayList<Tuple<String>> tuples = new ArrayList<Tuple<String>>(alertStats.length);
+            for (int j = 0; j < alertStats.length; j++) { // init all entries to null
               tuples.add(j, null);
             }
             tupleSets.put(alertKey, tuples); // add to map
@@ -161,20 +141,16 @@ public class AlertProcessor
     // post-processing step to discard any rows with null vals...
     // TODO: decide if this is best thing to do with incomplete rows
     List<String> selectedKeysToRemove = new ArrayList<String>();
-    for (String setKey : tupleSets.keySet())
-    {
+    for (String setKey : tupleSets.keySet()) {
       ArrayList<Tuple<String>> tupleSet = tupleSets.get(setKey);
-      for (Tuple<String> tup : tupleSet)
-      {
-        if (tup == null)
-        {
+      for (Tuple<String> tup : tupleSet) {
+        if (tup == null) {
           selectedKeysToRemove.add(setKey);
           break; // move on to next setKey
         }
       }
     }
-    for(String keyToRemove : selectedKeysToRemove)
-    {
+    for (String keyToRemove : selectedKeysToRemove) {
       tupleSets.remove(keyToRemove);
     }
 
@@ -184,29 +160,24 @@ public class AlertProcessor
   }
 
   public static List<Iterator<Tuple<String>>> convertTupleRowsToTupleColumns(
-      Map<String, ArrayList<Tuple<String>>> tupleMap)
-  {
+      Map<String, ArrayList<Tuple<String>>> tupleMap) {
     // input is a map of key -> list of tuples. each tuple list is same length
     // output should be a list of iterators. each column in input becomes
     // iterator in output
 
     ArrayList<ArrayList<Tuple<String>>> columns = new ArrayList<ArrayList<Tuple<String>>>();
     ArrayList<Iterator<Tuple<String>>> columnIters = new ArrayList<Iterator<Tuple<String>>>();
-    for (String currStat : tupleMap.keySet())
-    {
+    for (String currStat : tupleMap.keySet()) {
       List<Tuple<String>> currSet = tupleMap.get(currStat);
-      for (int i = 0; i < currSet.size(); i++)
-      {
-        if (columns.size() < (i + 1))
-        {
+      for (int i = 0; i < currSet.size(); i++) {
+        if (columns.size() < (i + 1)) {
           ArrayList<Tuple<String>> col = new ArrayList<Tuple<String>>();
           columns.add(col);
         }
         columns.get(i).add(currSet.get(i));
       }
     }
-    for (ArrayList<Tuple<String>> al : columns)
-    {
+    for (ArrayList<Tuple<String>> al : columns) {
       columnIters.add(al.iterator());
     }
     return columnIters;
@@ -214,20 +185,16 @@ public class AlertProcessor
   }
 
   public static Iterator<Tuple<String>> executeOperatorPipeline(
-      List<Iterator<Tuple<String>>> tupleIters, String[] operators)
-  {
+      List<Iterator<Tuple<String>>> tupleIters, String[] operators) {
     List<Iterator<Tuple<String>>> nextIters = tupleIters;
-    if (operators != null)
-    {
-      for (String opName : operators)
-      {
+    if (operators != null) {
+      for (String opName : operators) {
         Operator op = ExpressionParser.getOperator(opName);
         nextIters = op.execute(nextIters);
       }
     }
 
-    if (nextIters.size() != 1)
-    {
+    if (nextIters.size() != 1) {
       throw new HelixException("operator pipeline produced " + nextIters.size()
           + " tuple sets instead of exactly 1");
     }
@@ -239,15 +206,12 @@ public class AlertProcessor
    * TODO: consider returning actual values, rather than bools. Could just
    * return the triggered alerts
    */
-  public static ArrayList<AlertValueAndStatus> executeComparator(
-      Iterator<Tuple<String>> tuples, String comparatorName,
-      Tuple<String> constant)
-  {
+  public static ArrayList<AlertValueAndStatus> executeComparator(Iterator<Tuple<String>> tuples,
+      String comparatorName, Tuple<String> constant) {
     ArrayList<AlertValueAndStatus> results = new ArrayList<AlertValueAndStatus>();
     AlertComparator cmp = AlertParser.getComparator(comparatorName);
 
-    while (tuples.hasNext())
-    {
+    while (tuples.hasNext()) {
       Tuple<String> currTup = tuples.next();
       boolean fired = cmp.evaluate(currTup, constant);
       results.add(new AlertValueAndStatus(currTup, fired));
@@ -272,31 +236,23 @@ public class AlertProcessor
    * tuple list ArrayList<Boolean> evalResults =
    * executeComparator(opResultTuples, alert.getComparator(),
    * alert.getConstant());
-   * 
    * //TODO: convey this back to execute all
-   * 
    * }
    */
 
   public static HashMap<String, AlertValueAndStatus> generateResultMap(
-      Set<String> alertStatBindings, ArrayList<AlertValueAndStatus> evalResults)
-  {
+      Set<String> alertStatBindings, ArrayList<AlertValueAndStatus> evalResults) {
     HashMap<String, AlertValueAndStatus> resultMap = new HashMap<String, AlertValueAndStatus>();
     Iterator<String> bindingIter = alertStatBindings.iterator();
     Iterator<AlertValueAndStatus> resultIter = evalResults.iterator();
-    if (alertStatBindings.size() != evalResults.size())
-    {
+    if (alertStatBindings.size() != evalResults.size()) {
       // can't match up alerts bindings to results
-      while (resultIter.hasNext())
-      {
+      while (resultIter.hasNext()) {
         resultMap.put(noWildcardAlertKey, resultIter.next());
       }
-    }
-    else
-    {
+    } else {
       // they do match up
-      while (resultIter.hasNext())
-      {
+      while (resultIter.hasNext()) {
         resultMap.put(bindingIter.next(), resultIter.next());
       }
     }
@@ -304,19 +260,17 @@ public class AlertProcessor
   }
 
   public static HashMap<String, AlertValueAndStatus> executeAlert(Alert alert,
-      List<Stat> persistedStats)
-  {
+      List<Stat> persistedStats) {
     // init tuple lists and populate them
     // Map<String,List<Tuple<String>>> alertStatTupleSets =
     // initAlertStatTuples(alert);
 
     String[] alertStats = ExpressionParser.getBaseStats(alert.getExpression());
 
-    Map<String, ArrayList<Tuple<String>>> alertsToTupleRows = populateAlertStatTuples(
-        alertStats, persistedStats);
+    Map<String, ArrayList<Tuple<String>>> alertsToTupleRows =
+        populateAlertStatTuples(alertStats, persistedStats);
 
-    if (alertsToTupleRows.size() == 0)
-    {
+    if (alertsToTupleRows.size() == 0) {
       return null;
     }
     // convert to operator friendly format
@@ -324,31 +278,29 @@ public class AlertProcessor
     // get the operators
     String[] operators = ExpressionParser.getOperators(alert.getExpression());
     // do operator pipeline
-    Iterator<Tuple<String>> opResultTuples = executeOperatorPipeline(
-        tupleIters, operators);
+    Iterator<Tuple<String>> opResultTuples = executeOperatorPipeline(tupleIters, operators);
     // execute comparator for tuple list
-    ArrayList<AlertValueAndStatus> evalResults = executeComparator(
-        opResultTuples, alert.getComparator(), alert.getConstant());
+    ArrayList<AlertValueAndStatus> evalResults =
+        executeComparator(opResultTuples, alert.getComparator(), alert.getConstant());
 
     // stitch alert bindings back together with final result
     // XXX: there is a non-critical bug here. if we have an aggregating
     // operator, but that operator only takes one input,
     // we bind to original wildcard binding, instead of to "*"
 
-    HashMap<String, AlertValueAndStatus> alertBindingsToResult = generateResultMap(
-        alertsToTupleRows.keySet(), evalResults);
+    HashMap<String, AlertValueAndStatus> alertBindingsToResult =
+        generateResultMap(alertsToTupleRows.keySet(), evalResults);
 
     return alertBindingsToResult;
 
   }
 
-  public static Map<String, Map<String, AlertValueAndStatus>> executeAllAlerts(
-      List<Alert> alerts, List<Stat> stats)
-  {
-    Map<String, Map<String, AlertValueAndStatus>> alertsResults = new HashMap<String, Map<String, AlertValueAndStatus>>();
+  public static Map<String, Map<String, AlertValueAndStatus>> executeAllAlerts(List<Alert> alerts,
+      List<Stat> stats) {
+    Map<String, Map<String, AlertValueAndStatus>> alertsResults =
+        new HashMap<String, Map<String, AlertValueAndStatus>>();
 
-    for (Alert alert : alerts)
-    {
+    for (Alert alert : alerts) {
       HashMap<String, AlertValueAndStatus> result = executeAlert(alert, stats);
       // TODO: decide if sticking null results in here is ok
       alertsResults.put(alert.getName(), result);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/AlertValueAndStatus.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/AlertValueAndStatus.java b/helix-core/src/main/java/org/apache/helix/alerts/AlertValueAndStatus.java
index 891837d..1582312 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/AlertValueAndStatus.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/AlertValueAndStatus.java
@@ -20,24 +20,23 @@ package org.apache.helix.alerts;
  */
 
 public class AlertValueAndStatus {
-	public final static String VALUE_NAME = "value";
-	public final static String FIRED_NAME = "fired";
-	
-	private Tuple<String> value;
-	private boolean fired;
-	
-	public AlertValueAndStatus(Tuple<String> value, boolean fired)
-	{
-		this.value = value;
-		this.fired = fired;
-	}
+  public final static String VALUE_NAME = "value";
+  public final static String FIRED_NAME = "fired";
 
-	public Tuple<String> getValue() {
-		return value;
-	}
+  private Tuple<String> value;
+  private boolean fired;
+
+  public AlertValueAndStatus(Tuple<String> value, boolean fired) {
+    this.value = value;
+    this.fired = fired;
+  }
+
+  public Tuple<String> getValue() {
+    return value;
+  }
+
+  public boolean isFired() {
+    return fired;
+  }
 
-	public boolean isFired() {
-		return fired;
-	}
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/AlertsHolder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/AlertsHolder.java b/helix-core/src/main/java/org/apache/helix/alerts/AlertsHolder.java
index 78c650a..8bfaae6 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/AlertsHolder.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/AlertsHolder.java
@@ -38,31 +38,27 @@ import org.apache.helix.model.AlertStatus;
 import org.apache.helix.model.Alerts;
 import org.apache.log4j.Logger;
 
-
 public class AlertsHolder {
 
-	private static final Logger logger = Logger
-		    .getLogger(AlertsHolder.class.getName());
+  private static final Logger logger = Logger.getLogger(AlertsHolder.class.getName());
 
-	HelixDataAccessor _accessor;
-	HealthDataCache _cache;
-	Map<String, Map<String,String>> _alertsMap; //not sure if map or set yet
-	Map<String, Map<String,String>> _alertStatusMap;
-	//Alerts _alerts;
-	HashSet<String> alerts;
-	StatsHolder _statsHolder;
+  HelixDataAccessor _accessor;
+  HealthDataCache _cache;
+  Map<String, Map<String, String>> _alertsMap; // not sure if map or set yet
+  Map<String, Map<String, String>> _alertStatusMap;
+  // Alerts _alerts;
+  HashSet<String> alerts;
+  StatsHolder _statsHolder;
 
   private final HelixManager _manager;
 
   private Builder _keyBuilder;
 
-	public AlertsHolder(HelixManager manager, HealthDataCache cache)
-	{
-	  this(manager, cache, new StatsHolder(manager, cache));
-	}
-	
-	public AlertsHolder(HelixManager manager, HealthDataCache cache, StatsHolder statHolder)
-  {
+  public AlertsHolder(HelixManager manager, HealthDataCache cache) {
+    this(manager, cache, new StatsHolder(manager, cache));
+  }
+
+  public AlertsHolder(HelixManager manager, HealthDataCache cache, StatsHolder statHolder) {
     _manager = manager;
     _accessor = manager.getHelixDataAccessor();
     _cache = cache;
@@ -71,220 +67,198 @@ public class AlertsHolder {
     updateCache(_cache);
   }
 
-	public void refreshAlerts()
-	{
-	  _cache.refresh(_accessor);
-		updateCache(_cache);
+  public void refreshAlerts() {
+    _cache.refresh(_accessor);
+    updateCache(_cache);
 
+    /*
+     * _alertsMap = _cache.getAlerts();
+     * //TODO: confirm this a good place to init the _statMap when null
+     * if (_alertsMap == null) {
+     * _alertsMap = new HashMap<String, Map<String,String>>();
+     * }\
+     */
+  }
 
-		/*
-		_alertsMap = _cache.getAlerts();
-		//TODO: confirm this a good place to init the _statMap when null
-		if (_alertsMap == null) {
-			_alertsMap = new HashMap<String, Map<String,String>>();
-		}\*/
-	}
+  public void refreshAlertStatus() {
+    AlertStatus alertStatusRecord = _cache.getAlertStatus();
+    if (alertStatusRecord != null) {
+      _alertStatusMap = alertStatusRecord.getMapFields();
+    } else {
+      _alertStatusMap = new HashMap<String, Map<String, String>>();
+    }
+  }
 
-	public void refreshAlertStatus()
-	{
-		AlertStatus alertStatusRecord = _cache.getAlertStatus();
-		if (alertStatusRecord != null) {
-		_alertStatusMap = alertStatusRecord.getMapFields();
-		}
-		else {
-			_alertStatusMap = new HashMap<String, Map<String,String>>();
-		}
-	}
+  public void persistAlerts() {
+    // XXX: Am I using _accessor too directly here?
 
-	public void persistAlerts()
-	{
-		//XXX: Am I using _accessor too directly here?
-	  
-		Alerts alerts = _accessor.getProperty(_keyBuilder.alerts());
+    Alerts alerts = _accessor.getProperty(_keyBuilder.alerts());
     if (alerts == null) {
-      alerts = new Alerts(Alerts.nodeName); //TODO: fix naming of this record, if it matters
-		}
-		alerts.getRecord().setMapFields(_alertsMap);
-		 boolean retVal = _accessor.setProperty(_keyBuilder.alerts(), alerts);
-		 logger.debug("persistAlerts retVal: "+retVal);
-	}
+      alerts = new Alerts(Alerts.nodeName); // TODO: fix naming of this record, if it matters
+    }
+    alerts.getRecord().setMapFields(_alertsMap);
+    boolean retVal = _accessor.setProperty(_keyBuilder.alerts(), alerts);
+    logger.debug("persistAlerts retVal: " + retVal);
+  }
 
-	public void persistAlertStatus()
-	{
-		//XXX: Am I using _accessor too directly here?
-	  AlertStatus alertStatus = _accessor.getProperty(_keyBuilder.alertStatus());
-		if (alertStatus == null) {
-		  alertStatus = new AlertStatus(AlertStatus.nodeName); //TODO: fix naming of this record, if it matters
-		}
-		alertStatus.getRecord().setMapFields(_alertStatusMap);
-		boolean retVal = _accessor.setProperty(_keyBuilder.alertStatus(), alertStatus);
-		logger.debug("persistAlerts retVal: "+retVal);
-	}
+  public void persistAlertStatus() {
+    // XXX: Am I using _accessor too directly here?
+    AlertStatus alertStatus = _accessor.getProperty(_keyBuilder.alertStatus());
+    if (alertStatus == null) {
+      alertStatus = new AlertStatus(AlertStatus.nodeName); // TODO: fix naming of this record, if it
+                                                           // matters
+    }
+    alertStatus.getRecord().setMapFields(_alertStatusMap);
+    boolean retVal = _accessor.setProperty(_keyBuilder.alertStatus(), alertStatus);
+    logger.debug("persistAlerts retVal: " + retVal);
+  }
 
-	//read alerts from cm state
-	private void readExistingAlerts()
-	{
+  // read alerts from cm state
+  private void readExistingAlerts() {
 
-	}
+  }
 
-	public void addAlert(String alert) throws HelixException
-	{
-		alert = alert.replaceAll("\\s+", ""); //remove white space
-		AlertParser.validateAlert(alert);
-		refreshAlerts();
-		//stick the 3 alert fields in map
-		Map<String, String> alertFields = new HashMap<String,String>();
-		alertFields.put(AlertParser.EXPRESSION_NAME,
-				AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert));
-		alertFields.put(AlertParser.COMPARATOR_NAME,
-				AlertParser.getComponent(AlertParser.COMPARATOR_NAME, alert));
-		alertFields.put(AlertParser.CONSTANT_NAME,
-				AlertParser.getComponent(AlertParser.CONSTANT_NAME, alert));
-		try
-		{
-		  alertFields.put(AlertParser.ACTION_NAME,
-	        AlertParser.getComponent(AlertParser.ACTION_NAME, alert));
-		}
-		catch(Exception e)
-		{
-		  logger.info("No action specified in " + alert);
-		}
-		//store the expression as stat
-		_statsHolder.addStat(alertFields.get(AlertParser.EXPRESSION_NAME));
-        _statsHolder.persistStats();
+  public void addAlert(String alert) throws HelixException {
+    alert = alert.replaceAll("\\s+", ""); // remove white space
+    AlertParser.validateAlert(alert);
+    refreshAlerts();
+    // stick the 3 alert fields in map
+    Map<String, String> alertFields = new HashMap<String, String>();
+    alertFields.put(AlertParser.EXPRESSION_NAME,
+        AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert));
+    alertFields.put(AlertParser.COMPARATOR_NAME,
+        AlertParser.getComponent(AlertParser.COMPARATOR_NAME, alert));
+    alertFields.put(AlertParser.CONSTANT_NAME,
+        AlertParser.getComponent(AlertParser.CONSTANT_NAME, alert));
+    try {
+      alertFields.put(AlertParser.ACTION_NAME,
+          AlertParser.getComponent(AlertParser.ACTION_NAME, alert));
+    } catch (Exception e) {
+      logger.info("No action specified in " + alert);
+    }
+    // store the expression as stat
+    _statsHolder.addStat(alertFields.get(AlertParser.EXPRESSION_NAME));
+    _statsHolder.persistStats();
 
-		//naming the alert with the full name
-		_alertsMap.put(alert, alertFields);
-		persistAlerts();
-	}
+    // naming the alert with the full name
+    _alertsMap.put(alert, alertFields);
+    persistAlerts();
+  }
 
-	/*
-	 * Add a set of alert statuses to ZK
-	 */
-	public void addAlertStatusSet(Map<String, Map<String, AlertValueAndStatus>> statusSet) throws HelixException
-	{
-	  if (_alertStatusMap == null) {
-	    _alertStatusMap = new HashMap<String, Map<String,String>>();
-	  }
-	  _alertStatusMap.clear(); //clear map.  all alerts overwrite old alerts
-	  for (String alert : statusSet.keySet()) {
-	    Map<String,AlertValueAndStatus> currStatus = statusSet.get(alert);
-	    if (currStatus != null) {
-	      addAlertStatus(alert, currStatus);
-	    }
-	  }
+  /*
+   * Add a set of alert statuses to ZK
+   */
+  public void addAlertStatusSet(Map<String, Map<String, AlertValueAndStatus>> statusSet)
+      throws HelixException {
+    if (_alertStatusMap == null) {
+      _alertStatusMap = new HashMap<String, Map<String, String>>();
+    }
+    _alertStatusMap.clear(); // clear map. all alerts overwrite old alerts
+    for (String alert : statusSet.keySet()) {
+      Map<String, AlertValueAndStatus> currStatus = statusSet.get(alert);
+      if (currStatus != null) {
+        addAlertStatus(alert, currStatus);
+      }
+    }
 
-	  AlertStatus alertStatus = _accessor.getProperty(_keyBuilder.alertStatus());
-	  int alertStatusSize = 0;
-	  if (alertStatus != null) {
-	    alertStatusSize = alertStatus.getMapFields().size();
-	  }
-	  //no need to persist alerts if there are none to persist and none are currently persisted
-	 if (_alertStatusMap.size() > 0  || alertStatusSize > 0) {
-	  persistAlertStatus(); //save statuses in zk
-	 }
-	}
+    AlertStatus alertStatus = _accessor.getProperty(_keyBuilder.alertStatus());
+    int alertStatusSize = 0;
+    if (alertStatus != null) {
+      alertStatusSize = alertStatus.getMapFields().size();
+    }
+    // no need to persist alerts if there are none to persist and none are currently persisted
+    if (_alertStatusMap.size() > 0 || alertStatusSize > 0) {
+      persistAlertStatus(); // save statuses in zk
+    }
+  }
 
-	private void addAlertStatus(String parentAlertKey, Map<String,AlertValueAndStatus> alertStatus) throws HelixException
-	{
-		//_alertStatusMap = new HashMap<String,Map<String,String>>();
-		for (String alertName : alertStatus.keySet()) {
-			String mapAlertKey;
-			mapAlertKey = parentAlertKey;
-			if (!alertName.equals(ExpressionParser.wildcardChar)) {
-				mapAlertKey = mapAlertKey+" : ("+alertName+")";
-			}
-			AlertValueAndStatus vs = alertStatus.get(alertName);
-			Map<String,String> alertFields = new HashMap<String,String>();
-			alertFields.put(AlertValueAndStatus.VALUE_NAME, vs.getValue().toString());
-			alertFields.put(AlertValueAndStatus.FIRED_NAME, String.valueOf(vs.isFired()));
-			_alertStatusMap.put(mapAlertKey, alertFields);
-		}
-	}
+  private void addAlertStatus(String parentAlertKey, Map<String, AlertValueAndStatus> alertStatus)
+      throws HelixException {
+    // _alertStatusMap = new HashMap<String,Map<String,String>>();
+    for (String alertName : alertStatus.keySet()) {
+      String mapAlertKey;
+      mapAlertKey = parentAlertKey;
+      if (!alertName.equals(ExpressionParser.wildcardChar)) {
+        mapAlertKey = mapAlertKey + " : (" + alertName + ")";
+      }
+      AlertValueAndStatus vs = alertStatus.get(alertName);
+      Map<String, String> alertFields = new HashMap<String, String>();
+      alertFields.put(AlertValueAndStatus.VALUE_NAME, vs.getValue().toString());
+      alertFields.put(AlertValueAndStatus.FIRED_NAME, String.valueOf(vs.isFired()));
+      _alertStatusMap.put(mapAlertKey, alertFields);
+    }
+  }
 
-	public AlertValueAndStatus getAlertValueAndStatus(String alertName)
-	{
-		Map<String,String> alertFields = _alertStatusMap.get(alertName);
-		String val = alertFields.get(AlertValueAndStatus.VALUE_NAME);
-		Tuple<String> valTup = new Tuple<String>();
-		valTup.add(val);
-		boolean fired = Boolean.valueOf(alertFields.get(AlertValueAndStatus.FIRED_NAME));
-		AlertValueAndStatus vs = new AlertValueAndStatus(valTup, fired);
-		return vs;
-	}
+  public AlertValueAndStatus getAlertValueAndStatus(String alertName) {
+    Map<String, String> alertFields = _alertStatusMap.get(alertName);
+    String val = alertFields.get(AlertValueAndStatus.VALUE_NAME);
+    Tuple<String> valTup = new Tuple<String>();
+    valTup.add(val);
+    boolean fired = Boolean.valueOf(alertFields.get(AlertValueAndStatus.FIRED_NAME));
+    AlertValueAndStatus vs = new AlertValueAndStatus(valTup, fired);
+    return vs;
+  }
 
-	public static void parseAlert(String alert, StringBuilder statsName,
-			Map<String,String> alertFields) throws HelixException
-	{
-		alert = alert.replaceAll("\\s+", ""); //remove white space
-		AlertParser.validateAlert(alert);
-		//alertFields = new HashMap<String,String>();
-		alertFields.put(AlertParser.EXPRESSION_NAME,
-				AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert));
-		alertFields.put(AlertParser.COMPARATOR_NAME,
-				AlertParser.getComponent(AlertParser.COMPARATOR_NAME, alert));
-		alertFields.put(AlertParser.CONSTANT_NAME,
-				AlertParser.getComponent(AlertParser.CONSTANT_NAME, alert));
-		try
-        {
-          alertFields.put(AlertParser.ACTION_NAME,
+  public static void parseAlert(String alert, StringBuilder statsName,
+      Map<String, String> alertFields) throws HelixException {
+    alert = alert.replaceAll("\\s+", ""); // remove white space
+    AlertParser.validateAlert(alert);
+    // alertFields = new HashMap<String,String>();
+    alertFields.put(AlertParser.EXPRESSION_NAME,
+        AlertParser.getComponent(AlertParser.EXPRESSION_NAME, alert));
+    alertFields.put(AlertParser.COMPARATOR_NAME,
+        AlertParser.getComponent(AlertParser.COMPARATOR_NAME, alert));
+    alertFields.put(AlertParser.CONSTANT_NAME,
+        AlertParser.getComponent(AlertParser.CONSTANT_NAME, alert));
+    try {
+      alertFields.put(AlertParser.ACTION_NAME,
           AlertParser.getComponent(AlertParser.ACTION_NAME, alert));
-        }
-        catch(Exception e)
-        {
-           logger.info("No action specified in " + alert);
-        }
-		statsName.append(alertFields.get(AlertParser.EXPRESSION_NAME));
-	}
-
-
-	/*
-	public void evaluateAllAlerts()
-	{
-		for (String alert : _alertsMap.keySet()) {
-			Map<String,String> alertFields = _alertsMap.get(alert);
-			String exp = alertFields.get(AlertParser.EXPRESSION_NAME);
-			String comp = alertFields.get(AlertParser.COMPARATOR_NAME);
-			String con = alertFields.get(AlertParser.CONSTANT_NAME);
-			//TODO: test the fields for null and fail if needed
+    } catch (Exception e) {
+      logger.info("No action specified in " + alert);
+    }
+    statsName.append(alertFields.get(AlertParser.EXPRESSION_NAME));
+  }
 
-			AlertProcessor.execute(exp,  comp, con, sh);
-		}
-	}
-	*/
+  /*
+   * public void evaluateAllAlerts()
+   * {
+   * for (String alert : _alertsMap.keySet()) {
+   * Map<String,String> alertFields = _alertsMap.get(alert);
+   * String exp = alertFields.get(AlertParser.EXPRESSION_NAME);
+   * String comp = alertFields.get(AlertParser.COMPARATOR_NAME);
+   * String con = alertFields.get(AlertParser.CONSTANT_NAME);
+   * //TODO: test the fields for null and fail if needed
+   * AlertProcessor.execute(exp, comp, con, sh);
+   * }
+   * }
+   */
 
-	public List<Alert> getAlertList()
-	{
-		List<Alert> alerts = new LinkedList<Alert>();
-		for (String alert : _alertsMap.keySet()) {
-			Map<String,String> alertFields = _alertsMap.get(alert);
-			String exp = alertFields.get(AlertParser.EXPRESSION_NAME);
-			String comp = alertFields.get(AlertParser.COMPARATOR_NAME);
-			Tuple<String> con = Tuple.fromString(alertFields.get(AlertParser.CONSTANT_NAME));
-			//TODO: test the fields for null and fail if needed
+  public List<Alert> getAlertList() {
+    List<Alert> alerts = new LinkedList<Alert>();
+    for (String alert : _alertsMap.keySet()) {
+      Map<String, String> alertFields = _alertsMap.get(alert);
+      String exp = alertFields.get(AlertParser.EXPRESSION_NAME);
+      String comp = alertFields.get(AlertParser.COMPARATOR_NAME);
+      Tuple<String> con = Tuple.fromString(alertFields.get(AlertParser.CONSTANT_NAME));
+      // TODO: test the fields for null and fail if needed
 
-			Alert a = new Alert(alert, exp, comp, con);
-			alerts.add(a);
-		}
-		return alerts;
-	}
+      Alert a = new Alert(alert, exp, comp, con);
+      alerts.add(a);
+    }
+    return alerts;
+  }
 
-  public void updateCache(HealthDataCache cache)
-  {
+  public void updateCache(HealthDataCache cache) {
     _cache = cache;
     Alerts alertsRecord = _cache.getAlerts();
-    if (alertsRecord != null) 
-    {
+    if (alertsRecord != null) {
       _alertsMap = alertsRecord.getMapFields();
-    }
-    else 
-    {
-      _alertsMap = new HashMap<String, Map<String,String>>();
+    } else {
+      _alertsMap = new HashMap<String, Map<String, String>>();
     }
   }
-  
-  public Map<String, Map<String,String>> getAlertsMap()
-  {
+
+  public Map<String, Map<String, String>> getAlertsMap() {
     return _alertsMap;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/DecayAggregator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/DecayAggregator.java b/helix-core/src/main/java/org/apache/helix/alerts/DecayAggregator.java
index 06c38c9..be17ca9 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/DecayAggregator.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/DecayAggregator.java
@@ -23,61 +23,56 @@ import java.util.Iterator;
 
 import org.apache.helix.HelixException;
 
-
 public class DecayAggregator extends Aggregator {
 
-	double _decayWeight;
-	
-	public DecayAggregator(double weight)
-	{
-		_decayWeight = weight;
-	}
-	
-	public DecayAggregator() 
-	{
-		_numArgs = 1;
-	}
-	
-	@Override
-	public void merge(Tuple<String> currValTup, Tuple<String> newValTup,
-			Tuple<String> currTimeTup, Tuple<String> newTimeTup, String... args) {
-	
-		_decayWeight = Double.parseDouble(args[0]);
-		
-		double currVal = 0;
-		double currTime = -1;
-		double newVal;
-		double newTime;
-		double mergedVal;
-		double mergedTime;
-		
-		if (currValTup == null || newValTup == null || currTimeTup == null ||
-				newTimeTup == null) {
-			throw new HelixException("Tuples cannot be null");
-		}
-		
-		//old tuples may be empty, indicating no value/time exist
-		if (currValTup.size() > 0 && currTimeTup.size() > 0) {
-			currVal = Double.parseDouble(currValTup.iterator().next());
-			currTime = Double.parseDouble(currTimeTup.iterator().next());
-		}
-		newVal = Double.parseDouble(newValTup.iterator().next());
-		newTime = Double.parseDouble(newTimeTup.iterator().next());
-		
-		if (newTime > currTime) { //if old doesn't exist, we end up here
-			mergedVal = (1-_decayWeight)*currVal+_decayWeight*newVal; //if old doesn't exist, it has value "0"
-			mergedTime = newTime;
-		}
-		else {
-			mergedVal = currVal;
-			mergedTime = currTime;
-		}
-	
-		currValTup.clear();
-		currValTup.add(Double.toString(mergedVal));
-		currTimeTup.clear();
-		currTimeTup.add(Double.toString(mergedTime));
-	}
+  double _decayWeight;
+
+  public DecayAggregator(double weight) {
+    _decayWeight = weight;
+  }
+
+  public DecayAggregator() {
+    _numArgs = 1;
+  }
+
+  @Override
+  public void merge(Tuple<String> currValTup, Tuple<String> newValTup, Tuple<String> currTimeTup,
+      Tuple<String> newTimeTup, String... args) {
+
+    _decayWeight = Double.parseDouble(args[0]);
+
+    double currVal = 0;
+    double currTime = -1;
+    double newVal;
+    double newTime;
+    double mergedVal;
+    double mergedTime;
+
+    if (currValTup == null || newValTup == null || currTimeTup == null || newTimeTup == null) {
+      throw new HelixException("Tuples cannot be null");
+    }
+
+    // old tuples may be empty, indicating no value/time exist
+    if (currValTup.size() > 0 && currTimeTup.size() > 0) {
+      currVal = Double.parseDouble(currValTup.iterator().next());
+      currTime = Double.parseDouble(currTimeTup.iterator().next());
+    }
+    newVal = Double.parseDouble(newValTup.iterator().next());
+    newTime = Double.parseDouble(newTimeTup.iterator().next());
+
+    if (newTime > currTime) { // if old doesn't exist, we end up here
+      mergedVal = (1 - _decayWeight) * currVal + _decayWeight * newVal; // if old doesn't exist, it
+                                                                        // has value "0"
+      mergedTime = newTime;
+    } else {
+      mergedVal = currVal;
+      mergedTime = currTime;
+    }
+
+    currValTup.clear();
+    currValTup.add(Double.toString(mergedVal));
+    currTimeTup.clear();
+    currTimeTup.add(Double.toString(mergedTime));
+  }
 
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/DivideOperator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/DivideOperator.java b/helix-core/src/main/java/org/apache/helix/alerts/DivideOperator.java
index 15b8c38..122d4c1 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/DivideOperator.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/DivideOperator.java
@@ -24,17 +24,17 @@ import java.util.List;
 
 public class DivideOperator extends Operator {
 
-	public DivideOperator() {
-		minInputTupleLists = 2;
-		maxInputTupleLists = 2;
-		inputOutputTupleListsCountsEqual = false;
-		numOutputTupleLists = 1;
-	}
+  public DivideOperator() {
+    minInputTupleLists = 2;
+    maxInputTupleLists = 2;
+    inputOutputTupleListsCountsEqual = false;
+    numOutputTupleLists = 1;
+  }
 
-	@Override
-	public List<Iterator<Tuple<String>>> execute(List<Iterator<Tuple<String>>> input) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+  @Override
+  public List<Iterator<Tuple<String>>> execute(List<Iterator<Tuple<String>>> input) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/ExpandOperator.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/ExpandOperator.java b/helix-core/src/main/java/org/apache/helix/alerts/ExpandOperator.java
index 5f23dab..ecd4791 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/ExpandOperator.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/ExpandOperator.java
@@ -24,16 +24,16 @@ import java.util.List;
 
 public class ExpandOperator extends Operator {
 
-	public ExpandOperator() {
-		minInputTupleLists = 1;
-		maxInputTupleLists = Integer.MAX_VALUE;
-		inputOutputTupleListsCountsEqual = true;
-	}
+  public ExpandOperator() {
+    minInputTupleLists = 1;
+    maxInputTupleLists = Integer.MAX_VALUE;
+    inputOutputTupleListsCountsEqual = true;
+  }
 
-	@Override
-	public List<Iterator<Tuple<String>>> execute(List<Iterator<Tuple<String>>> input) {
-		//TODO: confirm this is a no-op operator
-		return input;
-	}
+  @Override
+  public List<Iterator<Tuple<String>>> execute(List<Iterator<Tuple<String>>> input) {
+    // TODO: confirm this is a no-op operator
+    return input;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/alerts/ExpressionOperatorType.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/alerts/ExpressionOperatorType.java b/helix-core/src/main/java/org/apache/helix/alerts/ExpressionOperatorType.java
index 0eff807..6c4f913 100644
--- a/helix-core/src/main/java/org/apache/helix/alerts/ExpressionOperatorType.java
+++ b/helix-core/src/main/java/org/apache/helix/alerts/ExpressionOperatorType.java
@@ -20,27 +20,25 @@ package org.apache.helix.alerts;
  */
 
 public enum ExpressionOperatorType {
-	//each
-	EACH(true),
-	//standard math
-	SUM(false),
-	MULTIPLY(false),
-	SUBTRACT(false),
-	DIVIDE(false),
-	//aggregation types
-	ACCUMULATE(true),
-	DECAY(false),
-	WINDOW(false);
-	
-	boolean isBase;
-	
-	private ExpressionOperatorType(boolean isBase) 
-	{
-		this.isBase = isBase;
-	}
-	
-	boolean isBaseOp()
-	{
-		return isBase;
-	}
+  // each
+  EACH(true),
+  // standard math
+  SUM(false),
+  MULTIPLY(false),
+  SUBTRACT(false),
+  DIVIDE(false),
+  // aggregation types
+  ACCUMULATE(true),
+  DECAY(false),
+  WINDOW(false);
+
+  boolean isBase;
+
+  private ExpressionOperatorType(boolean isBase) {
+    this.isBase = isBase;
+  }
+
+  boolean isBaseOp() {
+    return isBase;
+  }
 }


Mime
View raw message