tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramku...@apache.org
Subject svn commit: r811232 - in /tuscany/branches/sca-java-1.x/modules: ./ assembly-xml/src/main/resources/ implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/ implementation-spring/src/main/java/org/apach...
Date Fri, 04 Sep 2009 07:01:10 GMT
Author: ramkumar
Date: Fri Sep  4 07:01:10 2009
New Revision: 811232

URL: http://svn.apache.org/viewvc?rev=811232&view=rev
Log:
Fixes for TUSCANY-3250: Support for multiple application context using MANIFEST.MF

Added:
    tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
  (with props)
Modified:
    tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
    tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
    tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
    tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
    tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
    tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
    tuscany/branches/sca-java-1.x/modules/pom.xml

Modified: tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
(original)
+++ tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
Fri Sep  4 07:01:10 2009
@@ -25,5 +25,6 @@
 PolicyImplValidationException = PolicyValidation exception when processing implementation
of component {0} due to {1}. 
 PolicyServiceValidationException = PolicyValidation exceptions when processing service/reference
{0} in {1}. Error is {2}
 ContributionReadException = ContributionReadException occured due to : {0}
+ContributionResolveException = ContributionResolveException occured due to : {0}
 ContributionWriteException = ContributionWriteException occured due to : {0}
 XMLStreamException = XMLStreamException occured due to : {0}

Added: tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java?rev=811232&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
(added)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
Fri Sep  4 07:01:10 2009
@@ -0,0 +1,29 @@
+package org.apache.tuscany.sca.implementation.spring.runtime.context;
+
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+
+public class SCAGenericApplicationContext extends GenericApplicationContext {
+
+	 ClassLoader classloader = null;
+	 
+	 public SCAGenericApplicationContext(DefaultListableBeanFactory beanFactory, 
+             							 ApplicationContext parent,
+             							 ClassLoader classloader) {
+		 super(beanFactory, parent);
+		 this.classloader = classloader;
+	 }
+	 
+	 public SCAGenericApplicationContext(ApplicationContext parent,
+				 						 ClassLoader classloader) {
+		 super(parent);
+		 this.classloader = classloader;
+	 }
+
+	 @Override
+	 protected void postProcessBeanFactory (ConfigurableListableBeanFactory beanFactory) {
+		 beanFactory.setBeanClassLoader(classloader);
+	 }
+}

Propchange: tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
Fri Sep  4 07:01:10 2009
@@ -20,7 +20,6 @@
 package org.apache.tuscany.sca.implementation.spring.runtime.context;
 
 import java.net.URL;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.tuscany.sca.implementation.spring.processor.ComponentNameAnnotationProcessor;
@@ -31,17 +30,11 @@
 import org.apache.tuscany.sca.implementation.spring.processor.PropertyValueStub;
 import org.apache.tuscany.sca.implementation.spring.processor.ReferenceAnnotationProcessor;
 import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.ConstructorArgumentValues;
-import org.springframework.beans.factory.config.TypedStringValue;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.ManagedList;
 import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.context.ApplicationContext;
+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;
 import org.springframework.core.io.UrlResource;
 import org.springframework.core.SpringVersion;
@@ -59,29 +52,7 @@
     private boolean isAnnotationSupported;
     private String versionSupported;
     
