helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject [31/51] [partial] [HELIX-198] Unify helix code style, rb=13710
Date Wed, 21 Aug 2013 20:43:44 GMT
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/IdealState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/IdealState.java b/helix-core/src/main/java/org/apache/helix/model/IdealState.java
index 48a3eee..b0b3960 100644
--- a/helix-core/src/main/java/org/apache/helix/model/IdealState.java
+++ b/helix-core/src/main/java/org/apache/helix/model/IdealState.java
@@ -35,10 +35,8 @@ import org.apache.log4j.Logger;
 /**
  * The ideal states of all partition in a resource
  */
-public class IdealState extends HelixProperty
-{
-  public enum IdealStateProperty
-  {
+public class IdealState extends HelixProperty {
+  public enum IdealStateProperty {
     NUM_PARTITIONS,
     STATE_MODEL_DEF_REF,
     STATE_MODEL_FACTORY_NAME,
@@ -55,235 +53,192 @@ public class IdealState extends HelixProperty
   public static final String QUERY_LIST = "PREFERENCE_LIST_QUERYS";
 
   @Deprecated
-  public enum IdealStateModeProperty
-  {
-    AUTO, CUSTOMIZED, AUTO_REBALANCE
+  public enum IdealStateModeProperty {
+    AUTO,
+    CUSTOMIZED,
+    AUTO_REBALANCE
   }
 
-  public enum RebalanceMode
-  {
-    FULL_AUTO, SEMI_AUTO, CUSTOMIZED, USER_DEFINED, NONE
+  public enum RebalanceMode {
+    FULL_AUTO,
+    SEMI_AUTO,
+    CUSTOMIZED,
+    USER_DEFINED,
+    NONE
   }
 
-  private static final Logger logger = Logger.getLogger(IdealState.class
-      .getName());
+  private static final Logger logger = Logger.getLogger(IdealState.class.getName());
 
-  public IdealState(String resourceName)
-  {
+  public IdealState(String resourceName) {
     super(resourceName);
   }
 
-  public IdealState(ZNRecord record)
-  {
+  public IdealState(ZNRecord record) {
     super(record);
   }
 
-  public String getResourceName()
-  {
+  public String getResourceName() {
     return _record.getId();
   }
 
   @Deprecated
-  public void setIdealStateMode(String mode)
-  {
+  public void setIdealStateMode(String mode) {
     _record.setSimpleField(IdealStateProperty.IDEAL_STATE_MODE.toString(), mode);
     RebalanceMode rebalanceMode = normalizeRebalanceMode(IdealStateModeProperty.valueOf(mode));
     _record.setEnumField(IdealStateProperty.REBALANCE_MODE.toString(), rebalanceMode);
   }
 
-  public void setRebalanceMode(RebalanceMode rebalancerType)
-  {
+  public void setRebalanceMode(RebalanceMode rebalancerType) {
     _record.setEnumField(IdealStateProperty.REBALANCE_MODE.toString(), rebalancerType);
     IdealStateModeProperty idealStateMode = denormalizeRebalanceMode(rebalancerType);
-    _record.setEnumField(IdealStateProperty.IDEAL_STATE_MODE.toString(),idealStateMode);
+    _record.setEnumField(IdealStateProperty.IDEAL_STATE_MODE.toString(), idealStateMode);
   }
 
-  public int getMaxPartitionsPerInstance()
-  {
+  public int getMaxPartitionsPerInstance() {
     return _record.getIntField(IdealStateProperty.MAX_PARTITIONS_PER_INSTANCE.toString(),
         Integer.MAX_VALUE);
   }
-  
-  public void setRebalancerClassName(String rebalancerClassName)
-  {
+
+  public void setRebalancerClassName(String rebalancerClassName) {
     _record
-    .setSimpleField(IdealStateProperty.REBALANCER_CLASS_NAME.toString(), rebalancerClassName);
+        .setSimpleField(IdealStateProperty.REBALANCER_CLASS_NAME.toString(), rebalancerClassName);
   }
-  
-  public String getRebalancerClassName()
-  {
+
+  public String getRebalancerClassName() {
     return _record.getSimpleField(IdealStateProperty.REBALANCER_CLASS_NAME.toString());
   }
-  
-  public void setMaxPartitionsPerInstance(int max)
-  {
+
+  public void setMaxPartitionsPerInstance(int max) {
     _record.setIntField(IdealStateProperty.MAX_PARTITIONS_PER_INSTANCE.toString(), max);
   }
 
   @Deprecated
-  public IdealStateModeProperty getIdealStateMode()
-  {
+  public IdealStateModeProperty getIdealStateMode() {
     return _record.getEnumField(IdealStateProperty.IDEAL_STATE_MODE.toString(),
         IdealStateModeProperty.class, IdealStateModeProperty.AUTO);
   }
 
-  public RebalanceMode getRebalanceMode()
-  {
-    RebalanceMode property = _record.getEnumField(
-        IdealStateProperty.REBALANCE_MODE.toString(), RebalanceMode.class,
-        RebalanceMode.NONE);
-    if (property == RebalanceMode.NONE)
-    {
+  public RebalanceMode getRebalanceMode() {
+    RebalanceMode property =
+        _record.getEnumField(IdealStateProperty.REBALANCE_MODE.toString(), RebalanceMode.class,
+            RebalanceMode.NONE);
+    if (property == RebalanceMode.NONE) {
       property = normalizeRebalanceMode(getIdealStateMode());
       setRebalanceMode(property);
     }
     return property;
   }
 
-  public void setPartitionState(String partitionName, String instanceName,
-      String state)
-  {
+  public void setPartitionState(String partitionName, String instanceName, String state) {
     Map<String, String> mapField = _record.getMapField(partitionName);
-    if (mapField == null)
-    {
+    if (mapField == null) {
       _record.setMapField(partitionName, new TreeMap<String, String>());
     }
     _record.getMapField(partitionName).put(instanceName, state);
   }
 
-  public Set<String> getPartitionSet()
-  {
+  public Set<String> getPartitionSet() {
     if (getRebalanceMode() == RebalanceMode.SEMI_AUTO
         || getRebalanceMode() == RebalanceMode.FULL_AUTO
-        || getRebalanceMode() == RebalanceMode.USER_DEFINED)
-    {
+        || getRebalanceMode() == RebalanceMode.USER_DEFINED) {
       return _record.getListFields().keySet();
-    } else if (getRebalanceMode() == RebalanceMode.CUSTOMIZED)
-    {
+    } else if (getRebalanceMode() == RebalanceMode.CUSTOMIZED) {
       return _record.getMapFields().keySet();
-    } else
-    {
+    } else {
       logger.error("Invalid ideal state mode:" + getResourceName());
       return Collections.emptySet();
     }
   }
 
-  public Map<String, String> getInstanceStateMap(String partitionName)
-  {
+  public Map<String, String> getInstanceStateMap(String partitionName) {
     return _record.getMapField(partitionName);
   }
 
-  public Set<String> getInstanceSet(String partitionName)
-  {
+  public Set<String> getInstanceSet(String partitionName) {
     if (getRebalanceMode() == RebalanceMode.SEMI_AUTO
         || getRebalanceMode() == RebalanceMode.FULL_AUTO
-        || getRebalanceMode() == RebalanceMode.USER_DEFINED)
-    {
+        || getRebalanceMode() == RebalanceMode.USER_DEFINED) {
       List<String> prefList = _record.getListField(partitionName);
-      if (prefList != null)
-      {
+      if (prefList != null) {
         return new TreeSet<String>(prefList);
-      } else
-      {
+      } else {
         logger.warn(partitionName + " does NOT exist");
         return Collections.emptySet();
       }
-    } else if (getRebalanceMode() == RebalanceMode.CUSTOMIZED)
-    {
+    } else if (getRebalanceMode() == RebalanceMode.CUSTOMIZED) {
       Map<String, String> stateMap = _record.getMapField(partitionName);
-      if (stateMap != null)
-      {
+      if (stateMap != null) {
         return new TreeSet<String>(stateMap.keySet());
-      } else
-      {
+      } else {
         logger.warn(partitionName + " does NOT exist");
         return Collections.emptySet();
       }
-    } else
-    {
+    } else {
       logger.error("Invalid ideal state mode: " + getResourceName());
       return Collections.emptySet();
     }
 
   }
 
-  public List<String> getPreferenceList(String partitionName)
-  {
+  public List<String> getPreferenceList(String partitionName) {
     List<String> instanceStateList = _record.getListField(partitionName);
 
-    if (instanceStateList != null)
-    {
+    if (instanceStateList != null) {
       return instanceStateList;
     }
-    logger.warn("Resource key:" + partitionName
-        + " does not have a pre-computed preference list.");
+    logger.warn("Resource key:" + partitionName + " does not have a pre-computed preference list.");
     return null;
   }
 
-  public String getStateModelDefRef()
-  {
-    return _record.getSimpleField(IdealStateProperty.STATE_MODEL_DEF_REF
-        .toString());
+  public String getStateModelDefRef() {
+    return _record.getSimpleField(IdealStateProperty.STATE_MODEL_DEF_REF.toString());
   }
 
-  public void setStateModelDefRef(String stateModel)
-  {
-    _record.setSimpleField(IdealStateProperty.STATE_MODEL_DEF_REF.toString(),
-        stateModel);
+  public void setStateModelDefRef(String stateModel) {
+    _record.setSimpleField(IdealStateProperty.STATE_MODEL_DEF_REF.toString(), stateModel);
   }
 
-  public void setNumPartitions(int numPartitions)
-  {
+  public void setNumPartitions(int numPartitions) {
     _record.setIntField(IdealStateProperty.NUM_PARTITIONS.toString(), numPartitions);
   }
 
-  public int getNumPartitions()
-  {
+  public int getNumPartitions() {
     return _record.getIntField(IdealStateProperty.NUM_PARTITIONS.toString(), -1);
   }
 
-  public void setReplicas(String replicas)
-  {
+  public void setReplicas(String replicas) {
     _record.setSimpleField(IdealStateProperty.REPLICAS.toString(), replicas);
   }
 
-  public String getReplicas()
-  {
+  public String getReplicas() {
     // HACK: if replica doesn't exists, use the length of the first list field
     // instead
     // TODO: remove it when Dbus fixed the IdealState writer
-    String replica = _record.getSimpleField(IdealStateProperty.REPLICAS
-        .toString());
-    if (replica == null)
-    {
+    String replica = _record.getSimpleField(IdealStateProperty.REPLICAS.toString());
+    if (replica == null) {
       String firstPartition = null;
-      switch (getRebalanceMode())
-      {
+      switch (getRebalanceMode()) {
       case SEMI_AUTO:
-        if (_record.getListFields().size() == 0)
-        {
+        if (_record.getListFields().size() == 0) {
           replica = "0";
-        } else
-        {
-          firstPartition = new ArrayList<String>(_record.getListFields()
-              .keySet()).get(0);
-          replica = Integer.toString(firstPartition == null ? 0 : _record
-              .getListField(firstPartition).size());
+        } else {
+          firstPartition = new ArrayList<String>(_record.getListFields().keySet()).get(0);
+          replica =
+              Integer.toString(firstPartition == null ? 0 : _record.getListField(firstPartition)
+                  .size());
         }
         logger
             .warn("could NOT find number of replicas in idealState. Use size of the first list instead. replica: "
                 + replica + ", 1st partition: " + firstPartition);
         break;
       case CUSTOMIZED:
-        if (_record.getMapFields().size() == 0)
-        {
+        if (_record.getMapFields().size() == 0) {
           replica = "0";
-        } else
-        {
-          firstPartition = new ArrayList<String>(_record.getMapFields()
-              .keySet()).get(0);
-          replica = Integer.toString(firstPartition == null ? 0 : _record
-              .getMapField(firstPartition).size());
+        } else {
+          firstPartition = new ArrayList<String>(_record.getMapFields().keySet()).get(0);
+          replica =
+              Integer.toString(firstPartition == null ? 0 : _record.getMapField(firstPartition)
+                  .size());
         }
         logger
             .warn("could NOT find replicas in idealState. Use size of the first map instead. replica: "
@@ -299,85 +254,72 @@ public class IdealState extends HelixProperty
     return replica;
   }
 
-  public void setStateModelFactoryName(String name)
-  {
-    _record.setSimpleField(
-        IdealStateProperty.STATE_MODEL_FACTORY_NAME.toString(), name);
+  public void setStateModelFactoryName(String name) {
+    _record.setSimpleField(IdealStateProperty.STATE_MODEL_FACTORY_NAME.toString(), name);
   }
 
-  public String getStateModelFactoryName()
-  {
+  public String getStateModelFactoryName() {
     return _record.getStringField(IdealStateProperty.STATE_MODEL_FACTORY_NAME.toString(),
         HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
   }
 
-  public int getRebalanceTimerPeriod()
-  {
+  public int getRebalanceTimerPeriod() {
     return _record.getIntField(IdealStateProperty.REBALANCE_TIMER_PERIOD.toString(), -1);
   }
 
   @Override
-  public boolean isValid()
-  {
-    if (getNumPartitions() < 0)
-    {
-      logger.error("idealState:" + _record
-          + " does not have number of partitions (was " + getNumPartitions()
-          + ").");
+  public boolean isValid() {
+    if (getNumPartitions() < 0) {
+      logger.error("idealState:" + _record + " does not have number of partitions (was "
+          + getNumPartitions() + ").");
       return false;
     }
 
-    if (getStateModelDefRef() == null)
-    {
-      logger.error("idealStates:" + _record
-          + " does not have state model definition.");
+    if (getStateModelDefRef() == null) {
+      logger.error("idealStates:" + _record + " does not have state model definition.");
       return false;
     }
 
     if (getRebalanceMode() == RebalanceMode.SEMI_AUTO
-        || getRebalanceMode() == RebalanceMode.USER_DEFINED)
-    {
-        String replicaStr = getReplicas();
-        if (replicaStr == null) {
-            logger.error("invalid ideal-state. missing replicas in auto mode. record was: " + _record);
-            return false;
-        }
+        || getRebalanceMode() == RebalanceMode.USER_DEFINED) {
+      String replicaStr = getReplicas();
+      if (replicaStr == null) {
+        logger.error("invalid ideal-state. missing replicas in auto mode. record was: " + _record);
+        return false;
+      }
 
-        if (!replicaStr.equals(HelixConstants.StateModelToken.ANY_LIVEINSTANCE.toString())) {
-            int replica = Integer.parseInt(replicaStr);
-            Set<String> partitionSet = getPartitionSet();
-            for (String partition : partitionSet) {
-                List<String> preferenceList = getPreferenceList(partition);
-                if (preferenceList == null || preferenceList.size() != replica) {
-                    logger.error("invalid ideal-state. preference-list size not equals to replicas in auto mode. replica: "
-                            + replica + ", preference-list size: " + preferenceList.size() + ", record was: "
-                            + _record);
-                    return false;
-                }
-            }
+      if (!replicaStr.equals(HelixConstants.StateModelToken.ANY_LIVEINSTANCE.toString())) {
+        int replica = Integer.parseInt(replicaStr);
+        Set<String> partitionSet = getPartitionSet();
+        for (String partition : partitionSet) {
+          List<String> preferenceList = getPreferenceList(partition);
+          if (preferenceList == null || preferenceList.size() != replica) {
+            logger
+                .error("invalid ideal-state. preference-list size not equals to replicas in auto mode. replica: "
+                    + replica
+                    + ", preference-list size: "
+                    + preferenceList.size()
+                    + ", record was: " + _record);
+            return false;
+          }
         }
+      }
     }
 
     return true;
   }
-  
-  public void setInstanceGroupTag(String groupTag)
-  {
-    _record.setSimpleField(
-        IdealStateProperty.INSTANCE_GROUP_TAG.toString(), groupTag);
+
+  public void setInstanceGroupTag(String groupTag) {
+    _record.setSimpleField(IdealStateProperty.INSTANCE_GROUP_TAG.toString(), groupTag);
   }
-  
-  public String getInstanceGroupTag()
-  {
-    return _record.getSimpleField(
-        IdealStateProperty.INSTANCE_GROUP_TAG.toString());
+
+  public String getInstanceGroupTag() {
+    return _record.getSimpleField(IdealStateProperty.INSTANCE_GROUP_TAG.toString());
   }
 
-  private RebalanceMode normalizeRebalanceMode(IdealStateModeProperty mode)
-  {
+  private RebalanceMode normalizeRebalanceMode(IdealStateModeProperty mode) {
     RebalanceMode property;
-    switch (mode)
-    {
+    switch (mode) {
     case AUTO_REBALANCE:
       property = RebalanceMode.FULL_AUTO;
       break;
@@ -388,12 +330,9 @@ public class IdealState extends HelixProperty
       property = RebalanceMode.CUSTOMIZED;
       break;
     default:
-      if (getRebalancerClassName() != null)
-      {
+      if (getRebalancerClassName() != null) {
         property = RebalanceMode.USER_DEFINED;
-      }
-      else
-      {
+      } else {
         property = RebalanceMode.SEMI_AUTO;
       }
       break;
@@ -401,12 +340,9 @@ public class IdealState extends HelixProperty
     return property;
   }
 
-  private IdealStateModeProperty denormalizeRebalanceMode(
-      RebalanceMode rebalancerType)
-  {
+  private IdealStateModeProperty denormalizeRebalanceMode(RebalanceMode rebalancerType) {
     IdealStateModeProperty property;
-    switch (rebalancerType)
-    {
+    switch (rebalancerType) {
     case FULL_AUTO:
       property = IdealStateModeProperty.AUTO_REBALANCE;
       break;

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java b/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
index 6c9ac24..62f52a6 100644
--- a/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
+++ b/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
@@ -30,164 +30,131 @@ import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
 /**
  * Instance configurations
  */
-public class InstanceConfig extends HelixProperty
-{
-  public enum InstanceConfigProperty
-  {
+public class InstanceConfig extends HelixProperty {
+  public enum InstanceConfigProperty {
     HELIX_HOST,
     HELIX_PORT,
     HELIX_ENABLED,
     HELIX_DISABLED_PARTITION,
     TAG_LIST
   }
+
   private static final Logger _logger = Logger.getLogger(InstanceConfig.class.getName());
 
-  public InstanceConfig(String instanceId)
-  {
+  public InstanceConfig(String instanceId) {
     super(instanceId);
   }
 
-  public InstanceConfig(ZNRecord record)
-  {
+  public InstanceConfig(ZNRecord record) {
     super(record);
   }
 
-  public String getHostName()
-  {
+  public String getHostName() {
     return _record.getSimpleField(InstanceConfigProperty.HELIX_HOST.toString());
   }
 
-  public void setHostName(String hostName)
-  {
+  public void setHostName(String hostName) {
     _record.setSimpleField(InstanceConfigProperty.HELIX_HOST.toString(), hostName);
   }
 
-  public String getPort()
-  {
+  public String getPort() {
     return _record.getSimpleField(InstanceConfigProperty.HELIX_PORT.toString());
   }
 
-  public void setPort(String port)
-  {
+  public void setPort(String port) {
     _record.setSimpleField(InstanceConfigProperty.HELIX_PORT.toString(), port);
   }
-  
-  public List<String> getTags()
-  {
+
+  public List<String> getTags() {
     List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString());
-    if(tags == null)
-    {
+    if (tags == null) {
       tags = new ArrayList<String>(0);
     }
     return tags;
   }
-  
-  public void addTag(String tag)
-  {
+
+  public void addTag(String tag) {
     List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString());
-    if(tags == null)
-    {
+    if (tags == null) {
       tags = new ArrayList<String>(0);
     }
-    if(!tags.contains(tag))
-    {
+    if (!tags.contains(tag)) {
       tags.add(tag);
     }
     getRecord().setListField(InstanceConfigProperty.TAG_LIST.toString(), tags);
   }
-  
-  public void removeTag(String tag)
-  {
+
+  public void removeTag(String tag) {
     List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString());
-    if(tags == null)
-    {
+    if (tags == null) {
       return;
     }
-    if(tags.contains(tag))
-    {
+    if (tags.contains(tag)) {
       tags.remove(tag);
     }
   }
-  
-  public boolean containsTag(String tag)
-  {
+
+  public boolean containsTag(String tag) {
     List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString());
-    if(tags == null)
-    {
+    if (tags == null) {
       return false;
     }
     return tags.contains(tag);
   }
 
-  public boolean getInstanceEnabled()
-  {
+  public boolean getInstanceEnabled() {
     return _record.getBooleanField(InstanceConfigProperty.HELIX_ENABLED.toString(), true);
   }
 
-  public void setInstanceEnabled(boolean enabled)
-  {
+  public void setInstanceEnabled(boolean enabled) {
     _record.setBooleanField(InstanceConfigProperty.HELIX_ENABLED.toString(), enabled);
   }
 
-
-  public boolean getInstanceEnabledForPartition(String partition)
-  {
-    // Map<String, String> disabledPartitionMap = _record.getMapField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString());
-    List<String> disabledPartitions = _record.getListField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString());
-    if (disabledPartitions != null && disabledPartitions.contains(partition))
-    {
+  public boolean getInstanceEnabledForPartition(String partition) {
+    // Map<String, String> disabledPartitionMap =
+    // _record.getMapField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString());
+    List<String> disabledPartitions =
+        _record.getListField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString());
+    if (disabledPartitions != null && disabledPartitions.contains(partition)) {
       return false;
-    }
-    else
-    {
+    } else {
       return true;
     }
   }
 
-  public List<String> getDisabledPartitions()
-  {
+  public List<String> getDisabledPartitions() {
     return _record.getListField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString());
 
   }
 
-  public void setInstanceEnabledForPartition(String partitionName, boolean enabled)
-  {
+  public void setInstanceEnabledForPartition(String partitionName, boolean enabled) {
     List<String> list =
         _record.getListField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString());
     Set<String> disabledPartitions = new HashSet<String>();
-    if (list != null)
-    {
+    if (list != null) {
       disabledPartitions.addAll(list);
     }
 
-    if (enabled)
-    {
+    if (enabled) {
       disabledPartitions.remove(partitionName);
-    }
-    else
-    {
+    } else {
       disabledPartitions.add(partitionName);
     }
 
     list = new ArrayList<String>(disabledPartitions);
     Collections.sort(list);
-    _record.setListField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString(),
-                             list);
+    _record.setListField(InstanceConfigProperty.HELIX_DISABLED_PARTITION.toString(), list);
   }
 
   @Override
-  public boolean equals(Object obj)
-  {
-    if (obj instanceof InstanceConfig)
-    {
+  public boolean equals(Object obj) {
+    if (obj instanceof InstanceConfig) {
       InstanceConfig that = (InstanceConfig) obj;
 
-      if (this.getId().equals(that.getId()))
-      {
+      if (this.getId().equals(that.getId())) {
         return true;
       }
     }
@@ -195,19 +162,16 @@ public class InstanceConfig extends HelixProperty
   }
 
   @Override
-  public int hashCode()
-  {
+  public int hashCode() {
     return getId().hashCode();
   }
 
-  public String getInstanceName()
-  {
+  public String getInstanceName() {
     return _record.getId();
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // HELIX-65: remove check for hostname/port existence
     return true;
   }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/LeaderHistory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/LeaderHistory.java b/helix-core/src/main/java/org/apache/helix/model/LeaderHistory.java
index 394a277..8e57143 100644
--- a/helix-core/src/main/java/org/apache/helix/model/LeaderHistory.java
+++ b/helix-core/src/main/java/org/apache/helix/model/LeaderHistory.java
@@ -25,18 +25,14 @@ import java.util.List;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-
-public class LeaderHistory extends HelixProperty
-{
+public class LeaderHistory extends HelixProperty {
   private final static int HISTORY_SIZE = 8;
 
-  public LeaderHistory(String id)
-  {
+  public LeaderHistory(String id) {
     super(id);
   }
 
-  public LeaderHistory(ZNRecord record)
-  {
+  public LeaderHistory(ZNRecord record) {
     super(record);
   }
 
@@ -45,25 +41,21 @@ public class LeaderHistory extends HelixProperty
    * @param clusterName
    * @param instanceName
    */
-  public void updateHistory(String clusterName, String instanceName)
-  {
+  public void updateHistory(String clusterName, String instanceName) {
     List<String> list = _record.getListField(clusterName);
-    if (list == null)
-    {
+    if (list == null) {
       list = new ArrayList<String>();
       _record.setListField(clusterName, list);
     }
 
-    if (list.size() == HISTORY_SIZE)
-    {
+    if (list.size() == HISTORY_SIZE) {
       list.remove(0);
     }
     list.add(instanceName);
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     return true;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/LiveInstance.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/LiveInstance.java b/helix-core/src/main/java/org/apache/helix/model/LiveInstance.java
index 45c4570..584f5b9 100644
--- a/helix-core/src/main/java/org/apache/helix/model/LiveInstance.java
+++ b/helix-core/src/main/java/org/apache/helix/model/LiveInstance.java
@@ -23,14 +23,11 @@ import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
 /**
  * Instance that connects to zookeeper
  */
-public class LiveInstance extends HelixProperty
-{
-  public enum LiveInstanceProperty
-  {
+public class LiveInstance extends HelixProperty {
+  public enum LiveInstanceProperty {
     SESSION_ID,
     HELIX_VERSION,
     LIVE_INSTANCE,
@@ -39,75 +36,61 @@ public class LiveInstance extends HelixProperty
 
   private static final Logger _logger = Logger.getLogger(LiveInstance.class.getName());
 
-  public LiveInstance(String id)
-  {
+  public LiveInstance(String id) {
     super(id);
   }
 
-  public LiveInstance(ZNRecord record)
-  {
+  public LiveInstance(ZNRecord record) {
     super(record);
   }
 
-  public void setSessionId(String sessionId)
-  {
+  public void setSessionId(String sessionId) {
     _record.setSimpleField(LiveInstanceProperty.SESSION_ID.toString(), sessionId);
   }
 
-  public String getSessionId()
-  {
+  public String getSessionId() {
     return _record.getSimpleField(LiveInstanceProperty.SESSION_ID.toString());
   }
 
-  public String getInstanceName()
-  {
+  public String getInstanceName() {
     return _record.getId();
   }
 
-  public String getHelixVersion()
-  {
+  public String getHelixVersion() {
     return _record.getSimpleField(LiveInstanceProperty.HELIX_VERSION.toString());
   }
 
-  public void setHelixVersion(String helixVersion)
-  {
+  public void setHelixVersion(String helixVersion) {
     _record.setSimpleField(LiveInstanceProperty.HELIX_VERSION.toString(), helixVersion);
   }
 
-  public String getLiveInstance()
-  {
+  public String getLiveInstance() {
     return _record.getSimpleField(LiveInstanceProperty.LIVE_INSTANCE.toString());
   }
 
-  public void setLiveInstance(String leader)
-  {
+  public void setLiveInstance(String leader) {
     _record.setSimpleField(LiveInstanceProperty.LIVE_INSTANCE.toString(), leader);
   }
 
-  public long getModifiedTime()
-  {
+  public long getModifiedTime() {
     return _record.getModifiedTime();
   }
-  
-  public String getWebserviceUrl()
-  {
+
+  public String getWebserviceUrl() {
     return _record.getSimpleField(LiveInstanceProperty.ZKPROPERTYTRANSFERURL.toString());
   }
-  
-  public void setWebserviceUrl(String url)
-  {
+
+  public void setWebserviceUrl(String url) {
     _record.setSimpleField(LiveInstanceProperty.ZKPROPERTYTRANSFERURL.toString(), url);
   }
+
   @Override
-  public boolean isValid()
-  {
-    if(getSessionId() == null)
-    {
+  public boolean isValid() {
+    if (getSessionId() == null) {
       _logger.error("liveInstance does not have session id. id:" + _record.getId());
       return false;
     }
-    if(getHelixVersion() == null)
-    {
+    if (getHelixVersion() == null) {
       _logger.error("liveInstance does not have CLM verion. id:" + _record.getId());
       return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/Message.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/Message.java b/helix-core/src/main/java/org/apache/helix/model/Message.java
index fc4df4c..4a35152 100644
--- a/helix-core/src/main/java/org/apache/helix/model/Message.java
+++ b/helix-core/src/main/java/org/apache/helix/model/Message.java
@@ -35,15 +35,12 @@ import org.apache.helix.PropertyKey;
 import org.apache.helix.ZNRecord;
 import org.apache.helix.PropertyKey.Builder;
 
-
 /**
  * 
  */
 
-public class Message extends HelixProperty
-{
-  public enum MessageType
-  {
+public class Message extends HelixProperty {
+  public enum MessageType {
     STATE_TRANSITION,
     SCHEDULER_MSG,
     USER_DEFINE_MSG,
@@ -53,8 +50,7 @@ public class Message extends HelixProperty
     PARTICIPANT_ERROR_REPORT
   };
 
-  public enum Attributes
-  {
+  public enum Attributes {
     MSG_ID,
     SRC_SESSION_ID,
     TGT_SESSION_ID,
@@ -79,36 +75,32 @@ public class Message extends HelixProperty
     RETRY_COUNT,
     STATE_MODEL_FACTORY_NAME,
     BUCKET_SIZE,
-    PARENT_MSG_ID,   // used for group message mode
+    PARENT_MSG_ID, // used for group message mode
     INNER_MESSAGE
   }
 
-  public enum MessageState
-  {
-    NEW, 
+  public enum MessageState {
+    NEW,
     READ, // not used
     UNPROCESSABLE // get exception when create handler
   }
 
-  public static final Comparator<Message> CREATE_TIME_COMPARATOR = new Comparator<Message>(){
+  public static final Comparator<Message> CREATE_TIME_COMPARATOR = new Comparator<Message>() {
     @Override
-    public int compare(Message m1, Message m2)
-    {
-//      long t1 = m1.getCreateTimeStamp();
-//      long t2 = m2.getCreateTimeStamp();
+    public int compare(Message m1, Message m2) {
+      // long t1 = m1.getCreateTimeStamp();
+      // long t2 = m2.getCreateTimeStamp();
       return (int) (m1.getCreateTimeStamp() - m2.getCreateTimeStamp());
     }
   };
-  
+
   // AtomicInteger _groupMsgCountDown = new AtomicInteger(1);
-  
-  public Message(MessageType type, String msgId)
-  {
+
+  public Message(MessageType type, String msgId) {
     this(type.toString(), msgId);
   }
 
-  public Message(String type, String msgId)
-  {
+  public Message(String type, String msgId) {
     super(new ZNRecord(msgId));
     _record.setSimpleField(Attributes.MSG_TYPE.toString(), type);
     setMsgId(msgId);
@@ -116,388 +108,310 @@ public class Message extends HelixProperty
     _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), new Date().getTime());
   }
 
-  public Message(ZNRecord record)
-  {
+  public Message(ZNRecord record) {
     super(record);
-    if (getMsgState() == null)
-    {
+    if (getMsgState() == null) {
       setMsgState(MessageState.NEW);
     }
-    if (getCreateTimeStamp() == 0)
-    {
+    if (getCreateTimeStamp() == 0) {
       _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), new Date().getTime());
     }
   }
 
-  public void setCreateTimeStamp(long timestamp)
-  {
+  public void setCreateTimeStamp(long timestamp) {
     _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), timestamp);
   }
 
-  public Message(ZNRecord record, String id)
-  {
+  public Message(ZNRecord record, String id) {
     super(new ZNRecord(record, id));
     setMsgId(id);
   }
 
-  public void setMsgSubType(String subType)
-  {
+  public void setMsgSubType(String subType) {
     _record.setSimpleField(Attributes.MSG_SUBTYPE.toString(), subType);
   }
 
-  public String getMsgSubType()
-  {
+  public String getMsgSubType() {
     return _record.getSimpleField(Attributes.MSG_SUBTYPE.toString());
   }
 
-  void setMsgType(MessageType type)
-  {
+  void setMsgType(MessageType type) {
     _record.setSimpleField(Attributes.MSG_TYPE.toString(), type.toString());
   }
 
-  public String getMsgType()
-  {
+  public String getMsgType() {
     return _record.getSimpleField(Attributes.MSG_TYPE.toString());
   }
 
-  public String getTgtSessionId()
-  {
+  public String getTgtSessionId() {
     return _record.getSimpleField(Attributes.TGT_SESSION_ID.toString());
   }
 
-  public void setTgtSessionId(String tgtSessionId)
-  {
+  public void setTgtSessionId(String tgtSessionId) {
     _record.setSimpleField(Attributes.TGT_SESSION_ID.toString(), tgtSessionId);
   }
 
-  public String getSrcSessionId()
-  {
+  public String getSrcSessionId() {
     return _record.getSimpleField(Attributes.SRC_SESSION_ID.toString());
   }
 
-  public void setSrcSessionId(String srcSessionId)
-  {
+  public void setSrcSessionId(String srcSessionId) {
     _record.setSimpleField(Attributes.SRC_SESSION_ID.toString(), srcSessionId);
   }
 
-  public String getExecutionSessionId()
-  {
+  public String getExecutionSessionId() {
     return _record.getSimpleField(Attributes.EXE_SESSION_ID.toString());
   }
 
-  public void setExecuteSessionId(String exeSessionId)
-  {
+  public void setExecuteSessionId(String exeSessionId) {
     _record.setSimpleField(Attributes.EXE_SESSION_ID.toString(), exeSessionId);
   }
 
-  public String getMsgSrc()
-  {
+  public String getMsgSrc() {
     return _record.getSimpleField(Attributes.SRC_NAME.toString());
   }
 
-  public void setSrcInstanceType(InstanceType type)
-  {
+  public void setSrcInstanceType(InstanceType type) {
     _record.setEnumField(Attributes.SRC_INSTANCE_TYPE.toString(), type);
   }
 
-  public InstanceType getSrcInstanceType()
-  {
-    return _record.getEnumField(Attributes.SRC_INSTANCE_TYPE.toString(),
-        InstanceType.class, InstanceType.PARTICIPANT);
+  public InstanceType getSrcInstanceType() {
+    return _record.getEnumField(Attributes.SRC_INSTANCE_TYPE.toString(), InstanceType.class,
+        InstanceType.PARTICIPANT);
   }
 
-  public void setSrcName(String msgSrc)
-  {
+  public void setSrcName(String msgSrc) {
     _record.setSimpleField(Attributes.SRC_NAME.toString(), msgSrc);
   }
 
-  public String getTgtName()
-  {
+  public String getTgtName() {
     return _record.getSimpleField(Attributes.TGT_NAME.toString());
   }
 
-  public void setMsgState(MessageState msgState)
-  { // HACK: The "tolowerCase()" call is to make the change backward compatible
-    _record.setSimpleField(Attributes.MSG_STATE.toString(), msgState.toString()
-                                                                    .toLowerCase());
+  public void setMsgState(MessageState msgState) { // HACK: The "tolowerCase()" call is to make the
+                                                   // change backward compatible
+    _record.setSimpleField(Attributes.MSG_STATE.toString(), msgState.toString().toLowerCase());
   }
 
-  public MessageState getMsgState()
-  {
+  public MessageState getMsgState() {
     // HACK: The "toUpperCase()" call is to make the change backward compatible
     return MessageState.valueOf(_record.getSimpleField(Attributes.MSG_STATE.toString())
-                                       .toUpperCase());
+        .toUpperCase());
   }
 
-  public void setPartitionName(String partitionName)
-  {
+  public void setPartitionName(String partitionName) {
     _record.setSimpleField(Attributes.PARTITION_NAME.toString(), partitionName);
   }
 
-  public String getMsgId()
-  {
+  public String getMsgId() {
     return _record.getSimpleField(Attributes.MSG_ID.toString());
   }
 
-  public void setMsgId(String msgId)
-  {
+  public void setMsgId(String msgId) {
     _record.setSimpleField(Attributes.MSG_ID.toString(), msgId);
   }
 
-  public void setFromState(String state)
-  {
+  public void setFromState(String state) {
     _record.setSimpleField(Attributes.FROM_STATE.toString(), state);
   }
 
-  public String getFromState()
-  {
+  public String getFromState() {
     return _record.getSimpleField(Attributes.FROM_STATE.toString());
   }
 
-  public void setToState(String state)
-  {
+  public void setToState(String state) {
     _record.setSimpleField(Attributes.TO_STATE.toString(), state);
   }
 
-  public String getToState()
-  {
+  public String getToState() {
     return _record.getSimpleField(Attributes.TO_STATE.toString());
   }
 
-  public void setTgtName(String msgTgt)
-  {
+  public void setTgtName(String msgTgt) {
     _record.setSimpleField(Attributes.TGT_NAME.toString(), msgTgt);
   }
 
-  public Boolean getDebug()
-  {
+  public Boolean getDebug() {
     return false;
   }
 
-  public Integer getGeneration()
-  {
+  public Integer getGeneration() {
     return 1;
   }
 
-  public void setResourceName(String resourceName)
-  {
+  public void setResourceName(String resourceName) {
     _record.setSimpleField(Attributes.RESOURCE_NAME.toString(), resourceName);
   }
 
-  public String getResourceName()
-  {
+  public String getResourceName() {
     return _record.getSimpleField(Attributes.RESOURCE_NAME.toString());
   }
 
-  public String getPartitionName()
-  {
+  public String getPartitionName() {
     return _record.getSimpleField(Attributes.PARTITION_NAME.toString());
   }
 
-  public String getStateModelDef()
-  {
+  public String getStateModelDef() {
     return _record.getSimpleField(Attributes.STATE_MODEL_DEF.toString());
   }
 
-  public void setStateModelDef(String stateModelDefName)
-  {
+  public void setStateModelDef(String stateModelDefName) {
     _record.setSimpleField(Attributes.STATE_MODEL_DEF.toString(), stateModelDefName);
   }
 
-  public void setReadTimeStamp(long time)
-  {
+  public void setReadTimeStamp(long time) {
     _record.setLongField(Attributes.READ_TIMESTAMP.toString(), time);
   }
 
-  public void setExecuteStartTimeStamp(long time)
-  {
+  public void setExecuteStartTimeStamp(long time) {
     _record.setLongField(Attributes.EXECUTE_START_TIMESTAMP.toString(), time);
   }
 
-  public long getReadTimeStamp()
-  {
+  public long getReadTimeStamp() {
     return _record.getLongField(Attributes.READ_TIMESTAMP.toString(), 0L);
   }
 
-  public long getExecuteStartTimeStamp()
-  {
+  public long getExecuteStartTimeStamp() {
     return _record.getLongField(Attributes.EXECUTE_START_TIMESTAMP.toString(), 0L);
   }
 
-  public long getCreateTimeStamp()
-  {
+  public long getCreateTimeStamp() {
     return _record.getLongField(Attributes.CREATE_TIMESTAMP.toString(), 0L);
   }
 
-  public void setCorrelationId(String correlationId)
-  {
+  public void setCorrelationId(String correlationId) {
     _record.setSimpleField(Attributes.CORRELATION_ID.toString(), correlationId);
   }
 
-  public String getCorrelationId()
-  {
+  public String getCorrelationId() {
     return _record.getSimpleField(Attributes.CORRELATION_ID.toString());
   }
 
-  public int getExecutionTimeout()
-  {
+  public int getExecutionTimeout() {
     return _record.getIntField(Attributes.TIMEOUT.toString(), -1);
   }
 
-  public void setExecutionTimeout(int timeout)
-  {
+  public void setExecutionTimeout(int timeout) {
     _record.setIntField(Attributes.TIMEOUT.toString(), timeout);
   }
 
-  public void setRetryCount(int retryCount)
-  {
+  public void setRetryCount(int retryCount) {
     _record.setIntField(Attributes.RETRY_COUNT.toString(), retryCount);
   }
 
-  public int getRetryCount()
-  {
+  public int getRetryCount() {
     return _record.getIntField(Attributes.RETRY_COUNT.toString(), 0);
   }
 
-  public Map<String, String> getResultMap()
-  {
+  public Map<String, String> getResultMap() {
     return _record.getMapField(Attributes.MESSAGE_RESULT.toString());
   }
 
-  public void setResultMap(Map<String, String> resultMap)
-  {
+  public void setResultMap(Map<String, String> resultMap) {
     _record.setMapField(Attributes.MESSAGE_RESULT.toString(), resultMap);
   }
 
-  public String getStateModelFactoryName()
-  {
+  public String getStateModelFactoryName() {
     return _record.getSimpleField(Attributes.STATE_MODEL_FACTORY_NAME.toString());
   }
 
-  public void setStateModelFactoryName(String factoryName)
-  {
+  public void setStateModelFactoryName(String factoryName) {
     _record.setSimpleField(Attributes.STATE_MODEL_FACTORY_NAME.toString(), factoryName);
   }
 
   // TODO: remove this. impl in HelixProperty
   @Override
-  public int getBucketSize()
-  {
+  public int getBucketSize() {
     return _record.getIntField(Attributes.BUCKET_SIZE.toString(), 0);
   }
 
   @Override
-  public void setBucketSize(int bucketSize)
-  {
-    if (bucketSize > 0)
-    {
+  public void setBucketSize(int bucketSize) {
+    if (bucketSize > 0) {
       _record.setIntField(Attributes.BUCKET_SIZE.toString(), bucketSize);
     }
   }
 
-  public void setAttribute(Attributes attr, String val)
-  {
+  public void setAttribute(Attributes attr, String val) {
     _record.setSimpleField(attr.toString(), val);
   }
-  
-  public String getAttribute(Attributes attr)
-  {
+
+  public String getAttribute(Attributes attr) {
     return _record.getSimpleField(attr.toString());
   }
-  
-  public static Message createReplyMessage(Message srcMessage,
-                                           String instanceName,
-                                           Map<String, String> taskResultMap)
-  {
-    if (srcMessage.getCorrelationId() == null)
-    {
+
+  public static Message createReplyMessage(Message srcMessage, String instanceName,
+      Map<String, String> taskResultMap) {
+    if (srcMessage.getCorrelationId() == null) {
       throw new HelixException("Message " + srcMessage.getMsgId()
           + " does not contain correlation id");
     }
-    Message replyMessage =
-        new Message(MessageType.TASK_REPLY, UUID.randomUUID().toString());
+    Message replyMessage = new Message(MessageType.TASK_REPLY, UUID.randomUUID().toString());
     replyMessage.setCorrelationId(srcMessage.getCorrelationId());
     replyMessage.setResultMap(taskResultMap);
     replyMessage.setTgtSessionId("*");
     replyMessage.setMsgState(MessageState.NEW);
     replyMessage.setSrcName(instanceName);
-    if (srcMessage.getSrcInstanceType() == InstanceType.CONTROLLER)
-    {
+    if (srcMessage.getSrcInstanceType() == InstanceType.CONTROLLER) {
       replyMessage.setTgtName("Controller");
-    }
-    else
-    {
+    } else {
       replyMessage.setTgtName(srcMessage.getMsgSrc());
     }
     return replyMessage;
   }
 
-  public void addPartitionName(String partitionName)
-  {
-    if (_record.getListField(Attributes.PARTITION_NAME.toString()) == null)
-    {
+  public void addPartitionName(String partitionName) {
+    if (_record.getListField(Attributes.PARTITION_NAME.toString()) == null) {
       _record.setListField(Attributes.PARTITION_NAME.toString(), new ArrayList<String>());
     }
-    
+
     List<String> partitionNames = _record.getListField(Attributes.PARTITION_NAME.toString());
-    if (!partitionNames.contains(partitionName))
-    {
+    if (!partitionNames.contains(partitionName)) {
       partitionNames.add(partitionName);
     }
   }
 
-  public List<String> getPartitionNames()
-  {
-    List<String> partitionNames =
-        _record.getListField(Attributes.PARTITION_NAME.toString());
-    if (partitionNames == null)
-    {
+  public List<String> getPartitionNames() {
+    List<String> partitionNames = _record.getListField(Attributes.PARTITION_NAME.toString());
+    if (partitionNames == null) {
       return Collections.emptyList();
     }
 
     return partitionNames;
   }
 
-//  public AtomicInteger getGroupMsgCountDown()
-//  {
-//    return _groupMsgCountDown;
-//  }
-//  
-//  public void setGroupMsgCountDown(AtomicInteger countDown)
-//  {
-//    _groupMsgCountDown = countDown;
-//  }
-  
-  public boolean isControlerMsg()
-  {
+  // public AtomicInteger getGroupMsgCountDown()
+  // {
+  // return _groupMsgCountDown;
+  // }
+  //
+  // public void setGroupMsgCountDown(AtomicInteger countDown)
+  // {
+  // _groupMsgCountDown = countDown;
+  // }
+
+  public boolean isControlerMsg() {
     return getTgtName().equalsIgnoreCase("controller");
   }
-  
-  public PropertyKey getKey(Builder keyBuilder, String instanceName)
-  {
-    if (isControlerMsg())
-    {
+
+  public PropertyKey getKey(Builder keyBuilder, String instanceName) {
+    if (isControlerMsg()) {
       return keyBuilder.controllerMessage(getId());
-    }
-    else
-    {
+    } else {
       return keyBuilder.message(instanceName, getId());
     }
   }
-  
-  private boolean isNullOrEmpty(String data)
-  {
+
+  private boolean isNullOrEmpty(String data) {
     return data == null || data.length() == 0 || data.trim().length() == 0;
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     // TODO: refactor message to state transition message and task-message and
     // implement this function separately
 
-    if (getMsgType().equals(MessageType.STATE_TRANSITION.toString()))
-    {
+    if (getMsgType().equals(MessageType.STATE_TRANSITION.toString())) {
       boolean isNotValid =
           isNullOrEmpty(getTgtName()) || isNullOrEmpty(getPartitionName())
               || isNullOrEmpty(getResourceName()) || isNullOrEmpty(getStateModelDef())

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/Partition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/Partition.java b/helix-core/src/main/java/org/apache/helix/model/Partition.java
index 11e0ad3..0c8b9aa 100644
--- a/helix-core/src/main/java/org/apache/helix/model/Partition.java
+++ b/helix-core/src/main/java/org/apache/helix/model/Partition.java
@@ -22,40 +22,34 @@ package org.apache.helix.model;
 /**
  * The name of a resource
  */
-public class Partition
-{
+public class Partition {
   private final String _partitionName;
 
-  public String getPartitionName()
-  {
+  public String getPartitionName() {
     return _partitionName;
   }
 
-  public Partition(String partitionName)
-  {
+  public Partition(String partitionName) {
     this._partitionName = partitionName;
   }
 
   @Override
-  public boolean equals(Object obj)
-  {
-    if(obj == null || !(obj instanceof Partition)){
+  public boolean equals(Object obj) {
+    if (obj == null || !(obj instanceof Partition)) {
       return false;
     }
 
-    Partition that = (Partition)obj;
+    Partition that = (Partition) obj;
     return _partitionName.equals(that.getPartitionName());
   }
 
   @Override
-  public int hashCode()
-  {
+  public int hashCode() {
     return _partitionName.hashCode();
   }
 
   @Override
-  public String toString()
-  {
+  public String toString() {
     return _partitionName;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/PauseSignal.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/PauseSignal.java b/helix-core/src/main/java/org/apache/helix/model/PauseSignal.java
index c1785e5..4c02546 100644
--- a/helix-core/src/main/java/org/apache/helix/model/PauseSignal.java
+++ b/helix-core/src/main/java/org/apache/helix/model/PauseSignal.java
@@ -22,21 +22,17 @@ package org.apache.helix.model;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-public class PauseSignal extends HelixProperty
-{
-  public PauseSignal(String id)
-  {
+public class PauseSignal extends HelixProperty {
+  public PauseSignal(String id) {
     super(id);
   }
 
-  public PauseSignal(ZNRecord record)
-  {
+  public PauseSignal(ZNRecord record) {
     super(record);
   }
 
   @Override
-  public boolean isValid()
-  { 
+  public boolean isValid() {
     return true;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/PersistentStats.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/PersistentStats.java b/helix-core/src/main/java/org/apache/helix/model/PersistentStats.java
index 1afa55c..e028e66 100644
--- a/helix-core/src/main/java/org/apache/helix/model/PersistentStats.java
+++ b/helix-core/src/main/java/org/apache/helix/model/PersistentStats.java
@@ -19,84 +19,72 @@ package org.apache.helix.model;
  * under the License.
  */
 
-
 import java.util.Map;
 
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 import org.apache.log4j.Logger;
 
-
-public class PersistentStats extends HelixProperty
-{
+public class PersistentStats extends HelixProperty {
   private static final Logger _logger = Logger.getLogger(PersistentStats.class.getName());
 
-  public enum PersistentStatsProperty
-	  {
-	    SESSION_ID,
-	    FIELDS
-	  }
-	
-//  private final ZNRecord _record;
-	
+  public enum PersistentStatsProperty {
+    SESSION_ID,
+    FIELDS
+  }
+
+  // private final ZNRecord _record;
+
   public final static String nodeName = "PersistentStats";
-	
-  
-  public PersistentStats(String id)
-  {
+
+  public PersistentStats(String id) {
     super(id);
   }
-  
-  public PersistentStats(ZNRecord record)
-  {
-//    _record = record;
+
+  public PersistentStats(ZNRecord record) {
+    // _record = record;
     super(record);
 
   }
 
   /*
-  public PersistentStats(ZNRecord record, Stat stat)
-  {
-    super(record, stat);
-  }
-*/
+   * public PersistentStats(ZNRecord record, Stat stat)
+   * {
+   * super(record, stat);
+   * }
+   */
 
-  public void setSessionId(String sessionId){
+  public void setSessionId(String sessionId) {
     _record.setSimpleField(PersistentStatsProperty.SESSION_ID.toString(), sessionId);
   }
-  public String getSessionId()
-  {
+
+  public String getSessionId() {
     return _record.getSimpleField(PersistentStatsProperty.SESSION_ID.toString());
   }
 
-  public String getInstanceName()
-  {
+  public String getInstanceName() {
     return _record.getId();
   }
 
   /*
-  public String getVersion()
-  {
-    return _record.getSimpleField(CLUSTER_MANAGER_VERSION.toString());
-  }
-  */
-  
-  
+   * public String getVersion()
+   * {
+   * return _record.getSimpleField(CLUSTER_MANAGER_VERSION.toString());
+   * }
+   */
+
   public Map<String, Map<String, String>> getMapFields() {
-	  return _record.getMapFields();
+    return _record.getMapFields();
   }
-  
-  
+
   public Map<String, String> getStatFields(String statName) {
-	  return _record.getMapField(statName);
+    return _record.getMapField(statName);
   }
 
-@Override
-public boolean isValid() {
-	// TODO Auto-generated method stub
-	return true;
-}
-  
-}
-
+  @Override
+  public boolean isValid() {
+    // TODO Auto-generated method stub
+    return true;
+  }
 
+}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/Resource.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/Resource.java b/helix-core/src/main/java/org/apache/helix/model/Resource.java
index 9f027d9..b6ffea7 100644
--- a/helix-core/src/main/java/org/apache/helix/model/Resource.java
+++ b/helix-core/src/main/java/org/apache/helix/model/Resource.java
@@ -26,12 +26,10 @@ import java.util.Map;
 import org.apache.helix.HelixConstants;
 import org.apache.log4j.Logger;
 
-
 /**
  * A resource contains a set of partitions
  */
-public class Resource
-{
+public class Resource {
   private static Logger LOG = Logger.getLogger(Resource.class);
 
   private final String _resourceName;
@@ -41,81 +39,65 @@ public class Resource
   private int _bucketSize = 0;
   private boolean _batchMessageMode = false;
 
-  public Resource(String resourceName)
-  {
+  public Resource(String resourceName) {
     this._resourceName = resourceName;
     this._partitionMap = new LinkedHashMap<String, Partition>();
   }
 
-  public String getStateModelDefRef()
-  {
+  public String getStateModelDefRef() {
     return _stateModelDefRef;
   }
 
-  public void setStateModelDefRef(String stateModelDefRef)
-  {
+  public void setStateModelDefRef(String stateModelDefRef) {
     _stateModelDefRef = stateModelDefRef;
   }
 
-  public void setStateModelFactoryName(String factoryName)
-  {
-    if (factoryName == null)
-    {
+  public void setStateModelFactoryName(String factoryName) {
+    if (factoryName == null) {
       _stateModelFactoryName = HelixConstants.DEFAULT_STATE_MODEL_FACTORY;
-    } else
-    {
+    } else {
       _stateModelFactoryName = factoryName;
     }
   }
 
-  public String getStateModelFactoryname()
-  {
+  public String getStateModelFactoryname() {
     return _stateModelFactoryName;
   }
 
-  public String getResourceName()
-  {
+  public String getResourceName() {
     return _resourceName;
   }
 
-  public Collection<Partition> getPartitions()
-  {
+  public Collection<Partition> getPartitions() {
     return _partitionMap.values();
   }
 
-  public void addPartition(String partitionName)
-  {
+  public void addPartition(String partitionName) {
     _partitionMap.put(partitionName, new Partition(partitionName));
   }
 
-  public Partition getPartition(String partitionName)
-  {
+  public Partition getPartition(String partitionName) {
     return _partitionMap.get(partitionName);
   }
 
-  public int getBucketSize()
-  {
+  public int getBucketSize() {
     return _bucketSize;
   }
-  
-  public void setBucketSize(int bucketSize)
-  {
+
+  public void setBucketSize(int bucketSize) {
     _bucketSize = bucketSize;
   }
 
-  public void setBatchMessageMode(boolean mode)
-  {
+  public void setBatchMessageMode(boolean mode) {
     _batchMessageMode = mode;
   }
-  
-  public boolean getBatchMessageMode()
-  {
+
+  public boolean getBatchMessageMode() {
     return _batchMessageMode;
   }
-  
+
   @Override
-  public String toString()
-  {
+  public String toString() {
     StringBuilder sb = new StringBuilder();
     sb.append("resourceName:").append(_resourceName);
     sb.append(", stateModelDef:").append(_stateModelDefRef);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/ResourceAssignment.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/ResourceAssignment.java b/helix-core/src/main/java/org/apache/helix/model/ResourceAssignment.java
index de04aee..b0d7f1f 100644
--- a/helix-core/src/main/java/org/apache/helix/model/ResourceAssignment.java
+++ b/helix-core/src/main/java/org/apache/helix/model/ResourceAssignment.java
@@ -19,7 +19,6 @@ package org.apache.helix.model;
  * under the License.
  */
 
-public class ResourceAssignment
-{
+public class ResourceAssignment {
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/StateModelDefinition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/StateModelDefinition.java b/helix-core/src/main/java/org/apache/helix/model/StateModelDefinition.java
index cf787ff..31224d5 100644
--- a/helix-core/src/main/java/org/apache/helix/model/StateModelDefinition.java
+++ b/helix-core/src/main/java/org/apache/helix/model/StateModelDefinition.java
@@ -37,20 +37,19 @@ import org.apache.log4j.Logger;
 /**
  * Describe the state model
  */
-public class StateModelDefinition extends HelixProperty
-{
-  public enum StateModelDefinitionProperty
-  {
-    INITIAL_STATE, STATE_TRANSITION_PRIORITYLIST, STATE_PRIORITY_LIST
+public class StateModelDefinition extends HelixProperty {
+  public enum StateModelDefinitionProperty {
+    INITIAL_STATE,
+    STATE_TRANSITION_PRIORITYLIST,
+    STATE_PRIORITY_LIST
   }
-  
-  private static final Logger _logger = Logger
-      .getLogger(StateModelDefinition.class.getName());
+
+  private static final Logger _logger = Logger.getLogger(StateModelDefinition.class.getName());
   /**
    * state model's initial state
    */
   private final String _initialState;
-  
+
   /**
    * State Names in priority order. Indicates the order in which states are
    * fulfilled
@@ -76,33 +75,26 @@ public class StateModelDefinition extends HelixProperty
    */
   private final Map<String, Map<String, String>> _stateTransitionTable;
 
-  public StateModelDefinition(ZNRecord record)
-  {
+  public StateModelDefinition(ZNRecord record) {
     super(record);
 
     _initialState = record.getSimpleField(StateModelDefinitionProperty.INITIAL_STATE.toString());
-    
+
     if (_initialState == null) {
       throw new IllegalArgumentException("initial-state for " + record.getId() + " is null");
     }
-    
-    _statesPriorityList = record
-        .getListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST
-            .toString());
-    _stateTransitionPriorityList = record
-        .getListField(StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST
-            .toString());
+
+    _statesPriorityList =
+        record.getListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString());
+    _stateTransitionPriorityList =
+        record.getListField(StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST.toString());
     _stateTransitionTable = new HashMap<String, Map<String, String>>();
     _statesCountMap = new HashMap<String, String>();
-    if (_statesPriorityList != null)
-    {
-      for (String state : _statesPriorityList)
-      {
+    if (_statesPriorityList != null) {
+      for (String state : _statesPriorityList) {
         Map<String, String> metaData = record.getMapField(state + ".meta");
-        if (metaData != null)
-        {
-          if (metaData.get("count") != null)
-          {
+        if (metaData != null) {
+          if (metaData.get("count") != null) {
             _statesCountMap.put(state, metaData.get("count"));
           }
         }
@@ -110,22 +102,21 @@ public class StateModelDefinition extends HelixProperty
         _stateTransitionTable.put(state, nextData);
       }
     }
-    
+
     // add transitions for helix-defined states
     for (HelixDefinedState state : HelixDefinedState.values()) {
       if (!_statesPriorityList.contains(state.toString())) {
         _statesCountMap.put(state.toString(), "-1");
       }
     }
-    
-    addDefaultTransition(HelixDefinedState.ERROR.toString(), 
-        HelixDefinedState.DROPPED.toString(), HelixDefinedState.DROPPED.toString()); 
-    addDefaultTransition(HelixDefinedState.ERROR.toString(), 
-        _initialState, _initialState);
-    addDefaultTransition(_initialState, 
-        HelixDefinedState.DROPPED.toString(), HelixDefinedState.DROPPED.toString());  
+
+    addDefaultTransition(HelixDefinedState.ERROR.toString(), HelixDefinedState.DROPPED.toString(),
+        HelixDefinedState.DROPPED.toString());
+    addDefaultTransition(HelixDefinedState.ERROR.toString(), _initialState, _initialState);
+    addDefaultTransition(_initialState, HelixDefinedState.DROPPED.toString(),
+        HelixDefinedState.DROPPED.toString());
   }
-  
+
   /**
    * add transitions involving helix-defines states
    * these transitions need not to be specified in state-model-definition
@@ -137,59 +128,47 @@ public class StateModelDefinition extends HelixProperty
     if (!_stateTransitionTable.containsKey(from)) {
       _stateTransitionTable.put(from, new TreeMap<String, String>());
     }
-    
+
     if (!_stateTransitionTable.get(from).containsKey(to)) {
       _stateTransitionTable.get(from).put(to, next);
     }
   }
 
-  public List<String> getStateTransitionPriorityList()
-  {
+  public List<String> getStateTransitionPriorityList() {
     return _stateTransitionPriorityList;
   }
 
-  public List<String> getStatesPriorityList()
-  {
+  public List<String> getStatesPriorityList() {
     return _statesPriorityList;
   }
 
-  public String getNextStateForTransition(String fromState, String toState)
-  {
+  public String getNextStateForTransition(String fromState, String toState) {
     Map<String, String> map = _stateTransitionTable.get(fromState);
-    if (map != null)
-    {
+    if (map != null) {
       return map.get(toState);
     }
     return null;
   }
 
-  public String getInitialState()
-  {
-//    return _record.getSimpleField(StateModelDefinitionProperty.INITIAL_STATE
-//        .toString());
+  public String getInitialState() {
+    // return _record.getSimpleField(StateModelDefinitionProperty.INITIAL_STATE
+    // .toString());
     return _initialState;
   }
 
-  public String getNumInstancesPerState(String state)
-  {
+  public String getNumInstancesPerState(String state) {
     return _statesCountMap.get(state);
   }
 
   @Override
-  public boolean isValid()
-  {
-    if (getInitialState() == null)
-    {
-      _logger.error("State model does not contain init state, statemodel:"
-          + _record.getId());
+  public boolean isValid() {
+    if (getInitialState() == null) {
+      _logger.error("State model does not contain init state, statemodel:" + _record.getId());
       return false;
     }
-    if (_record.getListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST
-        .toString()) == null)
-    {
-      _logger
-          .error("CurrentState does not contain StatesPriorityList, state model : "
-              + _record.getId());
+    if (_record.getListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString()) == null) {
+      _logger.error("CurrentState does not contain StatesPriorityList, state model : "
+          + _record.getId());
       return false;
     }
     return true;
@@ -200,16 +179,14 @@ public class StateModelDefinition extends HelixProperty
    * 
    *
    */
-  public static class Builder
-  {
+  public static class Builder {
     private final String _statemodelName;
     private String initialState;
     Map<String, Integer> statesMap;
     Map<Transition, Integer> transitionMap;
     Map<String, String> stateConstraintMap;
 
-    public Builder(String name)
-    {
+    public Builder(String name) {
       this._statemodelName = name;
       statesMap = new HashMap<String, Integer>();
       transitionMap = new HashMap<Transition, Integer>();
@@ -219,11 +196,9 @@ public class StateModelDefinition extends HelixProperty
     /**
      * initial state of a replica when it starts, most commonly used initial
      * state is OFFLINE
-     * 
      * @param state
      */
-    public Builder initialState(String initialState)
-    {
+    public Builder initialState(String initialState) {
       this.initialState = initialState;
       return this;
     }
@@ -234,22 +209,18 @@ public class StateModelDefinition extends HelixProperty
      * STATE2 has a constraint of 3 but only one node is up then Helix will uses
      * the priority to see STATE constraint has to be given higher preference <br/>
      * Use -1 to indicates states with no constraints, like OFFLINE
-     * 
      * @param states
      */
-    public Builder addState(String state, int priority)
-    {
+    public Builder addState(String state, int priority) {
       statesMap.put(state, priority);
       return this;
     }
 
     /**
      * Sets the priority to Integer.MAX_VALUE
-     * 
      * @param state
      */
-    public Builder addState(String state)
-    {
+    public Builder addState(String state) {
       addState(state, Integer.MAX_VALUE);
       return this;
     }
@@ -261,25 +232,21 @@ public class StateModelDefinition extends HelixProperty
      * constraint. The transitions are first sorted based on priority and
      * transitions are selected in a greedy way until the constriants are not
      * violated.
-     * 
      * @param fromState
      * @param toState
      * @param priority
      */
-    public Builder addTransition(String fromState, String toState, int priority)
-    {
+    public Builder addTransition(String fromState, String toState, int priority) {
       transitionMap.put(new Transition(fromState, toState), priority);
       return this;
     }
 
-    public Builder addTransition(String fromState, String toState)
-    {
+    public Builder addTransition(String fromState, String toState) {
       addTransition(fromState, toState, Integer.MAX_VALUE);
       return this;
     }
 
-    public Builder upperBound(String state, int upperBound)
-    {
+    public Builder upperBound(String state, int upperBound) {
       stateConstraintMap.put(state, String.valueOf(upperBound));
       return this;
     }
@@ -294,75 +261,56 @@ public class StateModelDefinition extends HelixProperty
      * N --> Refers to all nodes in the cluster. Useful for resources that need
      * to exist on all nodes. This way one can add/remove nodes without having
      * the change the bounds.
-     * 
      * @param state
      * @param bound
      */
-    public Builder dynamicUpperBound(String state, String bound)
-    {
+    public Builder dynamicUpperBound(String state, String bound) {
       stateConstraintMap.put(state, bound);
       return this;
     }
 
-    public StateModelDefinition build()
-    {
+    public StateModelDefinition build() {
       ZNRecord record = new ZNRecord(_statemodelName);
-      ArrayList<String> statePriorityList = new ArrayList<String>(
-          statesMap.keySet());
-      Comparator<? super String> c1 = new Comparator<String>()
-      {
+      ArrayList<String> statePriorityList = new ArrayList<String>(statesMap.keySet());
+      Comparator<? super String> c1 = new Comparator<String>() {
 
         @Override
-        public int compare(String o1, String o2)
-        {
+        public int compare(String o1, String o2) {
           return statesMap.get(o1).compareTo(statesMap.get(o2));
         }
       };
       Collections.sort(statePriorityList, c1);
-      ArrayList<Transition> transitionList = new ArrayList<Transition>(
-          transitionMap.keySet());
+      ArrayList<Transition> transitionList = new ArrayList<Transition>(transitionMap.keySet());
 
-      Comparator<? super Transition> c2 = new Comparator<Transition>()
-      {
+      Comparator<? super Transition> c2 = new Comparator<Transition>() {
         @Override
-        public int compare(Transition o1, Transition o2)
-        {
+        public int compare(Transition o1, Transition o2) {
           return transitionMap.get(o1).compareTo(transitionMap.get(o2));
         }
       };
       Collections.sort(transitionList, c2);
-      List<String> transitionPriorityList = new ArrayList<String>(
-          transitionList.size());
-      for (Transition t : transitionList)
-      {
+      List<String> transitionPriorityList = new ArrayList<String>(transitionList.size());
+      for (Transition t : transitionList) {
         transitionPriorityList.add(t.toString());
       }
 
-      record.setSimpleField(
-          StateModelDefinitionProperty.INITIAL_STATE.toString(), initialState);
-      record.setListField(
-          StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString(),
+      record.setSimpleField(StateModelDefinitionProperty.INITIAL_STATE.toString(), initialState);
+      record.setListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString(),
           statePriorityList);
-      record
-          .setListField(
-              StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST
-                  .toString(), transitionPriorityList);
+      record.setListField(StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST.toString(),
+          transitionPriorityList);
       StateTransitionTableBuilder stateTransitionTableBuilder = new StateTransitionTableBuilder();
-      Map<String, Map<String, String>> transitionTable = stateTransitionTableBuilder
-          .buildTransitionTable(statePriorityList, new ArrayList<Transition>(
-              transitionMap.keySet()));
-      for (String state : transitionTable.keySet())
-      {
+      Map<String, Map<String, String>> transitionTable =
+          stateTransitionTableBuilder.buildTransitionTable(statePriorityList,
+              new ArrayList<Transition>(transitionMap.keySet()));
+      for (String state : transitionTable.keySet()) {
         record.setMapField(state + ".next", transitionTable.get(state));
       }
-      for (String state : statePriorityList)
-      {
+      for (String state : statePriorityList) {
         HashMap<String, String> metadata = new HashMap<String, String>();
-        if (stateConstraintMap.get(state) != null)
-        {
+        if (stateConstraintMap.get(state) != null) {
           metadata.put("count", stateConstraintMap.get(state));
-        } else
-        {
+        } else {
           metadata.put("count", "-1");
         }
         record.setMapField(state + ".meta", metadata);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/StatusUpdate.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/StatusUpdate.java b/helix-core/src/main/java/org/apache/helix/model/StatusUpdate.java
index 4079e2f..d65a333 100644
--- a/helix-core/src/main/java/org/apache/helix/model/StatusUpdate.java
+++ b/helix-core/src/main/java/org/apache/helix/model/StatusUpdate.java
@@ -22,19 +22,15 @@ package org.apache.helix.model;
 import org.apache.helix.HelixProperty;
 import org.apache.helix.ZNRecord;
 
-public class StatusUpdate extends HelixProperty
-{
+public class StatusUpdate extends HelixProperty {
 
-  public StatusUpdate(ZNRecord record)
-  {
+  public StatusUpdate(ZNRecord record) {
     super(record);
   }
 
   @Override
-  public boolean isValid()
-  {
+  public boolean isValid() {
     return true;
   }
 
-  
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/Transition.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/Transition.java b/helix-core/src/main/java/org/apache/helix/model/Transition.java
index 0accfaa..2bbec41 100644
--- a/helix-core/src/main/java/org/apache/helix/model/Transition.java
+++ b/helix-core/src/main/java/org/apache/helix/model/Transition.java
@@ -19,47 +19,39 @@ package org.apache.helix.model;
  * under the License.
  */
 
-public class Transition
-{
+public class Transition {
   final private String _fromState;
   final private String _toState;
 
-  public Transition(String fromState, String toState)
-  {
+  public Transition(String fromState, String toState) {
     _fromState = fromState;
     _toState = toState;
   }
 
   @Override
-  public String toString()
-  {
+  public String toString() {
     return _fromState + "-" + _toState;
   }
 
   @Override
-  public int hashCode()
-  {
+  public int hashCode() {
     return toString().hashCode();
   }
 
   @Override
-  public boolean equals(Object that)
-  {
-    if (that == null || !(that instanceof Transition))
-    {
+  public boolean equals(Object that) {
+    if (that == null || !(that instanceof Transition)) {
       return false;
     }
     return this.toString().equalsIgnoreCase(that.toString());
   }
 
-  public String getFromState()
-  {
+  public String getFromState() {
     return _fromState;
   }
 
-  public String getToState()
-  {
+  public String getToState() {
     return _toState;
   }
 
-}
\ 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/model/builder/AutoModeISBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/AutoModeISBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/AutoModeISBuilder.java
index ab98998..535f25b 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/AutoModeISBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/AutoModeISBuilder.java
@@ -25,26 +25,21 @@ import java.util.ArrayList;
 import java.util.Arrays;
 
 public class AutoModeISBuilder extends IdealStateBuilder {
-    public AutoModeISBuilder(String resourceName)
-    {
-        super(resourceName);
-        setRebalancerMode(RebalanceMode.SEMI_AUTO);
-    }
+  public AutoModeISBuilder(String resourceName) {
+    super(resourceName);
+    setRebalancerMode(RebalanceMode.SEMI_AUTO);
+  }
 
-    public void add(String partitionName)
-    {
-        if (_record.getListField(partitionName) == null)
-        {
-            _record.setListField(partitionName, new ArrayList<String>());
-        }
+  public void add(String partitionName) {
+    if (_record.getListField(partitionName) == null) {
+      _record.setListField(partitionName, new ArrayList<String>());
     }
+  }
 
-    public AutoModeISBuilder assignPreferenceList(String partitionName,
-                                     String... instanceNames)
-    {
-        add(partitionName);
-        _record.getListField(partitionName).addAll(Arrays.asList(instanceNames));
-        return this;
-    }
+  public AutoModeISBuilder assignPreferenceList(String partitionName, String... instanceNames) {
+    add(partitionName);
+    _record.getListField(partitionName).addAll(Arrays.asList(instanceNames));
+    return this;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
index fcb4e0f..3368c87 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/AutoRebalanceModeISBuilder.java
@@ -24,26 +24,22 @@ import org.apache.helix.model.IdealState.RebalanceMode;
 import java.util.ArrayList;
 
 public class AutoRebalanceModeISBuilder extends IdealStateBuilder {
-    public AutoRebalanceModeISBuilder(String resourceName)
-    {
-        super(resourceName);
-        setRebalancerMode(RebalanceMode.FULL_AUTO);
-    }
-
-    /**
-     * Add a partition, Helix will automatically assign the placement and state
-     * for this partition at runtime.
-     *
-     * @param partitionName
-     */
-    public AutoRebalanceModeISBuilder add(String partitionName)
-    {
-        if (_record.getListField(partitionName) == null)
-        {
-            _record.setListField(partitionName, new ArrayList<String>());
-        }
+  public AutoRebalanceModeISBuilder(String resourceName) {
+    super(resourceName);
+    setRebalancerMode(RebalanceMode.FULL_AUTO);
+  }
 
-        return this;
+  /**
+   * Add a partition, Helix will automatically assign the placement and state
+   * for this partition at runtime.
+   * @param partitionName
+   */
+  public AutoRebalanceModeISBuilder add(String partitionName) {
+    if (_record.getListField(partitionName) == null) {
+      _record.setListField(partitionName, new ArrayList<String>());
     }
 
+    return this;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/builder/ClusterConstraintsBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/ClusterConstraintsBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/ClusterConstraintsBuilder.java
index 63020d6..59cd825 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/ClusterConstraintsBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/ClusterConstraintsBuilder.java
@@ -30,20 +30,18 @@ public class ClusterConstraintsBuilder {
   private static Logger LOG = Logger.getLogger(ClusterConstraintsBuilder.class);
 
   final private ConstraintType _constraintType;
-  
+
   /**
    * constraint-id -> constraint-item-builder
-   * 
-   *   e.g. constraint_1: at most 1 offline->slave state transition message for MyDB:
-   *   constraint_1:
-   *     MESSAGE_TYPE     : StateTransition
-   *     RESOURCE         : MyDB
-   *     TRANSITION       : OFFLINE->SLAVE
-   *     CONSTRAINT_VALUE : 1     
-   *     
+   * e.g. constraint_1: at most 1 offline->slave state transition message for MyDB:
+   * constraint_1:
+   * MESSAGE_TYPE : StateTransition
+   * RESOURCE : MyDB
+   * TRANSITION : OFFLINE->SLAVE
+   * CONSTRAINT_VALUE : 1
    */
-  private final Map<String, ConstraintItemBuilder> _constraintBuilderMap = new HashMap<String, ConstraintItemBuilder>();
-
+  private final Map<String, ConstraintItemBuilder> _constraintBuilderMap =
+      new HashMap<String, ConstraintItemBuilder>();
 
   public ClusterConstraintsBuilder(ConstraintType type) {
     if (type == null) {
@@ -51,19 +49,20 @@ public class ClusterConstraintsBuilder {
     }
     _constraintType = type;
   }
-  
-  public ClusterConstraintsBuilder addConstraintAttribute(String constraintId, String attribute, String value) {
+
+  public ClusterConstraintsBuilder addConstraintAttribute(String constraintId, String attribute,
+      String value) {
     if (!_constraintBuilderMap.containsKey(constraintId)) {
       _constraintBuilderMap.put(constraintId, new ConstraintItemBuilder());
     }
-    ConstraintItemBuilder builder =  _constraintBuilderMap.get(constraintId);
+    ConstraintItemBuilder builder = _constraintBuilderMap.get(constraintId);
     builder.addConstraintAttribute(attribute, value);
     return this;
   }
-  
+
   public ClusterConstraints build() {
     ClusterConstraints constraints = new ClusterConstraints(_constraintType);
-    
+
     for (String constraintId : _constraintBuilderMap.keySet()) {
       ConstraintItemBuilder builder = _constraintBuilderMap.get(constraintId);
       constraints.addConstraintItem(constraintId, builder.build());

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/builder/ConfigScopeBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/ConfigScopeBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/ConfigScopeBuilder.java
index 7afb43e..a8ce835 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/ConfigScopeBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/ConfigScopeBuilder.java
@@ -27,75 +27,66 @@ import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
 import org.apache.helix.util.StringTemplate;
 import org.apache.log4j.Logger;
 
-
 /**
  * @deprecated replaced by {@link HelixConfigScopeBuilder}
  */
 @Deprecated
-public class ConfigScopeBuilder
-{
+public class ConfigScopeBuilder {
   private static Logger LOG = Logger.getLogger(ConfigScopeBuilder.class);
 
   private static StringTemplate template = new StringTemplate();
-  static
-  {
+  static {
     // @formatter:off
     template.addEntry(ConfigScopeProperty.CLUSTER, 1, "CLUSTER={clusterName}");
-    template.addEntry(ConfigScopeProperty.RESOURCE, 2, "CLUSTER={clusterName},RESOURCE={resourceName}");
-    template.addEntry(ConfigScopeProperty.PARTITION, 3, "CLUSTER={clusterName},RESOURCE={resourceName},PARTITION={partitionName}");
-    template.addEntry(ConfigScopeProperty.PARTICIPANT, 2, "CLUSTER={clusterName},PARTICIPANT={participantName}");
+    template.addEntry(ConfigScopeProperty.RESOURCE, 2,
+        "CLUSTER={clusterName},RESOURCE={resourceName}");
+    template.addEntry(ConfigScopeProperty.PARTITION, 3,
+        "CLUSTER={clusterName},RESOURCE={resourceName},PARTITION={partitionName}");
+    template.addEntry(ConfigScopeProperty.PARTICIPANT, 2,
+        "CLUSTER={clusterName},PARTICIPANT={participantName}");
     // @formatter:on
   }
 
   private final Map<ConfigScopeProperty, String> _scopeMap;
 
-  public Map<ConfigScopeProperty, String> getScopeMap()
-  {
+  public Map<ConfigScopeProperty, String> getScopeMap() {
     return _scopeMap;
   }
 
-  public ConfigScopeBuilder()
-  {
+  public ConfigScopeBuilder() {
     _scopeMap = new HashMap<ConfigScopeProperty, String>();
   }
 
-  public ConfigScopeBuilder forCluster(String clusterName)
-  {
+  public ConfigScopeBuilder forCluster(String clusterName) {
     _scopeMap.put(ConfigScopeProperty.CLUSTER, clusterName);
     return this;
   }
 
-  public ConfigScopeBuilder forParticipant(String participantName)
-  {
+  public ConfigScopeBuilder forParticipant(String participantName) {
     _scopeMap.put(ConfigScopeProperty.PARTICIPANT, participantName);
     return this;
   }
 
-  public ConfigScopeBuilder forResource(String resourceName)
-  {
+  public ConfigScopeBuilder forResource(String resourceName) {
     _scopeMap.put(ConfigScopeProperty.RESOURCE, resourceName);
     return this;
 
   }
 
-  public ConfigScopeBuilder forPartition(String partitionName)
-  {
+  public ConfigScopeBuilder forPartition(String partitionName) {
     _scopeMap.put(ConfigScopeProperty.PARTITION, partitionName);
     return this;
 
   }
 
-  public ConfigScope build()
-  {
+  public ConfigScope build() {
     // TODO: validate the scopes map
     return new ConfigScope(this);
   }
 
-  public ConfigScope build(ConfigScopeProperty scope, String clusterName, String... scopeKeys)
-  {
-    if (scopeKeys == null)
-    {
-      scopeKeys = new String[]{};
+  public ConfigScope build(ConfigScopeProperty scope, String clusterName, String... scopeKeys) {
+    if (scopeKeys == null) {
+      scopeKeys = new String[] {};
     }
 
     String[] args = new String[1 + scopeKeys.length];
@@ -106,16 +97,12 @@ public class ConfigScopeBuilder
     return build(scopePairs);
   }
 
-  public ConfigScope build(String scopePairs)
-  {
+  public ConfigScope build(String scopePairs) {
     String[] scopes = scopePairs.split("[\\s,]+");
-    for (String scope : scopes)
-    {
-      try
-      {
+    for (String scope : scopes) {
+      try {
         int idx = scope.indexOf('=');
-        if (idx == -1)
-        {
+        if (idx == -1) {
           LOG.error("Invalid scope string: " + scope);
           continue;
         }
@@ -124,8 +111,7 @@ public class ConfigScopeBuilder
         String value = scope.substring(idx + 1);
         ConfigScopeProperty scopeProperty = ConfigScopeProperty.valueOf(scopeStr);
         _scopeMap.put(scopeProperty, value);
-      } catch (Exception e)
-      {
+      } catch (Exception e) {
         LOG.error("Invalid scope string: " + scope);
         continue;
       }
@@ -135,8 +121,7 @@ public class ConfigScopeBuilder
   }
 
   @Override
-  public String toString()
-  {
+  public String toString() {
     return _scopeMap.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/f414aad4/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java b/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
index ed788b2..6296b04 100644
--- a/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
+++ b/helix-core/src/main/java/org/apache/helix/model/builder/ConstraintItemBuilder.java
@@ -27,18 +27,16 @@ import org.apache.helix.model.ClusterConstraints.ConstraintAttribute;
 import org.apache.helix.model.ClusterConstraints.ConstraintValue;
 import org.apache.log4j.Logger;
 
-
 public class ConstraintItemBuilder {
 
   private static Logger LOG = Logger.getLogger(ConstraintItemBuilder.class);
-  
+
   // attributes e.g. {STATE:MASTER, RESOURCE:TestDB, INSTANCE:localhost_12918}
   final Map<ConstraintAttribute, String> _attributes = new TreeMap<ConstraintAttribute, String>();
   String _constraintValue = null;
 
   /**
    * add an attribute to constraint-item, overwrite if already exists
-   * 
    * @param attribute
    * @param value
    */
@@ -46,64 +44,59 @@ public class ConstraintItemBuilder {
     // make sure constraint attribute is valid
     try {
       ConstraintAttribute attr = ConstraintAttribute.valueOf(attribute.toUpperCase());
-      
+
       if (attr == ConstraintAttribute.CONSTRAINT_VALUE) {
         // make sure constraint-value is valid
-        try
-        {
+        try {
           ConstraintValue.valueOf(value);
           if (_constraintValue == null) {
-            LOG.info("overwrite existing constraint-value. old-value: " + _constraintValue 
+            LOG.info("overwrite existing constraint-value. old-value: " + _constraintValue
                 + ", new-value: " + value);
           }
           _constraintValue = value;
-        } catch (IllegalArgumentException e)
-        {
-          try
-          {
+        } catch (IllegalArgumentException e) {
+          try {
             Integer.parseInt(value);
             if (_constraintValue == null) {
-              LOG.info("overwrite existing constraint-value. old-value: " + _constraintValue 
+              LOG.info("overwrite existing constraint-value. old-value: " + _constraintValue
                   + ", new-value: " + value);
             }
             _constraintValue = value;
-          }
-          catch (NumberFormatException ne)
-          {
-            LOG.error("fail to add constraint attribute. Invalid constraintValue. " 
-              + attribute + ": " + attribute + ", value: " + value);
+          } catch (NumberFormatException ne) {
+            LOG.error("fail to add constraint attribute. Invalid constraintValue. " + attribute
+                + ": " + attribute + ", value: " + value);
           }
         }
       } else {
         if (_attributes.containsKey(attr)) {
-          LOG.info("overwrite existing constraint attribute. attribute: " 
-            + attribute + ", old-value: " + _attributes.get(attr) + ", new-value: " + value);
+          LOG.info("overwrite existing constraint attribute. attribute: " + attribute
+              + ", old-value: " + _attributes.get(attr) + ", new-value: " + value);
         }
         _attributes.put(attr, value);
       }
     } catch (IllegalArgumentException e) {
-      LOG.error("fail to add constraint attribute. Invalid attribute type. attribute: " 
-          + attribute + ", value: " + value);
+      LOG.error("fail to add constraint attribute. Invalid attribute type. attribute: " + attribute
+          + ", value: " + value);
     }
-    
+
     return this;
   }
-  
+
   public ConstraintItemBuilder addConstraintAttributes(Map<String, String> attributes) {
     for (String attr : attributes.keySet()) {
       addConstraintAttribute(attr, attributes.get(attr));
     }
     return this;
   }
-  
+
   public Map<ConstraintAttribute, String> getAttributes() {
     return _attributes;
   }
-  
+
   public String getConstraintValue() {
     return _constraintValue;
   }
-  
+
   public ConstraintItem build() {
     // TODO: check if constraint-item is valid
     return new ConstraintItem(_attributes, _constraintValue);


Mime
View raw message