Search in sources :

Example 86 with JsonObject

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

the class GetMapEntryRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) throws Exception {
    IMap map = mcs.getHazelcastInstance().getMap(mapName);
    JsonObject result = new JsonObject();
    EntryView entry = null;
    if (type.equals("string")) {
        entry = map.getEntryView(key);
    } else if (type.equals("long")) {
        entry = map.getEntryView(Long.valueOf(key));
    } else if (type.equals("integer")) {
        entry = map.getEntryView(Integer.valueOf(key));
    }
    if (entry != null) {
        Object value = entry.getValue();
        result.add("browse_value", value != null ? value.toString() : "null");
        result.add("browse_class", value != null ? value.getClass().getName() : "null");
        result.add("memory_cost", Long.toString(entry.getCost()));
        result.add("date_creation_time", Long.toString(entry.getCreationTime()));
        result.add("date_expiration_time", Long.toString(entry.getExpirationTime()));
        result.add("browse_hits", Long.toString(entry.getHits()));
        result.add("date_access_time", Long.toString(entry.getLastAccessTime()));
        result.add("date_update_time", Long.toString(entry.getLastUpdateTime()));
        result.add("browse_version", Long.toString(entry.getVersion()));
    }
    root.add("result", result);
}
Also used : IMap(com.hazelcast.core.IMap) EntryView(com.hazelcast.core.EntryView) JsonObject(com.eclipsesource.json.JsonObject) JsonObject(com.eclipsesource.json.JsonObject)

Example 87 with JsonObject

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

the class GetMapEntryRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("mapName", mapName);
    root.add("type", type);
    root.add("key", key);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 88 with JsonObject

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

the class GetMemberSystemPropertiesRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) {
    Properties properties = System.getProperties();
    JsonObject result = new JsonObject();
    for (Map.Entry<Object, Object> entry : properties.entrySet()) {
        result.add(entry.getKey().toString(), entry.getValue().toString());
    }
    root.add("result", result);
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) JsonObject(com.eclipsesource.json.JsonObject) Properties(java.util.Properties) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 89 with JsonObject

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

the class MapConfigRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("mapName", mapName);
    root.add("update", update);
    root.add("config", config.toJson());
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 90 with JsonObject

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

the class ChangeClusterStateRequest method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("state", state);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)126 Test (org.junit.Test)41 ParallelTest (com.hazelcast.test.annotation.ParallelTest)38 QuickTest (com.hazelcast.test.annotation.QuickTest)38 JsonArray (com.eclipsesource.json.JsonArray)14 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)12 HashMap (java.util.HashMap)12 Map (java.util.Map)9 JsonValue (com.eclipsesource.json.JsonValue)5 ExecuteScriptRequest (com.hazelcast.internal.management.request.ExecuteScriptRequest)5 BoxSharedLink (com.box.androidsdk.content.models.BoxSharedLink)4 WanPublisherConfig (com.hazelcast.config.WanPublisherConfig)4 ChangeClusterStateRequest (com.hazelcast.internal.management.request.ChangeClusterStateRequest)3 ChangeWanStateRequest (com.hazelcast.internal.management.request.ChangeWanStateRequest)3 ILogger (com.hazelcast.logging.ILogger)3 IOException (java.io.IOException)3 BoxEntity (com.box.androidsdk.content.models.BoxEntity)2 ParseException (com.eclipsesource.json.ParseException)2 ClusterState (com.hazelcast.cluster.ClusterState)2 MapConfig (com.hazelcast.config.MapConfig)2