All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.charlemaznable.vertx.diamond.DiamondHazelcastClusterManager Maven / Gradle / Ivy

The newest version!
package com.github.charlemaznable.vertx.diamond;

import com.hazelcast.config.ConfigBuilder;
import com.hazelcast.config.XmlConfigBuilder;
import com.hazelcast.config.YamlConfigBuilder;
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.n3r.diamond.client.cache.ParamsAppliable;

import java.io.ByteArrayInputStream;

import static com.github.charlemaznable.vertx.diamond.VertxDiamondElf.getVertxClusterConfigStoneByApplyParams;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.startsWithIgnoreCase;

@Slf4j
public final class DiamondHazelcastClusterManager extends HazelcastClusterManager implements ParamsAppliable {

    @Override
    public void applyParams(String[] params) {
        val configStone = getVertxClusterConfigStoneByApplyParams(params);
        if (isBlank(configStone)) return; // none diamond or blank diamond or error params

        // read diamond stone as XML or YAML format
        val inputStream = new ByteArrayInputStream(configStone.getBytes(UTF_8));
        ConfigBuilder configBuilder = startsWithIgnoreCase(configStone, "




© 2015 - 2024 Weber Informatics LLC | Privacy Policy