Enables MVC capabilities in the given factory by injecting a {@link BundleSpecificDispatcherServlet}.

@param factory must not be <code>null</code>.
@param context must not be <code>null</code>.
492240
public void enableMvc(ConfigurableListableBeanFactory factory, BundleContext context) {
        if (factory == null) {
            throw new IllegalArgumentException("Method argument factory must not be null.");
        }
        if (context == null) {
            throw new IllegalArgumentException("Method argument context must not be null.");
        }

        BundleAwareServletConfig servletConfig = new BundleAwareServletConfig(context);

        factory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, servletConfig));
        factory.ignoreDependencyInterface(ServletContextAware.class);
        factory.ignoreDependencyInterface(ServletConfigAware.class);

        final BundleSpecificDispatcherServlet dispatcherServlet = createBundleSpecificDispatcherServlet(factory, servletConfig);
        factory.registerSingleton(generateNameFor(BundleSpecificDispatcherServlet.class), dispatcherServlet);
        this.mvcCapableBundles.put(context.getBundle(), dispatcherServlet);
    }
277220
@SuppressWarnings({ "rawtypes", "unchecked" })
	protected void applyInitializers(ConfigurableApplicationContext context) {
		for (ApplicationContextInitializer initializer : getInitializers()) {
			Class<?> requiredType = GenericTypeResolver.resolveTypeArgument(
					initializer.getClass(), ApplicationContextInitializer.class);
			Assert.isInstanceOf(requiredType, context, "Unable to call initializer.");
			initializer.initialize(context);
		}
	}
1048479
public Interceptor create(final InterceptorFactoryContext context) {
        final InterceptorFactory[] factories = interceptorFactories;
        final int length = factories.length;
        final Interceptor[] interceptors = new Interceptor[length];
        for (int i = 0; i < length; i++) {
            interceptors[i] = factories[i].create(context);
        }
        return new ChainedInterceptor(interceptors);
    }
476080
public static Bundle addBundle(final CFMLEngineFactory factory, final BundleContext context, final File bundle, final Log log) throws IOException, BundleException {

	return addBundle(factory, context, bundle.getAbsolutePath(), new FileInputStream(bundle), true, log);
    }
162669
public void setFhirContext(FhirContext theContext) {
		if (myContext != null && myContext != theContext) {
			throw new IllegalStateException("RestfulClientFactory instance is already associated with one FhirContext. RestfulClientFactory instances can not be shared.");
		}
		myContext = theContext;
	}
1099374
public void configureWebAppHelperFactory(WebAppConfiguratorHelperFactory webAppConfiguratorHelperFactory, ResourceRefConfigFactory resourceRefConfigFactory) {
        webAppHelper = webAppConfiguratorHelperFactory.createWebAppConfiguratorHelper(this, resourceRefConfigFactory, getListenerInterfaces());        
        this.configHelpers.add(webAppHelper);
    }
671805
def _set_factory_context(factory_class, bundle_context):
    # type: (type, Optional[BundleContext]) -> Optional[FactoryContext]
    
    try:
        # Try to get the factory context (built using decorators)
        context = getattr(factory_class, constants.IPOPO_FACTORY_CONTEXT)
    except AttributeError:
        # The class has not been manipulated, or too badly
        return None

    if not context.completed:
        # Partial context (class not manipulated)
        return None

    # Associate the factory to the bundle context
    context.set_bundle_context(bundle_context)
    return context
345055
private List<String> findFactoryCandidates(BundleContext context) throws IOException {
        Bundle[] bundles = context.getBundles();
        List<String> factoryCandidates = new ArrayList<String>();
        for (Bundle bundle : bundles) {
            if (bundle == null) {
                continue;
            }
            if ("system.bundle".equals(bundle.getSymbolicName())) {
                continue;
            }
            Enumeration urls = bundle.findEntries("META-INF/services", "javax.script.ScriptEngineFactory", false);
            if (urls == null) {
                continue;
            }
            while (urls.hasMoreElements()) {
                URL u = (URL) urls.nextElement();
                BufferedReader reader = null;
                try {
                    reader = new BufferedReader(
                            new InputStreamReader(u.openStream(), "UTF-8"));
                    String line;
                    while ((line = reader.readLine()) != null) {
                        line = line.trim();
                        if (!line.startsWith("#") && line.length() > 0) {
                            factoryCandidates.add(line);
                        }
                    }
                } finally {
                    IOUtil.closeResource(reader);
                }
            }
        }

        // Add java built in JavaScript ScriptEngineFactory's
        addJavaScriptEngine(factoryCandidates);

        return factoryCandidates;
    }
1131583
@SuppressWarnings("unchecked")
    public void addExtensionFactory(ExtensionFactory factory) {
        synchronized (lock) {
            if (initialized) {
                if (null == extensionFactories) {
                    extensionFactories = new ArrayList();
                }
                if(!extensionFactories.contains(factory)){
                extensionFactories.add(factory);
                }
                initializeExtensionProcessors(extensionFactories);
            } else {
                if(!extensionFactories.contains(factory)){
                extensionFactories.add(factory);
            }
        }
    }
    }
