You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ki...@apache.org on 2012/10/25 00:26:41 UTC

[28/47] Refactoring from com.linkedin.helix to org.apache.helix

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/tools/ZkLogCSVFormatter.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/tools/ZkLogCSVFormatter.java b/helix-core/src/main/java/com/linkedin/helix/tools/ZkLogCSVFormatter.java
deleted file mode 100644
index 6882cbd..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/tools/ZkLogCSVFormatter.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.tools;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.manager.zk.ZNRecordSerializer;
-import com.linkedin.helix.model.IdealState.IdealStateProperty;
-import com.linkedin.helix.util.HelixUtil;
-
-public class ZkLogCSVFormatter
-{
-  private static final ZNRecordSerializer _deserializer = new ZNRecordSerializer();
-  private static String _fieldDelim = ",";
-
-  /**
-   * @param args
-   */
-  public static void main(String[] args) throws Exception
-  {
-    if (args.length != 2)
-    {
-      System.err.println("USAGE: ZkLogCSVFormatter log_file output_dir");
-      System.exit(2);
-    }
-    File outputDir = new File(args[1]);
-    if (!outputDir.exists() || !outputDir.isDirectory())
-    {
-      System.err.println(outputDir.getAbsolutePath() + " does NOT exist or is NOT a directory");
-      System.exit(2);
-    }
-    format(args[0], args[1]);
-  }
-
-  private static void formatter(BufferedWriter bw, String... args)
-  {
-    StringBuffer sb = new StringBuffer();
-
-    if (args.length == 0)
-    {
-      return;
-    }
-    else
-    {
-      sb.append(args[0]);
-      for (int i = 1; i < args.length; i++)
-      {
-        sb.append(_fieldDelim).append(args[i]);
-      }
-    }
-
-    try
-    {
-      bw.write(sb.toString());
-      bw.newLine();
-      // System.out.println(sb.toString());
-    }
-    catch (IOException e)
-    {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-  }
-
-  private static String getAttributeValue(String line, String attribute)
-  {
-    String[] parts = line.split("\\s");
-    if (parts != null && parts.length > 0)
-    {
-      for (int i = 0; i < parts.length; i++)
-      {
-        if (parts[i].startsWith(attribute))
-        {
-          String val = parts[i].substring(attribute.length());
-          return val;
-        }
-      }
-    }
-    return null;
-  }
-
-  private static void format(String logfilepath, String outputDir) throws FileNotFoundException
-  {
-    try
-    {
-      // input file
-      FileInputStream fis = new FileInputStream(logfilepath);
-      BufferedReader br = new BufferedReader(new InputStreamReader(fis));
-
-      // output files
-      FileOutputStream isFos = new FileOutputStream(outputDir + "/" + "idealState.csv");
-      BufferedWriter isBw = new BufferedWriter(new OutputStreamWriter(isFos));
-
-      FileOutputStream cfgFos = new FileOutputStream(outputDir + "/" + "config.csv");
-      BufferedWriter cfgBw = new BufferedWriter(new OutputStreamWriter(cfgFos));
-
-      FileOutputStream evFos = new FileOutputStream(outputDir + "/" + "externalView.csv");
-      BufferedWriter evBw = new BufferedWriter(new OutputStreamWriter(evFos));
-
-      FileOutputStream smdCntFos =
-          new FileOutputStream(outputDir + "/" + "stateModelDefStateCount.csv");
-      BufferedWriter smdCntBw = new BufferedWriter(new OutputStreamWriter(smdCntFos));
-
-      FileOutputStream smdNextFos =
-          new FileOutputStream(outputDir + "/" + "stateModelDefStateNext.csv");
-      BufferedWriter smdNextBw = new BufferedWriter(new OutputStreamWriter(smdNextFos));
-
-      FileOutputStream csFos = new FileOutputStream(outputDir + "/" + "currentState.csv");
-      BufferedWriter csBw = new BufferedWriter(new OutputStreamWriter(csFos));
-
-      FileOutputStream msgFos = new FileOutputStream(outputDir + "/" + "messages.csv");
-      BufferedWriter msgBw = new BufferedWriter(new OutputStreamWriter(msgFos));
-
-      FileOutputStream hrPerfFos = new FileOutputStream(outputDir + "/" + "healthReportDefaultPerfCounters.csv");
-      BufferedWriter hrPerfBw = new BufferedWriter(new OutputStreamWriter(hrPerfFos));
-
-      FileOutputStream liFos =
-          new FileOutputStream(outputDir + "/" + "liveInstances.csv");
-      BufferedWriter liBw = new BufferedWriter(new OutputStreamWriter(liFos));
-
-      formatter(cfgBw, "timestamp", "instanceName", "host", "port", "enabled");
-      formatter(isBw,
-                "timestamp",
-                "resourceName",
-                "partitionNumber",
-                "mode",
-                "partition",
-                "instanceName",
-                "priority");
-      formatter(evBw, "timestamp", "resourceName", "partition", "instanceName", "state");
-      formatter(smdCntBw, "timestamp", "stateModel", "state", "count");
-      formatter(smdNextBw, "timestamp", "stateModel", "from", "to", "next");
-      formatter(liBw, "timestamp", "instanceName", "sessionId", "Operation");
-      formatter(csBw,
-                "timestamp",
-                "resourceName",
-                "partition",
-                "instanceName",
-                "sessionId",
-                "state");
-      formatter(msgBw,
-                "timestamp",
-                "resourceName",
-                "partition",
-                "instanceName",
-                "sessionId",
-                "from",
-                "to",
-                "messageType",
-                "messageState");
-      formatter(hrPerfBw,
-                "timestamp",
-                "instanceName",
-                "availableCPUs",
-                "averageSystemLoad",
-                "freeJvmMemory",
-                "freePhysicalMemory",
-                "totalJvmMemory");
-
-      Map<String, ZNRecord> liveInstanceSessionMap = new HashMap<String, ZNRecord>();
-
-      int pos;
-      String inputLine;
-      while ((inputLine = br.readLine()) != null)
-      {
-        if (inputLine.indexOf("CONFIGS") != -1)
-        {
-          pos = inputLine.indexOf("CONFIGS");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-
-            formatter(cfgBw,
-                      timestamp,
-                      record.getId(),
-                      record.getSimpleField("HOST"),
-                      record.getSimpleField("PORT"),
-                      record.getSimpleField("ENABLED"));
-
-          }
-        }
-        else if (inputLine.indexOf("IDEALSTATES") != -1)
-        {
-          pos = inputLine.indexOf("IDEALSTATES");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-            // System.out.println("record=" + record);
-            for (String partition : record.getListFields().keySet())
-            {
-              List<String> preferenceList = record.getListFields().get(partition);
-              for (int i = 0; i < preferenceList.size(); i++)
-              {
-                String instance = preferenceList.get(i);
-                formatter(isBw,
-                          timestamp,
-                          record.getId(),
-                          record.getSimpleField(IdealStateProperty.NUM_PARTITIONS.toString()),
-                          record.getSimpleField(IdealStateProperty.IDEAL_STATE_MODE.toString()),
-                          partition,
-                          instance,
-                          Integer.toString(i));
-              }
-            }
-          }
-        }
-        else if (inputLine.indexOf("LIVEINSTANCES") != -1)
-        {
-          pos = inputLine.indexOf("LIVEINSTANCES");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-            formatter(liBw, timestamp, record.getId(), record.getSimpleField("SESSION_ID"), "ADD");
-            String zkSessionId = getAttributeValue(inputLine, "session:");
-            if (zkSessionId == null)
-            {
-              System.err.println("no zk session id associated with the adding of live instance: "
-                  + inputLine);
-            }
-            else
-            {
-              liveInstanceSessionMap.put(zkSessionId, record);
-            }
-          }
-
-        }
-        else if (inputLine.indexOf("EXTERNALVIEW") != -1)
-        {
-          pos = inputLine.indexOf("EXTERNALVIEW");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-            // System.out.println("record=" + record);
-            for (String partition : record.getMapFields().keySet())
-            {
-              Map<String, String> stateMap = record.getMapFields().get(partition);
-              for (String instance : stateMap.keySet())
-              {
-                String state = stateMap.get(instance);
-                formatter(evBw, timestamp, record.getId(), partition, instance, state);
-              }
-            }
-          }
-        }
-        else if (inputLine.indexOf("STATEMODELDEFS") != -1)
-        {
-          pos = inputLine.indexOf("STATEMODELDEFS");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-
-            for (String stateInfo : record.getMapFields().keySet())
-            {
-              if (stateInfo.endsWith(".meta"))
-              {
-                Map<String, String> metaMap = record.getMapFields().get(stateInfo);
-                formatter(smdCntBw,
-                          timestamp,
-                          record.getId(),
-                          stateInfo.substring(0, stateInfo.indexOf('.')),
-                          metaMap.get("count"));
-              }
-              else if (stateInfo.endsWith(".next"))
-              {
-                Map<String, String> nextMap = record.getMapFields().get(stateInfo);
-                for (String destState : nextMap.keySet())
-                {
-                  formatter(smdNextBw,
-                            timestamp,
-                            record.getId(),
-                            stateInfo.substring(0, stateInfo.indexOf('.')),
-                            destState,
-                            nextMap.get(destState));
-                }
-              }
-            }
-          }
-        }
-        else if (inputLine.indexOf("CURRENTSTATES") != -1)
-        {
-          pos = inputLine.indexOf("CURRENTSTATES");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-            // System.out.println("record=" + record);
-            for (String partition : record.getMapFields().keySet())
-            {
-              Map<String, String> stateMap = record.getMapFields().get(partition);
-              String path = getAttributeValue(inputLine, "path:");
-              if (path != null)
-              {
-                String instance = HelixUtil.getInstanceNameFromPath(path);
-                formatter(csBw,
-                          timestamp,
-                          record.getId(),
-                          partition,
-                          instance,
-                          record.getSimpleField("SESSION_ID"),
-                          stateMap.get("CURRENT_STATE"));
-              }
-            }
-          }
-        }
-        else if (inputLine.indexOf("MESSAGES") != -1)
-        {
-          pos = inputLine.indexOf("MESSAGES");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-
-            formatter(msgBw,
-                      timestamp,
-                      record.getSimpleField("RESOURCE_NAME"),
-                      record.getSimpleField("PARTITION_NAME"),
-                      record.getSimpleField("TGT_NAME"),
-                      record.getSimpleField("TGT_SESSION_ID"),
-                      record.getSimpleField("FROM_STATE"),
-                      record.getSimpleField("TO_STATE"),
-                      record.getSimpleField("MSG_TYPE"),
-                      record.getSimpleField("MSG_STATE"));
-          }
-
-        }
-        else if (inputLine.indexOf("closeSession") != -1)
-        {
-          String zkSessionId = getAttributeValue(inputLine, "session:");
-          if (zkSessionId == null)
-          {
-            System.err.println("no zk session id associated with the closing of zk session: "
-                + inputLine);
-          }
-          else
-          {
-            ZNRecord record = liveInstanceSessionMap.remove(zkSessionId);
-            // System.err.println("zkSessionId:" + zkSessionId + ", record:" + record);
-            if (record != null)
-            {
-              String timestamp = getAttributeValue(inputLine, "time:");
-              formatter(liBw,
-                        timestamp,
-                        record.getId(),
-                        record.getSimpleField("SESSION_ID"),
-                        "DELETE");
-            }
-          }
-        }
-        else if (inputLine.indexOf("HEALTHREPORT/defaultPerfCounters") != -1)
-        {
-          pos = inputLine.indexOf("HEALTHREPORT/defaultPerfCounters");
-          pos = inputLine.indexOf("data:{", pos);
-          if (pos != -1)
-          {
-            String timestamp = getAttributeValue(inputLine, "time:");
-            ZNRecord record =
-                (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
-                                                              .getBytes());
-
-            String path = getAttributeValue(inputLine, "path:");
-            if (path != null)
-            {
-              String instance = HelixUtil.getInstanceNameFromPath(path);
-              formatter(hrPerfBw,
-                        timestamp,
-                        instance,
-                        record.getSimpleField("availableCPUs"),
-                        record.getSimpleField("averageSystemLoad"),
-                        record.getSimpleField("freeJvmMemory"),
-                        record.getSimpleField("freePhysicalMemory"),
-                        record.getSimpleField("totalJvmMemory"));
-            }
-          }
-        }
-      }
-
-      br.close();
-      isBw.close();
-      cfgBw.close();
-      evBw.close();
-      smdCntBw.close();
-      smdNextBw.close();
-      csBw.close();
-      msgBw.close();
-      liBw.close();
-      hrPerfBw.close();
-    }
-    catch (Exception e)
-    {
-      System.err.println("Error: " + e.getMessage());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeOpArg.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeOpArg.java b/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeOpArg.java
deleted file mode 100644
index feaeeeb..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeOpArg.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.tools;
-
-import java.util.List;
-import java.util.Map;
-
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.tools.TestExecutor.ZnodePropertyType;
-
-public class ZnodeOpArg
-{
-  public String _znodePath;
-  public ZnodePropertyType _propertyType;
-  
-  /**
-   *  "+" for update/create if not exist
-   *  '-' for remove
-   * "==" for test equals
-   * "!=" for test not equal
-   */ 
-  public String _operation;
-  public String _key;
-  public ZnodeValue _updateValue;
-  
-  public ZnodeOpArg()
-  {
-  }
-  
-  /**
-   * verify simple/list/map field: no update value
-   * @param znodePath
-   * @param type
-   * @param op
-   * @param key
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op, String key)
-  {
-    this(znodePath, type, op, key, new ZnodeValue());
-  }
-  
-  /**
-   * verify znode: no update value
-   * @param znodePath
-   * @param type
-   * @param op
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op)
-  {
-    this(znodePath, type, op, null, new ZnodeValue());
-  }
-  
-  /**
-   * simple field change
-   * @param znodePath
-   * @param type
-   * @param op
-   * @param key
-   * @param update
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op, String key, String update)
-  {
-    this(znodePath, type, op, key, new ZnodeValue(update));
-  }
-
-  /**
-   * list field change
-   * @param znodePath
-   * @param type
-   * @param op
-   * @param key
-   * @param update
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op, String key, List<String> update)
-  {
-    this(znodePath, type, op, key, new ZnodeValue(update));
-  }
-
-  /**
-   * map field change
-   * @param znodePath
-   * @param type
-   * @param op
-   * @param key
-   * @param update
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op, String key, Map<String, String> update)
-  {
-    this(znodePath, type, op, key, new ZnodeValue(update));
-  }
-
-  /**
-   * znode change
-   * @param znodePath
-   * @param type
-   * @param op
-   * @param key
-   * @param update
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op, ZNRecord update)
-  {
-    this(znodePath, type, op, null, new ZnodeValue(update));
-  }
-
-  /**
-   * 
-   * @param znodePath
-   * @param type
-   * @param op
-   * @param key
-   * @param update
-   */
-  public ZnodeOpArg(String znodePath, ZnodePropertyType type, String op, String key, ZnodeValue update)
-  {
-    _znodePath = znodePath;
-    _propertyType = type;
-    _operation = op;
-    _key = key;
-    _updateValue = update;
-  }
-  
-  @Override
-  public String toString()
-  {
-    String ret = "={\"" + 
-                 _znodePath + "\", " + _propertyType + "/" + _key + " " + _operation + " " +
-                 _updateValue + "}";
-    return ret;
-  }
-
-  
-  // TODO temp test; remove it
-  /*
-  public static void main(String[] args) 
-  {
-    // null modification command
-    ZnodeOpArg command = new ZnodeOpArg();
-    System.out.println(command);
-    
-    // simple modification command
-    command = new ZnodeOpArg("/testPath", ZnodePropertyType.SIMPLE, "+", "key1", "simpleValue1");
-    System.out.println(command);
-    
-    // list modification command
-    List<String> list = new ArrayList<String>();
-    list.add("listValue1");
-    list.add("listValue2");
-    command = new ZnodeOpArg("/testPath", ZnodePropertyType.LIST, "+", "key1", list);
-    System.out.println(command);
-    
-    // map modification command
-    Map<String, String> map = new HashMap<String, String>();
-    map.put("mapKey1", "mapValue1");
-    map.put("mapKey2", "mapValue2");
-    command = new ZnodeOpArg("/testPath", ZnodePropertyType.MAP, "+", "key1", map);
-    System.out.println(command);
-
-    // map modification command
-    ZNRecord record = new ZNRecord("znrecord");
-    record.setSimpleField("key1", "simpleValue1");
-    record.setListField("key1", list);
-    record.setMapField("key1", map);
-    command = new ZnodeOpArg("/testPath", ZnodePropertyType.ZNODE, "+", record);
-    System.out.println(command);
-  }
-  */
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeValue.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeValue.java b/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeValue.java
deleted file mode 100644
index 85b8fcb..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/tools/ZnodeValue.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.tools;
-
-import java.util.List;
-import java.util.Map;
-
-import com.linkedin.helix.ZNRecord;
-
-public class ZnodeValue
-{
-  public String _singleValue;
-  public List<String> _listValue;
-  public Map<String, String> _mapValue;
-  public ZNRecord _znodeValue;
-  
-  public ZnodeValue()
-  {
-  }
-  
-  public ZnodeValue(String value)
-  {
-    _singleValue = value;
-  }
-  
-  public ZnodeValue(List<String> value)
-  {
-    _listValue = value;
-  }
-  
-  public ZnodeValue(Map<String, String> value)
-  {
-    _mapValue = value;
-  }
-  
-  public ZnodeValue(ZNRecord value)
-  {
-    _znodeValue = value;
-  }
-  
-  @Override
-  public String toString()
-  {
-    if (_singleValue != null)
-    {
-      return _singleValue;
-    }
-    else if (_listValue != null)
-    {
-      return _listValue.toString();
-    }
-    else if (_mapValue != null)
-    {
-      return _mapValue.toString();
-    }
-    else if (_znodeValue != null)
-    {
-      return _znodeValue.toString();
-    }
-    
-    return "null";
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/tools/package-info.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/tools/package-info.java b/helix-core/src/main/java/com/linkedin/helix/tools/package-info.java
deleted file mode 100644
index a4bbe63..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/tools/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * Helix tools classes
- * 
- */
-package com.linkedin.helix.tools;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/util/HelixUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/util/HelixUtil.java b/helix-core/src/main/java/com/linkedin/helix/util/HelixUtil.java
deleted file mode 100644
index 138c295..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/util/HelixUtil.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.util;
-
-import com.linkedin.helix.PropertyPathConfig;
-import com.linkedin.helix.PropertyType;
-
-public final class HelixUtil
-{
-  private HelixUtil()
-  {
-  }
-
-  public static String getPropertyPath(String clusterName, PropertyType type)
-  {
-    return "/" + clusterName + "/" + type.toString();
-  }
-
-  public static String getInstancePropertyPath(String clusterName, String instanceName,
-      PropertyType type)
-  {
-    return getPropertyPath(clusterName, PropertyType.INSTANCES) + "/" + instanceName + "/"
-        + type.toString();
-  }
-
-  public static String getInstancePath(String clusterName, String instanceName)
-  {
-    return getPropertyPath(clusterName, PropertyType.INSTANCES) + "/" + instanceName;
-  }
-
-  public static String getIdealStatePath(String clusterName, String resourceName)
-  {
-    return getPropertyPath(clusterName, PropertyType.IDEALSTATES) + "/" + resourceName;
-  }
-
-  public static String getIdealStatePath(String clusterName)
-  {
-    return getPropertyPath(clusterName, PropertyType.IDEALSTATES);
-  }
-
-  public static String getLiveInstancesPath(String clusterName)
-  {
-    return getPropertyPath(clusterName, PropertyType.LIVEINSTANCES);
-  }
-
-  // public static String getConfigPath(String clusterName)
-  // {
-  // return getPropertyPath(clusterName, PropertyType.PARTICIPANT_CONFIGS);
-  // }
-
-  // public static String getConfigPath(String clusterName, String instanceName)
-  // {
-  // return getConfigPath(clusterName) + "/" + instanceName;
-  // }
-
-  public static String getMessagePath(String clusterName, String instanceName)
-  {
-    return getInstancePropertyPath(clusterName, instanceName, PropertyType.MESSAGES);
-  }
-
-  public static String getCurrentStateBasePath(String clusterName, String instanceName)
-  {
-    return getInstancePropertyPath(clusterName, instanceName, PropertyType.CURRENTSTATES);
-  }
-
-  /**
-   * Even though this is simple we want to have the mechanism of bucketing the
-   * partitions. If we have P partitions and N nodes with K replication factor
-   * and D databases. Then on each node we will have (P/N)*K*D partitions. And
-   * cluster manager neeeds to maintain watch on each of these nodes for every
-   * node. So over all cluster manager will have P*K*D watches which can be
-   * quite large given that we over partition.
-   * 
-   * The other extreme is having one znode per storage per database. This will
-   * result in N*D watches which is good. But data in every node might become
-   * really big since it has to save partition
-   * 
-   * Ideally we want to balance between the two models
-   * 
-   */
-  public static String getCurrentStatePath(String clusterName, String instanceName,
-      String sessionId, String stateUnitKey)
-  {
-    return getInstancePropertyPath(clusterName, instanceName, PropertyType.CURRENTSTATES) + "/"
-        + sessionId + "/" + stateUnitKey;
-  }
-
-  public static String getExternalViewPath(String clusterName)
-  {
-    return getPropertyPath(clusterName, PropertyType.EXTERNALVIEW);
-  }
-
-  public static String getStateModelDefinitionPath(String clusterName)
-  {
-    return getPropertyPath(clusterName, PropertyType.STATEMODELDEFS);
-  }
-
-  public static String getExternalViewPath(String clusterName, String resourceName)
-  {
-    return getPropertyPath(clusterName, PropertyType.EXTERNALVIEW) + "/" + resourceName;
-  }
-
-  public static String getLiveInstancePath(String clusterName, String instanceName)
-  {
-    return getPropertyPath(clusterName, PropertyType.LIVEINSTANCES) + "/" + instanceName;
-  }
-
-  public static String getMemberInstancesPath(String clusterName)
-  {
-    return getPropertyPath(clusterName, PropertyType.INSTANCES);
-  }
-
-  public static String getErrorsPath(String clusterName, String instanceName)
-  {
-    return getInstancePropertyPath(clusterName, instanceName, PropertyType.ERRORS);
-  }
-
-  public static String getStatusUpdatesPath(String clusterName, String instanceName)
-  {
-    return getInstancePropertyPath(clusterName, instanceName, PropertyType.STATUSUPDATES);
-  }
-
-  public static String getHealthPath(String clusterName, String instanceName)
-  {
-    return PropertyPathConfig.getPath(PropertyType.HEALTHREPORT, clusterName, instanceName);
-  }
-
-  public static String getPersistentStatsPath(String clusterName)
-  {
-    return PropertyPathConfig.getPath(PropertyType.PERSISTENTSTATS, clusterName);
-  }
-
-  public static String getAlertsPath(String clusterName)
-  {
-    return PropertyPathConfig.getPath(PropertyType.ALERTS, clusterName);
-  }
-
-  public static String getAlertStatusPath(String clusterName)
-  {
-    return PropertyPathConfig.getPath(PropertyType.ALERT_STATUS, clusterName);
-  }
-
-  public static String getInstanceNameFromPath(String path)
-  {
-    // path structure
-    // /<cluster_name>/instances/<instance_name>/[currentStates/messages]
-    if (path.contains("/" + PropertyType.INSTANCES + "/"))
-    {
-      String[] split = path.split("\\/");
-      if (split.length > 3)
-      {
-        return split[3];
-      }
-    }
-    return null;
-  }
-
-  // distributed cluster controller
-  public static String getControllerPath(String clusterName)
-  {
-    return getPropertyPath(clusterName, PropertyType.CONTROLLER);
-  }
-
-  public static String getControllerPropertyPath(String clusterName, PropertyType type)
-  {
-    return PropertyPathConfig.getPath(type, clusterName);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/util/StatusUpdateUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/util/StatusUpdateUtil.java b/helix-core/src/main/java/com/linkedin/helix/util/StatusUpdateUtil.java
deleted file mode 100644
index 662d621..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/util/StatusUpdateUtil.java
+++ /dev/null
@@ -1,629 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.util;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.log4j.Logger;
-
-import com.linkedin.helix.HelixDataAccessor;
-import com.linkedin.helix.HelixProperty;
-import com.linkedin.helix.PropertyKey;
-import com.linkedin.helix.PropertyKey.Builder;
-import com.linkedin.helix.ZNRecord;
-import com.linkedin.helix.model.Error;
-import com.linkedin.helix.model.Message;
-import com.linkedin.helix.model.Message.MessageType;
-import com.linkedin.helix.model.StatusUpdate;
-
-/**
- * Util class to create statusUpdates ZK records and error ZK records. These message
- * records are for diagnostics only, and they are stored on the "StatusUpdates" and
- * "errors" ZNodes in the zookeeper instances.
- * 
- * 
- * */
-public class StatusUpdateUtil
-{
-  static Logger _logger = Logger.getLogger(StatusUpdateUtil.class);
-
-  public static class Transition implements Comparable<Transition>
-  {
-    private final String _msgID;
-    private final long   _timeStamp;
-    private final String _from;
-    private final String _to;
-
-    public Transition(String msgID, long timeStamp, String from, String to)
-    {
-      this._msgID = msgID;
-      this._timeStamp = timeStamp;
-      this._from = from;
-      this._to = to;
-    }
-
-    @Override
-    public int compareTo(Transition t)
-    {
-      if (_timeStamp < t._timeStamp)
-        return -1;
-      else if (_timeStamp > t._timeStamp)
-        return 1;
-      else
-        return 0;
-    }
-
-    public boolean equals(Transition t)
-    {
-      return (_timeStamp == t._timeStamp && _from.equals(t._from) && _to.equals(t._to));
-    }
-
-    public String getFromState()
-    {
-      return _from;
-    }
-
-    public String getToState()
-    {
-      return _to;
-    }
-
-    public String getMsgID()
-    {
-      return _msgID;
-    }
-
-    @Override
-    public String toString()
-    {
-      return _msgID + ":" + _timeStamp + ":" + _from + "->" + _to;
-    }
-  }
-
-  public static enum TaskStatus
-  {
-    UNKNOWN, NEW, SCHEDULED, INVOKING, COMPLETED, FAILED
-  }
-
-  public static class StatusUpdateContents
-  {
-    private final List<Transition>        _transitions;
-    private final Map<String, TaskStatus> _taskMessages;
-
-    private StatusUpdateContents(List<Transition> transitions,
-                                 Map<String, TaskStatus> taskMessages)
-    {
-      this._transitions = transitions;
-      this._taskMessages = taskMessages;
-    }
-
-    public static StatusUpdateContents getStatusUpdateContents(HelixDataAccessor accessor,
-                                                               String instance,
-                                                               String resourceGroup,
-                                                               String partition)
-    {
-      return getStatusUpdateContents(accessor, instance, resourceGroup, null, partition);
-    }
-
-    // TODO: We should build a map and return the key instead of searching
-    // everytime
-    // for an (instance, resourceGroup, session, partition) tuple.
-    // But such a map is very similar to what exists in ZNRecord
-    // passing null for sessionID results in searching across all sessions
-    public static StatusUpdateContents getStatusUpdateContents(HelixDataAccessor accessor,
-                                                               String instance,
-                                                               String resourceGroup,
-                                                               String sessionID,
-                                                               String partition)
-    {
-      Builder keyBuilder = accessor.keyBuilder();
-
-      List<ZNRecord> instances =
-          HelixProperty.convertToList(accessor.getChildValues(keyBuilder.instanceConfigs()));
-      List<ZNRecord> partitionRecords = new ArrayList<ZNRecord>();
-      for (ZNRecord znRecord : instances)
-      {
-        String instanceName = znRecord.getId();
-        if (!instanceName.equals(instance))
-        {
-          continue;
-        }
-
-        List<String> sessions = accessor.getChildNames(keyBuilder.sessions(instanceName));
-        for (String session : sessions)
-        {
-          if (sessionID != null && !session.equals(sessionID))
-          {
-            continue;
-          }
-
-          List<String> resourceGroups =
-              accessor.getChildNames(keyBuilder.stateTransitionStatus(instanceName,
-                                                                      session));
-          for (String resourceGroupName : resourceGroups)
-          {
-            if (!resourceGroupName.equals(resourceGroup))
-            {
-              continue;
-            }
-
-            List<String> partitionStrings =
-                accessor.getChildNames(keyBuilder.stateTransitionStatus(instanceName,
-                                                                        session,
-                                                                        resourceGroupName));
-
-            for (String partitionString : partitionStrings)
-            {
-              ZNRecord partitionRecord =
-                  accessor.getProperty(keyBuilder.stateTransitionStatus(instanceName,
-                                                                        session,
-                                                                        resourceGroupName,
-                                                                        partitionString))
-                          .getRecord();
-              if (!partitionString.equals(partition))
-              {
-                continue;
-              }
-              partitionRecords.add(partitionRecord);
-            }
-          }
-        }
-      }
-
-      return new StatusUpdateContents(getSortedTransitions(partitionRecords),
-                                      getTaskMessages(partitionRecords));
-    }
-
-    public List<Transition> getTransitions()
-    {
-      return _transitions;
-    }
-
-    public Map<String, TaskStatus> getTaskMessages()
-    {
-      return _taskMessages;
-    }
-
-    // input: List<ZNRecord> corresponding to (instance, database,
-    // partition) tuples across all sessions
-    // return list of transitions sorted from earliest to latest
-    private static List<Transition> getSortedTransitions(List<ZNRecord> partitionRecords)
-    {
-      List<Transition> transitions = new ArrayList<Transition>();
-      for (ZNRecord partition : partitionRecords)
-      {
-        Map<String, Map<String, String>> mapFields = partition.getMapFields();
-        for (String key : mapFields.keySet())
-        {
-          if (key.startsWith("MESSAGE"))
-          {
-            Map<String, String> m = mapFields.get(key);
-            long createTimeStamp = 0;
-            try
-            {
-              createTimeStamp = Long.parseLong(m.get("CREATE_TIMESTAMP"));
-            }
-            catch (Exception e)
-            {
-            }
-            transitions.add(new Transition(m.get("MSG_ID"),
-                                           createTimeStamp,
-                                           m.get("FROM_STATE"),
-                                           m.get("TO_STATE")));
-          }
-        }
-      }
-      Collections.sort(transitions);
-      return transitions;
-    }
-
-    private static Map<String, TaskStatus> getTaskMessages(List<ZNRecord> partitionRecords)
-    {
-      Map<String, TaskStatus> taskMessages = new HashMap<String, TaskStatus>();
-      for (ZNRecord partition : partitionRecords)
-      {
-        Map<String, Map<String, String>> mapFields = partition.getMapFields();
-        // iterate over the task status updates in the order they occurred
-        // so that the last status can be recorded
-        for (String key : mapFields.keySet())
-        {
-          if (key.contains("STATE_TRANSITION"))
-          {
-            Map<String, String> m = mapFields.get(key);
-            String id = m.get("MSG_ID");
-            String statusString = m.get("AdditionalInfo");
-            TaskStatus status = TaskStatus.UNKNOWN;
-            if (statusString.contains("scheduled"))
-              status = TaskStatus.SCHEDULED;
-            else if (statusString.contains("invoking"))
-              status = TaskStatus.INVOKING;
-            else if (statusString.contains("completed"))
-              status = TaskStatus.COMPLETED;
-
-            taskMessages.put(id, status);
-          }
-        }
-      }
-      return taskMessages;
-    }
-  }
-
-  public enum Level
-  {
-    HELIX_ERROR, HELIX_WARNING, HELIX_INFO
-  }
-
-  /**
-   * Creates an empty ZNRecord as the statusUpdate/error record
-   * 
-   * @param id
-   */
-  public ZNRecord createEmptyStatusUpdateRecord(String id)
-  {
-    return new ZNRecord(id);
-  }
-
-  /**
-   * Create a ZNRecord for a message, which stores the content of the message (stored in
-   * simple fields) into the ZNRecord mapFields. In this way, the message update can be
-   * merged with the previous status update record in the zookeeper. See ZNRecord.merge()
-   * for more details.
-   * */
-  ZNRecord createMessageLogRecord(Message message)
-  {
-    ZNRecord result = new ZNRecord(getStatusUpdateRecordName(message));
-    String mapFieldKey = "MESSAGE " + message.getMsgId();
-    result.setMapField(mapFieldKey, new TreeMap<String, String>());
-
-    // Store all the simple fields of the message in the new ZNRecord's map
-    // field.
-    for (String simpleFieldKey : message.getRecord().getSimpleFields().keySet())
-    {
-      result.getMapField(mapFieldKey).put(simpleFieldKey,
-                                          message.getRecord()
-                                                 .getSimpleField(simpleFieldKey));
-    }
-    if (message.getResultMap() != null)
-    {
-      result.setMapField("MessageResult", message.getResultMap());
-    }
-    return result;
-  }
-
-  Map<String, String> _recordedMessages = new ConcurrentHashMap<String, String>();
-
-  /**
-   * Create a statusupdate that is related to a cluster manager message.
-   * 
-   * @param message
-   *          the related cluster manager message
-   * @param level
-   *          the error level
-   * @param classInfo
-   *          class info about the class that reports the status update
-   * @param additional
-   *          info the additional debug information
-   */
-  public ZNRecord createMessageStatusUpdateRecord(Message message,
-                                                  Level level,
-                                                  Class classInfo,
-                                                  String additionalInfo)
-  {
-    ZNRecord result = createEmptyStatusUpdateRecord(getStatusUpdateRecordName(message));
-    Map<String, String> contentMap = new TreeMap<String, String>();
-
-    contentMap.put("Message state", message.getMsgState().toString());
-    contentMap.put("AdditionalInfo", additionalInfo);
-    contentMap.put("Class", classInfo.toString());
-    contentMap.put("MSG_ID", message.getMsgId());
-
-    DateFormat formatter = new SimpleDateFormat("yyyyMMdd-HHmmss.SSSSSS");
-    String time = formatter.format(new Date());
-
-    String id =
-        String.format("%4s %26s ", level.toString(), time)
-            + getRecordIdForMessage(message);
-
-    result.setMapField(id, contentMap);
-
-    return result;
-  }
-
-  String getRecordIdForMessage(Message message)
-  {
-    if (message.getMsgType().equals(MessageType.STATE_TRANSITION))
-    {
-      return message.getPartitionName() + " Trans:" + message.getFromState().charAt(0)
-          + "->" + message.getToState().charAt(0) + "  " + UUID.randomUUID().toString();
-    }
-    else
-    {
-      return message.getMsgType() + " " + UUID.randomUUID().toString();
-    }
-  }
-
-  /**
-   * Create a statusupdate that is related to a cluster manager message, then record it to
-   * the zookeeper store.
-   * 
-   * @param message
-   *          the related cluster manager message
-   * @param level
-   *          the error level
-   * @param classInfo
-   *          class info about the class that reports the status update
-   * @param additional
-   *          info the additional debug information
-   * @param accessor
-   *          the zookeeper data accessor that writes the status update to zookeeper
-   */
-  public void logMessageStatusUpdateRecord(Message message,
-                                           Level level,
-                                           Class classInfo,
-                                           String additionalInfo,
-                                           HelixDataAccessor accessor)
-  {
-    try
-    {
-      ZNRecord record =
-          createMessageStatusUpdateRecord(message, level, classInfo, additionalInfo);
-      publishStatusUpdateRecord(record, message, level, accessor);
-    }
-    catch (Exception e)
-    {
-      _logger.error("Exception while logging status update", e);
-    }
-  }
-
-  public void logError(Message message,
-                       Class classInfo,
-                       String additionalInfo,
-                       HelixDataAccessor accessor)
-  {
-    logMessageStatusUpdateRecord(message,
-                                 Level.HELIX_ERROR,
-                                 classInfo,
-                                 additionalInfo,
-                                 accessor);
-  }
-
-  public void logError(Message message,
-                       Class classInfo,
-                       Exception e,
-                       String additionalInfo,
-                       HelixDataAccessor accessor)
-  {
-    StringWriter sw = new StringWriter();
-    PrintWriter pw = new PrintWriter(sw);
-    e.printStackTrace(pw);
-    logMessageStatusUpdateRecord(message, Level.HELIX_ERROR, classInfo, additionalInfo
-        + sw.toString(), accessor);
-  }
-
-  public void logInfo(Message message,
-                      Class classInfo,
-                      String additionalInfo,
-                      HelixDataAccessor accessor)
-  {
-    logMessageStatusUpdateRecord(message,
-                                 Level.HELIX_INFO,
-                                 classInfo,
-                                 additionalInfo,
-                                 accessor);
-  }
-
-  public void logWarning(Message message,
-                         Class classInfo,
-                         String additionalInfo,
-                         HelixDataAccessor accessor)
-  {
-    logMessageStatusUpdateRecord(message,
-                                 Level.HELIX_WARNING,
-                                 classInfo,
-                                 additionalInfo,
-                                 accessor);
-  }
-
-  /**
-   * Write a status update record to zookeeper to the zookeeper store.
-   * 
-   * @param record
-   *          the status update record
-   * @param message
-   *          the message to be logged
-   * @param level
-   *          the error level of the message update
-   * @param accessor
-   *          the zookeeper data accessor that writes the status update to zookeeper
-   */
-  void publishStatusUpdateRecord(ZNRecord record,
-                                 Message message,
-                                 Level level,
-                                 HelixDataAccessor accessor)
-  {
-    String instanceName = message.getTgtName();
-    String statusUpdateSubPath = getStatusUpdateSubPath(message);
-    String statusUpdateKey = getStatusUpdateKey(message);
-    String sessionId = message.getExecutionSessionId();
-    if (sessionId == null)
-    {
-      sessionId = message.getTgtSessionId();
-    }
-    if (sessionId == null)
-    {
-      sessionId = "*";
-    }
-
-    Builder keyBuilder = accessor.keyBuilder();
-    if (!_recordedMessages.containsKey(message.getMsgId()))
-    {
-      // TODO instanceName of a controller might be any string
-      if (instanceName.equalsIgnoreCase("Controller"))
-      {
-        accessor.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
-                                                                statusUpdateKey),
-                                new StatusUpdate(createMessageLogRecord(message)));
-
-      }
-      else
-      {
-        
-        PropertyKey propertyKey =
-            keyBuilder.stateTransitionStatus(instanceName,
-                                             sessionId,
-                                             statusUpdateSubPath,
-                                             statusUpdateKey);
-
-        ZNRecord statusUpdateRecord = createMessageLogRecord(message);
-
-        // For now write participant StatusUpdates to log4j. 
-        // we are using restlet as another data channel to report to controller.
-        
-        _logger.info("StatusUpdate path:" + propertyKey.getPath() + ", updates:"
-              + statusUpdateRecord);
-        accessor.updateProperty(propertyKey, new StatusUpdate(statusUpdateRecord));
-        
-      }
-      _recordedMessages.put(message.getMsgId(), message.getMsgId());
-    }
-
-    if (instanceName.equalsIgnoreCase("Controller"))
-    {
-      accessor.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
-                                                              statusUpdateKey),
-                              new StatusUpdate(record));
-    }
-    else
-    {
-      
-      PropertyKey propertyKey =
-          keyBuilder.stateTransitionStatus(instanceName,
-                                           sessionId,
-                                           statusUpdateSubPath,
-                                           statusUpdateKey);
-      // For now write participant StatusUpdates to log4j. 
-      // we are using restlet as another data channel to report to controller.
-      _logger.info("StatusUpdate path:" + propertyKey.getPath() + ", updates:" + record);
-      accessor.updateProperty(propertyKey, new StatusUpdate(record));
-    }
-
-    // If the error level is ERROR, also write the record to "ERROR" ZNode
-    if (Level.HELIX_ERROR == level)
-    {
-      publishErrorRecord(record, message, accessor);
-    }
-  }
-
-  private String getStatusUpdateKey(Message message)
-  {
-    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-    {
-      return message.getPartitionName();
-    }
-    return message.getMsgId();
-  }
-
-  /**
-   * Generate the sub-path under STATUSUPDATE or ERROR path for a status update
-   * 
-   */
-  String getStatusUpdateSubPath(Message message)
-  {
-    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-    {
-      return message.getResourceName();
-    }
-    else
-    {
-      return message.getMsgType();
-    }
-  }
-
-  String getStatusUpdateRecordName(Message message)
-  {
-    if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-    {
-      return message.getTgtSessionId() + "__" + message.getResourceName();
-    }
-    return message.getMsgId();
-  }
-
-  /**
-   * Write an error record to zookeeper to the zookeeper store.
-   * 
-   * @param record
-   *          the status update record
-   * @param message
-   *          the message to be logged
-   * @param accessor
-   *          the zookeeper data accessor that writes the status update to zookeeper
-   */
-  void publishErrorRecord(ZNRecord record, Message message, HelixDataAccessor accessor)
-  {
-    String instanceName = message.getTgtName();
-    String statusUpdateSubPath = getStatusUpdateSubPath(message);
-    String statusUpdateKey = getStatusUpdateKey(message);
-    String sessionId = message.getExecutionSessionId();
-    if (sessionId == null)
-    {
-      sessionId = message.getTgtSessionId();
-    }
-    if (sessionId == null)
-    {
-      sessionId = "*";
-    }
-
-    Builder keyBuilder = accessor.keyBuilder();
-
-    // TODO remove the hard code: "controller"
-    if (instanceName.equalsIgnoreCase("controller"))
-    {
-      // TODO need to fix: ERRORS_CONTROLLER doesn't have a form of
-      // ../{sessionId}/{subPath}
-      // accessor.setProperty(PropertyType.ERRORS_CONTROLLER, record,
-      // statusUpdateSubPath);
-      accessor.setProperty(keyBuilder.controllerTaskError(statusUpdateSubPath),
-                           new Error(record));
-    }
-    else
-    {
-      // accessor.updateProperty(PropertyType.ERRORS,
-      // record,
-      // instanceName,
-      // sessionId,
-      // statusUpdateSubPath,
-      // statusUpdateKey);
-      accessor.updateProperty(keyBuilder.stateTransitionError(instanceName,
-                                                              sessionId,
-                                                              statusUpdateSubPath,
-                                                              statusUpdateKey),
-                              new Error(record));
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/util/StringTemplate.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/util/StringTemplate.java b/helix-core/src/main/java/com/linkedin/helix/util/StringTemplate.java
deleted file mode 100644
index a5b870d..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/util/StringTemplate.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.util;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.log4j.Logger;
-
-public class StringTemplate
-{
-  private static Logger LOG = Logger.getLogger(StringTemplate.class);
-
-  Map<Enum, Map<Integer, String>> templateMap = new HashMap<Enum, Map<Integer, String>>();
-  static Pattern pattern = Pattern.compile("(\\{.+?\\})");
-
-  public void addEntry(Enum type, int numKeys, String template)
-  {
-    if (!templateMap.containsKey(type))
-    {
-      templateMap.put(type, new HashMap<Integer, String>());
-    }
-    LOG.trace("Add template for type: " + type.name() + ", arguments: " + numKeys
-        + ", template: " + template);
-    templateMap.get(type).put(numKeys, template);
-  }
-
-  public String instantiate(Enum type, String... keys)
-  {
-    if (keys == null)
-    {
-      keys = new String[] {};
-    }
-
-    String template = null;
-    if (templateMap.containsKey(type))
-    {
-      template = templateMap.get(type).get(keys.length);
-    }
-
-    String result = null;
-
-    if (template != null)
-    {
-      result = template;
-      Matcher matcher = pattern.matcher(template);
-      int count = 0;
-      while (matcher.find())
-      {
-        String var = matcher.group();
-        result = result.replace(var, keys[count]);
-        count++;
-      }
-    }
-
-    if (result == null || result.indexOf('{') > -1 || result.indexOf('}') > -1)
-    {
-      String errMsg = "Unable to instantiate template: " + template
-          + " using keys: " + Arrays.toString(keys);
-      LOG.error(errMsg);
-      throw new IllegalArgumentException(errMsg);
-    }
-
-    return result;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/util/ZKClientPool.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/util/ZKClientPool.java b/helix-core/src/main/java/com/linkedin/helix/util/ZKClientPool.java
deleted file mode 100644
index 4d7b7e2..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/util/ZKClientPool.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.util;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.zookeeper.ZooKeeper.States;
-
-import com.linkedin.helix.manager.zk.ZNRecordSerializer;
-import com.linkedin.helix.manager.zk.ZkClient;
-
-public class ZKClientPool
-{
-  static final Map<String, ZkClient> _zkClientMap = new ConcurrentHashMap<String, ZkClient>();
-  static final int DEFAULT_SESSION_TIMEOUT = 30 * 1000;
-
-  public static ZkClient getZkClient(String zkServer)
-  {
-    // happy path that we cache the zkclient and it's still connected
-    if (_zkClientMap.containsKey(zkServer))
-    {
-      ZkClient zkClient = _zkClientMap.get(zkServer);
-      if (zkClient.getConnection().getZookeeperState() == States.CONNECTED)
-      {
-        return zkClient;
-      }
-    }
-
-    synchronized (_zkClientMap)
-    {
-      // if we cache a stale zkclient, purge it
-      if (_zkClientMap.containsKey(zkServer))
-      {
-        ZkClient zkClient = _zkClientMap.get(zkServer);
-        if (zkClient.getConnection().getZookeeperState() != States.CONNECTED)
-        {
-          _zkClientMap.remove(zkServer);
-        }
-      }
-
-      // get a new zkclient
-      if (!_zkClientMap.containsKey(zkServer))
-      {
-        ZkClient zkClient = new ZkClient(zkServer, DEFAULT_SESSION_TIMEOUT, 
-            ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
-
-        _zkClientMap.put(zkServer, zkClient);
-      }
-      return _zkClientMap.get(zkServer);
-    }
-  }
-
-  public static void reset()
-  {
-    _zkClientMap.clear();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/util/ZNRecordUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/util/ZNRecordUtil.java b/helix-core/src/main/java/com/linkedin/helix/util/ZNRecordUtil.java
deleted file mode 100644
index 65fd7d8..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/util/ZNRecordUtil.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.linkedin.helix.util;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import com.linkedin.helix.ZNRecord;
-
-//TODO find a proper place for these methods
-public final class ZNRecordUtil
-{
-  private static final Logger logger = Logger.getLogger(ZNRecordUtil.class.getName());
-
-  private ZNRecordUtil()
-  {
-  }
-
-  public static ZNRecord find(String id, List<ZNRecord> list)
-  {
-    for (ZNRecord record : list)
-    {
-      if (record.getId() != null && record.getId().equals(id))
-      {
-        return record;
-      }
-    }
-    return null;
-  }
-
-  public static Map<String, ZNRecord> convertListToMap(List<ZNRecord> recordList)
-  {
-    Map<String, ZNRecord> recordMap = new HashMap<String, ZNRecord>();
-    for (ZNRecord record : recordList)
-    {
-      if (record.getId() != null)
-      {
-        recordMap.put(record.getId(), record);
-      }
-    }
-    return recordMap;
-  }
-
-  public static <T extends Object> List<T> convertListToTypedList(List<ZNRecord> recordList,
-                                                                  Class<T> clazz)
-  {
-    List<T> list = new ArrayList<T>();
-    for (ZNRecord record : recordList)
-    {
-      if (record.getId() == null)
-      {
-        logger.error("Invalid record: Id missing in " + record);
-        continue;
-      }
-      try
-      {
-
-        Constructor<T> constructor = clazz.getConstructor(new Class[] { ZNRecord.class });
-        T instance = constructor.newInstance(record);
-        list.add(instance);
-      }
-      catch (Exception e)
-      {
-        logger.error("Error creating an Object of type:" + clazz.getCanonicalName(), e);
-      }
-    }
-    return list;
-  }
-
-  public static <T extends Object> Map<String, T> convertListToTypedMap(List<ZNRecord> recordList,
-                                                                        Class<T> clazz)
-  {
-    Map<String, T> map = new HashMap<String, T>();
-    for (ZNRecord record : recordList)
-    {
-      if (record.getId() == null)
-      {
-        logger.error("Invalid record: Id missing in " + record);
-        continue;
-      }
-      try
-      {
-
-        Constructor<T> constructor = clazz.getConstructor(new Class[] { ZNRecord.class });
-        T instance = constructor.newInstance(record);
-        map.put(record.getId(), instance);
-      }
-      catch (Exception e)
-      {
-        logger.error("Error creating an Object of type:" + clazz.getCanonicalName(), e);
-      }
-    }
-    return map;
-  }
-
-  public static <T extends Object> List<T> convertMapToList(Map<String, T> map)
-  {
-    List<T> list = new ArrayList<T>();
-    for (T t : map.values())
-    {
-      list.add(t);
-    }
-    return list;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/helix-core/src/main/java/com/linkedin/helix/util/package-info.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/com/linkedin/helix/util/package-info.java b/helix-core/src/main/java/com/linkedin/helix/util/package-info.java
deleted file mode 100644
index 11fa5c6..0000000
--- a/helix-core/src/main/java/com/linkedin/helix/util/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * Helix utility classes
- * 
- */
-package com.linkedin.helix.util;
\ No newline at end of file