modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java [72:150]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
        beanFactory.setBeanClassLoader(classloader);
    }

    public void addSCAPropertyElement(SpringSCAPropertyElement propertyElement) {
        propertyElements.add(propertyElement);
    }

    public void addSCAServiceElement(SpringSCAServiceElement serviceElement) {
        serviceElements.add(serviceElement);
    }

    public void addSCAReferenceElement(SpringSCAReferenceElement referenceElement) {
        referenceElements.add(referenceElement);
    }

    public synchronized List<SpringBeanElement> getBeanElements() {
        if (beanElements == null) {
            beanElements = new ArrayList<SpringBeanElement>();
            for (String name : getBeanDefinitionNames()) {
                BeanDefinition def = getBeanDefinition(name);
                SpringBeanElement beanElement = new SpringBeanElement(name, def.getBeanClassName());
                beanElements.add(beanElement);
                beanElement.setAbstractBean(def.isAbstract());
                beanElement.setFactoryBeanAttribute(def.getFactoryBeanName() != null);
                beanElement.setFactoryMethodAttribute(def.getFactoryMethodName() != null);
                beanElement.setParentAttribute(def.getParentName() != null);
                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()) {
                    SpringPropertyElement propertyElement = new SpringPropertyElement(p.getName());
                    Object value = p.getValue();
                    configurePropertyElement(propertyElement, value);
                    beanElement.getProperties().add(propertyElement);
                }
            }
        }
        return beanElements;
    }

    public void configurePropertyElement(SpringPropertyElement propertyElement, Object value) {
        if (value instanceof BeanReference) {
            BeanReference beanRef = (BeanReference)value;
            propertyElement.addRef(beanRef.getBeanName());
        } else if (value instanceof Collection) {
            Collection collection = (Collection)value;
            for (Object item : collection) {
                configurePropertyElement(propertyElement, item);
            }
        } else if (value instanceof TypedStringValue) {
            TypedStringValue stringValue = (TypedStringValue)value;
            propertyElement.addValue(stringValue.getValue());
        } else {
            if (value != null) {
                propertyElement.addValue(value.toString());
            }
        }
    }

    public List<SpringSCAPropertyElement> getPropertyElements() {
        return propertyElements;
    }

    public List<SpringSCAServiceElement> getServiceElements() {
        return serviceElements;
    }

    public List<SpringSCAReferenceElement> getReferenceElements() {
        return referenceElements;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java [66:144]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
        beanFactory.setBeanClassLoader(classloader);
    }

    public void addSCAPropertyElement(SpringSCAPropertyElement propertyElement) {
        propertyElements.add(propertyElement);
    }

    public void addSCAServiceElement(SpringSCAServiceElement serviceElement) {
        serviceElements.add(serviceElement);
    }

    public void addSCAReferenceElement(SpringSCAReferenceElement referenceElement) {
        referenceElements.add(referenceElement);
    }

    public synchronized List<SpringBeanElement> getBeanElements() {
        if (beanElements == null) {
            beanElements = new ArrayList<SpringBeanElement>();
            for (String name : getBeanDefinitionNames()) {
                BeanDefinition def = getBeanDefinition(name);
                SpringBeanElement beanElement = new SpringBeanElement(name, def.getBeanClassName());
                beanElements.add(beanElement);
                beanElement.setAbstractBean(def.isAbstract());
                beanElement.setFactoryBeanAttribute(def.getFactoryBeanName() != null);
                beanElement.setFactoryMethodAttribute(def.getFactoryMethodName() != null);
                beanElement.setParentAttribute(def.getParentName() != null);
                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()) {
                    SpringPropertyElement propertyElement = new SpringPropertyElement(p.getName());
                    Object value = p.getValue();
                    configurePropertyElement(propertyElement, value);
                    beanElement.getProperties().add(propertyElement);
                }
            }
        }
        return beanElements;
    }

    public void configurePropertyElement(SpringPropertyElement propertyElement, Object value) {
        if (value instanceof BeanReference) {
            BeanReference beanRef = (BeanReference)value;
            propertyElement.addRef(beanRef.getBeanName());
        } else if (value instanceof Collection) {
            Collection collection = (Collection)value;
            for (Object item : collection) {
                configurePropertyElement(propertyElement, item);
            }
        } else if (value instanceof TypedStringValue) {
            TypedStringValue stringValue = (TypedStringValue)value;
            propertyElement.addValue(stringValue.getValue());
        } else {
            if (value != null) {
                propertyElement.addValue(value.toString());
            }
        }
    }

    public List<SpringSCAPropertyElement> getPropertyElements() {
        return propertyElements;
    }

    public List<SpringSCAServiceElement> getServiceElements() {
        return serviceElements;
    }

    public List<SpringSCAReferenceElement> getReferenceElements() {
        return referenceElements;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



