use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.
the class KubernetesClient method extractContainerPort.
private static Integer extractContainerPort(JsonValue podItemJson) {
JsonArray containers = toJsonArray(podItemJson.asObject().get("spec").asObject().get("containers"));
// If multiple containers are in one POD, then use the default Hazelcast port from the configuration.
if (containers.size() == 1) {
JsonValue container = containers.get(0);
JsonArray ports = toJsonArray(container.asObject().get("ports"));
// If multiple ports are exposed by a container, then use the default Hazelcast port from the configuration.
if (ports.size() == 1) {
JsonValue port = ports.get(0);
JsonValue containerPort = port.asObject().get("containerPort");
if (containerPort != null && containerPort.isNumber()) {
return containerPort.asInt();
}
}
}
return null;
}
use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.
the class SlowOperationDTO method fromJson.
@Override
public void fromJson(JsonObject json) {
operation = getString(json, "operation");
stackTrace = getString(json, "stackTrace");
totalInvocations = getInt(json, "totalInvocations");
invocations = new ArrayList<SlowOperationInvocationDTO>();
for (JsonValue jsonValue : getArray(json, "invocations")) {
SlowOperationInvocationDTO slowOperationInvocationDTO = new SlowOperationInvocationDTO();
slowOperationInvocationDTO.fromJson(jsonValue.asObject());
invocations.add(slowOperationInvocationDTO);
}
}
use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.
the class AliasedDiscoveryConfigDTO method fromJson.
@Override
public void fromJson(JsonObject json) {
config = AliasedDiscoveryConfigUtils.newConfigFor(tag);
JsonValue enabled = json.get("enabled");
if (enabled != null && !enabled.isNull()) {
config.setEnabled(enabled.asBoolean());
}
JsonValue usePublicIp = json.get("usePublicIp");
if (usePublicIp != null && !usePublicIp.isNull()) {
config.setUsePublicIp(usePublicIp.asBoolean());
}
Map<String, Comparable> properties = fromJsonObject((JsonObject) json.get("properties"));
for (Entry<String, Comparable> property : properties.entrySet()) {
config.setProperty(property.getKey(), (String) property.getValue());
}
}
use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.
the class ClientBwListDTO method fromJson.
@Override
public void fromJson(JsonObject json) {
String modeStr = getString(json, "mode");
mode = Mode.valueOf(modeStr);
entries = new ArrayList<>();
JsonArray entriesArray = getArray(json, "entries");
for (JsonValue jsonValue : entriesArray) {
ClientBwListEntryDTO entryDTO = new ClientBwListEntryDTO();
entryDTO.fromJson(jsonValue.asObject());
entries.add(entryDTO);
}
}
use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.
the class ClientEndPointDTO method fromJson.
@Override
public void fromJson(JsonObject json) {
uuid = UUID.fromString(getString(json, "uuid"));
address = getString(json, "address");
clientType = getString(json, "clientType");
name = getString(json, "name");
JsonArray labelsArray = getArray(json, "labels");
labels = new HashSet<>();
for (JsonValue labelValue : labelsArray) {
labels.add(labelValue.asString());
}
ipAddress = getString(json, "ipAddress", null);
canonicalHostName = getString(json, "canonicalHostName", null);
}
Aggregations