Examples of RootBeanDefinition


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

        }
        return clazz;
    }
   
    private void createAndRegisterBean(BeanDefinitionRegistry registry, Class clazz, Bean bean) {
        RootBeanDefinition rbd = new RootBeanDefinition();
        rbd.setAbstract(false);
        rbd.setBeanClass(clazz);
        rbd.setLazyInit(bean.lazy());
        if (bean.initMethod().length() > 0) rbd.setInitMethodName(bean.initMethod());
        if (bean.destroyMethod().length() > 0) rbd.setDestroyMethodName(bean.destroyMethod());
        rbd.setAutowireCandidate(true);
        rbd.setScope(bean.scope().getScopeName());
        if (log.isInfoEnabled()) log.info("Registering.." + rbd);
        registry.registerBeanDefinition(bean.name(), rbd);
    }
View Full Code Here

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

        }
        return clazz;
    }
   
    private void createAndRegisterBean(BeanDefinitionRegistry registry, Class clazz, Bean bean) {
        RootBeanDefinition rbd = new RootBeanDefinition();
        rbd.setAbstract(false);
        rbd.setBeanClass(clazz);
        rbd.setLazyInit(bean.lazy());
        if (bean.initMethod().length() > 0) rbd.setInitMethodName(bean.initMethod());
        if (bean.destroyMethod().length() > 0) rbd.setDestroyMethodName(bean.destroyMethod());
        rbd.setAutowireCandidate(true);
        rbd.setScope(bean.scope().getScopeName());
        if (log.isInfoEnabled()) log.info("Registering.." + rbd);
        registry.registerBeanDefinition(bean.name(), rbd);
    }
View Full Code Here

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

        return null;
    }

    private void registerEndpointMappings(Object source, ParserContext parserContext) {
        RootBeanDefinition payloadRootMappingDef =
                createBeanDefinition(PayloadRootAnnotationMethodEndpointMapping.class, source);
        payloadRootMappingDef.getPropertyValues().add("order", 0);
        parserContext.getReaderContext().registerWithGeneratedName(payloadRootMappingDef);

        RootBeanDefinition soapActionMappingDef =
                createBeanDefinition(SoapActionAnnotationMethodEndpointMapping.class, source);
        soapActionMappingDef.getPropertyValues().add("order", 1);
        parserContext.getReaderContext().registerWithGeneratedName(soapActionMappingDef);

        RootBeanDefinition annActionMappingDef =
                createBeanDefinition(AnnotationActionEndpointMapping.class, source);
        annActionMappingDef.getPropertyValues().add("order", 2);
        parserContext.getReaderContext().registerWithGeneratedName(annActionMappingDef);
    }