-    // TUSCANY-3128
-    // extension of the generic application context just to force the classloader
-    // on the bean factory to stay set to the contribution classloader
-    // instead of being set back to the application classloader
-    private class LocalGenericApplicationContext extends GenericApplicationContext{
-        
-        ClassLoader classloader = null;
-        
-        public LocalGenericApplicationContext(DefaultListableBeanFactory beanFactory, 
-                                              ApplicationContext parent,
-                                              ClassLoader classloader) {
-            super(beanFactory, parent);
-            this.classloader = classloader;
-        }
-        
-        @Override
-        protected void postProcessBeanFactory(
-                ConfigurableListableBeanFactory beanFactory) {
-            beanFactory.setBeanClassLoader(classloader);
-        }
-    }
-    
-    public SpringContextTie(SpringImplementationStub implementation, URL resource, boolean
annotationSupport, String versionSupported) throws Exception {
+    public SpringContextTie(SpringImplementationStub implementation, List<URL> resource,
boolean annotationSupport, String versionSupported) throws Exception {
         this.implementation = implementation;
         this.isAnnotationSupported = annotationSupport;
         this.versionSupported = versionSupported;
@@ -110,61 +81,36 @@
     /**
      * Create appropriate ApplicationContext by reading the bean definitions.
      */
-    private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext
scaParentContext, URL resource) {
+    private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext
scaParentContext, List<URL> resources) {
 
-        XmlBeanFactory beanFactory = new XmlBeanFactory(new UrlResource(resource));
-        beanFactory.setBeanClassLoader(implementation.getClassLoader());
-        AbstractApplicationContext appContext = null;
-        
-        for (String bean : beanFactory.getBeanDefinitionNames()) {
-            String beanClassName = (beanFactory.getType(bean)).getName();
-            // Using FileSystemXmlApplicationContext is not supported, as the 
-            // SCA runtime does not support paths relative to current VM working directory.
-            if (beanClassName.indexOf(".FileSystemXmlApplicationContext") != -1) {
-            	throw new RuntimeException("Usage of FileSystemXmlApplicationContext Bean is
not supported");
-            }
-            	
-            if (beanClassName.indexOf(".ClassPathXmlApplicationContext") != -1) {
-            	BeanDefinition beanDef = beanFactory.getBeanDefinition(bean);              
            
-                String[] configLocations = null;
-                List<ConstructorArgumentValues.ValueHolder> 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)
-                        	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(configLocations, true, scaParentContext);
            
-	            if (isAnnotationSupported)
-	            	includeAnnotationProcessors(appContext.getBeanFactory());
-	            return appContext;
-            }               
-        }
+    	XmlBeanFactory beanFactory = null;
+    	AbstractApplicationContext appContext = null;
+    	
+    	if (resources.size() > 1) 
+    	{
+    		GenericApplicationContext appCtx = 
+    			new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader());
+    		XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
+    		for (URL resource : resources) {
+    			xmlReader.loadBeanDefinitions(new UrlResource(resource));
+    		}
+    		xmlReader.setBeanClassLoader(implementation.getClassLoader());    		
+    		if (isAnnotationSupported)
+            	includeAnnotationProcessors(appCtx.getBeanFactory());
+    		return appCtx;
+    		
+    	} else {
+    		beanFactory = new XmlBeanFactory(new UrlResource(resources.get(0)));
+            beanFactory.setBeanClassLoader(implementation.getClassLoader());
+    	}
         
         // use the generic application context as default 
-        if (isAnnotationSupported)
-        {            
+        if (isAnnotationSupported) {            
         	includeAnnotationProcessors(beanFactory);
-        }
-        
-        appContext = new LocalGenericApplicationContext(beanFactory, 
-                                                        scaParentContext,
-                                                        implementation.getClassLoader());
+        }        
+        appContext = new SCAGenericApplicationContext(beanFactory, 
+                                                      scaParentContext,
+                                                      implementation.getClassLoader());
         return appContext;
     }
 

Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
Fri Sep  4 07:01:10 2009
@@ -44,7 +44,7 @@
     // The location attribute which points to the Spring application-context XML file
     private String location;
     // The application-context file as a Spring Resource
-    private URL resource;
+    private List<URL> resource;
     private ComponentType componentType;
     // Mapping of Services to Beans
     private Hashtable<String, SpringBeanElement> serviceMap;
@@ -78,11 +78,11 @@
         return;
     }
 
-    public void setResource(URL resource) {
+    public void setResource(List<URL> resource) {
         this.resource = resource;
     }
 
-    public URL getResource() {
+    public List<URL> getResource() {
         return resource;
     }
 

Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
Fri Sep  4 07:01:10 2009
@@ -51,7 +51,6 @@
 import org.apache.tuscany.sca.assembly.Property;
 import org.apache.tuscany.sca.assembly.Reference;
 import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.impl.ServiceImpl;
 import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
@@ -157,21 +156,23 @@
         List<SpringSCAPropertyElement> scaproperties = new ArrayList<SpringSCAPropertyElement>();
 
         URL resource;
-
+        List<URL> contextResources = new ArrayList<URL>();
         String contextPath = implementation.getLocation();
 
         try {
             resource = resolveLocation(resolver, contextPath);
-            resource = getApplicationContextResource(resource);
+            contextResources = getApplicationContextResource(resource);
 
             implementation.setClassLoader(new ContextClassLoader(resolver));
-            implementation.setResource(resource);
+            implementation.setResource(contextResources);
             // The URI is used to uniquely identify the Implementation
             implementation.setURI(resource.toString());
-            reader = xmlInputFactory.createXMLStreamReader(resource.openStream());
-
-            // System.out.println("Spring TypeLoader - starting to read context file");
-            readContextDefinition(resolver, reader, contextPath, beans, services, references,
scaproperties);
+            
+            for (URL contextResource : contextResources) {
+            	reader = xmlInputFactory.createXMLStreamReader(contextResource.openStream());
+            	// System.out.println("Spring TypeLoader - starting to read context file");
+            	readContextDefinition(resolver, reader, contextPath, beans, services, references,
scaproperties);
+            }
 
         } catch (IOException e) {
             throw new ContributionReadException(e);
@@ -215,7 +216,7 @@
     private XMLStreamReader getApplicationContextReader(ModelResolver resolver, String location)
throws ContributionReadException {
 
         try {
-            URL resource = getApplicationContextResource(resolveLocation(resolver, location));
+            URL resource = getApplicationContextResource(resolveLocation(resolver, location)).get(0);
             XMLStreamReader reader =
             	xmlInputFactory.createXMLStreamReader(resource.openStream());
             return reader;
@@ -338,13 +339,6 @@
                             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) {
-                                        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))
{
@@ -356,17 +350,8 @@
                         } else if (SpringImplementationConstants.VALUE_ELEMENT.equals(qname))
{
                             String value = reader.getElementText();
                             // Check if the parent element is a constructor-arg
-                            if (constructorArg != null) {
+                            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) {
-                                        XMLStreamReader creader = getApplicationContextReader(resolver,
value);
-                                        // Read the context definition for the constructor-arg
resources
-                                        readContextDefinition(resolver, creader, contextPath,
beans, services, references, scaproperties);
-                                    }
-                                }
-                            }
                         } // end if
                         break;
                     case END_ELEMENT:
@@ -568,10 +553,10 @@
                     		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()))
