test_class.declarator: loader
test_class.modifier: private
test_class.original_string: private PluginLoader loader;
test_class.type: PluginLoader
test_class.var_name: loader
test_class.declarator: dataTypes
test_class.modifier: private
test_class.original_string: private DataTypes dataTypes;
test_class.type: DataTypes
test_class.var_name: dataTypes
test_class.declarator: sourceTypes
test_class.modifier: private
test_class.original_string: private SourceTypes sourceTypes;
test_class.type: SourceTypes
test_class.var_name: sourceTypes
test_class.declarator: components
test_class.modifier: private
test_class.original_string: private Components components;
test_class.type: Components
test_class.var_name: components
test_class.declarator: themes
test_class.modifier: private
test_class.original_string: private Themes themes;
test_class.type: Themes
test_class.var_name: themes
test_class.declarator: tabInfoRegistry
test_class.modifier: private
test_class.original_string: private TabInfoRegistry tabInfoRegistry;
test_class.type: TabInfoRegistry
test_class.var_name: tabInfoRegistry
test_class.file: app/src/test/java/edu/wpi/first/shuffleboard/app/plugin/PluginLoaderTest.java
test_class.identifier: PluginLoaderTest
test_case.body: @Test
    public void testDefaultTabs() {
      // given
      Plugin plugin = new DefaultTabsPlugin();
  
      // when
      loader.load(plugin);
  
      // then
      assertTrue(tabInfoRegistry.isRegistered(DefaultTabsPlugin.tabInfo), "Tab info was not registered");
    }
