Package org.apache.myfaces.config.element

Examples of org.apache.myfaces.config.element.ManagedBean


        Map<String, ManagedBean> oldManagedBeans = runtimeConfig.getManagedBeansNotReaddedAfterPurge();
        if (oldManagedBeans != null)
        {
            for (Map.Entry<String, ManagedBean> entry : oldManagedBeans.entrySet())
            {
                ManagedBean bean = entry.getValue();

                String scope = bean.getManagedBeanScope();

                if (scope != null && scope.equalsIgnoreCase("session"))
                {
                    _externalContext.getSessionMap().remove(entry.getKey());
                }
View Full Code Here


        if (ectx == null || ectx.getRequestMap().containsKey(property) || ectx.getSessionMap().containsKey(property)
                || ectx.getApplicationMap().containsKey(property))
            return null;

        ManagedBean managedBean = runtimeConfig(ctx).getManagedBean((String)property);

        return managedBean == null ? null : getValue(ctx, ectx, managedBean.getManagedBeanClass());
    }
View Full Code Here

            return VIEW;
        }

        //not found - check mangaged bean config

        ManagedBean mbc = getRuntimeConfig(facesContext).getManagedBean(beanName);

        if (mbc != null)
        {
            // managed-bean-scope could be a EL ValueExpression (since 2.0)
            if (mbc.isManagedBeanScopeValueExpression())
            {  
                // the scope is a custom scope
                // Spec says, that the developer has to take care about the references
                // to and from managed-beans in custom scopes.
                // However, we do check the references, if we are not in Production stage
                if (facesContext.isProjectStage(ProjectStage.Production))
                {
                    return null;
                }
                else
                {
                    return getNarrowestScope(facesContext,
                                             mbc.getManagedBeanScopeValueExpression(facesContext)
                                                 .getExpressionString());
                }
            }
            else
            {
                return mbc.getManagedBeanScope();
            }
        }

        return null;
    }
