From eec6912ddff319e4992a19064c470a4fdad1542b Mon Sep 17 00:00:00 2001 From: ramkumar Date: Fri, 3 Jul 2009 10:48:57 +0000 Subject: Updated fixes for TUSCANY-3069 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@790853 13f79535-47bb-0310-9956-ffa450edef68 --- .../spring/runtime/context/SpringContextTie.java | 40 ++++++++++------------ 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'branches/sca-java-1.x/modules') diff --git a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java index f250db1631..5961c52cc4 100644 --- a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java +++ b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java @@ -38,7 +38,6 @@ import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.GenericApplicationContext; @@ -103,33 +102,30 @@ public class SpringContextTie { if (beanClassName.indexOf(".ClassPathXmlApplicationContext") != -1) { BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); - String[] listValues = null; + String[] configLocations = null; List conArgs = beanDef.getConstructorArgumentValues().getGenericArgumentValues(); for (ConstructorArgumentValues.ValueHolder conArg : conArgs) { - if (conArg.getValue() instanceof TypedStringValue) { - TypedStringValue value = (TypedStringValue) conArg.getValue(); - if (value.getValue().indexOf(".xml") != -1) - listValues = new String[]{value.getValue()}; - } - if (conArg.getValue() instanceof ManagedList) { - Iterator itml = ((ManagedList)conArg.getValue()).iterator(); - StringBuffer values = new StringBuffer(); - while (itml.hasNext()) { - TypedStringValue next = (TypedStringValue)itml.next(); - if (next.getValue().indexOf(".xml") != -1) { - values.append(next.getValue()); - values.append("~"); - } - } - listValues = (values.toString()).split("~"); + if (conArg.getValue() instanceof TypedStringValue) { + TypedStringValue value = (TypedStringValue) conArg.getValue(); + if (value.getValue().indexOf(".xml") != -1) + configLocations = new String[]{value.getValue()}; + } + if (conArg.getValue() instanceof ManagedList) { + Iterator itml = ((ManagedList)conArg.getValue()).iterator(); + StringBuffer values = new StringBuffer(); + while (itml.hasNext()) { + TypedStringValue next = (TypedStringValue)itml.next(); + if (next.getValue().indexOf(".xml") != -1) { + values.append(implementation.getClassLoader().getResource(next.getValue()).toString()); + values.append("~"); + } } + configLocations = (values.toString()).split("~"); + } } - appContext = new ClassPathXmlApplicationContext(listValues, false, scaParentContext); - appContext.setClassLoader(implementation.getClassLoader()); - appContext.refresh(); - //appContext.getBeanFactory().setBeanClassLoader(implementation.getClassLoader()); + appContext = new ClassPathXmlApplicationContext(configLocations, true, scaParentContext); if (isAnnotationSupported) includeAnnotationProcessors(appContext.getBeanFactory()); return appContext; -- cgit v1.2.3