Examples of AbstractBeanDefinition


Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

            }
        }

        private void handleLoginModule(final org.w3c.dom.Node node, List list) {
            final BeanDefinitionBuilder lmConfigBuilder = createBeanBuilder(LoginModuleConfig.class);
            final AbstractBeanDefinition beanDefinition = lmConfigBuilder.getBeanDefinition();
            fillAttributeValues(node, lmConfigBuilder);
            for (org.w3c.dom.Node child : new IterableNodeList(node.getChildNodes())) {
                final String nodeName = cleanNodeName(child.getNodeName());
                if ("properties".equals(nodeName)) {
                    handleProperties(child, lmConfigBuilder);
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

            list.add(beanDefinition);
        }

        private void handlePermissionPolicy(final Node node, final BeanDefinitionBuilder securityConfigBuilder) {
            final BeanDefinitionBuilder permPolicyConfigBuilder = createBeanBuilder(PermissionPolicyConfig.class);
            final AbstractBeanDefinition beanDefinition = permPolicyConfigBuilder.getBeanDefinition();
            final NamedNodeMap attrs = node.getAttributes();
            Node classNameNode = attrs.getNamedItem("class-name");
            String className = classNameNode != null ? getTextContent(classNameNode) : null;
            Node implNode = attrs.getNamedItem("implementation");
            String implementation = implNode != null ? getTextContent(implNode) : null;
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

            securityConfigBuilder.addPropertyValue("clientPermissionConfigs", permissions);
        }

        private void handleSecurityPermission(final Node node, final Set permissions, PermissionType type) {
            final BeanDefinitionBuilder permissionConfigBuilder = createBeanBuilder(PermissionConfig.class);
            final AbstractBeanDefinition beanDefinition = permissionConfigBuilder.getBeanDefinition();
            permissionConfigBuilder.addPropertyValue("type", type);
            final NamedNodeMap attrs = node.getAttributes();
            Node nameNode = attrs.getNamedItem("name");
            String name = nameNode != null ? getTextContent(nameNode) : "*";
            permissionConfigBuilder.addPropertyValue("name", name);
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

            handleCommonBeanAttributes(element, builder, parserContext);
            for (org.w3c.dom.Node node : new IterableNodeList(element, Node.ELEMENT_NODE)) {
                final String nodeName = cleanNodeName(node.getNodeName());
                if ("config".equals(nodeName)) {
                    final HazelcastConfigBeanDefinitionParser configParser = new HazelcastConfigBeanDefinitionParser();
                    final AbstractBeanDefinition configBeanDef = configParser
                            .parseInternal((Element) node, parserContext);
                    this.builder.addConstructorArgValue(configBeanDef);
                }
            }
        }
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

  public static final String INTERFACE_ATTRIBUTE = "interface";

  @Override
  protected AbstractBeanDefinition parseInternal(Element element,
      ParserContext parserContext) {   
    AbstractBeanDefinition beanDefinition = parserContext.getDelegate()
      .parseBeanDefinitionElement(element, null, null);
    Class<?>[] interfaces = null;
    if(beanDefinition.getBeanClassName() != null){
      //with CLASS_ATTRIBUTE
      interfaces = beanDefinition.getBeanClass().getInterfaces();
     
      if(! GenericEntityDao.class.isAssignableFrom(beanDefinition.getBeanClass()))
        throw new BeanCreationException("{} is not a valid GenericEntityDao bean.", element.getAttribute(ID_ATTRIBUTE));
     
      //override abstract method
      Method[] methods = beanDefinition.getBeanClass().getMethods();
      for (Method method : methods) {
        if (Modifier.isAbstract(method.getModifiers())) {
          beanDefinition.getMethodOverrides().addOverride(
              new ReplaceOverride(method.getName(), null));
        }
      }
    }else if(element.hasAttribute(INTERFACE_ATTRIBUTE)){
        try {
          Class<?> iClazz = ClassUtils.forName(element.getAttribute(INTERFACE_ATTRIBUTE), getClass().getClassLoader());       
          interfaces = new Class<?>[]{iClazz, ModelClassSupport.class};
         
          if (GenericEntityDao.class.isAssignableFrom(iClazz)) {
            beanDefinition = new RootBeanDefinition(SimpleModelClassSupport.class);
            beanDefinition.getPropertyValues().addPropertyValue("modelClass",getGenericModelClass(iClazz));
          }else{
            throw new BeanCreationException("{} is not a valid GenericEntityDao Interface.", element.getAttribute(ID_ATTRIBUTE));
          }
        } catch (ClassNotFoundException e) {
          e.printStackTrace();
          throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
        } catch (LinkageError e) {
          e.printStackTrace();
          throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
        }
    }else{
      throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
    }
   
    AbstractBeanDefinition rootDefinition = new GenericBeanDefinition();
    rootDefinition.setParentName("parentGenericDaoProxy");
    rootDefinition.getPropertyValues().addPropertyValue("proxyInterfaces",interfaces);
    rootDefinition.getPropertyValues().addPropertyValue("target",beanDefinition);   
    //rootDefinition.getPropertyValues().addPropertyValue("interceptorNames", new String[]{"queryInterceptor"});
    return rootDefinition;
  }
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

    try {
      String className = bean.getBeanClassName();
      Class<?> clazz = Class.forName(bean.getBeanClassName());
      Class<?>[] interfaces;
      String beanName = getBeanName(clazz);
      AbstractBeanDefinition targetBean;     
      if(clazz.isInterface()){
        logger.debug("Add Interface '{}' to '{}'.", className, beanName)
        Class<?> targetType = getGenericModelClass(clazz);
        if(targetType == null) throw new BeanCreationException("{} is not a valid GenericEntityDao bean.", beanName);
       
        targetBean = new RootBeanDefinition(SimpleModelClassSupport.class);
        targetBean.getPropertyValues().addPropertyValue("modelClass",targetType);
        interfaces = new Class<?>[]{clazz, ModelClassSupport.class};
      }else{
        logger.debug("Add Class '{}' to '{}'.", className, beanName);
        targetBean = new RootBeanDefinition(clazz);
        interfaces = clazz.getInterfaces();
        Method[] methods = targetBean.getBeanClass().getMethods();
        for (Method method : methods) {
          if (Modifier.isAbstract(method.getModifiers())) {
            targetBean.getMethodOverrides().addOverride(
                new ReplaceOverride(method.getName(), null));
          }
        }
      }     
      //bean.setAttribute(ID_ATTRIBUTE, beanName);
      AbstractBeanDefinition rootDefinition = new GenericBeanDefinition();
      rootDefinition.setParentName("parentGenericDaoProxy");
      rootDefinition.getPropertyValues().addPropertyValue("proxyInterfaces",interfaces);
      rootDefinition.getPropertyValues().addPropertyValue("target",targetBean)
     
      BeanComponentDefinition definition =
                new BeanComponentDefinition(rootDefinition, beanName);
      parserContext.registerBeanComponent(definition);
    } catch (ClassNotFoundException e) {
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

    public void setProperty(String property, Object newValue) {
        if(PARENT.equals(property)) {
            setParent(newValue);
        }
        else {
            AbstractBeanDefinition bd = getBeanDefinition();
            if(AUTOWIRE.equals(property)) {
                if(BY_NAME.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
                }
                else if(BY_TYPE.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE);
                }
                else if(Boolean.TRUE.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
                }
                else if(BY_CONSTRUCTOR.equals(newValue)) {
                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR);
                }
            }
            // constructorArgs
            else if(CONSTRUCTOR_ARGS.equals(property) && newValue instanceof List) {
                ConstructorArgumentValues cav = new ConstructorArgumentValues();
                List args = (List)newValue;
                for (Object e : args) {
                    cav.addGenericArgumentValue(e);
                }
                bd.setConstructorArgumentValues(cav);
            }
            // destroyMethod
            else if(DESTROY_METHOD.equals(property)) {
                if(newValue != null)
                    bd.setDestroyMethodName(newValue.toString());
            }
            // factoryBean
            else if(FACTORY_BEAN.equals(property)) {
                if(newValue != null)
                    bd.setFactoryBeanName(newValue.toString());
            }
            // factoryMethod
            else if(FACTORY_METHOD.equals(property)) {
                if(newValue != null)
                    bd.setFactoryMethodName(newValue.toString());
            }
            // initMethod
            else if(INIT_METHOD.equals(property)) {
                if(newValue != null)
                    bd.setInitMethodName(newValue.toString());
            }
            else if(wrapper.isWritableProperty(property)) {

                wrapper.setPropertyValue(property, newValue);
            }
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

      definition = createBeanDefinition();
    return definition;
  }

  protected AbstractBeanDefinition createBeanDefinition() {
    AbstractBeanDefinition bd;
    if(constructorArgs.size() > 0) {
      ConstructorArgumentValues cav = new ConstructorArgumentValues();
            for (Object constructorArg : constructorArgs) {
                cav.addGenericArgumentValue(constructorArg);
            }
            if(StringUtils.isBlank(parentName)) {
                bd = new RootBeanDefinition(clazz,cav,null);
            }
            else {
                bd = new ChildBeanDefinition(parentName,clazz,cav, null);
            }
            bd.setSingleton(singleton);
    }
    else {
            if(StringUtils.isBlank(parentName)) {
                bd = new RootBeanDefinition(clazz,singleton);
            }
            else {
                bd = new ChildBeanDefinition(parentName,clazz, null,null);
                bd.setSingleton(singleton);
            }

    }
    wrapper = new BeanWrapperImpl(bd);
    return bd;
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

     */
    private void changeEndpointFactory(ConfigurableListableBeanFactory beanFactory)
    {
        GenericBeanDefinition endpointFactory = (GenericBeanDefinition) beanFactory.getBeanDefinition(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY);

        AbstractBeanDefinition abstractBeanDefinition = endpointFactory.cloneBeanDefinition();

        MutablePropertyValues propertyValues = new MutablePropertyValues();
        propertyValues.add("defaultFactory", abstractBeanDefinition);
        endpointFactory.setPropertyValues(propertyValues);
        endpointFactory.setBeanClassName(MockEndpointManager.class.getCanonicalName());
View Full Code Here

Examples of org.springframework.beans.factory.support.AbstractBeanDefinition

  }

  private void registerProcessScope(Element element, ParserContext parserContext) {
    Class clz = ProcessScope.class;
    BeanDefinitionBuilder processScopeBDBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz);
    AbstractBeanDefinition scopeBeanDefinition = processScopeBDBuilder.getBeanDefinition();
    scopeBeanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
    configureProcessEngine(scopeBeanDefinition, element);
    String beanName = baseBeanName(clz);
    parserContext.getRegistry().registerBeanDefinition(beanName, scopeBeanDefinition);
  }
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.