Skip to content

Commit

Permalink
enable/disable change mancenter url
Browse files Browse the repository at this point in the history
  • Loading branch information
enesakar committed May 2, 2012
1 parent 0068624 commit 1278ad8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
Expand Up @@ -485,6 +485,14 @@ cfg.setProperty("hazelcast.property.foo", "value");
<td>integer</td>
<td>100</td>
</tr>
<tr>
<td>
<db:literal>hazelcast.mc.url.change.enabled</db:literal>
</td>
<td>Management Center changing server url is enabled</td>
<td>boolean</td>
<td>true</td>
</tr>
<tr>
<td>
<db:literal>hazelcast.elastic.memory.enabled</db:literal>
Expand Down
Expand Up @@ -72,6 +72,7 @@ public class GroupProperties {
public static final String PROP_MC_SEMAPHORE_EXCLUDES = "hazelcast.mc.semaphore.excludes";
public static final String PROP_MC_TOPIC_EXCLUDES = "hazelcast.mc.topic.excludes";
public static final String PROP_MC_MAX_VISIBLE_INSTANCE_COUNT = "hazelcast.mc.max.visible.instance.count";
public static final String PROP_MC_URL_CHANGE_ENABLED = "hazelcast.mc.url.change.enabled";
public static final String PROP_CONCURRENT_MAP_SIMPLE_RECORD = "hazelcast.map.simple.record";
public static final String PROP_CONNECTION_MONITOR_INTERVAL = "hazelcast.connection.monitor.interval";
public static final String PROP_CONNECTION_MONITOR_MAX_FAULTS = "hazelcast.connection.monitor.max.faults";
Expand Down Expand Up @@ -189,6 +190,8 @@ public class GroupProperties {

public final GroupProperty MC_MAX_INSTANCE_COUNT;

public final GroupProperty MC_URL_CHANGE_ENABLED;

public final GroupProperty CONCURRENT_MAP_SIMPLE_RECORD;

public final GroupProperty CONNECTION_MONITOR_INTERVAL;
Expand Down Expand Up @@ -263,6 +266,7 @@ public GroupProperties(Config config) {
MC_SEMAPHORE_EXCLUDES = new GroupProperty(config, PROP_MC_SEMAPHORE_EXCLUDES, null);
MC_TOPIC_EXCLUDES = new GroupProperty(config, PROP_MC_TOPIC_EXCLUDES, null);
MC_MAX_INSTANCE_COUNT = new GroupProperty(config, PROP_MC_MAX_VISIBLE_INSTANCE_COUNT, "100");
MC_URL_CHANGE_ENABLED = new GroupProperty(config, PROP_MC_URL_CHANGE_ENABLED, "true");
CONCURRENT_MAP_SIMPLE_RECORD = new GroupProperty(config, PROP_CONCURRENT_MAP_SIMPLE_RECORD, "false");
CONNECTION_MONITOR_INTERVAL = new GroupProperty(config, PROP_CONNECTION_MONITOR_INTERVAL, "100");
CONNECTION_MONITOR_MAX_FAULTS = new GroupProperty(config, PROP_CONNECTION_MONITOR_MAX_FAULTS, "3");
Expand Down
Expand Up @@ -40,18 +40,23 @@ public void handle(HttpPostCommand command) {
textCommandService.put(mapName, key, new RestValue(data, command.getContentType()), 0);
command.setResponse(HttpCommand.RES_204);
} else if (uri.startsWith(URI_MANCENTER_CHANGE_URL)) {
byte[] res = null;
byte[] data = command.getData();
String[] strList = new String(data).split("&");
String cluster = URLDecoder.decode(strList[0], "UTF-8");
String pass = URLDecoder.decode(strList[1], "UTF-8");
String url = URLDecoder.decode(strList[2], "UTF-8");
if (textCommandService.getNode().getGroupProperties().MC_URL_CHANGE_ENABLED.getBoolean()) {
byte[] res = null;
byte[] data = command.getData();
String[] strList = new String(data).split("&");
String cluster = URLDecoder.decode(strList[0], "UTF-8");
String pass = URLDecoder.decode(strList[1], "UTF-8");
String url = URLDecoder.decode(strList[2], "UTF-8");

ManagementCenterService managementCenterService = textCommandService.getNode().getManagementCenterService();
if (managementCenterService != null) {
res = managementCenterService.changeWebServerUrlOverCluster(cluster, pass, url);
ManagementCenterService managementCenterService = textCommandService.getNode().getManagementCenterService();
if (managementCenterService != null) {
res = managementCenterService.changeWebServerUrlOverCluster(cluster, pass, url);
}
command.setResponse(res);
}
else {
command.setResponse(HttpCommand.RES_503);
}
command.setResponse(res);
} else if (uri.startsWith(URI_QUEUES)) {
String queueName = null;
String simpleValue = null;
Expand Down

0 comments on commit 1278ad8

Please sign in to comment.