Search in sources :

Example 1 with MapConfigDTO

use of com.hazelcast.internal.management.dto.MapConfigDTO in project hazelcast by hazelcast.

the class MapConfigRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) {
    final JsonObject result = new JsonObject();
    result.add("update", update);
    if (update) {
        final Set<Member> members = mcs.getHazelcastInstance().getCluster().getMembers();
        for (Member member : members) {
            mcs.callOnMember(member, new UpdateMapConfigOperation(mapName, config.getMapConfig()));
        }
        result.add("updateResult", "success");
    } else {
        MapConfig cfg = (MapConfig) mcs.callOnThis(new GetMapConfigOperation(mapName));
        if (cfg != null) {
            result.add("hasMapConfig", true);
            result.add("mapConfig", new MapConfigDTO(cfg).toJson());
        } else {
            result.add("hasMapConfig", false);
        }
    }
    root.add("result", result);
}
Also used : GetMapConfigOperation(com.hazelcast.internal.management.operation.GetMapConfigOperation) MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO) JsonObject(com.eclipsesource.json.JsonObject) UpdateMapConfigOperation(com.hazelcast.internal.management.operation.UpdateMapConfigOperation) MapConfig(com.hazelcast.config.MapConfig) Member(com.hazelcast.core.Member)

Example 2 with MapConfigDTO

use of com.hazelcast.internal.management.dto.MapConfigDTO in project hazelcast by hazelcast.

the class MapConfigRequest method fromJson.

@Override
public void fromJson(JsonObject json) {
    mapName = getString(json, "mapName");
    update = getBoolean(json, "update");
    config = new MapConfigDTO();
    config.fromJson(getObject(json, "config"));
}
Also used : MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO)

Example 3 with MapConfigDTO

use of com.hazelcast.internal.management.dto.MapConfigDTO in project hazelcast by hazelcast.

the class MapConfigRequestTest method setUp.

@Before
public void setUp() {
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    HazelcastInstance[] instances = factory.newInstances();
    managementCenterService = getNode(instances[0]).getManagementCenterService();
    mapName = randomMapName();
    dto = new MapConfigDTO(new MapConfig("MapConfigRequestTest"));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO) MapConfig(com.hazelcast.config.MapConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) Before(org.junit.Before)

Example 4 with MapConfigDTO

use of com.hazelcast.internal.management.dto.MapConfigDTO in project hazelcast by hazelcast.

the class MapConfigRequest method readResponse.

@Override
public Object readResponse(JsonObject json) {
    update = getBoolean(json, "update", false);
    if (!update) {
        boolean hasMapConfig = getBoolean(json, "hasMapConfig", false);
        if (hasMapConfig) {
            final MapConfigDTO adapter = new MapConfigDTO();
            adapter.fromJson(getObject(json, "mapConfig"));
            return adapter.getMapConfig();
        } else {
            return null;
        }
    }
    return getString(json, "updateResult");
}
Also used : MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO)

Example 5 with MapConfigDTO

use of com.hazelcast.internal.management.dto.MapConfigDTO in project hazelcast by hazelcast.

the class UpdateMapConfigOperation method readInternal.

@Override
protected void readInternal(ObjectDataInput in) throws IOException {
    mapName = in.readUTF();
    MapConfigDTO adapter = new MapConfigDTO();
    adapter.readData(in);
    mapConfig = adapter.getMapConfig();
}
Also used : MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO)

Aggregations

MapConfigDTO (com.hazelcast.internal.management.dto.MapConfigDTO)7 MapConfig (com.hazelcast.config.MapConfig)2 UpdateMapConfigOperation (com.hazelcast.internal.management.operation.UpdateMapConfigOperation)2 JsonObject (com.eclipsesource.json.JsonObject)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 Member (com.hazelcast.core.Member)1 AddWanConfigOperation (com.hazelcast.internal.management.operation.AddWanConfigOperation)1 GetMapConfigOperation (com.hazelcast.internal.management.operation.GetMapConfigOperation)1 ScriptExecutorOperation (com.hazelcast.internal.management.operation.ScriptExecutorOperation)1 UpdateManagementCenterUrlOperation (com.hazelcast.internal.management.operation.UpdateManagementCenterUrlOperation)1 ArrayDataSerializableFactory (com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory)1 IdentifiedDataSerializable (com.hazelcast.nio.serialization.IdentifiedDataSerializable)1 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1 ConstructorFunction (com.hazelcast.util.ConstructorFunction)1 Before (org.junit.Before)1