Examples of InjectionProvider


Examples of com.sun.faces.spi.InjectionProvider

                      new FacesConfigInfo(facesDocuments[facesDocuments.length - 1]);

                facesDocuments = sortDocuments(facesDocuments, webInfFacesConfigInfo);
                InitFacesContext context = (InitFacesContext) FacesContext.getCurrentInstance();

                InjectionProvider containerConnector =
                        InjectionProviderFactory.createInstance(context.getExternalContext());
                context.getAttributes().put(INJECTION_PROVIDER_KEY, containerConnector);

                boolean isFaceletsDisabled =
                      isFaceletsDisabled(webConfig, webInfFacesConfigInfo);
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

                      new FacesConfigInfo(facesDocuments[facesDocuments.length - 1]);

                facesDocuments = sortDocuments(facesDocuments, lastFacesConfigInfo);
                InitFacesContext context = (InitFacesContext) FacesContext.getCurrentInstance();

                InjectionProvider containerConnector =
                        InjectionProviderFactory.createInstance(context.getExternalContext());
                context.getAttributes().put(INJECTION_PROVIDER_KEY, containerConnector);

                boolean isFaceletsDisabled = false;
               
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

        beanList.add(managedBean.getManagedBeanName());

        // populate the bean with its contents
        try {
            ApplicationAssociate associate = getAssociate(context);
            InjectionProvider injectionProvider =
                  associate.getInjectionProvider();
           
            // Perform resource injection first
            if (injectable) {
                injectionProvider.inject(bean);   
            }
           
           
            // now setup the managed properties which may
            // leverage the injected info from the previous step
            switch (beanType = getBeanType(bean)) {
                case TYPE_IS_LIST:
                    copyListEntriesFromConfigToList(
                        managedBean.getListEntries(),
                        (List) bean);
                    break;
                case TYPE_IS_MAP:
                    copyMapEntriesFromConfigToMap(managedBean.getMapEntries(),
                                                  (Map) bean);
                    break;
                case TYPE_IS_UICOMPONENT:
                    // intentional fall-through
                case TYPE_IS_BEAN:
                    setPropertiesIntoBean(bean, beanType, managedBean);
                    break;
                default:
                    // notreached
                    assert (false);
                    break;
            }
           
            // now invoke methods marked with @PostConstruct
            if (injectable) {
                injectionProvider.invokePostConstruct(bean);               
            }
           
        } catch (FacesException fe) {
            throw fe;
        } catch (ClassNotFoundException cnfe) {
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

        aFactory.getApplication(); // bootstraps the ApplicationAssociate   
        ApplicationAssociate associate = ApplicationAssociate
              .getInstance(getFacesContext().getExternalContext());       
        assertNotNull(associate);      
       
        InjectionProvider injectionProvider = associate.getInjectionProvider();
        assertNotNull(injectionProvider);
        try {
            injectionProvider.inject(protectedBean);
            injectionProvider.invokePostConstruct(protectedBean);
            injectionProvider.invokePreDestroy(protectedBean);
            injectionProvider.inject(packagePrivateBean);
            injectionProvider.invokePostConstruct(packagePrivateBean);
            injectionProvider.invokePreDestroy(packagePrivateBean);
            injectionProvider.inject(privateBean);
            injectionProvider.invokePostConstruct(privateBean);
            injectionProvider.invokePreDestroy(privateBean);
            injectionProvider.inject(concreteBean);
            injectionProvider.invokePostConstruct(concreteBean);
            injectionProvider.invokePreDestroy(concreteBean);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
            assertTrue(false);
        }
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

                      new FacesConfigInfo(facesDocuments[facesDocuments.length - 1]);

                facesDocuments = sortDocuments(facesDocuments, webInfFacesConfigInfo);
                InitFacesContext context = (InitFacesContext) FacesContext.getCurrentInstance();

                InjectionProvider containerConnector =
                        InjectionProviderFactory.createInstance(context.getExternalContext());
                context.getAttributes().put(INJECTION_PROVIDER_KEY, containerConnector);

                boolean isFaceletsDisabled =
                      isFaceletsDisabled(webConfig, webInfFacesConfigInfo);
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

                      new FacesConfigInfo(facesDocuments[facesDocuments.length - 1]);

                facesDocuments = sortDocuments(facesDocuments, webInfFacesConfigInfo);
                InitFacesContext context = (InitFacesContext) FacesContext.getCurrentInstance();

                InjectionProvider containerConnector =
                        InjectionProviderFactory.createInstance(context.getExternalContext());
                context.getAttributes().put(INJECTION_PROVIDER_KEY, containerConnector);

                boolean isFaceletsDisabled =
                      isFaceletsDisabled(webConfig, webInfFacesConfigInfo);
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

                      new FacesConfigInfo(facesDocuments[facesDocuments.length - 1]);

                facesDocuments = sortDocuments(facesDocuments, webInfFacesConfigInfo);
                InitFacesContext context = (InitFacesContext) FacesContext.getCurrentInstance();

                InjectionProvider containerConnector =
                        InjectionProviderFactory.createInstance(context.getExternalContext());
                context.getAttributes().put(INJECTION_PROVIDER_KEY, containerConnector);

                boolean isFaceletsDisabled =
                      isFaceletsDisabled(webConfig, webInfFacesConfigInfo);
View Full Code Here

Examples of com.sun.faces.spi.InjectionProvider

                  MessageUtils.CANT_INSTANTIATE_CLASS_ERROR_MESSAGE_ID,
                  clazz.getName())), t);
        }

        if (map.hasAnnotations(key)) {
            InjectionProvider injectionProvider = associate.getInjectionProvider();
            try {
                injectionProvider.invokePostConstruct(result);
            } catch (InjectionProviderException ex) {
               LOGGER.log(Level.SEVERE, "Unable to invoke @PostConstruct annotated method on instance " + key, ex);
               throw new FacesException(ex);
            }

            try {
                injectionProvider.inject(result);
            } catch (InjectionProviderException ex) {
               LOGGER.log(Level.SEVERE, "Unable to inject instance" + key, ex);
               throw new FacesException(ex);
            }
        }
