Search in sources :

Example 1 with ConfigFileTemplate

use of com.hazelcast.simulator.coordinator.ConfigFileTemplate in project hazelcast-simulator by hazelcast.

the class HazelcastDriver method initMemberHzConfig.

public String initMemberHzConfig(boolean liteMember) {
    String config = loadMemberConfig();
    ConfigFileTemplate template = new ConfigFileTemplate(config);
    String licenseKey = get("LICENCE_KEY");
    template.addEnvironment("licenseKey", licenseKey);
    template.addEnvironment(properties);
    // template.withAgents(componentRegistry);
    template.addReplacement("<!--MEMBERS-->", createAddressConfig("member", agents, get("HAZELCAST_PORT")));
    if (licenseKey != null) {
        template.addReplacement("<!--LICENSE-KEY-->", format("<license-key>%s</license-key>", licenseKey));
    }
    String manCenterURL = get("MANAGEMENT_CENTER_URL");
    if (!"none".equals(manCenterURL) && (manCenterURL.startsWith("http://") || manCenterURL.startsWith("https://"))) {
        String updateInterval = get("MANAGEMENT_CENTER_UPDATE_INTERVAL");
        String updateIntervalAttr = (updateInterval.isEmpty()) ? "" : " update-interval=\"" + updateInterval + '"';
        template.addReplacement("<!--MANAGEMENT_CENTER_CONFIG-->", format("<management-center enabled=\"true\"%s>%n        %s%n" + "    </management-center>%n", updateIntervalAttr, manCenterURL));
    }
    if (liteMember) {
        template.addReplacement("<!--LITE_MEMBER_CONFIG-->", "<lite-member enabled=\"true\"/>");
    }
    return template.render();
}
Also used : ConfigFileTemplate(com.hazelcast.simulator.coordinator.ConfigFileTemplate)

Example 2 with ConfigFileTemplate

use of com.hazelcast.simulator.coordinator.ConfigFileTemplate in project hazelcast-simulator by hazelcast.

the class JetDriver method initClientHzConfig.

public String initClientHzConfig() {
    String config = loadClientConfig();
    ConfigFileTemplate template = new ConfigFileTemplate(config);
    // template.withAgents(componentRegistry);
    String licenseKey = get("LICENCE_KEY");
    template.addEnvironment("licenseKey", licenseKey);
    template.addEnvironment(properties);
    template.addReplacement("<!--MEMBERS-->", createAddressConfig("address", agents, get("HAZELCAST_PORT")));
    if (licenseKey != null) {
        template.addReplacement("<!--LICENSE-KEY-->", format("<license-key>%s</license-key>", licenseKey));
    }
    return template.render();
}
Also used : ConfigFileTemplate(com.hazelcast.simulator.coordinator.ConfigFileTemplate)

Example 3 with ConfigFileTemplate

use of com.hazelcast.simulator.coordinator.ConfigFileTemplate in project hazelcast-simulator by hazelcast.

the class JetDriver method initMemberHzConfig.

public String initMemberHzConfig(boolean liteMember) {
    String config = loadMemberConfig();
    ConfigFileTemplate template = new ConfigFileTemplate(config);
    String licenseKey = get("LICENCE_KEY");
    template.addEnvironment("licenseKey", licenseKey);
    template.addEnvironment(properties);
    // template.withAgents(componentRegistry);
    template.addReplacement("<!--MEMBERS-->", createAddressConfig("member", agents, get("HAZELCAST_PORT")));
    if (licenseKey != null) {
        template.addReplacement("<!--LICENSE-KEY-->", format("<license-key>%s</license-key>", licenseKey));
    }
    String manCenterURL = get("MANAGEMENT_CENTER_URL");
    if (!"none".equals(manCenterURL) && (manCenterURL.startsWith("http://") || manCenterURL.startsWith("https://"))) {
        String updateInterval = get("MANAGEMENT_CENTER_UPDATE_INTERVAL");
        String updateIntervalAttr = (updateInterval.isEmpty()) ? "" : " update-interval=\"" + updateInterval + '"';
        template.addReplacement("<!--MANAGEMENT_CENTER_CONFIG-->", format("<management-center enabled=\"true\"%s>%n        %s%n" + "    </management-center>%n", updateIntervalAttr, manCenterURL));
    }
    if (liteMember) {
        template.addReplacement("<!--LITE_MEMBER_CONFIG-->", "<lite-member enabled=\"true\"/>");
    }
    return template.render();
}
Also used : ConfigFileTemplate(com.hazelcast.simulator.coordinator.ConfigFileTemplate)

Example 4 with ConfigFileTemplate

use of com.hazelcast.simulator.coordinator.ConfigFileTemplate in project hazelcast-simulator by hazelcast.

the class IgniteDriver method loadServerOrNativeClientConfig.

private String loadServerOrNativeClientConfig(boolean client) {
    String config = loadConfiguration("Ignite configuration", "ignite.xml");
    ConfigFileTemplate template = new ConfigFileTemplate(config).withAgents(agents);
    StringBuilder addresses = new StringBuilder();
    for (AgentData agent : agents) {
        addresses.append("<value>").append(agent.getPrivateAddress()).append("</value>");
    }
    template.addReplacement("<!--ADDRESSES-->", addresses.toString());
    template.addReplacement("<!--CLIENT_MODE-->", client);
    return template.render();
}
Also used : ConfigFileTemplate(com.hazelcast.simulator.coordinator.ConfigFileTemplate) AgentData(com.hazelcast.simulator.coordinator.registry.AgentData)

Example 5 with ConfigFileTemplate

use of com.hazelcast.simulator.coordinator.ConfigFileTemplate in project hazelcast-simulator by hazelcast.

the class HazelcastDriver method initClientHzConfig.

public String initClientHzConfig() {
    String config = loadClientConfig();
    ConfigFileTemplate template = new ConfigFileTemplate(config);
    // template.withAgents(componentRegistry);
    String licenseKey = get("LICENCE_KEY");
    template.addEnvironment("licenseKey", licenseKey);
    template.addEnvironment(properties);
    template.addReplacement("<!--MEMBERS-->", createAddressConfig("address", agents, get("HAZELCAST_PORT")));
    if (licenseKey != null) {
        template.addReplacement("<!--LICENSE-KEY-->", format("<license-key>%s</license-key>", licenseKey));
    }
    return template.render();
}
Also used : ConfigFileTemplate(com.hazelcast.simulator.coordinator.ConfigFileTemplate)

Aggregations

ConfigFileTemplate (com.hazelcast.simulator.coordinator.ConfigFileTemplate)5 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)1