use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class ClientBwListDTO method toJson.
@Override
public JsonObject toJson() {
JsonObject object = new JsonObject();
object.add("mode", mode.toString());
if (entries != null) {
JsonArray entriesArray = new JsonArray();
for (ClientBwListEntryDTO entry : entries) {
JsonObject json = entry.toJson();
if (json != null) {
entriesArray.add(json);
}
}
object.add("entries", entriesArray);
}
return object;
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class ClusterHotRestartStatusDTO method fromJson.
@Override
public void fromJson(JsonObject root) {
String dataRecoveryPolicyStr = root.getString("dataRecoveryPolicy", FULL_RECOVERY_ONLY.toString());
dataRecoveryPolicy = HotRestartClusterDataRecoveryPolicy.valueOf(dataRecoveryPolicyStr);
String hotRestartStatusStr = root.getString("hotRestartStatus", ClusterHotRestartStatus.UNKNOWN.toString());
hotRestartStatus = ClusterHotRestartStatus.valueOf(hotRestartStatusStr);
remainingValidationTimeMillis = root.getLong("remainingValidationTimeMillis", -1);
remainingDataLoadTimeMillis = root.getLong("remainingDataLoadTimeMillis", -1);
JsonArray memberStatuses = (JsonArray) root.get("memberHotRestartStatuses");
memberHotRestartStatusMap = createHashMap(memberStatuses.size());
for (JsonValue value : memberStatuses) {
JsonObject memberStatus = (JsonObject) value;
String member = memberStatus.getString("member", "<unknown>");
MemberHotRestartStatus status = MemberHotRestartStatus.valueOf(memberStatus.getString("status", MemberHotRestartStatus.PENDING.toString()));
memberHotRestartStatusMap.put(member, status);
}
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class ClusterHotRestartStatusDTO method toJson.
@Override
public JsonObject toJson() {
JsonObject root = new JsonObject();
root.add("dataRecoveryPolicy", dataRecoveryPolicy.toString());
root.add("hotRestartStatus", hotRestartStatus.toString());
root.add("remainingValidationTimeMillis", remainingValidationTimeMillis);
root.add("remainingDataLoadTimeMillis", remainingDataLoadTimeMillis);
JsonArray memberStatuses = new JsonArray();
for (Map.Entry<String, MemberHotRestartStatus> entry : memberHotRestartStatusMap.entrySet()) {
String member = entry.getKey();
MemberHotRestartStatus status = entry.getValue();
JsonObject pair = new JsonObject();
pair.add("member", member);
pair.add("status", status.toString());
memberStatuses.add(pair);
}
root.add("memberHotRestartStatuses", memberStatuses);
return root;
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class DiscoveryConfigDTO method toJson.
@Override
public JsonObject toJson() {
JsonObject root = new JsonObject().add("nodeFilterClass", config.getNodeFilterClass());
JsonArray strategies = new JsonArray();
for (DiscoveryStrategyConfig strategyConfig : config.getDiscoveryStrategyConfigs()) {
DiscoveryStrategyConfigDTO dto = new DiscoveryStrategyConfigDTO(strategyConfig);
strategies.add(dto.toJson());
}
root.add("discoveryStrategy", strategies);
return root;
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class WanConfigurationExtendedEvent method toJson.
@Override
public JsonObject toJson() {
JsonObject json = super.toJson();
JsonArray publisherIds = new JsonArray();
for (String publisherId : wanPublisherIds) {
publisherIds.add(publisherId);
}
json.add("wanPublisherIds", publisherIds);
return json;
}
Aggregations