// Path: src/main/java/org/jmeterplugins/repository/plugins/PluginSuggester.java
// public class PluginSuggester {
//     private static final Logger log = LoggerFactory.getLogger(PluginSuggester.class);
// 
//     protected TestPlanAnalyzer analyzer;
//     protected String testPlan;
//     private final PluginManager pmgr;
// 
//     public PluginSuggester(PluginManager pmgr) {
//         this.pmgr = pmgr;
//         analyzer = new TestPlanAnalyzer();
//     }
// 
//     public void checkAndSuggest(String msg) {
//         Set<Plugin> pluginsToInstall = findPluginsToInstall(msg);
//         if (pluginsToInstall.size() > 0) {
// 
//             pmgr.togglePlugins(pluginsToInstall, true);
// 
//             Frame parent = (GuiPackage.getInstance() != null) ? GuiPackage.getInstance().getMainFrame() : null;
//             SuggestDialog dialog = new SuggestDialog(parent, pmgr, pluginsToInstall, testPlan);
//             dialog.setVisible(true);
//             dialog.setAlwaysOnTop(true);
//         }
//     }
// 
//     protected Set<Plugin> findPluginsToInstall(String msg) {
//         if (msg != null && msg.contains("Loading file")) {
//             testPlan = msg.substring(msg.indexOf(": ") + 2);
//             if (!"null".equals(testPlan)) {
//                 return analyzeTestPlan(testPlan);
//             }
//         }
//         return Collections.emptySet();
//     }
// 
//     public Set<Plugin> analyzeTestPlan(String path) {
//         Set<String> nonExistentClasses = analyzer.analyze(path);
//         if (nonExistentClasses.size() > 0) {
//             return findPluginsFromClasses(nonExistentClasses);
//         }
//         return Collections.emptySet();
//     }
// 
// 
//     protected Set<Plugin> findPluginsFromClasses(Set<String> nonExistentClasses) {
//         try {
//             pmgr.load();
//         } catch (Throwable throwable) {
//             log.warn("Cannot load plugins repo: ", throwable);
//             return Collections.emptySet();
//         }
//         final Set<Plugin> availablePlugins = pmgr.getAvailablePlugins();
//         final Set<Plugin> pluginsToInstall = new HashSet<>();
//         for (Plugin plugin : availablePlugins) {
//             if (plugin.containsComponentClasses(nonExistentClasses)) {
//                 pluginsToInstall.add(plugin);
//             }
//         }
// 
//         if (pluginsToInstall.isEmpty()) {
//             log.warn("Plugins Manager were unable to find plugins to satisfy Test Plan requirements. " +
//                     "To help improve, please report following list to https://jmeter-plugins.org/support/: " +
//                     Arrays.toString(nonExistentClasses.toArray()));
//         }
// 
//         return pluginsToInstall;
//     }
// 
//     public TestPlanAnalyzer getAnalyzer() {
//         return analyzer;
//     }
// 
//     public void setAnalyzer(TestPlanAnalyzer analyzer) {
//         this.analyzer = analyzer;
//     }
// 
// }
// 
// Path: src/main/java/org/jmeterplugins/repository/logging/LoggingHooker.java
// public static boolean isJMeter32orLater() {
//     try {
//         Class<?> cls = LoggingHooker.class.getClassLoader().loadClass("org.apache.jmeter.gui.logging.GuiLogEventBus");
//         if (cls != null) {
//             return true;
//         }
//     } catch (ClassNotFoundException ex) {
//         log.debug("Class 'org.apache.jmeter.gui.logging.GuiLogEventBus' not found", ex);
//     } catch (Throwable ex) {
//         log.warn("Fail to detect JMeter version", ex);
//     }
//     return false;
// }


import kg.apc.cmdtools.AbstractCMDTool;
import org.apache.jmeter.util.JMeterUtils;
import org.jmeterplugins.repository.plugins.PluginSuggester;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.net.URLDecoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import static org.jmeterplugins.repository.logging.LoggingHooker.isJMeter32orLater;
package org.jmeterplugins.repository;




public class PluginManagerCMD extends AbstractCMDTool implements GenericCallback<String> {
    private static final Logger log = LoggerFactory.getLogger(PluginManagerCMD.class);

