Package org.springframework.beans

Examples of org.springframework.beans.MutablePropertyValues


        beanFactory.getBean(MunitMessageProcessorInterceptorFactory.ID);
        if (configuration != null) {
            RootBeanDefinition beanDefinition = new RootBeanDefinition();
            beanDefinition.setBeanClass(MunitSpringFactoryPostProcessor.class);
            MutablePropertyValues propertyValues = new MutablePropertyValues();
            propertyValues.add(MOCK_INBOUNDS_PROPERTY_NAME, configuration.isMockInbounds());
            propertyValues.add(MOCK_CONNECTORS_PROPERTY_NAME, configuration.isMockConnectors());
            propertyValues.add(MOCKING_EXCLUDED_FLOWS_PROPERTY_NAME, configuration.getMockingExcludedFlows());
            beanDefinition.setPropertyValues(propertyValues);
            beanFactory.registerBeanDefinition(MUNIT_FACTORY_POST_PROCESSOR, beanDefinition);
        }
        // Communicate mule context to parsers
View Full Code Here


    @Override
    protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
        super.prepareBeanFactory(beanFactory);
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition(MUNIT_FACTORY_POST_PROCESSOR);
        MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
        MunitApplicationContextPostProcessor postProcessor = new MunitApplicationContextPostProcessor();
        postProcessor.setMockConnectors((Boolean) propertyValues.getPropertyValue("mockConnectors").getValue());
        postProcessor.setMockInbounds((Boolean) propertyValues.getPropertyValue("mockInbounds").getValue());
        postProcessor.setMockingExcludedFlows((List) propertyValues.getPropertyValue("mockingExcludedFlows").getValue());
        postProcessor.postProcessBeanFactory(beanFactory);

    }
View Full Code Here

    private static class WsdlDefinitionWebApplicationContext extends StaticWebApplicationContext {

        @Override
        public void refresh() throws BeansException, IllegalStateException {
            MutablePropertyValues mpv = new MutablePropertyValues();
            mpv.addPropertyValue("wsdl", new ClassPathResource("wsdl11-input.wsdl", getClass()));
            registerSingleton("definition", SimpleWsdl11Definition.class, mpv);
            super.refresh();
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory)  {
        if (configurableListableBeanFactory.containsBean(sessionFactoryBeanName)) {
            BeanDefinition sessionFactoryBeanDefinition =
                    configurableListableBeanFactory.getBeanDefinition(sessionFactoryBeanName);
            MutablePropertyValues propertyValues = sessionFactoryBeanDefinition.getPropertyValues();

            if (mappingResources != null) {
                // do we have existing resourses?
                PropertyValue propertyValue = propertyValues.getPropertyValue("mappingResources");

                if (propertyValue == null) {
                    propertyValue = new PropertyValue("mappingResources", new ArrayList());
                    propertyValues.addPropertyValue(propertyValue);
                }

                // value is expected to be a list.
                List existingMappingResources = (List) propertyValue.getValue();
                existingMappingResources.addAll(mappingResources);
            }

            if (annotatedClasses != null) {
                // do we have existing resources?
                PropertyValue propertyValue = propertyValues.getPropertyValue("annotatedClasses");

                if (propertyValue == null) {
                    propertyValue = new PropertyValue("annotatedClasses", new ArrayList());
                    propertyValues.addPropertyValue(propertyValue);
                }

                // value is expected to be a list.
                List existingMappingResources = (List) propertyValue.getValue();
                existingMappingResources.addAll(annotatedClasses);
            }

            if (configLocations != null) {
                PropertyValue propertyValue = propertyValues.getPropertyValue("configLocations");
                if (propertyValue == null) {
                    propertyValue = new PropertyValue("configLocations", new ArrayList());
                    propertyValues.addPropertyValue(propertyValue);
                }
                List existingConfigLocations = (List) propertyValue.getValue();
                existingConfigLocations.addAll(configLocations);
            }

            if (hibernateProperties != null) {
                PropertyValue propertyValue = propertyValues.getPropertyValue("hibernateProperties");
                if (propertyValue == null) {
                    propertyValue = new PropertyValue("hibernateProperties", new Properties());
                    propertyValues.addPropertyValue(propertyValue);
                }
                Properties existingHibernateProperties = (Properties) propertyValue.getValue();
                existingHibernateProperties.putAll(hibernateProperties);
            }
        } else {
View Full Code Here

        String pathPrefix = element.getAttribute(PATH_PREFIX_ATTR);

        GenericBeanDefinition definition = new GenericBeanDefinition();
        definition.setBeanClass(GwtServiceBeanFactoryPostProcessor.class);

        MutablePropertyValues propertyValues = new MutablePropertyValues();
        propertyValues.addPropertyValue("pathPrefix", new TypedStringValue(pathPrefix));

        Element mappingsElement = DomUtils.getChildElementByTagName(element, UNEXPECTED_EXCEPTION_MAPPTINS_DEF);

        if (mappingsElement != null) {

            ManagedList<RootBeanDefinition> mappingList = new ManagedList<RootBeanDefinition>();
            for (Element mappingElement : DomUtils.getChildElementsByTagName(mappingsElement, MAPPING_DEF)) {
                BeanDefinitionBuilder mappingBuilder = BeanDefinitionBuilder.rootBeanDefinition(UnexpectedExceptionMapping.class);
                String throwableClassName = mappingElement.getAttribute(THROWABLE_CLASS_ATTR);
                String statusCode = mappingElement.getAttribute(STATUS_CODE_ATTR);
                String message = mappingElement.getAttribute(MESSAGE_ATTR);
                mappingBuilder.addConstructorArgValue(throwableClassName);
                mappingBuilder.addConstructorArgValue(statusCode);
                mappingBuilder.addConstructorArgValue(message);
                mappingList.add((RootBeanDefinition) mappingBuilder.getBeanDefinition());
            }

            BeanDefinitionBuilder mappingsBuilder = BeanDefinitionBuilder.rootBeanDefinition(UnexpectedExceptionMappings.class);
            mappingsBuilder.addConstructorArgValue(mappingList);
            RootBeanDefinition mappingsBeanDefinition = (RootBeanDefinition) mappingsBuilder.getBeanDefinition();
            String id = parserContext.getReaderContext().registerWithGeneratedName(mappingsBeanDefinition);

            logger.info("Registered UnexpectedExceptionMappgins bean with id '" + id + "'");

            propertyValues.addPropertyValue("unexpectedExceptionMappingsBeanName", new TypedStringValue(id));

        }

        definition.setPropertyValues(propertyValues);
View Full Code Here

        }

        GenericBeanDefinition mapperDef = new GenericBeanDefinition();
        mapperDef.setBeanClass(SimpleUrlHandlerMapping.class);
        MutablePropertyValues propertyValues = new MutablePropertyValues();
        propertyValues.addPropertyValue("mappings", new TypedStringValue(sb.toString()));
        mapperDef.setPropertyValues(propertyValues);
        ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition("__urlMapper", mapperDef);


        for (String name : names) {
            GenericBeanDefinition definition = new GenericBeanDefinition();
            definition.setBeanClass(GwtRpcController.class);

            propertyValues = new MutablePropertyValues();
            propertyValues.addPropertyValue("remoteService", new RuntimeBeanReference(name));
            if (unexpectedExceptionMappingsBeanName != null) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Registering unexpected exception mappings on controler: " + name + "Controller");
                }
                propertyValues.addPropertyValue("unexpectedExceptionMappings", new RuntimeBeanReference(unexpectedExceptionMappingsBeanName));
            }
            definition.setPropertyValues(propertyValues);

            if (logger.isDebugEnabled()) {
                logger.debug("Registering controller: " + name + "Controller");
View Full Code Here

        descriptorProperty.setAttribute("ref", "installationDescriptorExtension");

        // lets find all elements which are not in the JBI namespace
        Map propertiesMap = new HashMap();
        propertiesMap.put("descriptorExtension", fragment);
        RootBeanDefinition definition = new RootBeanDefinition(InstallationDescriptorExtension.class, new MutablePropertyValues(propertiesMap));
        beanDefinitionReader.getBeanFactory().registerBeanDefinition("installationDescriptorExtension", definition);

        super.processElement(element, beanDefinitionReader);
    }
View Full Code Here

      RootBeanDefinition proxyDefinition = new RootBeanDefinition();
      // create proxy factory bean definitionHolder
      proxyDefinition.setBeanClass(ProxyFactoryBean.class);

      // set up property values
      MutablePropertyValues mpvs = new MutablePropertyValues();
      proxyDefinition.setPropertyValues(mpvs);

      // set the target
      mpvs.addPropertyValue("target", existingDefinition);

      // create the interceptor names list
      ManagedList interceptorList = new ManagedList();
      mpvs.addPropertyValue("interceptorNames", interceptorList);

      result = new BeanDefinitionHolder(proxyDefinition, existingBeanName);
    }

    addInterceptorNameToList(interceptorName, result.getBeanDefinition());
