Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helix monitoring #2

Open
wants to merge 122 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
d161a4e
[HELIX-212] Rebalancer interface should have 1 function to compute th…
zzhang5 Aug 23, 2013
e5f2ef7
[HELIX-224] Moving examples package to separate module helix-examples
kishoreg Aug 26, 2013
f73b3a7
[HELIX-225] fix helix-examples package build error
zzhang5 Aug 26, 2013
21c4fcb
[HELIX-174] Clean up ideal state calculators, move them to the contro…
zzhang5 Aug 26, 2013
934bb0f
[HELIX-214] User-defined rebalancer should never use SEMI_AUTO code p…
zzhang5 Aug 26, 2013
7dbb58c
[HELIX-109] Review Helix model package, initial changes
zzhang5 Aug 28, 2013
a019f3b
[HELIX-225] fix helix-examples package build error, rb=13835
zzhang5 Aug 28, 2013
433b001
[HELIX-109] Review Helix model package, merge model changes with acce…
zzhang5 Aug 29, 2013
becfda1
[HELIX-109] Review Helix model package, more accessor changes, rb=13878
zzhang5 Aug 29, 2013
c574265
[HELIX-215] YAML-based configuration, new recipe that uses YAML and U…
zzhang5 Sep 3, 2013
1d3c32e
[HELIX-227] Create a wiki page for helix admin api, rb=13933
zzhang5 Sep 3, 2013
19c6841
[HELIX-215] Adding new recipe on how to write a custom rebalancer
kishoreg Sep 3, 2013
84fb26b
[HELIX-228] fix errors in quick start wiki page, rb=13940
zzhang5 Sep 3, 2013
f90e0d8
[HELIX-250] Add Kanak as committer to website, rb=14287
kanakb Sep 23, 2013
8a39b8a
[HELIX-250] Add Kanak as committer to website, rb=14287
kanakb Sep 23, 2013
963c2bf
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
kanakb Sep 23, 2013
52717e4
[HELIX-250] Add Kanak as committer to website, fix bug in deploy script
kanakb Sep 26, 2013
b9fe738
[HELIX-264] fix zkclient#close() bug, rb=14483
zzhang5 Oct 4, 2013
b1c80f4
[HELIX-266] Create an IRC channel for Helix
kanakb Oct 6, 2013
d7140ff
[HELIX-266] Create an IRC channel for Helix, rb=14515
kanakb Oct 6, 2013
6513e4c
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
kanakb Oct 7, 2013
1f66035
[HELIX-266] Create an IRC channel for Helix (escape quote), rb=14515
kanakb Oct 7, 2013
f2a6455
[HELIX-216] Allow HelixAdmin addResource to accept the old rebalancin…
kanakb Oct 15, 2013
fbdafa6
[HELIX-144] Validate StateModelDefinition before adding it to the clu…
kanakb Oct 17, 2013
427cc97
[HELIX-144] Validate StateModelDefinition before adding it to the clu…
kanakb Oct 17, 2013
80abba3
[HELIX-270] Refactor website to have release-specific pages, disable …
kanakb Oct 18, 2013
96c8084
[HELIX-270] Refactor website to have release-specific pages, disable …
kanakb Oct 18, 2013
390bfda
[HELIX-258] Upgrade Apache Camel due to CVE-2013-4330
kanakb Oct 19, 2013
4224342
[HELIX-257] Upgraded restlet from 1.1.10 to 2.1.4 (merged pull reques…
kanakb Oct 21, 2013
f6e4c87
[HELIX-274] Verify FULL_AUTO tagged node behavior, fix bug in AutoReb…
kanakb Oct 22, 2013
90faf91
[HELIX-277] FULL_AUTO rebalancer should not prefer nodes that are jus…
kanakb Oct 24, 2013
486acd4
[HELIX-280] Full auto rebalancer should check resource tag first, rb=…
kanakb Oct 30, 2013
463f3a9
[HELIX-284] Support participant auto join in YAML cluster setup, rb=1…
kanakb Oct 30, 2013
181073d
[HELIX-284] Support participant auto join in YAML cluster setup (fix …
kanakb Oct 30, 2013
b67c3d3
[HELIX-285] add integration test util's, rb=15160
zzhang5 Oct 31, 2013
97b557a
[HELIX-286] add a test for redefine state model definition
zzhang5 Nov 5, 2013
13c1c4c
[HELIX-288] Update guava version, rb=15249
kanakb Nov 5, 2013
3b4129c
[HELIX-109] Review Helix model package, rb=13878
zzhang5 Aug 30, 2013
5557a8a
[HELIX-109] Review Helix model package, first half of rebalance-pipel…
zzhang5 Sep 4, 2013
042fe0c
[HELIX-109] adding config classes
kishoreg Sep 7, 2013
b42fbb5
[HELIX-109] Review Helix model package, fix failing tests
zzhang5 Sep 9, 2013
b1f2009
[HELIX-109] Review Helix model package, implemented more of ClusterAc…
zzhang5 Sep 10, 2013
397a7e9
[HELIX-109] Review Helix model package, fix failing tests
zzhang5 Sep 10, 2013
187d38b
[HELIX-100] improve helix config api, namespaced user configs
zzhang5 Sep 12, 2013
4c07c14
[HELIX-242] Re-integrate the scheduler rebalancing into the new contr…
zzhang5 Sep 13, 2013
8c58257
[HELIX-244] Redesign rebalancers using rebalancer-specific configs
zzhang5 Sep 13, 2013
ba436aa
[HELIX-243] Fix failing tests related to helix model overhaul
zzhang5 Sep 16, 2013
fb96a13
[HELIX-234] Convert-all-Id.x-to-x.from-and-assorted-code-cleanup
zzhang5 Sep 17, 2013
243f2ad
[HELIX-98] clean up setting constraint api, [HELIX-246] Refactor sche…
zzhang5 Sep 18, 2013
917af3e
[HELIX-100] Improve the helix config api
kanakb Sep 24, 2013
bc65737
[HELIX-238] Logical model accessor implementation
kanakb Sep 24, 2013
24fd868
[HELIX-238] Cleaned up ResourceAssignment
kanakb Sep 24, 2013
0b67257
[HELIX-236] Create a hierarchical cluster snapshot to replace Cluster…
zzhang5 Sep 25, 2013
89b3bc5
[HELIX-238] Added basic updater logic
kanakb Sep 26, 2013
644ef67
[HELIX-238] Refactor, add update to accessors, test update logic
kanakb Sep 26, 2013
31725b6
[HELIX-240] Add update examples to the existing example class
kanakb Sep 27, 2013
71c62c4
[HELIX-238] Added user config get/set/update to accessors
kanakb Sep 27, 2013
84441d3
[HELIX-216] Allow HelixAdmin addResource to accept the old rebalancin…
kanakb Sep 30, 2013
b32849f
[HELIX-100] IdealState compatibility with RebalancerContext
kanakb Sep 30, 2013
8c17dac
[HELIX-248] More IdealState/RebalancerContext compatibility
kanakb Sep 30, 2013
ae10d00
[HELIX-243] Fix one failing test
kanakb Oct 1, 2013
c506e95
[HELIX-100] Support participant auto join setting
kanakb Oct 1, 2013
8699060
[HELIX-100] Clean up immutable return values
kanakb Oct 2, 2013
314ed45
[HELIX-100] Use .equals instead of == for scope
kanakb Oct 2, 2013
19cdf76
[HELIX-100] Remove creating transitions from plain strings
kanakb Oct 3, 2013
dc94c8c
[HELIX-238] Updated accessors for a new cluster setup
kanakb Oct 4, 2013
e23a308
[HELIX-18] Added more functionality to the new cluster setup
kanakb Oct 5, 2013
61643b1
[HELIX-268] Atomic API - Add a ZK lock and a skeleton AtomicClusterAc…
kanakb Oct 8, 2013
e39b924
[HELIX-268] Atomic API, rb=14578
kanakb Oct 11, 2013
e707a60
[HELIX-209] Remove unused function
kanakb Oct 15, 2013
142c924
[HELIX-209] Backward compatible function naming in the model package
kanakb Oct 15, 2013
5405df1
[HELIX-209] Shuffling around rebalancer code to allow for compatibility
kanakb Oct 15, 2013
c589fb8
[HELIX-259] add HelixConnection, rb=14728
zzhang5 Nov 6, 2013
8cb38a5
[HELIX-209] Make UserConfig and RebalancerConfig backward compatible
kanakb Nov 5, 2013
0839afa
[HELIX-259] Add HelixConnection usage to the logical model example code
kanakb Nov 6, 2013
18a8c7c
Merge branch 'helix-logical-model'
kanakb Nov 7, 2013
ba25214
[HELIX-291] Update master POM files to say current version is 0.7.0
kanakb Nov 7, 2013
2f1f147
[HELIX-295] Remove xstream dependency
kanakb Nov 8, 2013
0bbd045
Revert "[HELIX-291] Update master POM files to say current version is…
kanakb Nov 8, 2013
ea8c61d
[HELIX-294] Add Swaroop as committer to the website, rb=15343
kanakb Nov 8, 2013
f8e3b1a
[HELIX-279] Apply gc handling fixes to ZKHelixManager
zzhang5 Nov 11, 2013
ebd37fe
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
zzhang5 Nov 11, 2013
0cb3775
[HELIX-290] Prefer ideal state for 0.7.0 rebalancer if not user defin…
kanakb Nov 9, 2013
00ff8c0
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
kanakb Nov 11, 2013
ec36112
[HELIX-292] ZNRecordStreamingSerializer should not assume id comes first
kanakb Nov 11, 2013
55c9351
[HELIX-297] Support old rebalancer for backward compatibility, rb=15431
kanakb Nov 11, 2013
72d879e
[HELIX-296] HelixConnection in 0.7.0 does not remove LiveInstance znode
zzhang5 Nov 12, 2013
7c444e5
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
zzhang5 Nov 12, 2013
2849e42
restore ASF links
olamy Nov 12, 2013
620c45b
[HELIX-300] Add missing license headers, rb=15459
kanakb Nov 12, 2013
3de26c7
[HELIX-301] Update integration test utils for 0.7.0, rb=15463
kanakb Nov 12, 2013
b3eca30
[HELIX-302] fix helix version compare bug
zzhang5 Nov 13, 2013
f3dd633
[HELIX-304] Add rat check to hpost-review, add missing license header
kanakb Nov 13, 2013
7adbd74
fix typo
zzhang5 Nov 13, 2013
ab02e1f
[maven-release-plugin] prepare release helix-0.7.0-incubating
zzhang5 Nov 13, 2013
114d709
[maven-release-plugin] prepare for next development iteration
zzhang5 Nov 13, 2013
3f6d64c
[HELIX-305] Build fails because net.sf.josql cannot be resolved, rb=1…
kanakb Nov 14, 2013
eac1ec4
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
kanakb Nov 14, 2013
e57569a
[maven-release-plugin] prepare release helix-0.7.0-incubating
zzhang5 Nov 14, 2013
875ed57
[maven-release-plugin] prepare for next development iteration
zzhang5 Nov 14, 2013
9f82f6e
[HELIX-306] helix-agent package doesn't create an assembled tar
kanakb Nov 14, 2013
8770b48
[maven-release-plugin] prepare release helix-0.7.0-incubating
zzhang5 Nov 14, 2013
1704252
[maven-release-plugin] prepare for next development iteration
zzhang5 Nov 14, 2013
150ce69
[HELIX-270] Include documentation for previous version on the website
kanakb Nov 15, 2013
2c29549
[maven-release-plugin] prepare release helix-0.7.0-incubating
zzhang5 Nov 14, 2013
48a99a2
[maven-release-plugin] prepare for next development iteration
zzhang5 Nov 14, 2013
9ec2a1f
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
kanakb Nov 15, 2013
80af2de
[HELIX-270] Include documentation for previous version on the website…
kanakb Nov 16, 2013
d09de23
[HELIX-270] Include documentation for previous version on the website…
kanakb Nov 17, 2013
2194542
[HELIX-308] Get website ready for the 0.6.2 and 0.7.0 releases
kanakb Nov 23, 2013
bac40bb
[HELIX-321] Controller forgets that it's the leader, rb=15817
kanakb Nov 23, 2013
2904c83
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incu…
kanakb Nov 25, 2013
77f14b4
[HELIX-319] Plug Riemann server into Helix, config management, first …
kanakb Nov 28, 2013
902e6fa
[HELIX-317] Create a monitoring client API
kanakb Dec 10, 2013
b1df294
A basic alerting example
kanakb Jan 18, 2014
a992842
Create and join the cluster directly from the config
kanakb Jan 28, 2014
b182690
[HELIX-315] Handle alerts in controller, rb=17758
zzhang5 Feb 13, 2014
3505bea
[HELIX-319] refactor MonitoringClient to accommodate distributed moni…
zzhang5 Feb 27, 2014
8dc50de
[HELIX-319] refactor MonitoringClient to accommodate distributed moni…
zzhang5 Feb 27, 2014
f0367e9
[HELIX-319] refactor MonitoringClient to accommodate distributed moni…
zzhang5 Feb 28, 2014
db4c10a
[HELIX-395] Remove old Helix alert/stat modules
zzhang5 Mar 3, 2014
c0b1780
[HELIX-319] refactor MonitoringClient to accommodate distributed moni…
zzhang5 Mar 19, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
cscope.*
.classpath
.project
Expand Down
2 changes: 1 addition & 1 deletion deploySite.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
read -s -p "Enter Apache Username: " myusername
echo ""
read -s -p "Enter Apache Password: " mypassword
mvn clean site-deploy scm-publish:publish-scm -Dusername=$myusername -Dpassword=$mypassword -DskipTests $@
mvn clean site-deploy scm-publish:publish-scm -Dusername="$myusername" -Dpassword="$mypassword" -DskipTests $@
11 changes: 3 additions & 8 deletions helix-admin-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ under the License.
<parent>
<groupId>org.apache.helix</groupId>
<artifactId>helix</artifactId>
<version>0.6.2-incubating-SNAPSHOT</version>
<version>0.7.1-incubating-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -47,13 +47,8 @@ under the License.
<artifactId>helix-core</artifactId>
</dependency>
<dependency>
<groupId>com.noelios.restlet</groupId>
<artifactId>com.noelios.restlet</artifactId>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* under the License.
*/

import java.util.logging.Level;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
Expand Down Expand Up @@ -52,13 +54,13 @@
import org.apache.helix.webapp.resources.ZkPathResource;
import org.restlet.Application;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.Restlet;
import org.restlet.Router;
import org.restlet.data.MediaType;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.StringRepresentation;
import org.restlet.util.Template;
import org.restlet.representation.StringRepresentation;
import org.restlet.routing.Router;
import org.restlet.routing.Template;

public class RestAdminApplication extends Application {
public static final String HELP = "help";
Expand All @@ -67,6 +69,10 @@ public class RestAdminApplication extends Application {
public static final String ZKCLIENT = "zkClient";
public static final int DEFAULT_PORT = 8100;

static {
org.restlet.engine.Engine.setLogLevel(Level.SEVERE);
}

public RestAdminApplication() {
super();
}
Expand All @@ -76,7 +82,7 @@ public RestAdminApplication(Context context) {
}

@Override
public Restlet createRoot() {
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_EQUALS);
router.attach("/clusters", ClustersResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import org.apache.helix.HelixDataAccessor;
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.ZNRecordSerializer;
import org.apache.helix.manager.zk.ZkBaseDataAccessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,39 @@
*/

import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixException;
import org.apache.helix.ZNRecord;
import org.apache.helix.PropertyKey.Builder;
import org.apache.helix.ZNRecord;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.model.Leader;
import org.apache.helix.model.LiveInstance;
import org.apache.helix.tools.ClusterSetup;
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.Method;
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 ClusterResource extends Resource {
public ClusterResource(Context context, Request request, Response response) {
super(context, request, response);
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.representation.Variant;
import org.restlet.resource.ServerResource;

public class ClusterResource extends ServerResource {
public ClusterResource() {
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
getVariants().add(new Variant(MediaType.APPLICATION_JSON));
setNegotiated(false);
}

@Override
public boolean allowGet() {
return true;
}

@Override
public boolean allowPost() {
return true;
}

@Override
public boolean allowPut() {
return false;
}

@Override
public boolean allowDelete() {
return true;
}

@Override
public Representation represent(Variant variant) {
public Representation get() {
StringRepresentation presentation = null;
try {
String clusterName = (String) getRequest().getAttributes().get("clusterName");
Expand All @@ -80,7 +62,6 @@ public Representation represent(Variant variant) {
catch (Exception e) {
String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);

e.printStackTrace();
}
return presentation;
Expand All @@ -107,7 +88,7 @@ StringRepresentation getClusterRepresentation(String clusterName) throws JsonGen
ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
Builder keyBuilder = accessor.keyBuilder();

LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
Leader leader = accessor.getProperty(keyBuilder.controllerLeader());
if (leader != null) {
clusterSummayRecord.setSimpleField("LEADER", leader.getInstanceName());
} else {
Expand All @@ -121,7 +102,7 @@ StringRepresentation getClusterRepresentation(String clusterName) throws JsonGen
}

@Override
public void acceptRepresentation(Representation entity) {
public Representation post(Representation entity) {
try {
String clusterName = (String) getRequest().getAttributes().get("clusterName");
ZkClient zkClient =
Expand Down Expand Up @@ -160,10 +141,11 @@ public void acceptRepresentation(Representation entity) {
MediaType.APPLICATION_JSON);
getResponse().setStatus(Status.SUCCESS_OK);
}
return getResponseEntity();
}

@Override
public void removeRepresentations() {
public Representation delete() {
try {
String clusterName = (String) getRequest().getAttributes().get("clusterName");
ZkClient zkClient =
Expand All @@ -176,5 +158,6 @@ public void removeRepresentations() {
MediaType.APPLICATION_JSON);
getResponse().setStatus(Status.SUCCESS_OK);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,25 @@
import org.apache.log4j.Logger;
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;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.representation.Variant;
import org.restlet.resource.ServerResource;

public class ClustersResource extends Resource {
public class ClustersResource extends ServerResource {
private final static Logger LOG = Logger.getLogger(ClustersResource.class);

public ClustersResource(Context context, Request request, Response response) {
super(context, request, response);
public ClustersResource() {
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
getVariants().add(new Variant(MediaType.APPLICATION_JSON));
setNegotiated(false);
// handle(request,response);
}

@Override
public boolean allowPost() {
return true;
}

@Override
public boolean allowPut() {
return false;
}

@Override
public boolean allowDelete() {
return true;
}

@Override
public Representation represent(Variant variant) {
public Representation get() {
StringRepresentation presentation = null;
try {
presentation = getClustersRepresentation();
Expand Down Expand Up @@ -96,7 +78,7 @@ StringRepresentation getClustersRepresentation() throws JsonGenerationException,
}

@Override
public void acceptRepresentation(Representation entity) {
public Representation post(Representation entity) {
try {
JsonParameters jsonParameters = new JsonParameters(entity);
String command = jsonParameters.getCommand();
Expand Down Expand Up @@ -124,10 +106,11 @@ public void acceptRepresentation(Representation entity) {
getResponse().setStatus(Status.SUCCESS_OK);
LOG.error("Error in posting " + entity, e);
}
return null;
}

@Override
public void removeRepresentations() {

public Representation delete() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,36 @@
*/

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.apache.helix.HelixAdmin;
import org.apache.helix.HelixException;
import org.apache.helix.ZNRecord;
import org.apache.helix.manager.zk.ZkClient;
import org.apache.helix.model.ConfigScope;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
import org.apache.helix.model.builder.ConfigScopeBuilder;
import org.apache.helix.model.builder.HelixConfigScopeBuilder;
import org.apache.helix.tools.ClusterSetup;
import org.apache.helix.webapp.RestAdminApplication;
import org.apache.log4j.Logger;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
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;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.representation.Variant;
import org.restlet.resource.ServerResource;

public class ConfigResource extends Resource {
public class ConfigResource extends ServerResource {
private final static Logger LOG = Logger.getLogger(ConfigResource.class);

public ConfigResource(Context context, Request request, Response response) {
super(context, request, response);
public ConfigResource() {
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
getVariants().add(new Variant(MediaType.APPLICATION_JSON));
setModifiable(true);
setNegotiated(false);
}

String getValue(String key) {
Expand Down Expand Up @@ -122,7 +118,7 @@ StringRepresentation getConfigs(// ConfigScope scope,
}

@Override
public Representation represent(Variant variant) {
public Representation get() {
StringRepresentation representation = null;

String clusterName = getValue("clusterName");
Expand Down Expand Up @@ -221,12 +217,13 @@ void setConfigs(Representation entity, ConfigScopeProperty type, String scopeArg

}

getResponse().setEntity(represent());
getResponse().setEntity(get());
getResponse().setStatus(Status.SUCCESS_OK);
}

@Override
public void acceptRepresentation(Representation entity) {

@Override
public Representation post(Representation entity) {
String clusterName = getValue("clusterName");

String scopeStr = getValue("scope").toUpperCase();
Expand Down Expand Up @@ -268,5 +265,6 @@ public void acceptRepresentation(Representation entity) {
MediaType.APPLICATION_JSON);
getResponse().setStatus(Status.SUCCESS_OK);
}
return null;
}
}
Loading