Search in sources :

Example 91 with JsonObject

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

the class ChangeWanStateRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    Object operationResult = mcs.callOnThis(new ChangeWanStateOperation(schemeName, publisherName, start));
    JsonObject result = new JsonObject();
    if (operationResult == null) {
        result.add("result", SUCCESS);
    } else {
        result.add("result", operationResult.toString());
    }
    out.add("result", result);
}
Also used : ChangeWanStateOperation(com.hazelcast.internal.management.operation.ChangeWanStateOperation) JsonObject(com.eclipsesource.json.JsonObject) JsonObject(com.eclipsesource.json.JsonObject)

Example 92 with JsonObject

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

the class ChangeWanStateRequest method toJson.

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

Example 93 with JsonObject

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

the class ClearWanQueuesRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    ClearWanQueuesOperation operation = new ClearWanQueuesOperation(schemeName, publisherName);
    Object operationResult = mcs.callOnThis(operation);
    JsonObject result = new JsonObject();
    if (operationResult == null) {
        result.add("result", SUCCESS);
    } else {
        result.add("result", operationResult.toString());
    }
    out.add("result", result);
}
Also used : ClearWanQueuesOperation(com.hazelcast.internal.management.operation.ClearWanQueuesOperation) JsonObject(com.eclipsesource.json.JsonObject) JsonObject(com.eclipsesource.json.JsonObject)

Example 94 with JsonObject

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

the class ClusterPropsRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) throws Exception {
    Runtime runtime = Runtime.getRuntime();
    RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
    IPartitionService partitionService = mcs.getHazelcastInstance().node.getPartitionService();
    JsonObject properties = new JsonObject();
    properties.add("hazelcast.cl_version", mcs.getHazelcastInstance().node.getBuildInfo().getVersion());
    properties.add("date.cl_startTime", Long.toString(runtimeMxBean.getStartTime()));
    properties.add("seconds.cl_upTime", Long.toString(runtimeMxBean.getUptime()));
    properties.add("memory.cl_freeMemory", Long.toString(runtime.freeMemory()));
    properties.add("memory.cl_totalMemory", Long.toString(runtime.totalMemory()));
    properties.add("memory.cl_maxMemory", Long.toString(runtime.maxMemory()));
    properties.add("return.hasOngoingMigration", Boolean.toString(partitionService.hasOnGoingMigration()));
    properties.add("data.cl_migrationTasksCount", Long.toString(partitionService.getMigrationQueueSize()));
    root.add("result", properties);
}
Also used : IPartitionService(com.hazelcast.spi.partition.IPartitionService) JsonObject(com.eclipsesource.json.JsonObject) RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 95 with JsonObject

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

the class ConsoleCommandRequest method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = new JsonObject();
    root.add("command", command);
    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