<commit_before>package org.bitrepository.integrityservice.tools;

import java.util.List;

import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.settings.XMLFileSettingsLoader;
import org.bitrepository.common.utils.SettingsUtils;
import org.bitrepository.integrityservice.cache.database.IntegrityDBTools;
import org.bitrepository.service.ServiceSettingsProvider;
import org.bitrepository.service.database.DBConnector;
import org.bitrepository.settings.referencesettings.ServiceType;

/**
 * Class to handle removal and additions of colletions in the integrityDB 
 */
public class CollectionsAdmin {

    final String method;
    final String collectionID;
    final Settings settings;
    IntegrityDBTools tools;
    
    public CollectionsAdmin(String method, String collectionID, String pathToSettings) {
        this.method = method;
        this.collectionID = collectionID;
        
        ServiceSettingsProvider settingsLoader =
                new ServiceSettingsProvider(new XMLFileSettingsLoader(pathToSettings), ServiceType.INTEGRITY_SERVICE);
        settings = settingsLoader.getSettings();
        SettingsUtils.initialize(settings);
        tools = new IntegrityDBTools(new DBConnector(settings.getReferenceSettings().getIntegrityServiceSettings().getIntegrityDatabase()));
    }
    
    /**
     * Method to run the requested action on the database. Checks to see if the requested actions is supported.
     * And if we can operate on the requested collectionID
     * @throws InvalidMethodException if the method/action is not supported
     * @throws UnknownCollectionException if the requested collectionID is not found in settings. 
     */
    public void invoke() throws InvalidMethodException, UnknownCollectionException {
        hasCollection();
        if(method.equals("add")) {
            tools.addCollection(collectionID);
        } else if(method.equals("remove")) {<commit_msg>make member variables private<commit_after>package org.bitrepository.integrityservice.tools;

import java.util.List;

import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.settings.XMLFileSettingsLoader;
import org.bitrepository.common.utils.SettingsUtils;
import org.bitrepository.integrityservice.cache.database.IntegrityDBTools;
import org.bitrepository.service.ServiceSettingsProvider;
import org.bitrepository.service.database.DBConnector;
import org.bitrepository.settings.referencesettings.ServiceType;

/**
 * Class to handle removal and additions of colletions in the integrityDB 
 */
public class CollectionsAdmin {

    private final String method;
    private final String collectionID;
    private final Settings settings;
    IntegrityDBTools tools;
    
    public CollectionsAdmin(String method, String collectionID, String pathToSettings) {
        this.method = method;
        this.collectionID = collectionID;
        
        ServiceSettingsProvider settingsLoader =
                new ServiceSettingsProvider(new XMLFileSettingsLoader(pathToSettings), ServiceType.INTEGRITY_SERVICE);
        settings = settingsLoader.getSettings();
        SettingsUtils.initialize(settings);
        tools = new IntegrityDBTools(new DBConnector(settings.getReferenceSettings().getIntegrityServiceSettings().getIntegrityDatabase()));
    }
    
    /**
     * Method to run the requested action on the database. Checks to see if the requested actions is supported.
     * And if we can operate on the requested collectionID
     * @throws InvalidMethodException if the method/action is not supported
     * @throws UnknownCollectionException if the requested collectionID is not found in settings. 
     */
    public void invoke() throws InvalidMethodException, UnknownCollectionException {
        hasCollection();
        if(method.equals("add")) {
            tools.addCollection(collectionID);
        } else if(method.equals("remove")) {
{'fraction_non_alphanumeric': 0.07299642674834099, 'fraction_numerical': 0.0, 'mean_word_length': 4.1095176010430245, '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': '6993247', 'n_tokens_mistral': 927, 'n_tokens_neox': 918, 'n_words': 254}