Package org.apache.tuscany.sca.implementation.spring

Examples of org.apache.tuscany.sca.implementation.spring.SpringSCAReferenceElement


            } // end while

            // Next handle the references
            Iterator<SpringSCAReferenceElement> itr = references.iterator();
            while (itr.hasNext()) {
                SpringSCAReferenceElement referenceElement = itr.next();
                Class<?> interfaze = resolveClass(resolver, referenceElement.getType(), context);
                Reference theReference = createReference(interfaze, referenceElement.getName());
                // Override the older bean definition with the latest ones
                // for the duplicate definitions found.
                Reference duplicate = null;
                for (Reference reference : componentType.getReferences()) {
                    if (reference.getName().equals(theReference.getName()))
                        duplicate = reference;
                }
                if (duplicate != null)
                    componentType.getReferences().remove(duplicate);

                // add the required intents and policySets for this reference
                theReference.getRequiredIntents().addAll(referenceElement.getRequiredIntents());
                theReference.getPolicySets().addAll(referenceElement.getPolicySets());
                componentType.getReferences().add(theReference);
            } // end while

            // Next handle the properties
            Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
View Full Code Here


            } // end while
              // Scan over the SCA reference elements looking for a match
            if (unresolved) {
                Iterator<SpringSCAReferenceElement> itr = references.iterator();
                while (itr.hasNext()) {
                    SpringSCAReferenceElement referenceElement = itr.next();
                    if (ref.equals(referenceElement.getName())) {
                        unresolved = false;
                        break;
                    } // end if
                } // end while
            } // end if
View Full Code Here

        // The @default attribute of a <sca:reference/> subelement of a <beans/> 
        // element MUST have the value of the @name attribute of one of the <bean/>
        // subelements of the <beans/> element.
        Iterator<SpringSCAReferenceElement> itr = references.iterator();
        while (itr.hasNext()) {
            SpringSCAReferenceElement referenceElement = itr.next();
            boolean defaultBeanExists = false;
            boolean isUniqueReferenceName = true;
            Iterator<SpringBeanElement> itb = beans.iterator();
            while (itb.hasNext()) {
                SpringBeanElement beanElement = itb.next();
                if (referenceElement.getDefaultBean() != null)
                    if (referenceElement.getDefaultBean().equals(beanElement.getId()))
                        defaultBeanExists = true;
                if (referenceElement.getName().equals(beanElement.getId()))
                    isUniqueReferenceName = false;
            }
            Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
            while (itp.hasNext()) {
                SpringSCAPropertyElement propertyElement = itp.next();
                if (referenceElement.getName().equals(propertyElement.getName()))
                    isUniqueReferenceName = false;
            }
            if (!defaultBeanExists && referenceElement.getDefaultBean() != null)
                error(monitor, "DefaultBeanDoesNotExist", beans);
            if (!isUniqueReferenceName)
                error(monitor, "ScaReferenceNameNotUnique", beans);
        } // end while

        // The value of the @name attribute of an <sca:property/> subelement of a <beans/>
        // element MUST be unique amongst the @name attributes of the <sca:reference/>
        // subelements and the <bean/> subelements of the <beans/> element.     
        Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
        while (itp.hasNext()) {
            SpringSCAPropertyElement propertyElement = itp.next();
            boolean isUniquePropertyName = true;
            Iterator<SpringBeanElement> itb = beans.iterator();
            while (itb.hasNext()) {
                SpringBeanElement beanElement = itb.next();
                if (propertyElement.getName().equals(beanElement.getId()))
                    isUniquePropertyName = false;
            }
            Iterator<SpringSCAReferenceElement> itrp = references.iterator();
            while (itrp.hasNext()) {
                SpringSCAReferenceElement referenceElement = itrp.next();
                if (propertyElement.getName().equals(referenceElement.getName()))
                    isUniquePropertyName = false;
            }
            if (!isUniquePropertyName)
                error(monitor, "ScaPropertyNameNotUnique", beans);
        } // end while
