use of com.hazelcast.wan.impl.AddWanConfigResult in project hazelcast by hazelcast.
the class HttpPostCommandProcessor method handleAddWanConfig.
/**
* Broadcasts a new {@link WanReplicationConfig} to all members. The config is defined
* by an encoded JSON as a first parameter of the HTTP command.
*
* @param cmd the HTTP command
*/
private void handleAddWanConfig(HttpPostCommand cmd) throws Throwable {
String[] params = decodeParamsAndAuthenticate(cmd, 3);
String wanConfigJson = params[2];
WanReplicationConfigDTO dto = new WanReplicationConfigDTO(new WanReplicationConfig());
dto.fromJson(Json.parse(wanConfigJson).asObject());
AddWanConfigResult result = getNode().getNodeEngine().getWanReplicationService().addWanReplicationConfig(dto.getConfig());
JsonObject res = response(SUCCESS, "message", "WAN configuration added.");
res.add("addedPublisherIds", Json.array(result.getAddedPublisherIds().toArray(new String[] {})));
res.add("ignoredPublisherIds", Json.array(result.getIgnoredPublisherIds().toArray(new String[] {})));
prepareResponse(cmd, res);
}
Aggregations