View Full Code Here

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

        annActionMappingDef.getPropertyValues().add("order", 2);
        parserContext.getReaderContext().registerWithGeneratedName(annActionMappingDef);
    }

    private void registerEndpointAdapters(Element element, Object source, ParserContext parserContext) {
        RootBeanDefinition adapterDef = createBeanDefinition(DefaultMethodEndpointAdapter.class, source);

        ManagedList<BeanMetadataElement> argumentResolvers = new ManagedList<BeanMetadataElement>();
        argumentResolvers.setSource(source);

        ManagedList<BeanMetadataElement> returnValueHandlers = new ManagedList<BeanMetadataElement>();
        returnValueHandlers.setSource(source);

        argumentResolvers.add(createBeanDefinition(MessageContextMethodArgumentResolver.class, source));
        argumentResolvers.add(createBeanDefinition(XPathParamMethodArgumentResolver.class, source));
        argumentResolvers.add(createBeanDefinition(SoapMethodArgumentResolver.class, source));
        argumentResolvers.add(createBeanDefinition(SoapHeaderElementMethodArgumentResolver.class, source));

        RuntimeBeanReference domProcessor = createBeanReference(DomPayloadMethodProcessor.class, source, parserContext);
        argumentResolvers.add(domProcessor);
        returnValueHandlers.add(domProcessor);

        RuntimeBeanReference sourceProcessor =
                createBeanReference(SourcePayloadMethodProcessor.class, source, parserContext);
        argumentResolvers.add(sourceProcessor);
        returnValueHandlers.add(sourceProcessor);

        if (dom4jPresent) {
            RuntimeBeanReference dom4jProcessor =
                    createBeanReference(Dom4jPayloadMethodProcessor.class, source, parserContext);
            argumentResolvers.add(dom4jProcessor);
            returnValueHandlers.add(dom4jProcessor);
        }
        if (jaxb2Present) {
            RuntimeBeanReference xmlRootElementProcessor =
                    createBeanReference(XmlRootElementPayloadMethodProcessor.class, source, parserContext);
            argumentResolvers.add(xmlRootElementProcessor);
            returnValueHandlers.add(xmlRootElementProcessor);

            RuntimeBeanReference jaxbElementProcessor =
                    createBeanReference(JaxbElementPayloadMethodProcessor.class, source, parserContext);
            argumentResolvers.add(jaxbElementProcessor);
            returnValueHandlers.add(jaxbElementProcessor);
        }
        if (jdomPresent) {
            RuntimeBeanReference jdomProcessor =
                    createBeanReference(JDomPayloadMethodProcessor.class, source, parserContext);
            argumentResolvers.add(jdomProcessor);
            returnValueHandlers.add(jdomProcessor);
        }
        if (staxPresent) {
            argumentResolvers.add(createBeanDefinition(StaxPayloadMethodArgumentResolver.class, source));
        }
        if (xomPresent) {
            RuntimeBeanReference xomProcessor =
                    createBeanReference(XomPayloadMethodProcessor.class, source, parserContext);
            argumentResolvers.add(xomProcessor);
            returnValueHandlers.add(xomProcessor);
        }
        if (element.hasAttribute("marshaller")) {
            RuntimeBeanReference marshallerReference = new RuntimeBeanReference(element.getAttribute("marshaller"));
            RuntimeBeanReference unmarshallerReference;
            if (element.hasAttribute("unmarshaller")) {
                unmarshallerReference = new RuntimeBeanReference(element.getAttribute("unmarshaller"));
            }
            else {
                unmarshallerReference = marshallerReference;
            }

            RootBeanDefinition marshallingProcessorDef =
                    createBeanDefinition(MarshallingPayloadMethodProcessor.class, source);
            marshallingProcessorDef.getPropertyValues().add("marshaller", marshallerReference);
            marshallingProcessorDef.getPropertyValues().add("unmarshaller", unmarshallerReference);
            argumentResolvers.add(marshallingProcessorDef);
            returnValueHandlers.add(marshallingProcessorDef);
        }

        adapterDef.getPropertyValues().add("methodArgumentResolvers", argumentResolvers);
View Full Code Here

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

        parserContext.getReaderContext().registerWithGeneratedName(adapterDef);
    }

    private void registerEndpointExceptionResolvers(Object source, ParserContext parserContext) {
        RootBeanDefinition annotationResolverDef =
                createBeanDefinition(SoapFaultAnnotationExceptionResolver.class, source);
        annotationResolverDef.getPropertyValues().add("order", 0);
        parserContext.getReaderContext().registerWithGeneratedName(annotationResolverDef);

        RootBeanDefinition simpleResolverDef =
                createBeanDefinition(SimpleSoapExceptionResolver.class, source);
        simpleResolverDef.getPropertyValues().add("order", Ordered.LOWEST_PRECEDENCE);
        parserContext.getReaderContext().registerWithGeneratedName(simpleResolverDef);
    }
View Full Code Here

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

        simpleResolverDef.getPropertyValues().add("order", Ordered.LOWEST_PRECEDENCE);
        parserContext.getReaderContext().registerWithGeneratedName(simpleResolverDef);
    }

    private RuntimeBeanReference createBeanReference(Class<?> beanClass, Object source, ParserContext parserContext) {
        RootBeanDefinition beanDefinition = createBeanDefinition(beanClass, source);
        String beanName = parserContext.getReaderContext().registerWithGeneratedName(beanDefinition);
        parserContext.registerComponent(new BeanComponentDefinition(beanDefinition, beanName));
        return new RuntimeBeanReference(beanName);
    }
View Full Code Here

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

        parserContext.registerComponent(new BeanComponentDefinition(beanDefinition, beanName));
        return new RuntimeBeanReference(beanName);
    }

    private RootBeanDefinition createBeanDefinition(Class<?> beanClass, Object source) {
        RootBeanDefinition beanDefinition = new RootBeanDefinition(beanClass);
        beanDefinition.setSource(source);
        beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        return beanDefinition;
    }