View Full Code Here

            } // end while

            // Next handle the references
            Iterator<SpringSCAReferenceElement> itr = references.iterator();
            while (itr.hasNext()) {
                SpringSCAReferenceElement referenceElement = itr.next();
                Class<?> interfaze = resolveClass(resolver, referenceElement.getType(), context);
                Reference theReference = createReference(interfaze, referenceElement.getName());
                // Override the older bean definition with the latest ones
                // for the duplicate definitions found.
                Reference duplicate = null;
                for (Reference reference : componentType.getReferences()) {
                    if (reference.getName().equals(theReference.getName()))
                        duplicate = reference;
                }
                if (duplicate != null)
                    componentType.getReferences().remove(duplicate);

                // add the required intents and policySets for this reference
                theReference.getRequiredIntents().addAll(referenceElement.getRequiredIntents());
                theReference.getPolicySets().addAll(referenceElement.getPolicySets());
                componentType.getReferences().add(theReference);
            } // end while

            // Next handle the properties
            Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
View Full Code Here

            } // end while
              // Scan over the SCA reference elements looking for a match
            if (unresolved) {
                Iterator<SpringSCAReferenceElement> itr = references.iterator();
                while (itr.hasNext()) {
                    SpringSCAReferenceElement referenceElement = itr.next();
                    if (ref.equals(referenceElement.getName())) {
                        unresolved = false;
                        break;
                    } // end if
                } // end while
            } // end if
View Full Code Here

        // The @default attribute of a <sca:reference/> subelement of a <beans/> 
        // element MUST have the value of the @name attribute of one of the <bean/>
        // subelements of the <beans/> element.
        Iterator<SpringSCAReferenceElement> itr = references.iterator();
        while (itr.hasNext()) {
            SpringSCAReferenceElement referenceElement = itr.next();
            boolean defaultBeanExists = true;
            boolean isUniqueReferenceName = true;
            Iterator<SpringBeanElement> itb = beans.iterator();
            while (itb.hasNext()) {
                SpringBeanElement beanElement = itb.next();
                if (referenceElement.getDefaultBean() != null)
                    if (referenceElement.getDefaultBean().equals(beanElement.getId()))
                        defaultBeanExists = false;
                if (referenceElement.getName().equals(beanElement.getId()))
                    isUniqueReferenceName = false;
            }
            Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
            while (itp.hasNext()) {
                SpringSCAPropertyElement propertyElement = itp.next();
                if (referenceElement.getName().equals(propertyElement.getName()))
                    isUniqueReferenceName = false;
            }
            if (!defaultBeanExists)
                error(monitor, "DefaultBeanDoesNotExist", beans);
            if (!isUniqueReferenceName)
                error(monitor, "ScaReferenceNameNotUnique", beans);
        } // end while

        // The value of the @name attribute of an <sca:property/> subelement of a <beans/>
        // element MUST be unique amongst the @name attributes of the <sca:reference/>
        // subelements and the <bean/> subelements of the <beans/> element.     
        Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
        while (itp.hasNext()) {
            SpringSCAPropertyElement propertyElement = itp.next();
            boolean isUniquePropertyName = true;
            Iterator<SpringBeanElement> itb = beans.iterator();
            while (itb.hasNext()) {
                SpringBeanElement beanElement = itb.next();
                if (propertyElement.getName().equals(beanElement.getId()))
                    isUniquePropertyName = false;
            }
            Iterator<SpringSCAReferenceElement> itrp = references.iterator();
            while (itrp.hasNext()) {
                SpringSCAReferenceElement referenceElement = itrp.next();
                if (propertyElement.getName().equals(referenceElement.getName()))
                    isUniquePropertyName = false;
            }
            if (!isUniquePropertyName)
                error(monitor, "ScaPropertyNameNotUnique", beans);
        } // end while
