<commit_before>package org.zstack.identity;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.zstack.core.componentloader.PluginRegistry;
import org.zstack.header.exception.CloudRuntimeException;
import org.zstack.header.managementnode.PrepareDbInitialValueExtensionPoint;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Configurable(preConstruction = true, autowire = Autowire.BY_TYPE)
public class SystemIdentityResourceGenerator implements PrepareDbInitialValueExtensionPoint {
    @Autowired
    private PluginRegistry pluginRgty;

    public void generate() {
        if (StringUtils.isEmpty(IdentityGlobalProperty.IDENTITY_INIT_TYPE)) {
            for (IdentityResourceGenerateExtensionPoint ext : pluginRgty.getExtensionList(IdentityResourceGenerateExtensionPoint.class)) {
                ext.prepareResources();
            }

            return;
        }

        Map<String, List<IdentityResourceGenerateExtensionPoint>> extensionMap = new HashMap<>();
        for (IdentityResourceGenerateExtensionPoint ext : pluginRgty.getExtensionList(IdentityResourceGenerateExtensionPoint.class)) {
            extensionMap.putIfAbsent(ext.getIdentityType(), new ArrayList<>());
            extensionMap.get(ext.getIdentityType()).add(ext);
        }

        for (String identityInitType : IdentityGlobalProperty.IDENTITY_INIT_TYPE.split(",")) {
            identityInitType = identityInitType.trim();
            List<IdentityResourceGenerateExtensionPoint> extensionPoints = extensionMap.get(identityInitType);

            if (extensionPoints != null && !extensionPoints.isEmpty()) {
                for (IdentityResourceGenerateExtensionPoint ext : extensionPoints) {
                    ext.prepareResources();
                }
            } else {
                throw new CloudRuntimeException(String.format("Unknown recognized identity init type %s", identityInitType));
            }
        }
    }

    @Override
    public void prepareDbInitialValue() {
        generate();
    }
}<commit_msg>Print debug message instead of abort mn starting<commit_after>package org.zstack.identity;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.zstack.core.componentloader.PluginRegistry;
import org.zstack.header.exception.CloudRuntimeException;
import org.zstack.header.managementnode.PrepareDbInitialValueExtensionPoint;
import org.zstack.utils.Utils;
import org.zstack.utils.logging.CLogger;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Configurable(preConstruction = true, autowire = Autowire.BY_TYPE)
public class SystemIdentityResourceGenerator implements PrepareDbInitialValueExtensionPoint {
    private static final CLogger logger = Utils.getLogger(SystemIdentityResourceGenerator.class);

    @Autowired
    private PluginRegistry pluginRgty;

    public void generate() {
        if (StringUtils.isEmpty(IdentityGlobalProperty.IDENTITY_INIT_TYPE)) {
            for (IdentityResourceGenerateExtensionPoint ext : pluginRgty.getExtensionList(IdentityResourceGenerateExtensionPoint.class)) {
                ext.prepareResources();
            }

            return;
        }

        Map<String, List<IdentityResourceGenerateExtensionPoint>> extensionMap = new HashMap<>();
        for (IdentityResourceGenerateExtensionPoint ext : pluginRgty.getExtensionList(IdentityResourceGenerateExtensionPoint.class)) {
            extensionMap.putIfAbsent(ext.getIdentityType(), new ArrayList<>());
            extensionMap.get(ext.getIdentityType()).add(ext);
        }

        for (String identityInitType : IdentityGlobalProperty.IDENTITY_INIT_TYPE.split(",")) {
            identityInitType = identityInitType.trim();
            List<IdentityResourceGenerateExtensionPoint> extensionPoints = extensionMap.get(identityInitType);

            if (extensionPoints != null && !extensionPoints.isEmpty()) {
                for (IdentityResourceGenerateExtensionPoint ext : extensionPoints) {
                    ext.prepareResources();
                }
            } else {
                logger.debug(String.format("Unknown recognized identity init type %s", identityInitType));
            }
        }
    }

    @Override
    public void prepareDbInitialValue() {
        generate();
    }
}
{'fraction_non_alphanumeric': 0.08834147377362497, 'fraction_numerical': 0.0, 'mean_word_length': 3.6541501976284585, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3319264', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1133, 'n_words': 203}