    public PluginManagerCMD() {
        setJMeterHome();
// Path: src/main/java/org/jmeterplugins/repository/plugins/PluginSuggester.java
// public class PluginSuggester {
//     private static final Logger log = LoggerFactory.getLogger(PluginSuggester.class);
// 
//     protected TestPlanAnalyzer analyzer;
//     protected String testPlan;
//     private final PluginManager pmgr;
// 
//     public PluginSuggester(PluginManager pmgr) {
//         this.pmgr = pmgr;
//         analyzer = new TestPlanAnalyzer();
//     }
// 
//     public void checkAndSuggest(String msg) {
//         Set<Plugin> pluginsToInstall = findPluginsToInstall(msg);
//         if (pluginsToInstall.size() > 0) {
// 
//             pmgr.togglePlugins(pluginsToInstall, true);
// 
//             Frame parent = (GuiPackage.getInstance() != null) ? GuiPackage.getInstance().getMainFrame() : null;
//             SuggestDialog dialog = new SuggestDialog(parent, pmgr, pluginsToInstall, testPlan);
//             dialog.setVisible(true);
//             dialog.setAlwaysOnTop(true);
//         }
//     }
// 
//     protected Set<Plugin> findPluginsToInstall(String msg) {
//         if (msg != null && msg.contains("Loading file")) {
//             testPlan = msg.substring(msg.indexOf(": ") + 2);
//             if (!"null".equals(testPlan)) {
//                 return analyzeTestPlan(testPlan);
//             }
//         }
//         return Collections.emptySet();
//     }
// 
//     public Set<Plugin> analyzeTestPlan(String path) {
//         Set<String> nonExistentClasses = analyzer.analyze(path);
//         if (nonExistentClasses.size() > 0) {
//             return findPluginsFromClasses(nonExistentClasses);
//         }
//         return Collections.emptySet();
//     }
// 
// 
//     protected Set<Plugin> findPluginsFromClasses(Set<String> nonExistentClasses) {
//         try {
//             pmgr.load();
//         } catch (Throwable throwable) {
//             log.warn("Cannot load plugins repo: ", throwable);
//             return Collections.emptySet();
//         }
//         final Set<Plugin> availablePlugins = pmgr.getAvailablePlugins();
//         final Set<Plugin> pluginsToInstall = new HashSet<>();
//         for (Plugin plugin : availablePlugins) {
//             if (plugin.containsComponentClasses(nonExistentClasses)) {
//                 pluginsToInstall.add(plugin);
//             }
//         }
// 
//         if (pluginsToInstall.isEmpty()) {
//             log.warn("Plugins Manager were unable to find plugins to satisfy Test Plan requirements. " +
//                     "To help improve, please report following list to https://jmeter-plugins.org/support/: " +
//                     Arrays.toString(nonExistentClasses.toArray()));
//         }
// 
//         return pluginsToInstall;
//     }
// 
//     public TestPlanAnalyzer getAnalyzer() {
//         return analyzer;
//     }
// 
//     public void setAnalyzer(TestPlanAnalyzer analyzer) {
//         this.analyzer = analyzer;
//     }
// 
// }
// 
// Path: src/main/java/org/jmeterplugins/repository/logging/LoggingHooker.java
// public static boolean isJMeter32orLater() {
//     try {
//         Class<?> cls = LoggingHooker.class.getClassLoader().loadClass("org.apache.jmeter.gui.logging.GuiLogEventBus");
//         if (cls != null) {
//             return true;
//         }
//     } catch (ClassNotFoundException ex) {
//         log.debug("Class 'org.apache.jmeter.gui.logging.GuiLogEventBus' not found", ex);
//     } catch (Throwable ex) {
//         log.warn("Fail to detect JMeter version", ex);
//     }
//     return false;
// }


// Path: src/main/java/org/jmeterplugins/repository/PluginManagerCMD.java
import kg.apc.cmdtools.AbstractCMDTool;
import org.apache.jmeter.util.JMeterUtils;
import org.jmeterplugins.repository.plugins.PluginSuggester;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.net.URLDecoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import static org.jmeterplugins.repository.logging.LoggingHooker.isJMeter32orLater;

package org.jmeterplugins.repository;




public class PluginManagerCMD extends AbstractCMDTool implements GenericCallback<String> {
    private static final Logger log = LoggerFactory.getLogger(PluginManagerCMD.class);

    public PluginManagerCMD() {
        setJMeterHome();
        if (isJMeter32orLater()) {