Search in sources :

Example 1 with JsonValue

use of com.eclipsesource.json.JsonValue in project hazelcast by hazelcast.

the class ExecuteScriptRequest method fromJson.

@Override
public void fromJson(JsonObject json) {
    script = getString(json, "script", "");
    engine = getString(json, "engine", "");
    targets = new HashSet<String>();
    for (JsonValue target : getArray(json, "targets", new JsonArray())) {
        targets.add(target.asString());
    }
    targetAllMembers = getBoolean(json, "targetAllMembers", false);
    bindings = new HashMap<String, Object>();
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonValue(com.eclipsesource.json.JsonValue) JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 2 with JsonValue

use of com.eclipsesource.json.JsonValue in project hazelcast by hazelcast.

the class MemberPartitionStateImpl method fromJson.

@Override
public void fromJson(JsonObject json) {
    final JsonArray jsonPartitions = getArray(json, "partitions");
    for (JsonValue jsonPartition : jsonPartitions) {
        partitions.add(jsonPartition.asInt());
    }
    memberStateSafe = getBoolean(json, "memberStateSafe");
    migrationQueueSize = getInt(json, "migrationQueueSize");
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonValue(com.eclipsesource.json.JsonValue)

Example 3 with JsonValue

use of com.eclipsesource.json.JsonValue in project hazelcast by hazelcast.

the class MemberStateImpl method fromJson.

//CHECKSTYLE:OFF
@Override
public void fromJson(JsonObject json) {
    address = getString(json, "address");
    for (JsonObject.Member next : getObject(json, "mapStats")) {
        LocalMapStatsImpl stats = new LocalMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        mapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "multiMapStats")) {
        LocalMultiMapStatsImpl stats = new LocalMultiMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        multiMapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "replicatedMapStats", new JsonObject())) {
        LocalReplicatedMapStats stats = new LocalReplicatedMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        replicatedMapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "queueStats")) {
        LocalQueueStatsImpl stats = new LocalQueueStatsImpl();
        stats.fromJson(next.getValue().asObject());
        queueStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "topicStats")) {
        LocalTopicStatsImpl stats = new LocalTopicStatsImpl();
        stats.fromJson(next.getValue().asObject());
        topicStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "executorStats")) {
        LocalExecutorStatsImpl stats = new LocalExecutorStatsImpl();
        stats.fromJson(next.getValue().asObject());
        executorStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "cacheStats", new JsonObject())) {
        LocalCacheStats stats = new LocalCacheStatsImpl();
        stats.fromJson(next.getValue().asObject());
        cacheStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "wanStats", new JsonObject())) {
        LocalWanStats stats = new LocalWanStatsImpl();
        stats.fromJson(next.getValue().asObject());
        wanStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "runtimeProps")) {
        runtimeProps.put(next.getName(), next.getValue().asLong());
    }
    final JsonArray jsonClients = getArray(json, "clients");
    for (JsonValue jsonClient : jsonClients) {
        final ClientEndPointDTO client = new ClientEndPointDTO();
        client.fromJson(jsonClient.asObject());
        clients.add(client);
    }
    beans = new MXBeansDTO();
    beans.fromJson(getObject(json, "beans"));
    JsonObject jsonMemoryStats = getObject(json, "memoryStats", null);
    if (jsonMemoryStats != null) {
        memoryStats.fromJson(jsonMemoryStats);
    }
    JsonObject jsonOperationStats = getObject(json, "operationStats", null);
    if (jsonOperationStats != null) {
        operationStats.fromJson(jsonOperationStats);
    }
    JsonObject jsonMemberPartitionState = getObject(json, "memberPartitionState", null);
    if (jsonMemberPartitionState != null) {
        memberPartitionState = new MemberPartitionStateImpl();
        memberPartitionState.fromJson(jsonMemberPartitionState);
    }
    JsonObject jsonNodeState = getObject(json, "nodeState", null);
    if (jsonNodeState != null) {
        nodeState = new NodeStateImpl();
        nodeState.fromJson(jsonNodeState);
    }
    JsonObject jsonHotRestartState = getObject(json, "hotRestartState", null);
    if (jsonHotRestartState != null) {
        hotRestartState = new HotRestartStateImpl();
        hotRestartState.fromJson(jsonHotRestartState);
    }
    JsonObject jsonClusterHotRestartStatus = getObject(json, "clusterHotRestartStatus", null);
    if (jsonClusterHotRestartStatus != null) {
        clusterHotRestartStatus = new ClusterHotRestartStatusDTO();
        clusterHotRestartStatus.fromJson(jsonClusterHotRestartStatus);
    }
    JsonObject jsonWanSyncState = getObject(json, "wanSyncState", null);
    if (jsonWanSyncState != null) {
        wanSyncState = new WanSyncStateImpl();
        wanSyncState.fromJson(jsonWanSyncState);
    }
}
Also used : LocalCacheStats(com.hazelcast.monitor.LocalCacheStats) ClientEndPointDTO(com.hazelcast.internal.management.dto.ClientEndPointDTO) JsonValue(com.eclipsesource.json.JsonValue) JsonObject(com.eclipsesource.json.JsonObject) MXBeansDTO(com.hazelcast.internal.management.dto.MXBeansDTO) JsonArray(com.eclipsesource.json.JsonArray) LocalWanStats(com.hazelcast.monitor.LocalWanStats) ClusterHotRestartStatusDTO(com.hazelcast.internal.management.dto.ClusterHotRestartStatusDTO) LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats)