263360
public final Factory registerFactory(Factory factory) {
        if (factory == null) {
            throw new NullPointerException();
        }
        try {
            factoryLock.acquireWrite();
            factories.add(0, factory);
            clearCaches();
        }
        finally {
            factoryLock.releaseWrite();
        }
        notifyChanged();
        return factory;
    }
11094
protected function injectContextToViewExtensionFactory(IViewExtensionFactory $factory)
    {
        if ($factory instanceof IContextAware) {
            $factory->clearContext();

            if ($this->hasContext()) {
                $factory->setContext($this->getContext());
            }
        }

        if ($factory instanceof IModelAware && $this->modelFactory) {
            $factory->setModelFactory($this->modelFactory);
        }
    }
901924
private void checkObjectFactoryAttributes(ResourceInjectionBinding resourceBinding,
                                              ObjectFactoryInfo extensionFactory) // d675976
    throws InjectionConfigurationException
    {
        Resource resourceAnnotation = resourceBinding.getAnnotation();

        if (!extensionFactory.isAttributeAllowed("authenticationType"))
        {
            checkObjectFactoryAttribute(resourceBinding, "authenticationType",
                                        resourceAnnotation.authenticationType(), AuthenticationType.CONTAINER);
        }

        if (!extensionFactory.isAttributeAllowed("shareable"))
        {
            checkObjectFactoryAttribute(resourceBinding, "shareable",
                                        resourceAnnotation.shareable(), true);
        }
    }
1301210
@Override
    public void onApplicationEvent(@Nonnull ApplicationEvent event) {
        if (event instanceof ContextRefreshedEvent) {
            synchronized (this) {
                ApplicationContext applicationContext = ((ContextRefreshedEvent) event).getApplicationContext();
                setApplicationContext(new WebApplicationContextAdapter(applicationContext, this.servletConfig.getServletContext()));

                // Configure the MVC infrastructure
                configureMultipartResolver();
                configureExceptionResolvers();
                configureHandlerAdapters();
                registerCustomArgumentResolvers();
                configureHandlerMappings();
                addNebaViewResolver();

                // Picks up the previously registered MVC infrastructure
                onRefresh(applicationContext);

                this.initialized = true;
            }
        }
    }
680282
public boolean registerMap(MapSchema.MessageFactory factory)
    {
        return null == mapMapping.putIfAbsent(factory.typeClass().getName(),
                factory);
    }
615296
function (childFactory, requestor) {
                var context;
                if (childFactory) {

                    var configuration,
                        requestorConfiguration,
                        baseConfiguration = this,
                        isModel = childFactory.classof(Model);

                    context = this.root();

                    if (requestor) {
                        var requestorContext = requestor.$context,
                            contextStack = [];
                        // find correct configuration of requestor
                        while (requestorContext.$contextModel) {
                            contextStack.push(requestorContext);
                            requestorContext = requestorContext.$contextModel.$context;
                        }
                        var rootConfiguration = this,
                            rootContext;
                        while (contextStack.length > 0 && rootConfiguration) {
                            rootContext = contextStack.pop();
                            rootConfiguration = rootConfiguration.getConfigurationForModelClass(rootContext.$contextModel.factory);
                        }
                        var factory = requestor.factory;
                        if (factory.classof(Model)) {
                            requestorConfiguration = rootConfiguration.getConfigurationForModelClass(factory);
                        } else if (factory.classof(Collection)) {
                            requestorConfiguration = rootConfiguration.getConfigurationForCollectionClassName(factory.prototype.$modelFactory);
                        }
                        // starting from the requestors configuration, find correct context of the childFactory
                        if (requestorConfiguration) {
                            context = this.getContextByProperties(requestor, null, requestor.$context);
                            baseConfiguration = requestorConfiguration;
                        }
                        while (baseConfiguration.$parent && context) {
                            if (isModel) {
                                configuration = baseConfiguration.getConfigurationForModelClass(childFactory);
                            } else {
                                configuration = baseConfiguration.getConfigurationForModelClass(childFactory.prototype.$modelFactory);
                            }
                            if (configuration) {
                                // found context
                                break;
                            } else {
                                context = context.$contextModel ? context.$contextModel.$context : null;
                                baseConfiguration = baseConfiguration.$parent;
                            }
                        }
                    }
                }
                return context || this.root();
            }
1274229
public void set(BridgeFactory factory) {
        if (factory.getNearType() != nearType) {
            throw new IllegalArgumentException("Type mismatch: " + nearType + ": " + factory.getNearType());
        }
        factorySetting.set(factory);
    }
154042
public synchronized boolean enableContext(final String contextPath, final String jvmRoute, final List<String> aliases) {
        final Node node = nodes.get(jvmRoute);
        if (node != null) {
            Context context = node.getContext(contextPath, aliases);
            if (context == null) {
                context = node.registerContext(contextPath, aliases);
                UndertowLogger.ROOT_LOGGER.registeringContext(contextPath, jvmRoute);
                UndertowLogger.ROOT_LOGGER.registeringContext(contextPath, jvmRoute, aliases);
                for (final String alias : aliases) {
                    VirtualHost virtualHost = hosts.get(alias);
                    if (virtualHost == null) {
                        virtualHost = new VirtualHost();
                        hosts.put(alias, virtualHost);
                    }
                    virtualHost.registerContext(contextPath, jvmRoute, context);
                }
            }
            context.enable();
            return true;
        }
        return false;
    }