View Full Code Here

        Map<String, ManagedBean> oldManagedBeans = runtimeConfig.getManagedBeansNotReaddedAfterPurge();
        if (oldManagedBeans != null)
        {
            for (Map.Entry<String, ManagedBean> entry : oldManagedBeans.entrySet())
            {
                ManagedBean bean = entry.getValue();

                String scope = bean.getManagedBeanScope();

                if (scope != null && scope.equalsIgnoreCase("session"))
                {
                    _externalContext.getSessionMap().remove(entry.getKey());
                }
View Full Code Here

        Map<String, ManagedBean> oldManagedBeans = runtimeConfig.getManagedBeansNotReaddedAfterPurge();
        if (oldManagedBeans != null)
        {
            for (Map.Entry<String, ManagedBean> entry : oldManagedBeans.entrySet())
            {
                ManagedBean bean = entry.getValue();

                String scope = bean.getManagedBeanScope();

                if (scope != null && scope.equalsIgnoreCase("session"))
                {
                    _externalContext.getSessionMap().remove(entry.getKey());
                }
View Full Code Here

        {
            return VIEW;
        }

        //not found - check mangaged bean config
        ManagedBean mbc = getRuntimeConfig(facesContext).getManagedBean(beanName);
        if (mbc != null)
        {
            // managed-bean-scope could be a EL ValueExpression (since 2.0)
            if (mbc.isManagedBeanScopeValueExpression())
            {  
                // the scope is a custom scope
                // Spec says, that the developer has to take care about the references
                // to and from managed-beans in custom scopes.
                // However, we do check the references, if we are not in Production stage
                if (facesContext.isProjectStage(ProjectStage.Production))
                {
                    return null;
                }
                else
                {
                    String scopeExpression = mbc.getManagedBeanScopeValueExpression(facesContext).getExpressionString();
                    return getNarrowestScope(facesContext, scopeExpression);
                }
            }
            else
            {
                return mbc.getManagedBeanScope();
            }
        }

        return null;
    }
View Full Code Here

        Map<String, ManagedBean> oldManagedBeans = runtimeConfig.getManagedBeansNotReaddedAfterPurge();
        if (oldManagedBeans != null)
        {
            for (Map.Entry<String, ManagedBean> entry : oldManagedBeans.entrySet())
            {
                ManagedBean bean = entry.getValue();

                String scope = bean.getManagedBeanScope();

                if (scope != null && scope.equalsIgnoreCase("session"))
                {
                    _externalContext.getSessionMap().remove(entry.getKey());
                }
View Full Code Here

        {
            return null;
        }
        final String strProperty = (String) property;

        final ManagedBean managedBean = runtimeConfig(context).getManagedBean(strProperty);
        Object beanInstance = null;
        if (managedBean != null)
        {
            context.setPropertyResolved(true);
           
            // managed-bean-scope could be a ValueExpression pointing to a Map (since 2.0) --> custom scope
            if (managedBean.isManagedBeanScopeValueExpression())
            {
                // check for cyclic references in custom scopes, if we are not in Production stage
                boolean checkCyclicReferences = !facesContext.isProjectStage(ProjectStage.Production);
                List<String> cyclicReferences = null;
               
                if (checkCyclicReferences)
                {
                    final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
                    final String managedBeanName = managedBean.getManagedBeanName();
                   
                    cyclicReferences = (List<String>) requestMap.get(CUSTOM_SCOPE_CYCLIC_REFERENCE_DETECTION);
                    if (cyclicReferences == null)
                    {
                        cyclicReferences = new ArrayList<String>();
                        requestMap.put(CUSTOM_SCOPE_CYCLIC_REFERENCE_DETECTION, cyclicReferences);
                    }
                    else if (cyclicReferences.contains(managedBeanName))
                    {
                        throw new ELException("Detected cyclic reference to managedBean " + managedBeanName);
                    }

                    cyclicReferences.add(managedBeanName);
                }
                try
                {
                    Object customScope = managedBean.getManagedBeanScopeValueExpression(facesContext)
                                                .getValue(facesContext.getELContext());
                    if (customScope instanceof Map)
                    {
                        beanInstance = ((Map) customScope).get(managedBean.getManagedBeanName());
                    }
                    else if (customScope != null)
                    {
                        throw new FacesException("The expression '" + managedBean.getManagedBeanScope() +
                                "' does not evaluate to java.util.Map. It evaluates to '" + customScope +
                                "' of type " + customScope.getClass().getName());
                    }
                    else
                    {
                        log.warning("Custom scope '" + managedBean.getManagedBeanScope() +
                                "' evaluated to null. Unable to determine if managed bean '" +
                                managedBean.getManagedBeanName() + "' exists.");
                    }
                }
                finally
                {
                    if (checkCyclicReferences)
                    {
                        cyclicReferences.remove(managedBean.getManagedBeanName());
                    }
                }
            }

            // not found in any scope - create instance!
View Full Code Here

                || ectx.getApplicationMap().containsKey(property))
        {
            return null;
        }

        ManagedBean managedBean = runtimeConfig(ctx).getManagedBean((String)property);

        return managedBean == null ? null : getValue(ctx, ectx, managedBean.getManagedBeanClass());
    }
View Full Code Here

        {
            return VIEW;
        }

        //not found - check mangaged bean config
        ManagedBean mbc = getRuntimeConfig(facesContext).getManagedBean(beanName);
        if (mbc != null)
        {
            // managed-bean-scope could be a EL ValueExpression (since 2.0)
            if (mbc.isManagedBeanScopeValueExpression())
            {  
                // the scope is a custom scope
                // Spec says, that the developer has to take care about the references
                // to and from managed-beans in custom scopes.
                // However, we do check the references, if we are not in Production stage
                if (facesContext.isProjectStage(ProjectStage.Production))
                {
                    return null;
                }
                else
                {
                    String scopeExpression = mbc.getManagedBeanScopeValueExpression(facesContext).getExpressionString();
                    return getNarrowestScope(facesContext, scopeExpression);
                }
            }
            else
            {
                return mbc.getManagedBeanScope();
            }
        }

        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.config.element.ManagedBean

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.