Example 4 with JsonValue

use of com.eclipsesource.json.JsonValue in project hazelcast by hazelcast.

the class TimedMemberState method fromJson.

@Override
public void fromJson(JsonObject json) {
    time = getLong(json, "time");
    master = getBoolean(json, "master");
    clusterName = getString(json, "clusterName");
    instanceNames = new HashSet<String>();
    final JsonArray jsonInstanceNames = getArray(json, "instanceNames");
    for (JsonValue instanceName : jsonInstanceNames.values()) {
        instanceNames.add(instanceName.asString());
    }
    memberList = new ArrayList<String>();
    final JsonArray jsonMemberList = getArray(json, "memberList");
    for (JsonValue member : jsonMemberList.values()) {
        memberList.add(member.asString());
    }
    final JsonObject jsonMemberState = getObject(json, "memberState");
    memberState = new MemberStateImpl();
    memberState.fromJson(jsonMemberState);
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) MemberStateImpl(com.hazelcast.monitor.impl.MemberStateImpl) JsonValue(com.eclipsesource.json.JsonValue) JsonObject(com.eclipsesource.json.JsonObject) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString)

Example 5 with JsonValue

use of com.eclipsesource.json.JsonValue in project hazelcast by hazelcast.

the class LocalMapStatsImpl method fromJson.

@Override
public void fromJson(JsonObject json) {
    getCount = getLong(json, "getCount", -1L);
    putCount = getLong(json, "putCount", -1L);
    removeCount = getLong(json, "removeCount", -1L);
    numberOfOtherOperations = getLong(json, "numberOfOtherOperations", -1L);
    numberOfEvents = getLong(json, "numberOfEvents", -1L);
    lastAccessTime = getLong(json, "lastAccessTime", -1L);
    lastUpdateTime = getLong(json, "lastUpdateTime", -1L);
    totalGetLatencies = getLong(json, "totalGetLatencies", -1L);
    totalPutLatencies = getLong(json, "totalPutLatencies", -1L);
    totalRemoveLatencies = getLong(json, "totalRemoveLatencies", -1L);
    maxGetLatency = getLong(json, "maxGetLatency", -1L);
    maxPutLatency = getLong(json, "maxPutLatency", -1L);
    maxRemoveLatency = getLong(json, "maxRemoveLatency", -1L);
    hits = getLong(json, "hits", -1L);
    ownedEntryCount = getLong(json, "ownedEntryCount", -1L);
    backupEntryCount = getLong(json, "backupEntryCount", -1L);
    backupCount = getInt(json, "backupCount", -1);
    ownedEntryMemoryCost = getLong(json, "ownedEntryMemoryCost", -1L);
    backupEntryMemoryCost = getLong(json, "backupEntryMemoryCost", -1L);
    creationTime = getLong(json, "creationTime", -1L);
    lockedEntryCount = getLong(json, "lockedEntryCount", -1L);
    dirtyEntryCount = getLong(json, "dirtyEntryCount", -1L);
    heapCost = getLong(json, "heapCost", -1L);
    JsonValue jsonNearCacheStats = json.get("nearCacheStats");
    if (jsonNearCacheStats != null) {
        nearCacheStats = new NearCacheStatsImpl();
        nearCacheStats.fromJson(jsonNearCacheStats.asObject());
    }
}
Also used : JsonValue(com.eclipsesource.json.JsonValue)

Aggregations

JsonValue (com.eclipsesource.json.JsonValue)90 JsonObject (com.eclipsesource.json.JsonObject)44 JsonArray (com.eclipsesource.json.JsonArray)32 ArrayList (java.util.ArrayList)24 URL (java.net.URL)20 HashMap (java.util.HashMap)8 ParseException (com.eclipsesource.json.ParseException)4 IOException (java.io.IOException)4 MalformedURLException (java.net.MalformedURLException)4 InetSocketAddress (java.net.InetSocketAddress)3 ParseException (java.text.ParseException)3 Member (com.eclipsesource.json.JsonObject.Member)2 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)2 WalletCallException (com.vaklinov.zcashui.ZCashClientCaller.WalletCallException)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 InputStreamReader (java.io.InputStreamReader)2 Reader (java.io.Reader)2 PublicKey (java.security.PublicKey)2 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)2