<commit_before>package org.opentosca.broker.mqtt;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;

import com.google.common.hash.Hashing;
import io.moquette.server.Server;
import org.opentosca.container.core.common.Settings;
import org.opentosca.container.core.impl.service.FileSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardOpenOption.CREATE;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
import static java.nio.file.StandardOpenOption.WRITE;

@Component
public class BrokerSupport {
    private static final Logger LOG = LoggerFactory.getLogger(BrokerSupport.class);

    private static final String CONFIGFILE_PATH = "credentials/password.config";

    private Server mqttBroker;

    public synchronized void start() {
        if (mqttBroker != null) {
            LOG.info("Registered attempt to start Broker again. Aborting!");
            return;
        }
        LOG.info("Starting local MQTT broker at port: {}", Settings.OPENTOSCA_BROKER_MQTT_PORT);<commit_msg>Only start internal MQTT broker if distributed IA deployment is active<commit_after>package org.opentosca.broker.mqtt;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;

import com.google.common.hash.Hashing;
import io.moquette.server.Server;
import org.opentosca.container.core.common.Settings;
import org.opentosca.container.core.impl.service.FileSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardOpenOption.CREATE;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
import static java.nio.file.StandardOpenOption.WRITE;

@Component
public class BrokerSupport {
    private static final Logger LOG = LoggerFactory.getLogger(BrokerSupport.class);

    private static final String CONFIGFILE_PATH = "credentials/password.config";

    private Server mqttBroker;

    public synchronized void start() {
        if (!Boolean.parseBoolean(Settings.OPENTOSCA_COLLABORATION_MODE)) {
            LOG.info("Collaboration mode is turned off. Skipping MQTT broker startup.");
            return;
        }
        if (mqttBroker != null) {
            LOG.info("Registered attempt to start Broker again. Aborting!");
            return;
        }
        LOG.info("Starting local MQTT broker at port: {}", Settings.OPENTOSCA_BROKER_MQTT_PORT);
{'fraction_non_alphanumeric': 0.09388971684053651, 'fraction_numerical': 0.0022354694485842027, 'mean_word_length': 4.3273809523809526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6016296', 'n_tokens_mistral': 815, 'n_tokens_neox': 792, 'n_words': 175}