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

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


                    List<Property> beanProperties = beanComponentType.getProperties();

                    Set<String> excludedNames = new HashSet<String>();
                    Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
                    while (itp.hasNext()) {
                        SpringPropertyElement propertyElement = itp.next();
                        // Exclude the reference that is also known as a spring property
                        excludedNames.add(propertyElement.getName());
                        for (String propertyRef : propertyElement.getRefs()) {
                            if (propertyRefUnresolved(propertyRef, beans, references, scaproperties)) {
                                // This means an unresolved reference from the spring bean...
                                for (Reference reference : beanReferences) {
                                    if (propertyElement.getName().equals(reference.getName())) {
                                        // The name of the reference in this case is the string in
                                        // the @ref attribute of the Spring property element, NOT the
                                        // name of the field in the Spring bean....
                                        reference.setName(propertyRef);
                                        // reference.setWiredByImpl(true);
                                        componentType.getReferences().add(reference);
                                        break;
                                    } // end if
                                } // end for

                                // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                                for (Property scaproperty : beanProperties) {
                                    if (propertyElement.getName().equals(scaproperty.getName())) {
                                        // The name of the reference in this case is the string in
                                        // the @ref attribute of the Spring property element, NOT the
                                        // name of the field in the Spring bean....
                                        Class<?> interfaze =
                                            resolveClass(resolver,
                                                         (propertyMap.get(propertyElement.getName()).getType())
                                                             .getName(),
                                                         context);
                                        Reference theReference = createReference(interfaze, propertyRef);
                                        implementation.setUnresolvedBeanRef(propertyRef, theReference);
                                        break;
View Full Code Here


                List<Property> beanProperties = beanComponentType.getProperties();

                Set<String> excludedNames = new HashSet<String>();
                Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
                while (itp.hasNext()) {
                    SpringPropertyElement propertyElement = itp.next();
                    // Exclude the reference that is also known as a spring property
                    excludedNames.add(propertyElement.getName());
                    for (String propertyRef : propertyElement.getRefs()) {
                        if (propertyRefUnresolved(propertyRef, beans, references, scaproperties)) {
                            // This means an unresolved reference from the spring bean...
                            for (Reference reference : beanReferences) {
                                if (propertyElement.getName().equals(reference.getName())) {
                                    // The name of the reference in this case is the string in
                                    // the @ref attribute of the Spring property element, NOT the
                                    // name of the field in the Spring bean....
                                    reference.setName(propertyRef);
                                    componentType.getReferences().add(reference);
                                    break;
                                } // end if
                            } // end for

                            // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                            for (Property scaproperty : beanProperties) {
                                if (propertyElement.getName().equals(scaproperty.getName())) {
                                    // The name of the reference in this case is the string in
                                    // the @ref attribute of the Spring property element, NOT the
                                    // name of the field in the Spring bean....
                                    Class<?> interfaze =
                                        resolveClass(resolver,
                                                     (propertyMap.get(propertyElement.getName()).getType()).getName(),
                                                     context);
                                    Reference theReference = createReference(interfaze, propertyRef);
                                    implementation.setUnresolvedBeanRef(propertyRef, theReference);
                                    break;
                                } // end if
View Full Code Here

                    beanElement.addCustructorArgs(arg);
                }

                MutablePropertyValues values = def.getPropertyValues();
                for (PropertyValue p : values.getPropertyValueList()) {
                    SpringPropertyElement propertyElement = new SpringPropertyElement(p.getName());
                    Object value = p.getValue();
                    configurePropertyElement(propertyElement, value);
                    beanElement.getProperties().add(propertyElement);
                }
            }
View Full Code Here

                    List<Property> beanProperties = beanComponentType.getProperties();

                    Set<String> excludedNames = new HashSet<String>();
                    Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
                    while (itp.hasNext()) {
                        SpringPropertyElement propertyElement = itp.next();
                        // Exclude the reference that is also known as a spring property
                        excludedNames.add(propertyElement.getName());
                        for (String propertyRef : propertyElement.getRefs()) {
                            if (propertyRefUnresolved(propertyRef, beans, references, scaproperties)) {
                                // This means an unresolved reference from the spring bean...
                                for (Reference reference : beanReferences) {
                                    if (propertyElement.getName().equals(reference.getName())) {
                                        // The name of the reference in this case is the string in
                                        // the @ref attribute of the Spring property element, NOT the
                                        // name of the field in the Spring bean....
                                        reference.setName(propertyRef);
                                        // reference.setWiredByImpl(true);
                                        componentType.getReferences().add(reference);
                                        break;
                                    } // end if
                                } // end for

                                // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                                for (Property scaproperty : beanProperties) {
                                    if (propertyElement.getName().equals(scaproperty.getName())) {
                                        // The name of the reference in this case is the string in
                                        // the @ref attribute of the Spring property element, NOT the
                                        // name of the field in the Spring bean....
                                        Class<?> interfaze =
                                            resolveClass(resolver,
                                                         (propertyMap.get(propertyElement.getName()).getType())
                                                             .getName(),
                                                         context);
                                        Reference theReference = createReference(interfaze, propertyRef);
                                        implementation.setUnresolvedBeanRef(propertyRef, theReference);
                                        break;
View Full Code Here

                                    List<SpringSCAServiceElement> services,
                                    List<SpringSCAReferenceElement> references,
                                    List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {

      SpringBeanElement innerbean = null;
        SpringPropertyElement property = null;
        SpringConstructorArgElement constructorArg = null;
        int autoConstructorIndex = -1;

        try {
            boolean completed = false;
            while (!completed) {
                switch (reader.next()) {
                    case START_ELEMENT:
                        QName qname = reader.getName();
                        if (SpringImplementationConstants.BEAN_ELEMENT.equals(qname)) {
                          innerbean = new SpringBeanElement(reader.getAttributeValue(null, "id"), reader
                                    .getAttributeValue(null, "class"));
                            innerbean.setInnerBean(true);
                            beans.add(innerbean);
                            readBeanDefinition(resolver, reader, contextPath, innerbean, beans, services, references, scaproperties);
                        } else if (SpringImplementationConstants.PROPERTY_ELEMENT.equals(qname)) {
                            property = new SpringPropertyElement(reader.getAttributeValue(null, "name"), reader
                                    .getAttributeValue(null, "ref"));
                            bean.addProperty(property);
                        } else if (SpringImplementationConstants.CONSTRUCTORARG_ELEMENT.equals(qname)) {
                            constructorArg = new SpringConstructorArgElement(reader.getAttributeValue(null, "ref"),
                                    reader.getAttributeValue(null, "type"));
                            autoConstructorIndex++;
                            constructorArg.setAutoIndex(autoConstructorIndex);
                            if (reader.getAttributeValue(null, "index") != null)
                              constructorArg.setIndex((new Integer(reader.getAttributeValue(null, "index"))).intValue());
                            if (reader.getAttributeValue(null, "value") != null) {
                              String value = reader.getAttributeValue(null, "value");
                              constructorArg.addValue(value);
                              if ((value.indexOf(".xml") != -1)) {
                                    if ((bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) ||
                                        (bean.getClassName().indexOf(".FileSystemXmlApplicationContext") != -1)) {
                                        XMLStreamReader creader = getApplicationContextReader(resolver, value);
                                        // Read the context definition for the constructor-arg resources
                                        readContextDefinition(resolver, creader, contextPath, beans, services, references, scaproperties);
                                    }
                                }
                            }
                            bean.addCustructorArgs(constructorArg);
                        } else if (SpringImplementationConstants.REF_ELEMENT.equals(qname)) {
                            String ref = reader.getAttributeValue(null, "bean");
                            // Check if the parent element is a property
                            if (property != null) property.setRef(ref);
                            // Check if the parent element is a constructor-arg
                            if (constructorArg != null) constructorArg.setRef(ref);
                        } else if (SpringImplementationConstants.VALUE_ELEMENT.equals(qname)) {
                            String value = reader.getElementText();
                            // Check if the parent element is a constructor-arg
View Full Code Here

                List<Reference> beanReferences = beanComponentType.getReferences();
                List<Property> beanProperties = beanComponentType.getProperties();

                Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
                while (itp.hasNext()) {
                    SpringPropertyElement propertyElement = itp.next();
                    if (propertyRefUnresolved(propertyElement.getRef(), beans, references, scaproperties)) {
                        // This means an unresolved reference from the spring bean...
                      for (Reference reference : beanReferences) {
                            if (propertyElement.getName().equals(reference.getName())) {
                              // The name of the reference in this case is the string in
                                // the @ref attribute of the Spring property element, NOT the
                                // name of the field in the Spring bean....
                                reference.setName(propertyElement.getRef());
                                componentType.getReferences().add(reference);
                            } // end if
                        } // end for

                      // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                      for (Property scaproperty : beanProperties) {
                            if (propertyElement.getName().equals(scaproperty.getName())) {
                              // The name of the reference in this case is the string in
                                // the @ref attribute of the Spring property element, NOT the
                                // name of the field in the Spring bean....
                              Class<?> interfaze = resolveClass(resolver, (propertyMap.get(propertyElement.getName()).getType()).getName());
                                Reference theReference = createReference(interfaze, propertyElement.getRef());
                                implementation.setUnresolvedBeanRef(propertyElement.getRef(), theReference);
                            } // end if
                      } // end for
                    } // end if
                } // end while
View Full Code Here

                List<Property> beanProperties = beanComponentType.getProperties();

                Set<String> excludedNames = new HashSet<String>();
                Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
                while (itp.hasNext()) {
                    SpringPropertyElement propertyElement = itp.next();
                    // Exclude the reference that is also known as a spring property
                    excludedNames.add(propertyElement.getName());
                    for (String propertyRef : propertyElement.getRefs()) {
                        if (propertyRefUnresolved(propertyRef, beans, references, scaproperties)) {
                            // This means an unresolved reference from the spring bean...
                            for (Reference reference : beanReferences) {
                                if (propertyElement.getName().equals(reference.getName())) {
                                    // The name of the reference in this case is the string in
                                    // the @ref attribute of the Spring property element, NOT the
                                    // name of the field in the Spring bean....
                                    reference.setName(propertyRef);
                                    componentType.getReferences().add(reference);
                                    break;
                                } // end if
                            } // end for

                            // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                            for (Property scaproperty : beanProperties) {
                                if (propertyElement.getName().equals(scaproperty.getName())) {
                                    // The name of the reference in this case is the string in
                                    // the @ref attribute of the Spring property element, NOT the
                                    // name of the field in the Spring bean....
                                    Class<?> interfaze =
                                        resolveClass(resolver,
                                                     (propertyMap.get(propertyElement.getName()).getType()).getName(),
                                                     context);
                                    Reference theReference = createReference(interfaze, propertyRef);
                                    implementation.setUnresolvedBeanRef(propertyRef, theReference);
                                    break;
                                } // end if
View Full Code Here

                                    List<SpringSCAServiceElement> services,
                                    List<SpringSCAReferenceElement> references,
                                    List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {

      SpringBeanElement innerbean = null;
        SpringPropertyElement property = null;
        SpringConstructorArgElement constructorArg = null;
        int autoConstructorIndex = -1;

        try {
            boolean completed = false;
            while (!completed) {
                switch (reader.next()) {
                    case START_ELEMENT:
                        QName qname = reader.getName();
                        if (SpringImplementationConstants.BEAN_ELEMENT.equals(qname)) {
                          innerbean = new SpringBeanElement(reader.getAttributeValue(null, "id"), reader
                                    .getAttributeValue(null, "class"));
                            innerbean.setInnerBean(true);
                            beans.add(innerbean);
                            readBeanDefinition(resolver, reader, contextPath, innerbean, beans, services, references, scaproperties);
                        } else if (SpringImplementationConstants.PROPERTY_ELEMENT.equals(qname)) {
                            property = new SpringPropertyElement(reader.getAttributeValue(null, "name"), reader
                                    .getAttributeValue(null, "ref"));
                            bean.addProperty(property);
                        } else if (SpringImplementationConstants.CONSTRUCTORARG_ELEMENT.equals(qname)) {
                            constructorArg = new SpringConstructorArgElement(reader.getAttributeValue(null, "ref"),
                                    reader.getAttributeValue(null, "type"));
                            autoConstructorIndex++;
                            constructorArg.setAutoIndex(autoConstructorIndex);
                            if (reader.getAttributeValue(null, "index") != null)
                              constructorArg.setIndex((new Integer(reader.getAttributeValue(null, "index"))).intValue());
                            if (reader.getAttributeValue(null, "value") != null) {
                              String value = reader.getAttributeValue(null, "value");
                              constructorArg.addValue(value);
                              if ((isMultipleContextSupported) && (value.indexOf(".xml") != -1)) {
                                    if (bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) {
                                        XMLStreamReader creader = getApplicationContextReader(resolver, value);
                                        // Read the context definition for the constructor-arg resources
                                        readContextDefinition(resolver, creader, contextPath, beans, services, references, scaproperties);
                                    }
                                }
                            }
                            bean.addCustructorArgs(constructorArg);
                        } else if (SpringImplementationConstants.REF_ELEMENT.equals(qname)) {
                            String ref = reader.getAttributeValue(null, "bean");
                            // Check if the parent element is a property
                            if (property != null) property.setRef(ref);
                            // Check if the parent element is a constructor-arg
                            if (constructorArg != null) constructorArg.setRef(ref);
                        } else if (SpringImplementationConstants.VALUE_ELEMENT.equals(qname)) {
                            String value = reader.getElementText();
                            // Check if the parent element is a constructor-arg
View Full Code Here

                List<Reference> beanReferences = beanComponentType.getReferences();
                List<Property> beanProperties = beanComponentType.getProperties();

                Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
                while (itp.hasNext()) {
                    SpringPropertyElement propertyElement = itp.next();
                    if (propertyRefUnresolved(propertyElement.getRef(), beans, references, scaproperties)) {
                        // This means an unresolved reference from the spring bean...
                      for (Reference reference : beanReferences) {
                            if (propertyElement.getName().equals(reference.getName())) {
                              // The name of the reference in this case is the string in
                                // the @ref attribute of the Spring property element, NOT the
                                // name of the field in the Spring bean....
                                reference.setName(propertyElement.getRef());
                                componentType.getReferences().add(reference);
                            } // end if
                        } // end for

                      // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                      for (Property scaproperty : beanProperties) {
                            if (propertyElement.getName().equals(scaproperty.getName())) {
                              // The name of the reference in this case is the string in
                                // the @ref attribute of the Spring property element, NOT the
                                // name of the field in the Spring bean....
                              Class<?> interfaze = resolveClass(resolver, (propertyMap.get(propertyElement.getName()).getType()).getName());
                                Reference theReference = createReference(interfaze, propertyElement.getRef());
                                implementation.setUnresolvedBeanRef(propertyElement.getRef(), theReference);
                            } // end if
                      } // end for
                    } // end if
                } // end while
View Full Code Here

                                    List<SpringSCAServiceElement> services,
                                    List<SpringSCAReferenceElement> references,
                                    List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {

      SpringBeanElement innerbean = null;
        SpringPropertyElement property = null;
        SpringConstructorArgElement constructorArg = null;
        int autoConstructorIndex = -1;

        try {
            boolean completed = false;
            while (!completed) {
                switch (reader.next()) {
                    case START_ELEMENT:
                        QName qname = reader.getName();
                        if (SpringImplementationConstants.BEAN_ELEMENT.equals(qname)) {
                          innerbean = new SpringBeanElement(reader.getAttributeValue(null, "id"), reader
                                    .getAttributeValue(null, "class"));
                            innerbean.setInnerBean(true);
                            beans.add(innerbean);
                            readBeanDefinition(resolver, reader, contextPath, innerbean, beans, services, references, scaproperties);
                        } else if (SpringImplementationConstants.PROPERTY_ELEMENT.equals(qname)) {
                            property = new SpringPropertyElement(reader.getAttributeValue(null, "name"), reader
                                    .getAttributeValue(null, "ref"));
                            bean.addProperty(property);
                        } else if (SpringImplementationConstants.CONSTRUCTORARG_ELEMENT.equals(qname)) {
                            constructorArg = new SpringConstructorArgElement(reader.getAttributeValue(null, "ref"),
                                    reader.getAttributeValue(null, "type"));
                            autoConstructorIndex++;
                            constructorArg.setAutoIndex(autoConstructorIndex);
                            if (reader.getAttributeValue(null, "index") != null)
                              constructorArg.setIndex((new Integer(reader.getAttributeValue(null, "index"))).intValue());
                            if (reader.getAttributeValue(null, "value") != null) {
                              String value = reader.getAttributeValue(null, "value");
                              constructorArg.addValue(value);
                            }
                            bean.addCustructorArgs(constructorArg);
                        } else if (SpringImplementationConstants.REF_ELEMENT.equals(qname)) {
                            String ref = reader.getAttributeValue(null, "bean");
                            // Check if the parent element is a property
                            if (property != null) property.setRef(ref);
                            // Check if the parent element is a constructor-arg
                            if (constructorArg != null) constructorArg.setRef(ref);
                        } else if (SpringImplementationConstants.VALUE_ELEMENT.equals(qname)) {
                            String value = reader.getElementText();
                            // Check if the parent element is a constructor-arg
View Full Code Here

TOP

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

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.