<commit_before>package cz.metacentrum.perun.core.impl;

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.ExtSourcesManager;
import cz.metacentrum.perun.core.api.Group;
import cz.metacentrum.perun.core.api.Member;
import cz.metacentrum.perun.core.api.PerunPrincipal;
import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.Status;
import cz.metacentrum.perun.core.api.User;
import cz.metacentrum.perun.core.api.Vo;
import cz.metacentrum.perun.core.bl.PerunBl;
import cz.metacentrum.perun.core.api.AttributesManager;
import cz.metacentrum.perun.core.api.ExtSource;
import cz.metacentrum.perun.core.api.Resource;
import cz.metacentrum.perun.core.api.UserExtSource;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Class with main method to get some special action or write version.
 *
 * @author <NAME> <<EMAIL>>
 * @version $Id$
 */
public class Main {

    private PerunBl perun;
    private AbstractApplicationContext springCtx;
    private PerunSession perunSession;
    private final static Logger log = LoggerFactory.getLogger(Main.class);
    private final PerunPrincipal pp = new PerunPrincipal("main", ExtSourcesManager.EXTSOURCE_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL);
    
    private static BufferedWriter writer;
    
    public Main(String fileName) throws Exception{
        try {
            this.springCtx = new ClassPathXmlApplicationContext("perun-beans.xml", "perun-datasources.xml", "perun-transaction-manager.xml");
            this.perun = springCtx.getBean("perun", PerunBl.class);
            this.perunSession = perun.getPerunSession(pp);
        } catch (Exception e) {
            log.error("Application context loading error.", e);
            throw e;
        }
        this.writer = new BufferedWriter(openForFile(fileName));
        
        int LastMessageBeforeInitializingData = perun.getAuditer().getLastMessageId();
        System.err.println("Last message id before starting initializing: " + LastMessageBeforeInitializingData + '\n');
        vosLdifToWriter();
        groupsLdifToWriter();
        usersLdifToWriter();
        int LastMessageAfterInitializingData = perun.getAuditer().getLastMessageId();
        System.err.println("Last message id after initializing: " + LastMessageAfterInitializingData + '\n');
        perun.getAuditer().setLastProcessedId("ldapConsumer", LastMessageAfterInitializingData);<commit_msg>Ldapc: fix typo in ldapConsumer name<commit_after>package cz.metacentrum.perun.core.impl;

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.ExtSourcesManager;
import cz.metacentrum.perun.core.api.Group;
import cz.metacentrum.perun.core.api.Member;
import cz.metacentrum.perun.core.api.PerunPrincipal;
import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.Status;
import cz.metacentrum.perun.core.api.User;
import cz.metacentrum.perun.core.api.Vo;
import cz.metacentrum.perun.core.bl.PerunBl;
import cz.metacentrum.perun.core.api.AttributesManager;
import cz.metacentrum.perun.core.api.ExtSource;
import cz.metacentrum.perun.core.api.Resource;
import cz.metacentrum.perun.core.api.UserExtSource;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Class with main method to get some special action or write version.
 *
 * @author <NAME> <<EMAIL>>
 * @version $Id$
 */
public class Main {

    private PerunBl perun;
    private AbstractApplicationContext springCtx;
    private PerunSession perunSession;
    private final static Logger log = LoggerFactory.getLogger(Main.class);
    private final PerunPrincipal pp = new PerunPrincipal("main", ExtSourcesManager.EXTSOURCE_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL);
    
    private static BufferedWriter writer;
    
    public Main(String fileName) throws Exception{
        try {
            this.springCtx = new ClassPathXmlApplicationContext("perun-beans.xml", "perun-datasources.xml", "perun-transaction-manager.xml");
            this.perun = springCtx.getBean("perun", PerunBl.class);
            this.perunSession = perun.getPerunSession(pp);
        } catch (Exception e) {
            log.error("Application context loading error.", e);
            throw e;
        }
        this.writer = new BufferedWriter(openForFile(fileName));
        
        int LastMessageBeforeInitializingData = perun.getAuditer().getLastMessageId();
        System.err.println("Last message id before starting initializing: " + LastMessageBeforeInitializingData + '\n');
        vosLdifToWriter();
        groupsLdifToWriter();
        usersLdifToWriter();
        int LastMessageAfterInitializingData = perun.getAuditer().getLastMessageId();
        System.err.println("Last message id after initializing: " + LastMessageAfterInitializingData + '\n');
        perun.getAuditer().setLastProcessedId("ldapcConsumer", LastMessageAfterInitializingData);
{'fraction_non_alphanumeric': 0.10444078947368421, 'fraction_numerical': 0.0006578947368421052, 'mean_word_length': 4.429464285714285, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4332825', 'n_tokens_mistral': 1817, 'n_tokens_neox': 1821, 'n_words': 340}