use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class DiscoveryStrategyConfigDTO method fromJson.
@Override
public void fromJson(JsonObject json) {
config = new DiscoveryStrategyConfig();
JsonValue className = json.get("className");
if (className != null && !className.isNull()) {
config.setClassName(className.asString());
}
config.setProperties(fromJsonObject((JsonObject) json.get("properties")));
}
use of com.hazelcast.internal.json.JsonObject in project hazelcast by hazelcast.
the class ClientBwListEntryDTO method toJson.
public JsonObject toJson() {
JsonObject root = new JsonObject();
root.add("type", type.toString());
root.add("value", value);
return root;
}
use of com.hazelcast.internal.json.JsonObject 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.JsonObject 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.JsonObject 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;
}
Aggregations