||
+                    	    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);
@@ -667,19 +652,19 @@
      * @param locationAttr - the location attribute from the <implementation.spring../>
element
      * @param cl - the ClassLoader for the Spring implementation
      */
-    protected URL getApplicationContextResource(URL url)
+    protected List<URL> getApplicationContextResource(URL url)
         throws ContributionReadException {
         File manifestFile = null;
         File appXmlFile;
         File locationFile = null;
+        List<URL> appCtxResources = new ArrayList<URL>();
 
         if (url != null) {
             String path = url.getPath();
             locationFile = new File(path);
         } else {
-            throw new ContributionReadException(
-                    "SpringXMLLoader getApplicationContextResource: " + "unable to find resource
file "
-                        + url);
+            throw new ContributionReadException("SpringXMLComponentTypeLoader getApplicationContextResource:
" 
+            		            + "unable to find resource file " + url);
         }
 
         if (locationFile.isDirectory()) {
@@ -689,18 +674,23 @@
                     Manifest mf = new Manifest(new FileInputStream(manifestFile));
                     Attributes mainAttrs = mf.getMainAttributes();
                     String appCtxPath = mainAttrs.getValue("Spring-Context");
-                    if (appCtxPath != null) {
-                        appXmlFile = new File(locationFile, appCtxPath);
-                        if (appXmlFile.exists()) {
-                            return appXmlFile.toURL();
-                        }
+                    if (appCtxPath != null) {                    	
+	            		String[] cxtPaths = appCtxPath.split(";");
+	            		for (String path : cxtPaths) {
+	            			appXmlFile = new File(locationFile, path);
+	            			if (appXmlFile.exists()) {
+	            				appCtxResources.add(appXmlFile.toURI().toURL());
+	            			}
+	            		}
+	            		return appCtxResources;
                     }
                 }
                 // no manifest-specified Spring context, use default
                 appXmlFile = new File(locationFile, "META-INF" + File.separator + "spring"
                                                         + File.separator + SpringImplementationConstants.APPLICATION_CONTEXT);
                 if (appXmlFile.exists()) {
-                    return appXmlFile.toURL();
+                	appCtxResources.add(appXmlFile.toURI().toURL());
+                	return appCtxResources;
                 }
             } catch (IOException e) {
                 throw new ContributionReadException("Error reading manifest " + manifestFile);
@@ -715,18 +705,22 @@
                         Attributes mainAttrs = mf.getMainAttributes();
                         String appCtxPath = mainAttrs.getValue("Spring-Context");
                         if (appCtxPath != null) {
-                            je = jf.getJarEntry(appCtxPath);
-                            if (je != null) {
-                                // TODO return a Spring specific Resource type for jars
-                                return new URL("jar:" + locationFile.toURI().toURL() + "!/"
+ appCtxPath);
-                            }
+                        	String[] cxtPaths = appCtxPath.split(";");
+    	            		for (String path : cxtPaths) {
+    	            			je = jf.getJarEntry(path);
+    	            			if (je != null) {
+    	            				appCtxResources.add(new URL("jar:" + locationFile.toURI().toURL() +
"!/" + appCtxPath));
+    	            			}
+    	            		}
+    	            		return appCtxResources;
                         }
                     }
                     // Look for the default applicaiton-context.xml file, when MANIFEST.MF
is absent.
                     je = jf.getJarEntry("META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
                     if (je != null) {
-                        return new URL("jar:" + locationFile.toURI().toURL() + "!/" +
-                        		"META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
+                    	appCtxResources.add(new URL("jar:" + locationFile.toURI().toURL() +
"!/" +
+                        		"META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT));
+                    	return appCtxResources;                        
                     }
                 } catch (IOException e) {
                     // TODO: create a more appropriate exception type
@@ -736,7 +730,8 @@
         	}
         	else {
         		if (locationFile.getName().endsWith(".xml")) {
-        			return url;
+        			appCtxResources.add(url);
+                	return appCtxResources;
         		}
         		else {
         			// Deal with the directory inside a jar file, in case the contribution itself
is a JAR file.
@@ -751,18 +746,23 @@
 	        					Attributes mainAttrs = mf.getMainAttributes();
 	                            String appCtxPath = mainAttrs.getValue("Spring-Context");
 	                            if (appCtxPath != null) {
-	                                je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
+ "/" + appCtxPath);
-	                                if (je != null) {
-	                                    return new URL("jar:" + url.getPath() + "/" + appCtxPath);
-	                                }
+	                            	String[] cxtPaths = appCtxPath.split(";");
+	        	            		for (String path : cxtPaths) {
+		                                je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
+ "/" + path);
+		                                if (je != null) {
+		                                	appCtxResources.add(new URL("jar:" + url.getPath() + "/"
+ path));
+		    	                        	return appCtxResources;
+		                                }
+	        	            		}
 	                            }
 	        				}
 	        			    // Look for the default applicaiton-context.xml file, when MANIFEST.MF is
absent.
         			    	je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
+ "/" + 
                         			"META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
                             if (je != null) {
-                                return new URL("jar:" + url.getPath() + "/" + 
-                                	"META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
+                            	appCtxResources.add(new URL("jar:" + url.getPath() + "/" + 
+                                    	"META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT));
+	                        	return appCtxResources;
                             }
 	        			}
             		} catch (IOException e) {
@@ -772,8 +772,8 @@
         	}
         }
 
-        throw new ContributionReadException("SpringXMLLoader getApplicationContextResource:
"
-                                        + "META-INF/spring/" + SpringImplementationConstants.APPLICATION_CONTEXT
+ "not found");
+        throw new ContributionReadException("SpringXMLComponentTypeLoader getApplicationContextResource:
" 
+        		                            + "unable to read resource file " + url);
     } // end method getApplicationContextResource
 
     /**

Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
Fri Sep  4 07:01:10 2009
@@ -22,7 +22,7 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.net.URL;
+import java.util.List;
 
 import org.apache.tuscany.sca.core.invocation.ProxyFactory;
 import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
@@ -69,7 +69,7 @@
             Object stub = stubConstructor.newInstance(new SpringImplementationTie(implementation,
component, propertyValueObjectFactory));
 
             Class<?> tieClass = Class.forName("org.apache.tuscany.sca.implementation.spring.runtime.context.SpringContextTie",
true, cl);
-            Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass,
URL.class, boolean.class, String.class});
+            Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass,
List.class, boolean.class, String.class});
             this.tie = tieConstructor.newInstance(stub, implementation.getResource(), annotationSupport,
versionSupported);
             
             this.startMethod = tieClass.getMethod("start");

Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
(original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
Fri Sep  4 07:01:10 2009
@@ -31,6 +31,7 @@
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -66,11 +67,11 @@
 
     private ModelFactoryExtensionPoint factories;
 
-    public SpringImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor
monitor) {
-        this.factories = modelFactories;
-        this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
-        this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
-        this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+    public SpringImplementationProcessor(ExtensionPointRegistry extensionPoints, Monitor
monitor) {
+        this.factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
   	
+        this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
+        this.javaFactory = factories.getFactory(JavaInterfaceFactory.class);
+        this.policyFactory = factories.getFactory(PolicyFactory.class);
         this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
         this.monitor = monitor;
     }

Modified: tuscany/branches/sca-java-1.x/modules/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/pom.xml?rev=811232&r1=811231&r2=811232&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/pom.xml (original)
+++ tuscany/branches/sca-java-1.x/modules/pom.xml Fri Sep  4 07:01:10 2009
@@ -155,7 +155,7 @@
                 <module>implementation-resource-runtime</module>
                 <module>implementation-script</module>
                 <module>implementation-spring</module>
-		        <module>implementation-spring-runtime</module>
+		    <module>implementation-spring-runtime</module>
                 <module>implementation-web</module>
                 <module>implementation-web-runtime</module>
                 <module>implementation-widget</module>
@@ -182,8 +182,8 @@
                 <module>policy-transaction</module>
                 <module>sca-api</module>
                 <module>sca-api-extension</module>
-                <module>web-javascript</module>
-                <module>web-javascript-dojo</module>                
+                <!--module>web-javascript</module>
+                <module>web-javascript-dojo</module-->                
                 <module>workspace</module>
                 <module>workspace-impl</module>
                 <module>workspace-xml</module>



Mime
View raw message