test_case.class_method_signature: PluginLoaderTest.testDefaultTabs()
test_case.full_signature: @Test public void testDefaultTabs()
test_case.identifier: testDefaultTabs
test_case.invocations: load assertTrue isRegistered
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDefaultTabs()
focal_class.declarator: log = Logger.getLogger(PluginLoader.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = Logger.getLogger(PluginLoader.class.getName());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: defaultLoader =
        new PluginLoader(
            DataTypes.getDefault(),
            SourceTypes.getDefault(),
            Components.getDefault(),
            Themes.getDefault(),
            TabInfoRegistry.getDefault(),
            Converters.getDefault(),
            PropertyParsers.getDefault())
focal_class.modifier: private static final
focal_class.original_string: private static final PluginLoader defaultLoader =
        new PluginLoader(
            DataTypes.getDefault(),
            SourceTypes.getDefault(),
            Components.getDefault(),
            Themes.getDefault(),
            TabInfoRegistry.getDefault(),
            Converters.getDefault(),
            PropertyParsers.getDefault());
focal_class.type: PluginLoader
focal_class.var_name: defaultLoader
focal_class.declarator: loadedPlugins = FXCollections.observableSet(new LinkedHashSet<>())
focal_class.modifier: private final
focal_class.original_string: private final ObservableSet<Plugin> loadedPlugins = FXCollections.observableSet(new LinkedHashSet<>());
focal_class.type: ObservableSet<Plugin>
focal_class.var_name: loadedPlugins
focal_class.declarator: knownPluginClasses = new HashSet<>()
focal_class.modifier: private final
focal_class.original_string: private final Set<Class<? extends Plugin>> knownPluginClasses = new HashSet<>();
focal_class.type: Set<Class<? extends Plugin>>
focal_class.var_name: knownPluginClasses
focal_class.declarator: knownPlugins = FXCollections.observableArrayList()
focal_class.modifier: private final
focal_class.original_string: private final ObservableList<Plugin> knownPlugins = FXCollections.observableArrayList();
focal_class.type: ObservableList<Plugin>
focal_class.var_name: knownPlugins
focal_class.declarator: classLoaders = FXCollections.observableArrayList()
focal_class.modifier: private final
focal_class.original_string: private final ObservableList<ClassLoader> classLoaders = FXCollections.observableArrayList();
focal_class.type: ObservableList<ClassLoader>
focal_class.var_name: classLoaders
focal_class.declarator: dataTypes
focal_class.modifier: private final
focal_class.original_string: private final DataTypes dataTypes;
focal_class.type: DataTypes
focal_class.var_name: dataTypes
focal_class.declarator: sourceTypes
focal_class.modifier: private final
focal_class.original_string: private final SourceTypes sourceTypes;
focal_class.type: SourceTypes
focal_class.var_name: sourceTypes
focal_class.declarator: components
focal_class.modifier: private final
focal_class.original_string: private final Components components;
focal_class.type: Components
focal_class.var_name: components
focal_class.declarator: themes
focal_class.modifier: private final
focal_class.original_string: private final Themes themes;
focal_class.type: Themes
focal_class.var_name: themes
focal_class.declarator: tabInfoRegistry
focal_class.modifier: private final
focal_class.original_string: private final TabInfoRegistry tabInfoRegistry;
focal_class.type: TabInfoRegistry
focal_class.var_name: tabInfoRegistry
focal_class.declarator: converters
focal_class.modifier: private final
focal_class.original_string: private final Converters converters;
focal_class.type: Converters
focal_class.var_name: converters
focal_class.declarator: propertyParsers
focal_class.modifier: private final
focal_class.original_string: private final PropertyParsers propertyParsers;
focal_class.type: PropertyParsers
focal_class.var_name: propertyParsers
focal_class.file: app/src/main/java/edu/wpi/first/shuffleboard/app/plugin/PluginLoader.java
focal_class.identifier: PluginLoader
focal_class.class_method_signature: PluginLoader.PluginLoader(DataTypes dataTypes,
                        SourceTypes sourceTypes,
                        Components components,
                        Themes themes,
                        TabInfoRegistry tabInfoRegistry,
                        Converters converters,
                        PropertyParsers propertyParsers)
focal_class.full_signature: public  PluginLoader(DataTypes dataTypes,
                        SourceTypes sourceTypes,
                        Components components,
                        Themes themes,
                        TabInfoRegistry tabInfoRegistry,
                        Converters converters,
                        PropertyParsers propertyParsers)
focal_class.identifier: PluginLoader
focal_class.modifiers: public
focal_class.parameters: (DataTypes dataTypes,
                        SourceTypes sourceTypes,
                        Components components,
                        Themes themes,
                        TabInfoRegistry tabInfoRegistry,
                        Converters converters,
                        PropertyParsers propertyParsers)
focal_class.signature:  PluginLoader(DataTypes dataTypes,
                        SourceTypes sourceTypes,
                        Components components,
                        Themes themes,
                        TabInfoRegistry tabInfoRegistry,
                        Converters converters,
                        PropertyParsers propertyParsers)
focal_class.class_method_signature: PluginLoader.getDefault()
focal_class.full_signature: public static PluginLoader getDefault()
focal_class.identifier: getDefault
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: PluginLoader
focal_class.signature: PluginLoader getDefault()
focal_class.class_method_signature: PluginLoader.loadAllJarsFromDir(Path directory)
focal_class.full_signature: public void loadAllJarsFromDir(Path directory)
focal_class.identifier: loadAllJarsFromDir
focal_class.modifiers: public
focal_class.parameters: (Path directory)
focal_class.return: void
focal_class.signature: void loadAllJarsFromDir(Path directory)
focal_class.class_method_signature: PluginLoader.loadPluginJar(URI jarUri)
focal_class.full_signature: public void loadPluginJar(URI jarUri)
focal_class.identifier: loadPluginJar
focal_class.modifiers: public
focal_class.parameters: (URI jarUri)
focal_class.return: void
focal_class.signature: void loadPluginJar(URI jarUri)
focal_class.class_method_signature: PluginLoader.comparePluginsByDependencyGraph(Class<? extends Plugin> p1, Class<? extends Plugin> p2)
focal_class.full_signature: @VisibleForTesting int comparePluginsByDependencyGraph(Class<? extends Plugin> p1, Class<? extends Plugin> p2)
focal_class.identifier: comparePluginsByDependencyGraph
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (Class<? extends Plugin> p1, Class<? extends Plugin> p2)
focal_class.return: int
focal_class.signature: int comparePluginsByDependencyGraph(Class<? extends Plugin> p1, Class<? extends Plugin> p2)
focal_class.class_method_signature: PluginLoader.loadPluginClass(Class<? extends Plugin> clazz)
focal_class.full_signature: public boolean loadPluginClass(Class<? extends Plugin> clazz)
focal_class.identifier: loadPluginClass
focal_class.modifiers: public
focal_class.parameters: (Class<? extends Plugin> clazz)
focal_class.return: boolean
focal_class.signature: boolean loadPluginClass(Class<? extends Plugin> clazz)
focal_class.class_method_signature: PluginLoader.unloadOldVersion(Plugin plugin)
focal_class.full_signature: private void unloadOldVersion(Plugin plugin)
focal_class.identifier: unloadOldVersion
focal_class.modifiers: private
focal_class.parameters: (Plugin plugin)
focal_class.return: void
focal_class.signature: void unloadOldVersion(Plugin plugin)
focal_class.class_method_signature: PluginLoader.load(Plugin plugin)
focal_class.full_signature: public boolean load(Plugin plugin)
focal_class.identifier: load
focal_class.modifiers: public
focal_class.parameters: (Plugin plugin)
focal_class.return: boolean
focal_class.signature: boolean load(Plugin plugin)
focal_class.class_method_signature: PluginLoader.requires(Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.full_signature: private boolean requires(Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.identifier: requires
focal_class.modifiers: private
focal_class.parameters: (Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.return: boolean
focal_class.signature: boolean requires(Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.class_method_signature: PluginLoader.isDirectRequirement(Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.full_signature: private static boolean isDirectRequirement(Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.identifier: isDirectRequirement
focal_class.modifiers: private static
focal_class.parameters: (Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.return: boolean
focal_class.signature: boolean isDirectRequirement(Class<? extends Plugin> pluginA, Class<? extends Plugin> pluginB)
focal_class.class_method_signature: PluginLoader.canLoad(Plugin plugin)
focal_class.full_signature: public boolean canLoad(Plugin plugin)
focal_class.identifier: canLoad
focal_class.modifiers: public
focal_class.parameters: (Plugin plugin)
focal_class.return: boolean
focal_class.signature: boolean canLoad(Plugin plugin)
focal_class.class_method_signature: PluginLoader.tryRestoreSource(Widget widget, DestroyedSource destroyedSource)
focal_class.full_signature: private void tryRestoreSource(Widget widget, DestroyedSource destroyedSource)
focal_class.identifier: tryRestoreSource
focal_class.modifiers: private
focal_class.parameters: (Widget widget, DestroyedSource destroyedSource)
focal_class.return: void
focal_class.signature: void tryRestoreSource(Widget widget, DestroyedSource destroyedSource)
focal_class.class_method_signature: PluginLoader.unload(Plugin plugin)
focal_class.full_signature: @SuppressWarnings("unchecked") public boolean unload(Plugin plugin)
focal_class.identifier: unload
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (Plugin plugin)
focal_class.return: boolean
focal_class.signature: boolean unload(Plugin plugin)
focal_class.class_method_signature: PluginLoader.getKnownPlugins()
focal_class.full_signature: public ObservableList<Plugin> getKnownPlugins()
focal_class.identifier: getKnownPlugins
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ObservableList<Plugin>
focal_class.signature: ObservableList<Plugin> getKnownPlugins()
focal_class.class_method_signature: PluginLoader.getLoadedPlugins()
focal_class.full_signature: public ObservableSet<Plugin> getLoadedPlugins()
focal_class.identifier: getLoadedPlugins
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ObservableSet<Plugin>
focal_class.signature: ObservableSet<Plugin> getLoadedPlugins()
focal_class.class_method_signature: PluginLoader.getClassLoaders()
focal_class.full_signature: public ObservableList<ClassLoader> getClassLoaders()
focal_class.identifier: getClassLoaders
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ObservableList<ClassLoader>
focal_class.signature: ObservableList<ClassLoader> getClassLoaders()
focal_method.body: public boolean load(Plugin plugin) {
      if (loadedPlugins.contains(plugin)) {
        // Already loaded
        return false;
      }
      final Stopwatch timer = Stopwatch.createStarted(); // NOPMD -- need to time as much as posible
  
      // Unload an already-loaded version of this plugin, if it exists
      // This allows us to load
      unloadOldVersion(plugin);
      knownPluginClasses.add(plugin.getClass());
  
      if (!canLoad(plugin)) {
        log.warning("Not all requirements are present for " + plugin.fullIdString());
        if (!knownPlugins.contains(plugin)) {
          knownPlugins.add(plugin);
        }
        return false;
      }
      log.info("Loading plugin " + plugin.fullIdString());
      dataTypes.registerAll(plugin.getDataTypes());
      sourceTypes.registerAll(plugin.getSourceTypes());
      plugin.getTypeAdapters().forEach(Serializers::add);
      components.registerAll(plugin.getComponents());
      plugin.getDefaultComponents().forEach(components::setDefaultComponent);
      components.getActiveWidgets().stream()
          .filter(w -> w.getSources().stream().anyMatch(s -> s instanceof DestroyedSource))
          .filter(w -> {
            return plugin.getComponents().stream().anyMatch(t -> t.getType().equals(w.getClass()))
                || w.getSources().stream().anyMatch(s -> plugin.getDataTypes().contains(s.getDataType()))
                || w.getSources().stream().anyMatch(s -> plugin.getSourceTypes().contains(s.getType()));
          })
          .filter(w -> w.getSources().stream().anyMatch(s -> sourceTypes.isRegistered(s.getType())))
          .forEach(w -> {
            w.getSources().stream()
                .filter(s -> s instanceof DestroyedSource)
                .forEach(s -> tryRestoreSource(w, (DestroyedSource) s));
          });
      plugin.getThemes().forEach(themes::register);
      tabInfoRegistry.registerAll(plugin.getDefaultTabInfo());
      converters.registerAll(plugin.getRecordingConverters());
      propertyParsers.registerAll(plugin.getPropertyParsers());
  
      plugin.onLoad();
      plugin.setLoaded(true);
  
      loadedPlugins.add(plugin);
      if (!knownPlugins.contains(plugin)) {
        knownPlugins.add(plugin);
      }
      log.info("Loaded plugin " + plugin.idString() + " in " + timer.elapsed(TimeUnit.MILLISECONDS) + "ms");
      return true;
    }
focal_method.class_method_signature: PluginLoader.load(Plugin plugin)
focal_method.full_signature: public boolean load(Plugin plugin)
focal_method.identifier: load
focal_method.invocations: contains createStarted unloadOldVersion add getClass canLoad warning fullIdString contains add info fullIdString registerAll getDataTypes registerAll getSourceTypes forEach getTypeAdapters registerAll getComponents forEach getDefaultComponents forEach filter filter filter stream getActiveWidgets anyMatch stream getSources anyMatch stream getComponents equals getType getClass anyMatch stream getSources contains getDataTypes getDataType anyMatch stream getSources contains getSourceTypes getType anyMatch stream getSources isRegistered getType forEach filter stream getSources tryRestoreSource forEach getThemes registerAll getDefaultTabInfo registerAll getRecordingConverters registerAll getPropertyParsers onLoad setLoaded add contains add info idString elapsed
focal_method.modifiers: public
focal_method.parameters: (Plugin plugin)
focal_method.return: boolean
focal_method.signature: boolean load(Plugin plugin)