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

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


                        } // end for
                    } // end while

                    Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
                    while (itcr.hasNext()) {
                        SpringConstructorArgElement conArgElement = itcr.next();
                        for (String constructorArgRef : conArgElement.getRefs()) {
                            if (propertyRefUnresolved(constructorArgRef, beans, references, scaproperties)) {
                                for (JavaParameterImpl parameter : constructor.getParameters()) {
                                    String paramType = parameter.getType().getName();
                                    Class<?> interfaze = resolveClass(resolver, paramType, context);
                                    // Create a component type reference/property if the constructor-arg element has a
                                    // type attribute OR index attribute declared...
                                    if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) || (conArgElement
                                        .getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex()))) {
                                        // [rfeng] Commenting out the following code as the constructor parameter based SCA
                                        // references are added already
                                        /*
                                        if (parameter.getClassifer() == org.oasisopen.sca.annotation.Reference.class) {
                                            Reference theReference = createReference(interfaze, constructorArgRef);
View Full Code Here


                    } // end for
                } // end while

                Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
                while (itcr.hasNext()) {
                    SpringConstructorArgElement conArgElement = itcr.next();
                    for (String constructorArgRef : conArgElement.getRefs()) {
                        if (propertyRefUnresolved(constructorArgRef, beans, references, scaproperties)) {
                            for (JavaParameterImpl parameter : constructor.getParameters()) {
                                String paramType = parameter.getType().getName();
                                Class<?> interfaze = resolveClass(resolver, paramType, context);
                                // Create a component type reference/property if the constructor-arg element has a
                                // type attribute OR index attribute declared...
                                if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) || (conArgElement
                                    .getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex()))) {
                                    // [rfeng] Commenting out the following code as the constructor parameter based SCA
                                    // references are added already
                                    /*
                                    if (parameter.getClassifer() == org.oasisopen.sca.annotation.Reference.class) {
                                        Reference theReference = createReference(interfaze, constructorArgRef);
View Full Code Here

                beanElement.setInnerBean(beanElement.getId() == null);

                ConstructorArgumentValues args = def.getConstructorArgumentValues();
                for (Map.Entry<Integer, ValueHolder> e: args.getIndexedArgumentValues().entrySet()) {
                    ValueHolder holder = e.getValue();
                    SpringConstructorArgElement arg = new SpringConstructorArgElement(holder.getType());
                    arg.setIndex(e.getKey());
                    beanElement.addCustructorArgs(arg);
                }

                MutablePropertyValues values = def.getPropertyValues();
                for (PropertyValue p : values.getPropertyValueList()) {
View Full Code Here

                        } // end for
                    } // end while

                    Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
                    while (itcr.hasNext()) {
                        SpringConstructorArgElement conArgElement = itcr.next();
                        for (String constructorArgRef : conArgElement.getRefs()) {
                            if (propertyRefUnresolved(constructorArgRef, beans, references, scaproperties)) {
                                for (JavaParameterImpl parameter : constructor.getParameters()) {
                                    String paramType = parameter.getType().getName();
                                    Class<?> interfaze = resolveClass(resolver, paramType, context);
                                    // Create a component type reference/property if the constructor-arg element has a
                                    // type attribute OR index attribute declared...
                                    if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) || (conArgElement
                                        .getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex()))) {
                                        // [rfeng] Commenting out the following code as the constructor parameter based SCA
                                        // references are added already
                                        /*
                                        if (parameter.getClassifer() == org.oasisopen.sca.annotation.Reference.class) {
                                            Reference theReference = createReference(interfaze, constructorArgRef);
View Full Code Here

                                    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
                            if (constructorArg != null) {
                              constructorArg.addValue(value);
                                // Identify the XML resource specified for the constructor-arg element
                                if ((value.indexOf(".xml") != -1)) {
                                    if ((bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) ||
                                        (bean.getClassName().indexOf(".FileSystemXmlApplicationContext") != -1)) {
                                        XMLStreamReader creader = getApplicationContextReader(resolver, value);
View Full Code Here

                    } // end if
                } // end while

                Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
                while (itcr.hasNext()) {
                  SpringConstructorArgElement conArgElement = itcr.next();
                    if (propertyRefUnresolved(conArgElement.getRef(), beans, references, scaproperties)) {
                      for (JavaParameterImpl parameter : constructor.getParameters()) {
                        String paramType = parameter.getType().getName();
                        Class<?> interfaze = resolveClass(resolver, paramType);
                        // Create a component type reference/property if the constructor-arg element has a
                            // type attribute OR index attribute declared...
                        if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) ||
                            (conArgElement.getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex())) ||
                            (conArgElement.getAutoIndex() == parameter.getIndex()))
                        {
                          if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Reference")) {
                            Reference theReference = createReference(interfaze, conArgElement.getRef());
                            componentType.getReferences().add(theReference);
                          }
                          if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Property")) {
                            // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                                  // we might need to verify with the component definition later.
                            Reference theReference = createReference(interfaze, conArgElement.getRef());
                              implementation.setUnresolvedBeanRef(conArgElement.getRef(), theReference);
                          }
                        }
                      } // end for
                    } // end if
                } // end while
View Full Code Here

                    } // end for
                } // end while

                Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
                while (itcr.hasNext()) {
                    SpringConstructorArgElement conArgElement = itcr.next();
                    for (String constructorArgRef : conArgElement.getRefs()) {
                        if (propertyRefUnresolved(constructorArgRef, beans, references, scaproperties)) {
                            for (JavaParameterImpl parameter : constructor.getParameters()) {
                                String paramType = parameter.getType().getName();
                                Class<?> interfaze = resolveClass(resolver, paramType, context);
                                // Create a component type reference/property if the constructor-arg element has a
                                // type attribute OR index attribute declared...
                                if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) || (conArgElement
                                    .getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex()))) {
                                    // [rfeng] Commenting out the following code as the constructor parameter based SCA
                                    // references are added already
                                    /*
                                    if (parameter.getClassifer() == org.oasisopen.sca.annotation.Reference.class) {
                                        Reference theReference = createReference(interfaze, constructorArgRef);
View Full Code Here

                                    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
                            if (constructorArg != null) {
                              constructorArg.addValue(value);
                                // Identify the XML resource specified for the constructor-arg element
                                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
View Full Code Here

                    } // end if
                } // end while

                Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
                while (itcr.hasNext()) {
                  SpringConstructorArgElement conArgElement = itcr.next();
                    if (propertyRefUnresolved(conArgElement.getRef(), beans, references, scaproperties)) {
                      for (JavaParameterImpl parameter : constructor.getParameters()) {
                        String paramType = parameter.getType().getName();
                        Class<?> interfaze = resolveClass(resolver, paramType);
                        // Create a component type reference/property if the constructor-arg element has a
                            // type attribute OR index attribute declared...
                        if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) ||
                            (conArgElement.getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex())))
                        {
                          if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Reference")) {
                            Reference theReference = createReference(interfaze, conArgElement.getRef());
                            componentType.getReferences().add(theReference);
                          }
                          if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Property")) {
                            // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
                                  // we might need to verify with the component definition later.
                            Reference theReference = createReference(interfaze, conArgElement.getRef());
                              implementation.setUnresolvedBeanRef(conArgElement.getRef(), theReference);
                          }
                        }
                      } // end for
                    } // end if
                } // end while
View Full Code Here

                                    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
                            if (constructorArg != null)
                              constructorArg.addValue(value);
                        } // end if
                        break;
                    case END_ELEMENT:
                        if (SpringImplementationConstants.BEAN_ELEMENT.equals(reader.getName())) {
                            completed = true;
View Full Code Here

TOP

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

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.