Package com.sun.faces.mgbean

Examples of com.sun.faces.mgbean.BeanManager


                                                   "session",
                                                   null,
                                                   null,
                                                   null,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);
        BeanBuilder builder = beanManager.getBuilder(beanName);
        Boolean isInjectable = (Boolean) TestingUtil.invokePrivateMethod("scanForAnnotations",
                                                                         new Class[] { Class.class },
                                                                         new Object[] { TestBean.class },
                                                                         BeanBuilder.class,
                                                                         builder);
        assertTrue(!isInjectable);

        bean = new ManagedBeanInfo(beanName,
                                   "com.sun.faces.config.TestManagedBeanFactory$InjectionBean",
                                   "request",
                                   null,
                                   null,
                                   null,
                                   null);
        beanManager.register(bean);

        isInjectable = (Boolean) TestingUtil.invokePrivateMethod("scanForAnnotations",
                                                                 new Class[] { Class.class },
                                                                 new Object[] { InjectionBean.class },
                                                                 BeanBuilder.class,
View Full Code Here


                                                   "request",
                                                   null,
                                                   null,
                                                   properties,
                                                   null);
        BeanManager beanManager =
             ApplicationAssociate.getCurrentInstance().getBeanManager();
        beanManager.register(bean);
        testBean = (TestBean) beanManager.create(beanName, getFacesContext());
        assertTrue("this is a String", "this is a String".equals(testBean.getModelLabel()));
       
    }
View Full Code Here

        ApplicationFactory aFactory = (ApplicationFactory) FactoryFinder.getFactory(
            FactoryFinder.APPLICATION_FACTORY);
        ApplicationImpl application = (ApplicationImpl) aFactory.getApplication();
        ApplicationAssociate associate = ApplicationAssociate.getCurrentInstance();
        BeanManager manager = associate.getBeanManager();
        manager.register(beanInfo);

        VariableResolver variableResolver = application.getVariableResolver();

        Object result = variableResolver.resolveVariable(getFacesContext(),
                                                         beanName);
View Full Code Here

                                      ELUtils.Scope scope) {

        ApplicationAssociate associate = getAssociate();
        try {
            if (associate != null) {
                BeanManager beanManager = associate.getBeanManager();
                if (beanManager != null && beanManager.isManaged(beanName)) {
                    beanManager.destroy(beanName, bean);
                }             
            }
        } catch (Exception e) {
            String className = e.getClass().getName();
            String message = e.getMessage();           
View Full Code Here

            if (session != null) {
                ApplicationAssociate associate = getAssociate();
                if (associate == null) {
                    return;
                }
                BeanManager manager = associate.getBeanManager();
                if (manager != null) {
                    for (Enumeration e = session.getAttributeNames();
                         e.hasMoreElements();) {
                        String name = (String) e.nextElement();
                        if (manager.isManaged(name)) {
                            session
                                  .setAttribute(name, session.getAttribute(name));
                        }
                    }
                }
View Full Code Here

        // If the attribute refers to an entity handled by the BeanManager
        // try getting the value from there as the value may be in a custom
        // scope.
        ApplicationAssociate associate = ApplicationAssociate.getCurrentInstance();
        if (associate != null) {
            BeanManager manager = associate.getBeanManager();
            if (manager != null) {
                if (manager.isManaged(attribute)) {
                    return manager.getBeanFromScope(attribute, facesContext);
                }
            }
        }

        return null;
View Full Code Here

        if (null == valueScope) {
            // Perhaps the bean hasn't been created yet.  See what its
            // scope would be when it is created.
            if (firstSegment[0] != null) {
                BeanManager manager =
                     ApplicationAssociate.getCurrentInstance().getBeanManager();

                if (manager.isManaged(firstSegment[0])) {
                    valueScope = ELUtils.getScope(manager.getBuilder(firstSegment[0]).getScope());
                }
            } else {
                // we are referring to a bean that doesn't exist in the
                // configuration file.  Give it a wide scope...
                valueScope = Scope.APPLICATION;
View Full Code Here

            initContext.setELContext(elctx);
            ApplicationAssociate associate =
                    ApplicationAssociate.getInstance(context);
            if (associate != null) {
                associate.setContextName(getServletContextIdentifier(context));
                BeanManager manager = associate.getBeanManager();
                List<String> eagerBeans = manager.getEagerBeanNames();
                if (!eagerBeans.isEmpty()) {
                    for (String name : eagerBeans) {
                        manager.create(name, initContext);
                    }
                }
                boolean isErrorPagePresent = webXmlProcessor.isErrorPagePresent();
                associate.setErrorPagePresent(isErrorPagePresent);
                context.setAttribute(RIConstants.ERROR_PAGE_PRESENT_KEY_NAME,
View Full Code Here

                    session.invalidate();
                }
            }
            ApplicationAssociate associate = ApplicationAssociate.getInstance(sc);
            if (associate != null) {
                BeanManager manager = associate.getBeanManager();
                for (Map.Entry<String, BeanBuilder> entry : manager.getRegisteredBeans().entrySet()) {
                    String name = entry.getKey();
                    BeanBuilder bean = entry.getValue();
                    if (ELUtils.Scope.APPLICATION.toString().equals(bean.getScope())) {
                        if (LOGGER.isLoggable(Level.INFO)) {
                            LOGGER.log(Level.INFO,
View Full Code Here

                                      ELUtils.Scope scope) {

        ApplicationAssociate associate = getAssociate();
        try {
            if (associate != null) {
                BeanManager beanManager = associate.getBeanManager();
                if (beanManager != null && beanManager.isManaged(beanName)) {
                    beanManager.destroy(beanName, bean);
                }             
            }
        } catch (Exception e) {
            String className = e.getClass().getName();
            String message = e.getMessage();           
View Full Code Here

TOP

Related Classes of com.sun.faces.mgbean.BeanManager

Copyright © 2018 www.massapicom. 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.