Search in sources :

Example 1 with GetMapConfigOperation

use of com.hazelcast.internal.management.operation.GetMapConfigOperation in project hazelcast by hazelcast.

the class MapConfigRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) {
    final JsonObject result = new JsonObject();
    result.add("update", update);
    if (update) {
        final Set<Member> members = mcs.getHazelcastInstance().getCluster().getMembers();
        for (Member member : members) {
            mcs.callOnMember(member, new UpdateMapConfigOperation(mapName, config.getMapConfig()));
        }
        result.add("updateResult", "success");
    } else {
        MapConfig cfg = (MapConfig) mcs.callOnThis(new GetMapConfigOperation(mapName));
        if (cfg != null) {
            result.add("hasMapConfig", true);
            result.add("mapConfig", new MapConfigDTO(cfg).toJson());
        } else {
            result.add("hasMapConfig", false);
        }
    }
    root.add("result", result);
}
Also used : GetMapConfigOperation(com.hazelcast.internal.management.operation.GetMapConfigOperation) MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO) JsonObject(com.eclipsesource.json.JsonObject) UpdateMapConfigOperation(com.hazelcast.internal.management.operation.UpdateMapConfigOperation) MapConfig(com.hazelcast.config.MapConfig) Member(com.hazelcast.core.Member)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)1 MapConfig (com.hazelcast.config.MapConfig)1 Member (com.hazelcast.core.Member)1 MapConfigDTO (com.hazelcast.internal.management.dto.MapConfigDTO)1 GetMapConfigOperation (com.hazelcast.internal.management.operation.GetMapConfigOperation)1 UpdateMapConfigOperation (com.hazelcast.internal.management.operation.UpdateMapConfigOperation)1