Load all components and activate the correct one

@throws PlinthException
972730
private function loadComponent()
	{
		/** @var Component $component */
    	$component = false;
    	$currentPath = Request::getRequestPath(__BASE);
    	$defaultPath = false;
    	
    	if (file_exists(__APP_CONFIG_COMPONENTS)) {
	    	$componentsData = json_decode(file_get_contents(__APP_CONFIG_COMPONENTS), true);
	    	
	    	if (!is_array($componentsData)) throw new PlinthException('Cannot parse components.json config');
	    	
	    	foreach ($componentsData as $label => $data) {
	    		$loadedComponent = Component::loadFromArray(__APP_CONFIG_PATH, $label, $data);
	    		if ($loadedComponent->getPath() === false) {
	    			if ($defaultPath === false) $defaultPath = true;
	    			else throw new PlinthException('Their can only be one default path in components.json config');
	    		}
	    		if ($loadedComponent->matchesCurrentPath($currentPath)) {
	    			if ($component === false || $loadedComponent->getDepth() > $component->getDepth()) $component = $loadedComponent;
	    		}
	    	}
    	}
    	    	
    	$this->component = $component;
    }
902262
protected void activate(ComponentContext context) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Activating");
        }

        processConfig(context.getProperties());

        SystemLogger.setLogService(logService);
    }
1128599
protected final void load()throws Exception
	{
		synchronized (this) {
			Set<Class<?>> classes=classProvider.getLoadedClasses();
			initScriptClasses(classes);
			onScriptLoaded(classes);
		}
	}
1097385
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();

		$builder->addDefinition($this->prefix('factory'))
			->setImplement(IStandaloneFormFactory::class);
	}
260417
def start_system(components, bind_to, hooks={}):
    """"""
    deps = build_deps_graph(components)
    started_components = start_components(components, deps, None)

    run_hooks(hooks, started_components)

    if type(bind_to) is str:
        master = started_components[bind_to]
    else:
        master = bind_to

    setattr(master, '__components', started_components)
    return master
473249
public void add(UIComponent... components)
	{
		for (UIComponent component : components)
		{
			if (component != null && component != this)
			{
				content.components.add(component);
				component.setParent(this);
				component.register(this);
			}
		}
		onContentUpdate();
	}
674965
public static function init() :void {

		// marker
		Profiler::setMarker('Bundles.init', 'framework');

		// if cache is enabled and in prod load the cache, else parse bundles
		Config::isProd() && Cache::has('Includes') ? self::loadCachedDependencies() : self::loadDependencies();
		
		// now that we have the list of config files, pass them to the config class
		Config::includeBundlesConfigs(self::$_configs);

		// now that we have the list of route files, pass them to the router class
		Router::includeBundlesRoutes(self::$_routes);

		// marker
		Profiler::releaseMarker('Bundles.init');

	}
808099
protected void activate(BundleContext context, Map<String, Object> props) {
        final String jndiName = (String) props.get("jndiName");
        final String urlValue = (String) props.get("value");

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Registering JNDIURLEntry with value " + urlValue + " and JNDI name " + jndiName);
        }

        if (jndiName == null || jndiName.isEmpty() || urlValue == null || urlValue.isEmpty()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unable to register JNDIURLEntry with jndiName [" + jndiName + "] and value [" + urlValue + "] because both must be set");
            }
            return;
        }

        // Test that the URL is valid
        // creating a url should be a protected action
        createURL(jndiName, urlValue);

        Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
        propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
        propertiesForJndiService.put(Constants.OBJECTCLASS, Reference.class);

        Reference ref = new Reference(URL.class.getName(), this.getClass().getName(), null);
        ref.add(new RefAddr("JndiURLEntry") {
            private static final long serialVersionUID = 5168161341101144689L;

            @Override
            public Object getContent() {
                return urlValue;
            }
        });

        this.serviceRegistration = context.registerService(Reference.class, ref, propertiesForJndiService);
    }
758507
protected function setupComponents()
    {
        $components = Arr::get($this->config, 'components');
        foreach ($components as $component) {
            $instance = new $component($this->config);
            $instance->setup();

            $this->componentInstances[ $component ] = $instance;
        }
    }
14487
protected void activate(ComponentContext compcontext) {
        if (TC.isDebugEnabled()) {
            Tr.debug(TC, "Activating " + this.getClass().getName());
        }
        this.userTransaction.activate(compcontext);
        this.transactionManager.activate(compcontext);
    }
769394
protected function bootComponents(): void
    {
        $path = realpath(__DIR__.'/../');

        $this->addConfigComponent('orchestra/html', 'orchestra/html', "{$path}/config");
        $this->addViewComponent('orchestra/html', 'orchestra/html', "{$path}/resources/views");

        if (! $this->hasPackageRepository()) {
            $this->bootUsingLaravel($path);
        }
    }
1174114
private function load()
    {
        if (null === $this->collection) {
            $this->collection = $this->transformer->getChildren($this->page);
        }
    }
1191436
protected void preloadModules() {

        // Add default ModuleModel component interface (because it cannot be added by module starter, API is not processed with annotation engine)
        JRebirthThread.getThread().getFacade().componentFactory().define(
                                                                         RegistrationPointItemBase.create()
                                                                                                  .interfaceClass(ModuleModel.class)
                                                                                                  .exclusive(false)
                                                                                                  .reverse(false));

        final ServiceLoader<ModuleStarter> loader = ServiceLoader.load(ModuleStarter.class);

        final List<ModuleStarter> modules = new ArrayList<>();
        loader.iterator().forEachRemaining(modules::add);

        modules.stream()
               .sorted((m1, m2) -> -1 * Integer.compare(m1.priority(), m2.priority()))
               .forEach(ModuleStarter::start);

    }
1223542
public function load()
    {
        // Make the $menu variable available to all files
        $menu = app('menu');

        // Include menu files
        $files = $this->getFiles();

        /** @var \SplFileInfo $file */
        foreach ($files as $file) {
            require_once $file->getPath() . '/' . $file->getFilename();
        }
    }
512598
protected synchronized void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Activating");
        }
        bContext = context.getBundleContext();
        instance.set(this);

        sslConfigs.activate(context);
        cfwBundle.getFramework().registerFactories(this);
    }
407300
function ComponentLoader(load, placeholder, fallback) {
    this.load = load;
    this.placeholder = placeholder;
    this.fallback = fallback;

    this.listeners = [];
}
379225
@Activate
    public void startUp(BundleContext bundleContext) {
        extendedBundleContext = new ExtendedBundle.ExtendedBundleContext(bundleContext);
        bundleContext.addBundleListener(this);
    }