View Full Code Here

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

        parserContext.pushContainingComponent(compDefinition);

        List<Element> childElements = DomUtils.getChildElements(element);
        for (Element childElement : childElements) {
            if ("bean".equals(childElement.getLocalName())) {
                RootBeanDefinition smartInterceptorDef =
                        createSmartInterceptorDefinition(DelegatingSmartSoapEndpointInterceptor.class, childElement,
                                parserContext);
                BeanDefinitionHolder interceptorDef = createInterceptorDefinition(parserContext, childElement);

                smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorDef);

                registerSmartInterceptor(parserContext, smartInterceptorDef);
            }
            else if ("ref".equals(childElement.getLocalName())) {
                RootBeanDefinition smartInterceptorDef =
                        createSmartInterceptorDefinition(DelegatingSmartSoapEndpointInterceptor.class, childElement,
                                parserContext);

                BeanReference interceptorRef = createInterceptorReference(parserContext, childElement);

                smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorRef);

                registerSmartInterceptor(parserContext, smartInterceptorDef);

            }
            else if ("payloadRoot".equals(childElement.getLocalName())) {
                List<Element> payloadRootChildren = DomUtils.getChildElements(childElement);
                for (Element payloadRootChild : payloadRootChildren) {
                    if ("bean".equals(payloadRootChild.getLocalName())) {
                        RootBeanDefinition smartInterceptorDef =
                                createSmartInterceptorDefinition(PayloadRootSmartSoapEndpointInterceptor.class,
                                        childElement, parserContext);
                        BeanDefinitionHolder interceptorDef =
                                createInterceptorDefinition(parserContext, payloadRootChild);

                        String namespaceUri = childElement.getAttribute("namespaceUri");
                        String localPart = childElement.getAttribute("localPart");

                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorDef);
                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(1, namespaceUri);
                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(2, localPart);

                        registerSmartInterceptor(parserContext, smartInterceptorDef);
                    }
                    else if ("ref".equals(payloadRootChild.getLocalName())) {
                        RootBeanDefinition smartInterceptorDef =
                                createSmartInterceptorDefinition(PayloadRootSmartSoapEndpointInterceptor.class,
                                        childElement, parserContext);
                        BeanReference interceptorRef = createInterceptorReference(parserContext, payloadRootChild);

                        String namespaceUri = childElement.getAttribute("namespaceUri");
                        String localPart = childElement.getAttribute("localPart");

                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorRef);
                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(1, namespaceUri);
                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(2, localPart);

                        registerSmartInterceptor(parserContext, smartInterceptorDef);
                    }
                }
            }
            else if ("soapAction".equals(childElement.getLocalName())) {
                List<Element> soapActionChildren = DomUtils.getChildElements(childElement);
                for (Element soapActionChild : soapActionChildren) {
                    if ("bean".equals(soapActionChild.getLocalName())) {
                        RootBeanDefinition smartInterceptorDef =
                                createSmartInterceptorDefinition(SoapActionSmartEndpointInterceptor.class, childElement,
                                        parserContext);
                        BeanDefinitionHolder interceptorDef =
                                createInterceptorDefinition(parserContext, soapActionChild);

                        String soapAction = childElement.getAttribute("value");

                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorDef);
                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(1, soapAction);

                        registerSmartInterceptor(parserContext, smartInterceptorDef);
                    }
                    else if ("ref".equals(soapActionChild.getLocalName())) {
                        RootBeanDefinition smartInterceptorDef =
                                createSmartInterceptorDefinition(SoapActionSmartEndpointInterceptor.class, childElement,
                                        parserContext);
                        BeanReference interceptorRef = createInterceptorReference(parserContext, soapActionChild);

                        String soapAction = childElement.getAttribute("value");

                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(0, interceptorRef);
                        smartInterceptorDef.getConstructorArgumentValues().addIndexedArgumentValue(1, soapAction);

                        registerSmartInterceptor(parserContext, smartInterceptorDef);
                    }
                }
            }
View Full Code Here

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

    }

    private RootBeanDefinition createSmartInterceptorDefinition(Class<? extends SmartEndpointInterceptor> interceptorClass,
                                                                Element element,
                                                                ParserContext parserContext) {
        RootBeanDefinition smartInterceptorDef = new RootBeanDefinition(interceptorClass);
        smartInterceptorDef.setSource(parserContext.extractSource(element));
        smartInterceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        return smartInterceptorDef;
    }
View Full Code Here

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

        addProperty(element, wsdlBuilder, "locationUri");
        addProperty(element, wsdlBuilder, "serviceName");

        List<Element> schemas = DomUtils.getChildElementsByTagName(element, "xsd");
        if (commonsSchemaPresent) {
            RootBeanDefinition collectionDef = createBeanDefinition(CommonsXsdSchemaCollection.class, source);
            collectionDef.getPropertyValues().addPropertyValue("inline", "true");
            ManagedList<String> xsds = new ManagedList<String>();
            xsds.setSource(source);
            for (Element schema : schemas) {
                xsds.add(schema.getAttribute("location"));
            }
            collectionDef.getPropertyValues().addPropertyValue("xsds", xsds);
            String collectionName = parserContext.getReaderContext().registerWithGeneratedName(collectionDef);
            wsdlBuilder.addPropertyReference("schemaCollection", collectionName);
        }
        else {
            if (schemas.size() > 1) {
                throw new IllegalArgumentException(
                        "Multiple <xsd/> elements requires Commons XMLSchema." +
                                "Please put Commons XMLSchema on the classpath.");
            }
            RootBeanDefinition schemaDef = createBeanDefinition(SimpleXsdSchema.class, source);
            Element schema = schemas.iterator().next();
            schemaDef.getPropertyValues().addPropertyValue("xsd", schema.getAttribute("location"));
            String schemaName = parserContext.getReaderContext().registerWithGeneratedName(schemaDef);
            wsdlBuilder.addPropertyReference("schema", schemaName);
        }
        return wsdlBuilder.getBeanDefinition();
    }
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.