View Full Code Here

    public BeanDefinition parse(Element element, ParserContext parserContext) {
        BeanDefinitionRegistry registry = parserContext.getRegistry();
        if (registry instanceof SCAGenericApplicationContext) {
            SCAGenericApplicationContext context = (SCAGenericApplicationContext)registry;
            SpringSCAReferenceElement referenceElement =
                new SpringSCAReferenceElement(getAttribute(element, "name"), getAttribute(element, "type"));
            referenceElement.setDefaultBean(getAttribute(element, "default"));

            String requires = getAttribute(element, "requires");
            if (requires != null) {
                List<QName> qnames = ScaNamespaceHandler.resolve(element, requires);
                referenceElement.getIntentNames().addAll(qnames);
            }

            String policySets = getAttribute(element, "policySets");
            if (policySets != null) {
                List<QName> qnames = ScaNamespaceHandler.resolve(element, policySets);
                referenceElement.getPolicySetNames().addAll(qnames);
            }

            context.addSCAReferenceElement(referenceElement);
        }
View Full Code Here

            } // end while

            // Next handle the references
            Iterator<SpringSCAReferenceElement> itr = references.iterator();
            while (itr.hasNext()) {
                SpringSCAReferenceElement referenceElement = itr.next();
                Class<?> interfaze = resolveClass(resolver, referenceElement.getType(), context);
                Reference theReference = createReference(interfaze, referenceElement.getName());
                // Override the older bean definition with the latest ones
                // for the duplicate definitions found.
                Reference duplicate = null;
                for (Reference reference : componentType.getReferences()) {
                    if (reference.getName().equals(theReference.getName()))
                        duplicate = reference;
                }
                if (duplicate != null)
                    componentType.getReferences().remove(duplicate);

                // add the required intents and policySets for this reference
                theReference.getRequiredIntents().addAll(referenceElement.getRequiredIntents());
                theReference.getPolicySets().addAll(referenceElement.getPolicySets());
                componentType.getReferences().add(theReference);
            } // end while

            // Next handle the properties
            Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
View Full Code Here

            } // end while
              // Scan over the SCA reference elements looking for a match
            if (unresolved) {
                Iterator<SpringSCAReferenceElement> itr = references.iterator();
                while (itr.hasNext()) {
                    SpringSCAReferenceElement referenceElement = itr.next();
                    if (ref.equals(referenceElement.getName())) {
                        unresolved = false;
                        break;
                    } // end if
                } // end while
            } // end if
View Full Code Here

        // The @default attribute of a <sca:reference/> subelement of a <beans/> 
        // element MUST have the value of the @name attribute of one of the <bean/>
        // subelements of the <beans/> element.
        Iterator<SpringSCAReferenceElement> itr = references.iterator();
        while (itr.hasNext()) {
            SpringSCAReferenceElement referenceElement = itr.next();
            boolean defaultBeanExists = false;
            boolean isUniqueReferenceName = true;
            Iterator<SpringBeanElement> itb = beans.iterator();
            while (itb.hasNext()) {
                SpringBeanElement beanElement = itb.next();
                if (referenceElement.getDefaultBean() != null)
                    if (referenceElement.getDefaultBean().equals(beanElement.getId()))
                        defaultBeanExists = true;
                if (referenceElement.getName().equals(beanElement.getId()))
                    isUniqueReferenceName = false;
            }
            Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
            while (itp.hasNext()) {
                SpringSCAPropertyElement propertyElement = itp.next();
                if (referenceElement.getName().equals(propertyElement.getName()))
                    isUniqueReferenceName = false;
            }
            if (!defaultBeanExists && referenceElement.getDefaultBean() != null)
                error(monitor, "DefaultBeanDoesNotExist", beans);
            if (!isUniqueReferenceName)
                error(monitor, "ScaReferenceNameNotUnique", beans);
        } // end while

        // The value of the @name attribute of an <sca:property/> subelement of a <beans/>
        // element MUST be unique amongst the @name attributes of the <sca:reference/>
        // subelements and the <bean/> subelements of the <beans/> element.     
        Iterator<SpringSCAPropertyElement> itp = scaproperties.iterator();
        while (itp.hasNext()) {
            SpringSCAPropertyElement propertyElement = itp.next();
            boolean isUniquePropertyName = true;
            Iterator<SpringBeanElement> itb = beans.iterator();
            while (itb.hasNext()) {
                SpringBeanElement beanElement = itb.next();
                if (propertyElement.getName().equals(beanElement.getId()))
                    isUniquePropertyName = false;
            }
            Iterator<SpringSCAReferenceElement> itrp = references.iterator();
            while (itrp.hasNext()) {
                SpringSCAReferenceElement referenceElement = itrp.next();
                if (propertyElement.getName().equals(referenceElement.getName()))
                    isUniquePropertyName = false;
            }
            if (!isUniquePropertyName)
                error(monitor, "ScaPropertyNameNotUnique", beans);
        } // end while
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.implementation.spring.SpringSCAReferenceElement

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.