<commit_before>package org.project.openbaton.nfvo.plugin.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * Created by lto on 10/09/15.
 */
public class PluginStartup {

    private static Logger log = LoggerFactory.getLogger(PluginStartup.class);

    private static Map<String, Process> processes = new HashMap<>();

    private static void installPlugin(String path, boolean waitForPlugin, String registryip, String  port) throws IOException {
        String pluginName = path.substring(path.lastIndexOf("/") + 1, path.length());

        StringTokenizer st = new StringTokenizer(pluginName, "-");
        String token = st.nextToken();
        log.debug("Running: java -jar " + path + " " + token + " localhost "+ port);
        ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", path, token, registryip, port);
        File file = new File("plugin-" + token + ".log");
        processBuilder.redirectErrorStream(true);
        processBuilder.redirectOutput(ProcessBuilder.Redirect.appendTo(file));
        log.debug("ProcessBuilder is: " + processBuilder);
        Process p = processBuilder.start();
        if (waitForPlugin)
            try {
                Thread.sleep(4000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        processes.put(path,p);
    }

    public static void startPluginRecursive(String folderPath, boolean waitForPlugin, String registryip, String  port) throws IOException {

        File folder = new File(folderPath);

        if (folder.isDirectory()){
            for (File jar : folder.listFiles()) {
                if (jar.getAbsolutePath().endsWith(".jar"))
                    installPlugin(jar.getAbsolutePath(), waitForPlugin, registryip, port);
                else
                    if (jar.isDirectory())
                        startPluginRecursive(jar.getAbsolutePath(), waitForPlugin,registryip, port);
                    else
                        log.error(jar.getAbsolutePath() + " is not a jar file");
            }
        }else log.error(folderPath + " must be a folder");

    }

    public static void destroy(){
        for (Process p : processes.values()){
            p.destroy();
        }
    }
}
<commit_msg>fixed name plugin<commit_after>package org.project.openbaton.nfvo.plugin.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * Created by lto on 10/09/15.
 */
public class PluginStartup {

    private static Logger log = LoggerFactory.getLogger(PluginStartup.class);

    private static Map<String, Process> processes = new HashMap<>();

    private static void installPlugin(String path, boolean waitForPlugin, String registryip, String  port) throws IOException {
        String pluginName = path.substring(path.lastIndexOf("/") + 1, path.length());

        StringTokenizer st = new StringTokenizer(pluginName, "-");
        String token = st.nextToken();
        log.trace("Running: java -jar " + path + " " + token + " localhost "+ port);
        ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", path, token, registryip, port);
        File file = new File("plugin-" + token + ".log");
        processBuilder.redirectErrorStream(true);
        processBuilder.redirectOutput(ProcessBuilder.Redirect.appendTo(file));
        log.trace("ProcessBuilder is: " + processBuilder);
        Process p = processBuilder.start();
        if (waitForPlugin)
            try {
                Thread.sleep(4000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        processes.put(path,p);
    }

    public static void startPluginRecursive(String folderPath, boolean waitForPlugin, String registryip, String  port) throws IOException {

        File folder = new File(folderPath);

        if (folder.isDirectory()){
            for (File jar : folder.listFiles()) {
                if (jar.getAbsolutePath().endsWith(".jar"))
                    installPlugin(jar.getAbsolutePath(), waitForPlugin, registryip, port);
                else
                    if (jar.isDirectory())
                        startPluginRecursive(jar.getAbsolutePath(), waitForPlugin,registryip, port);
                    else
                        log.error(jar.getAbsolutePath() + " is not a jar file");
            }
        }else log.error(folderPath + " must be a folder");

    }

    public static void destroy(){
        for (Process p : processes.values()){
            p.destroy();
        }
    }
}

{'fraction_non_alphanumeric': 0.11397670549084858, 'fraction_numerical': 0.005407653910149751, 'mean_word_length': 2.472202166064982, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2500520', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1240, 'n_words': 316}