/* (non-Javadoc)
@see grails.plugins.GrailsPluginManager#loadPlugins()
490769
public void loadPlugins() throws PluginException {
        if (initialised) {
            return;
        }

        ClassLoader gcl = application.getClassLoader();

        attemptLoadPlugins(gcl);

        if (!delayedLoadPlugins.isEmpty()) {
            loadDelayedPlugins();
        }
        if (!delayedEvictions.isEmpty()) {
            processDelayedEvictions();
        }

        pluginList = sortPlugins(pluginList);
        initializePlugins();
        initialised = true;
    }
477655
private void initializeRpcPlugins(final String[] pluginClassNames,
        final ImmutableList.Builder<RpcPlugin> rpcs) {
    for (final String plugin : pluginClassNames) {
      final RpcPlugin rpc = createAndInitialize(plugin, RpcPlugin.class);
      rpcs.add(rpc);
    }
  }
681586
private void loadPluginJobTypes(final JobTypePluginSet plugins)
      throws JobTypeManagerException {
    final File jobPluginsDir = new File(this.jobTypePluginDir);

    if (!jobPluginsDir.exists()) {
      logger.error("Job type plugin dir " + this.jobTypePluginDir
          + " doesn't exist. Will not load any external plugins.");
      return;
    } else if (!jobPluginsDir.isDirectory()) {
      throw new JobTypeManagerException("Job type plugin dir "
          + this.jobTypePluginDir + " is not a directory!");
    } else if (!jobPluginsDir.canRead()) {
      throw new JobTypeManagerException("Job type plugin dir "
          + this.jobTypePluginDir + " is not readable!");
    }

    // Load the common properties used by all jobs that are run
    Props commonPluginJobProps = null;
    final File commonJobPropsFile = new File(jobPluginsDir, COMMONCONFFILE);
    if (commonJobPropsFile.exists()) {
      logger.info("Common plugin job props file " + commonJobPropsFile
          + " found. Attempt to load.");
      try {
        commonPluginJobProps = new Props(this.globalProperties, commonJobPropsFile);
      } catch (final IOException e) {
        throw new JobTypeManagerException(
            "Failed to load common plugin job properties" + e.getCause());
      }
    } else {
      logger.info("Common plugin job props file " + commonJobPropsFile
          + " not found. Using only globals props");
      commonPluginJobProps = new Props(this.globalProperties);
    }

    // Loads the common properties used by all plugins when loading
    Props commonPluginLoadProps = null;
    final File commonLoadPropsFile = new File(jobPluginsDir, COMMONSYSCONFFILE);
    if (commonLoadPropsFile.exists()) {
      logger.info("Common plugin load props file " + commonLoadPropsFile
          + " found. Attempt to load.");
      try {
        commonPluginLoadProps = new Props(null, commonLoadPropsFile);
      } catch (final IOException e) {
        throw new JobTypeManagerException(
            "Failed to load common plugin loader properties" + e.getCause());
      }
    } else {
      logger.info("Common plugin load props file " + commonLoadPropsFile
          + " not found. Using empty props.");
      commonPluginLoadProps = new Props();
    }

    plugins.setCommonPluginJobProps(commonPluginJobProps);
    plugins.setCommonPluginLoadProps(commonPluginLoadProps);

    // Loading job types
    for (final File dir : jobPluginsDir.listFiles()) {
      if (dir.isDirectory() && dir.canRead()) {
        try {
          loadJobTypes(dir, plugins);
        } catch (final Exception e) {
          logger.error(
              "Failed to load jobtype " + dir.getName() + e.getMessage(), e);
          throw new JobTypeManagerException(e);
        }
      }
    }
  }
13896
def load_modules(self, modules, config):
        """"""
        for pluginclass in get_plugin_classes(modules):
            name = pluginclass.__name__
            if name in config["enabledplugins"]:
                if issubclass(pluginclass, _ConnectionPlugin):
                    log.debug(LOG_PLUGIN, "Enable connection plugin %s", name)
                    self.connection_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ContentPlugin):
                    log.debug(LOG_PLUGIN, "Enable content plugin %s", name)
                    self.content_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ParserPlugin):
                    log.debug(LOG_PLUGIN, "Enable parser plugin %s", name)
                    self.parser_plugins.append(pluginclass(config[name]))
                else:
                    raise ValueError("Invalid plugin class %s" % pluginclass)
1374685
private static void doLoadSpringGroovyResources(RuntimeSpringConfiguration config, GrailsApplication application,
                                                    GenericApplicationContext context) {
        loadExternalSpringConfig(config, application);
        if (context != null) {
            springGroovyResourcesBeanBuilder.registerBeans(context);
        }
    }
411618
@SuppressWarnings("unchecked")
    <T> T loadPlugin(final Class<T> pluginType) {
        return (T) loadPlugin(pluginType, null);
    }
737584
public static function loadList(array $plugins)
    {
        foreach ($plugins as $name) {
            if (self::loaded($name)) {
                continue;
            }

            if ($path = self::_findPlugin($name)) {
                self::load($name, self::_getConfigForLoad($path));
            }
        }
    }
639879
def _load_plugins(self):
        '''
        
        '''
        plugins = self.settings['PLUGINS']

        self.plugins_dict = {}
        for key in plugins:
            # skip loading the plugin if its value is None
            if plugins[key] is None:
                continue
            # valid plugin, import and setup
            self.logger.debug("Trying to load plugin {cls}".format(cls=key))
            the_class = self._import_class(key)
            instance = the_class()
            instance._set_logger(self.logger)
            if not self.unit_test:
                instance.setup(self.settings)
            the_schema = None
            with open(self.settings['PLUGIN_DIR'] + instance.schema) as the_file:
                the_schema = json.load(the_file)

            mini = {}
            mini['instance'] = instance
            mini['schema'] = the_schema
            self.logger.debug("Successfully loaded plugin {cls}".format(cls=key))
            self.plugins_dict[plugins[key]] = mini

        self.plugins_dict = OrderedDict(sorted(list(self.plugins_dict.items()),
                                               key=lambda t: t[0]))
689701
public <P extends Plugin> List<P> getPlugins(Class<P> clazz) {
        List<P> result = new ArrayList<>();
        for (PluginWrapper w: pluginManager.getPlugins(clazz)) {
            result.add((P)w.getPlugin());
        }
        return Collections.unmodifiableList(result);
    }
445137
protected function setPluginAutoloading()
    {
        foreach ($this->config('plugin.autoloading', []) as $ns => $path) {
            $path = $this->dirPath.'/'.trim($path, '\/');
            $this->loader->addPsr4($ns, $path);
        }

        $this->loader->register();
    }
897209
@Override
    protected void loadPlugins() {
		pickingPlugin = new PickingGraphMousePlugin<String,String>();
		scalingPlugin = new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, in, out);
		editingPlugin = new RoleGraphEditingPlugin();
		add(scalingPlugin);
		setMode(Mode.EDITING);
	}
255249
public function loadActivatedPlugins()
    {
        $pluginsToLoad = $this->getActivatedPluginsFromConfig();
        if (!SettingsPiwik::isInternetEnabled()) {
            $pluginsToLoad = array_filter($pluginsToLoad, function($name) {
                $plugin = Manager::makePluginClass($name);
                return !$plugin->requiresInternetConnection();
            });
        }
        $this->loadPlugins($pluginsToLoad);
    }
1264158
@Override
    protected Collection<String> loadBundledPlugins() {
        // this is used in tests, when we want to override the default bundled plugins with .jpl (or .hpl) versions
        if (SystemProperties.getString("hudson.bundled.plugins") != null) {
            return Collections.emptySet();
        }

        try {
            return loadPluginsFromWar("/WEB-INF/plugins");
        } finally {
            loadDetachedPlugins();
        }
    }
1088701
protected function _loadPlugins($plugins)
    {
        $app_plugins = [];
        foreach ($this->filesystem->glob('@app/Plugins/*Plugin.php') as $item) {
            $app_plugins[basename($item, '.php')] = 1;
        }

        foreach ($plugins as $k => $v) {
            $plugin = is_string($k) ? $k : $v;
            if (($pos = strrpos($plugin, 'Plugin')) === false || $pos !== strlen($plugin) - 6) {
                $plugin .= 'Plugin';
            }

            if ($plugin[0] === '!') {
                unset($app_plugins[ucfirst(substr($plugin, 1))]);
                continue;
            }

            $plugin = ucfirst($plugin);

            $pluginClassName = isset($app_plugins[$plugin]) ? $this->alias->get('@ns.app') . "\\Plugins\\$plugin" : "ManaPHP\Plugins\\$plugin";
            unset($app_plugins[$plugin]);

            $plugin = lcfirst($plugin);
            $this->_di->setShared($plugin, is_int($k) ? $pluginClassName : array_merge($v, ['class' => $pluginClassName]))->getShared($plugin);
        }

        foreach ($app_plugins as $plugin => $_) {
            $pluginClassName = $this->alias->get('@ns.app') . "\\Plugins\\$plugin";
            $plugin = lcfirst($plugin);
            $this->_di->setShared($plugin, $pluginClassName)->getShared($plugin);
        }
    }
197262
public void add(Collection<Plugin> plugins)
    {
        for(Plugin plugin : plugins)
            this.plugins.put(plugin.getId(), plugin);
    }
735048
public function installLoadedPlugins()
    {
        Log::debug("Loaded plugins: " . implode(", ", array_keys($this->getLoadedPlugins())));
        
        foreach ($this->getLoadedPlugins() as $plugin) {
            $this->installPluginIfNecessary($plugin);
        }
    }
157688
protected function loadPlugins()
    {
        if (
            !defined('WP_PLUGIN_DIR') ||
            !defined('WPMU_PLUGIN_DIR') ||
            !is_blog_installed()
        ) {
            return;
        }

        $cache = get_site_option('wordplate_autoloader_plugin_cache');

        if ($cache !== false && isset($cache['files'])) {
            $cacheFiles = $cache['files'];

            foreach ($cacheFiles as $file) {
                // Check if plugin have been removed.
                if (!file_exists(WPMU_PLUGIN_DIR.'/'.$file)) {
                    $cache = false; // Invalidate cache.
                    break;
                }
            }
        } else {
            $cache = false; // Invalidate cache.
            $cacheFiles = [];
        }

        // Required for 'get_plugins' & 'get_mu_plugins' functions.
        require_once ABSPATH.'wp-admin/includes/plugin.php';

        $this->relativePath = UrlGenerator::getRelativePath(
            WP_PLUGIN_DIR.'/',
            WPMU_PLUGIN_DIR.'/'
        );

        $this->autoloadPlugins = get_plugins('/'.$this->relativePath);
        $this->mustUsePlugins = get_mu_plugins();

        // Remove duplicate plugins.
        $this->plugins = array_diff_key($this->autoloadPlugins, $this->mustUsePlugins);

        $this->files = array_keys($this->plugins);

        // Add relativePath before filename
        $this->relativeFiles = preg_filter('/^/', $this->relativePath, $this->files);

        $this->activate = array_diff($this->files, $cacheFiles);

        // Check if plugin have been added.
        if ($this->activate) {
            $cache = false; // Invalidate cache.
        }

        if ($cache === false) {
            // Update cache.
            update_site_option('wordplate_autoloader_plugin_cache', [
                'files' => $this->files,
            ]);
        }

        // Load already activated plugins
        $activated = array_diff($this->files, $this->activate);
        foreach ($activated as $file) {
            include_once WPMU_PLUGIN_DIR.'/'.$file;
        }

        add_action('after_setup_theme', function () {
            $this->activatePlugins();
        });
    }