View Full Code Here

Examples of org.apache.myfaces.spi.InjectionProvider

    }

    @Override
    public InjectionProvider getInjectionProvider(ExternalContext externalContext)
    {
        InjectionProvider lifecycleProvider = null;
        if (externalContext == null)
        {
            // Really in jsf 2.0, this will not happen, because a Startup/Shutdown
            // FacesContext and ExternalContext are provided on initialization and shutdown,
            // and in other scenarios the real FacesContext/ExternalContext is provided.
            log.info("No ExternalContext using fallback InjectionProvider.");
            lifecycleProvider = resolveFallbackInjectionProvider();
        }
        else
        {
            lifecycleProvider = (InjectionProvider)
                    externalContext.getApplicationMap().get(INJECTION_PROVIDER_INSTANCE_KEY);
        }
        if (lifecycleProvider == null)
        {
            if (!resolveInjectionProviderFromExternalContext(externalContext))
            {
                if (!resolveInjectionProviderFromService(externalContext))
                {
                    lifecycleProvider = resolveFallbackInjectionProvider();
                    externalContext.getApplicationMap().put(INJECTION_PROVIDER_INSTANCE_KEY, lifecycleProvider);
                }
                else
                {
                    //Retrieve it because it was resolved
                    lifecycleProvider = (InjectionProvider)
                            externalContext.getApplicationMap().get(INJECTION_PROVIDER_INSTANCE_KEY);
                }
            }
            else
            {
                //Retrieve it because it was resolved
                lifecycleProvider = (InjectionProvider)
                        externalContext.getApplicationMap().get(INJECTION_PROVIDER_INSTANCE_KEY);
            }
            log.info("Using InjectionProvider "+ lifecycleProvider.getClass().getName());
        }
        return lifecycleProvider;
    }
View Full Code Here

Examples of org.apache.myfaces.spi.InjectionProvider

                                {
                                    String className = iter.next();
                                    Object obj = createClass(className,extContext);
                                    if (InjectionProvider.class.isAssignableFrom(obj.getClass()))
                                    {
                                        InjectionProvider discoverableInjectionProvider =
                                                (InjectionProvider) obj;
                                        if (discoverableInjectionProvider.isAvailable())
                                        {
                                            extContext.getApplicationMap().put(INJECTION_PROVIDER_INSTANCE_KEY,
                                                                               discoverableInjectionProvider);
                                            return true;
                                        }
                                    }
                                }
                                return false;
                            }
                        });
            }
            else
            {
                List<String> classList = ServiceProviderFinderFactory.getServiceProviderFinder(extContext).
                        getServiceProviderList(INJECTION_PROVIDER);
                Iterator<String> iter = classList.iterator();
                while (iter.hasNext())
                {
                    String className = iter.next();
                    Object obj = createClass(className,extContext);
                    if (InjectionProvider.class.isAssignableFrom(obj.getClass()))
                    {
                        InjectionProvider discoverableInjectionProvider
                                = (InjectionProvider) obj;
                        if (discoverableInjectionProvider.isAvailable())
                        {
                            extContext.getApplicationMap().put(INJECTION_PROVIDER_INSTANCE_KEY,
                                                               discoverableInjectionProvider);
                            return (Boolean) true;
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.