helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzh...@apache.org
Subject git commit: [Helix-9]
Date Thu, 15 Nov 2012 23:42:41 GMT
Updated Branches:
  refs/heads/master 37f5e4947 -> 0ddcc274f


[Helix-9]


Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/0ddcc274
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/0ddcc274
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/0ddcc274

Branch: refs/heads/master
Commit: 0ddcc274f9e0fe9e1f53d50c3e8d263b7fe641c5
Parents: 37f5e49
Author: zzhang <zzhang@apache.org>
Authored: Thu Nov 15 15:42:31 2012 -0800
Committer: zzhang <zzhang@apache.org>
Committed: Thu Nov 15 15:42:31 2012 -0800

----------------------------------------------------------------------
 .../helix/webapp/resources/ControllerResource.java |   29 ++++++++++-----
 .../java/org/apache/helix/ZNRecordBucketizer.java  |    1 -
 2 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ddcc274/helix-admin-webapp/src/main/java/org/apache/helix/webapp/resources/ControllerResource.java
----------------------------------------------------------------------
diff --git a/helix-admin-webapp/src/main/java/org/apache/helix/webapp/resources/ControllerResource.java
b/helix-admin-webapp/src/main/java/org/apache/helix/webapp/resources/ControllerResource.java
index 5e0c96a..588edc2 100644
--- a/helix-admin-webapp/src/main/java/org/apache/helix/webapp/resources/ControllerResource.java
+++ b/helix-admin-webapp/src/main/java/org/apache/helix/webapp/resources/ControllerResource.java
@@ -27,31 +27,40 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.helix.HelixException;
-import org.apache.helix.HelixProperty;
 import org.apache.helix.PropertyKey;
+import org.apache.helix.PropertyKey.Builder;
 import org.apache.helix.PropertyType;
 import org.apache.helix.ZNRecord;
-import org.apache.helix.PropertyKey.Builder;
 import org.apache.helix.manager.zk.ZKHelixDataAccessor;
 import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.manager.zk.ZkClient;
 import org.apache.helix.model.LiveInstance;
-import org.apache.helix.model.PauseSignal;
 import org.apache.helix.tools.ClusterSetup;
 import org.apache.helix.util.StatusUpdateUtil.Level;
 import org.apache.helix.webapp.RestAdminApplication;
 import org.codehaus.jackson.JsonGenerationException;
 import org.codehaus.jackson.map.JsonMappingException;
+import org.restlet.Context;
 import org.restlet.data.MediaType;
+import org.restlet.data.Request;
+import org.restlet.data.Response;
 import org.restlet.data.Status;
 import org.restlet.resource.Representation;
 import org.restlet.resource.Resource;
 import org.restlet.resource.StringRepresentation;
 import org.restlet.resource.Variant;
 
-
 public class ControllerResource extends Resource
 {
+
+  public ControllerResource(Context context, Request request, Response response)
+
+  {
+    super(context, request, response);
+    getVariants().add(new Variant(MediaType.TEXT_PLAIN));
+    getVariants().add(new Variant(MediaType.APPLICATION_JSON));
+  }
+
   @Override
   public boolean allowGet()
   {
@@ -87,7 +96,6 @@ public class ControllerResource extends Resource
     ZKHelixDataAccessor accessor =
         new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
 
-
     ZNRecord record = null;
     LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
     if (leader != null)
@@ -103,8 +111,8 @@ public class ControllerResource extends Resource
       contentMap.put("AdditionalInfo", "No leader exists");
       record.setMapField(Level.HELIX_INFO + "-" + time, contentMap);
     }
-    
-    boolean paused = (accessor.getProperty(keyBuilder.pause()) == null? false : true);
+
+    boolean paused = (accessor.getProperty(keyBuilder.pause()) == null ? false : true);
     record.setSimpleField(PropertyType.PAUSE.toString(), "" + paused);
 
     String retVal = ClusterRepresentationUtil.ZNRecordToJson(record);
@@ -147,7 +155,8 @@ public class ControllerResource extends Resource
 
       if (command == null)
       {
-        throw new HelixException("Could NOT find 'command' in parameterMap: " + jsonParameters._parameterMap);
+        throw new HelixException("Could NOT find 'command' in parameterMap: "
+            + jsonParameters._parameterMap);
       }
       else if (command.equalsIgnoreCase(ClusterSetup.enableCluster))
       {
@@ -159,9 +168,9 @@ public class ControllerResource extends Resource
       else
       {
         throw new HelixException("Unsupported command: " + command
-                                 + ". Should be one of [" + ClusterSetup.enableCluster +
"]");
+            + ". Should be one of [" + ClusterSetup.enableCluster + "]");
       }
-      
+
       getResponse().setEntity(getControllerRepresentation(clusterName));
       getResponse().setStatus(Status.SUCCESS_OK);
 

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ddcc274/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java b/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
index 7c41702..c0fbdc0 100644
--- a/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
+++ b/helix-core/src/main/java/org/apache/helix/ZNRecordBucketizer.java
@@ -19,7 +19,6 @@ package org.apache.helix;
  * under the License.
  */
 
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 


Mime
View raw message