View Full Code Here

    assertEquals("name4", bw.getPropertyValue("map[key1].name"));
    assertEquals("name5", bw.getPropertyValue("map[key2].name"));
    assertEquals("name4", bw.getPropertyValue("map['key1'].name"));
    assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("array[0].name", "name5");
    pvs.addPropertyValue("array[1].name", "name4");
    pvs.addPropertyValue("list[0].name", "name3");
    pvs.addPropertyValue("list[1].name", "name2");
    pvs.addPropertyValue("map[key1].name", "name1");
    pvs.addPropertyValue("map['key2'].name", "name0");
    bw.setPropertyValues(pvs);
    assertEquals("arrayname5", tb0.getName());
    assertEquals("arrayname4", tb1.getName());
    assertEquals("listname3", tb2.getName());
    assertEquals("listname2", tb3.getName());
View Full Code Here

    assertEquals("name4", bw.getPropertyValue("map[key1].name"));
    assertEquals("name5", bw.getPropertyValue("map[key2].name"));
    assertEquals("name4", bw.getPropertyValue("map['key1'].name"));
    assertEquals("name5", bw.getPropertyValue("map[\"key2\"].name"));

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("array[0].name", "name5");
    pvs.addPropertyValue("array[1].name", "name4");
    pvs.addPropertyValue("list[0].name", "name3");
    pvs.addPropertyValue("list[1].name", "name2");
    pvs.addPropertyValue("map[key1].name", "name1");
    pvs.addPropertyValue("map['key2'].name", "name0");
    bw.setPropertyValues(pvs);
    assertEquals("array0name5", tb0.getName());
    assertEquals("array1name4", tb1.getName());
    assertEquals("list0name3", tb2.getName());
    assertEquals("list1name2", tb3.getName());
View Full Code Here

TOP

Related Classes of org.springframework.beans.MutablePropertyValues

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.