You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2007/05/31 23:51:50 UTC

svn commit: r543273 [2/2] - in /incubator/tuscany/sandbox/implementation-spring2: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/implementation/ src/main/...

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAReferenceElement.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAReferenceElement.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAReferenceElement.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAReferenceElement.java Thu May 31 14:51:47 2007
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.implementation.spring;
+
+
+/**
+ * Represents a <sca:reference> element in a Spring application-context
+ * - this has id and className attributes
+ * - plus zero or more property elements as children
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringSCAReferenceElement {
+
+    private String name;
+    private String type;
+    
+    public SpringSCAReferenceElement( String name, String type ) {
+    	this.name = name;
+    	this.type = type;
+    }
+    
+    public String getName() {
+    	return name;
+    }
+    
+    public String getType() {
+    	return type;
+    }
+    
+} // end class SpringSCAReferenceElement
\ No newline at end of file

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAReferenceElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAReferenceElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAServiceElement.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAServiceElement.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAServiceElement.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAServiceElement.java Thu May 31 14:51:47 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.implementation.spring;
+
+
+/**
+ * Represents a <sca:service> element in a Spring application-context
+ * - this has id and className attributes
+ * - plus zero or more property elements as children
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringSCAServiceElement {
+
+    private String name;
+    private String type;
+    private String target;
+    
+    public SpringSCAServiceElement( String name, String type, String target ) {
+    	this.name = name;
+    	this.type = type;
+    	this.target = target;
+    }
+    
+    public String getName() {
+    	return name;
+    }
+    
+    public String getType() {
+    	return type;
+    }
+    
+    public String getTarget() {
+    	return target;
+    }
+    
+} // end class SpringSCAServiceElement
\ No newline at end of file

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAServiceElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringSCAServiceElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringXMLComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringXMLComponentTypeLoader.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringXMLComponentTypeLoader.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringXMLComponentTypeLoader.java Thu May 31 14:51:47 2007
@@ -0,0 +1,454 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.implementation.spring;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * Introspects a Spring XML application-context configuration file to create <implementation-spring../>
+ * component type information. 
+ * 
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringXMLComponentTypeLoader {
+    private static final String SCA_NS = "http://www.springframework.org/schema/sca";
+    private static final String SPRING_NS = "http://www.springframework.org/schema/beans";
+    private static final QName SERVICE_ELEMENT = new QName(SCA_NS, "service");
+    private static final QName REFERENCE_ELEMENT = new QName(SCA_NS, "reference");
+    private static final QName BEANS_ELEMENT = new QName(SPRING_NS, "beans");
+    private static final QName BEAN_ELEMENT = new QName(SPRING_NS, "bean");
+    private static final QName PROPERTY_ELEMENT = new QName(SPRING_NS, "property");
+    private static final String APPLICATION_CONTEXT = "application-context.xml";
+
+    private AssemblyFactory 			assemblyFactory;
+    private JavaInterfaceIntrospector 	interfaceIntrospector;
+    private JavaInterfaceFactory 		javaFactory;
+    private PolicyFactory 				policyFactory;
+    private ClassLoader 				cl;
+    
+    private SpringBeanIntrospector		beanIntrospector;
+
+    public SpringXMLComponentTypeLoader( AssemblyFactory 	  assemblyFactory,
+    									 JavaInterfaceIntrospector interfaceIntrospector,
+    									 JavaInterfaceFactory javaFactory,
+    									 PolicyFactory 		  policyFactory) {
+        super();
+        this.assemblyFactory 		= assemblyFactory;
+        this.interfaceIntrospector 	= interfaceIntrospector;
+        this.javaFactory 			= javaFactory;
+        this.policyFactory			= policyFactory;
+        beanIntrospector = new SpringBeanIntrospector( assemblyFactory,
+   			 interfaceIntrospector, javaFactory, policyFactory );
+    }
+
+    protected Class<SpringImplementation> getImplementationClass() {
+        return SpringImplementation.class;
+    }
+
+    /**
+     * Base method which loads the component type from the application-context attached to the 
+     * Spring implementation
+     * 
+     */
+    public void load( SpringImplementation implementation ) throws ContributionReadException {
+    	System.out.println("Spring TypeLoader - load method called");
+    	ComponentType componentType = implementation.getComponentType();
+    	/* Check that there is a component type object already set	*/
+        if ( componentType == null) {
+            throw new ContributionReadException("SpringXMLLoader load: implementation has no ComponentType object");
+        } 
+    	if ( componentType.isUnresolved() ) {
+	    	/* Fetch the location of the application-context file from the implementation */
+	        String location = implementation.getSpringLocation();
+	        loadFromXML( componentType, location );
+    	} // end if
+    } // end method load
+
+    /**
+     * Method which fills out the component type for a Spring implementation by reading the 
+     * Spring application-context.xml file
+     * @param componentType - the component type to complete
+     * @parma location - a string containing the relative location of the application-context.xml
+     * file
+     */
+    private void loadFromXML( ComponentType componentType, String location )
+        throws ContributionReadException {
+        XMLStreamReader reader;
+        List<SpringBeanElement> beans = new ArrayList<SpringBeanElement>();
+        List<SpringSCAServiceElement> services = new ArrayList<SpringSCAServiceElement>();
+        List<SpringSCAReferenceElement> references = new ArrayList<SpringSCAReferenceElement>();
+        SpringBeanElement bean = null;
+        
+        try {
+            // FIXME - is the ContextClassLoader the right place to start the search?
+        	cl = Thread.currentThread().getContextClassLoader();
+
+            Resource resource = getApplicationContextResource( location, cl );
+        	// FIXME - need a better way to handle the XMLInputFactory than allocating a new one every time
+            XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
+            reader = xmlFactory.createXMLStreamReader(resource.getInputStream());
+            
+            System.out.println("Spring TypeLoader - starting to read context file");
+            
+            boolean completed = false;
+            while ( !completed ) {
+                switch (reader.next()) {
+                case START_ELEMENT:
+                    QName qname = reader.getName();
+                    System.out.println("Spring TypeLoader - found element with name: " + qname.toString());
+                    if (SERVICE_ELEMENT.equals(qname)) {
+                        SpringSCAServiceElement service = new SpringSCAServiceElement(
+                        		reader.getAttributeValue(SCA_NS, "name"),
+                        		reader.getAttributeValue(SCA_NS, "type"),
+                        		reader.getAttributeValue(SCA_NS, "target") );
+                        services.add( service );
+                    } else if (REFERENCE_ELEMENT.equals(qname)) {
+                        SpringSCAReferenceElement reference = new SpringSCAReferenceElement(
+                        		reader.getAttributeValue(SCA_NS, "name"),
+                        		reader.getAttributeValue(SCA_NS, "type") );
+                        references.add( reference );
+                    } else if (BEAN_ELEMENT.equals(qname)) {
+                    	// TODO FIX THIS !!
+                    	int count=reader.getAttributeCount();
+                    	bean = new SpringBeanElement(
+                    			reader.getAttributeValue( null, "id"),
+                    			reader.getAttributeValue( null, "class") );
+                    	beans.add( bean );
+                    } else if (PROPERTY_ELEMENT.equals(qname)) {
+                    	SpringPropertyElement property = new SpringPropertyElement(
+                    			reader.getAttributeValue(SPRING_NS, "name"),
+                    			reader.getAttributeValue(SPRING_NS, "ref"));
+                    	bean.addProperty( property );
+                    } // end if
+                    break;
+                case END_ELEMENT:
+                    if (BEANS_ELEMENT.equals(reader.getName())) {
+                    	System.out.println("Spring TypeLoader - finished read of context file");
+                        //type.setExposeAllBeans(exposeAllBeans);
+                    	completed = true;
+                        break;
+                    } // end if
+                } // end switch
+            } // end while
+
+        } catch (IOException e) {
+            throw new ContributionReadException(e);
+        } catch (XMLStreamException e) {
+            throw new ContributionReadException(e);
+        }
+        
+        /* At this point, the complete application-context.xml file has been read and its contents  */
+        /* stored in the lists of beans, services, references.  These are now used to generate      */
+        /* the implied componentType for the application context								    */
+        componentType = generateComponentType( componentType, beans, services, references );
+        
+        return;
+    } // end method loadFromXML
+    
+    /**
+     * Generates the Spring implementation component type from the configuration contained in the
+     * lists of beans, services and references derived from the application context
+     */
+    private ComponentType generateComponentType( ComponentType componentType,
+    		                                     List<SpringBeanElement> beans,
+    		                                     List<SpringSCAServiceElement> services,
+    		                                     List<SpringSCAReferenceElement> references )
+    	throws ContributionReadException {
+    	/*
+    	 * Each service becomes a service in the component type
+    	 * Each reference becomes a reference in the component type
+    	 * Each bean becomes a service, unless it is the target of a service element or unless it
+    	 * is the target of a bean reference property
+    	 * Each bean property which is a reference not pointing at another bean in the 
+    	 * application context becomes a reference unless it is pointing at one of the references
+    	 */
+    	
+    	try {
+	    	// Deal with the services first....												
+	    	Iterator<SpringSCAServiceElement> its = services.iterator(); 
+	    	while( its.hasNext() ) {
+	    		SpringSCAServiceElement serviceElement = its.next();
+	    		Class<?> interfaze = cl.loadClass( serviceElement.getType() );
+	    		Service theService = createService( interfaze, serviceElement.getName() );
+	    		componentType.getServices().add( theService );
+	    	} // end while
+	    	
+	    	// Next handle the references
+	    	Iterator<SpringSCAReferenceElement> itr = references.iterator(); 
+	    	while( itr.hasNext() ) {
+	    		SpringSCAReferenceElement referenceElement = itr.next();
+	    		Class<?> interfaze = cl.loadClass( referenceElement.getType() );
+	    		Reference theReference = createReference( interfaze, referenceElement.getName() );
+	    		componentType.getReferences().add( theReference );
+	    	} // end while
+	    	
+	    	// Finally deal with the beans
+	    	Iterator<SpringBeanElement> itb;
+	    	// If there are no explicit service elements, then expose all the beans
+	    	if( services.isEmpty() ) {
+	    		itb = beans.iterator();
+	    		// Loop through all the beans found
+	    		while( itb.hasNext() ) {
+	    			SpringBeanElement beanElement = itb.next();
+	    			// Load the Spring bean class
+	    			Class<?> beanClass = cl.loadClass( beanElement.getClassName() );
+	    			// Introspect the bean 
+	    			ComponentType beanComponentType = assemblyFactory.createComponentType();
+	    			beanIntrospector.introspectBean( beanClass, beanComponentType );
+	    			// Get the service interface defined by this Spring Bean and add to
+	    			// the component type of the Spring Assembly
+	    			List<Service> beanServices = beanComponentType.getServices();
+	    			componentType.getServices().addAll( beanServices );
+	    		} // end while
+	    	} // end if
+	    	// Now check to see if there are any more references
+	    	itb = beans.iterator();
+	    	while( itb.hasNext() ) {
+	    		SpringBeanElement beanElement = itb.next();
+	    		if( !beanElement.getProperties().isEmpty() ) {
+	    			Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
+	    			while( itp.hasNext() ) {
+	    				SpringPropertyElement propertyElement = itp.next();
+	    				if( propertyRefUnresolved( propertyElement.getRef(), beans, references ) ) {
+	    					// This means an unresolved reference from the spring bean...
+	    					
+	    				} // end if
+	    			} // end while 
+	    		} // end if
+	    		
+	    		//Reference theReference = createReference( interfaze, referenceElement.getName() );
+	    		//componentType.getReferences().add( theReference );
+	    	} // end while
+		
+    	} catch ( ClassNotFoundException e ) {
+    		// Means that either an interface class or a bean was not found
+    		throw new ContributionReadException( e );
+    	} catch ( InvalidInterfaceException e ) {
+    		throw new ContributionReadException( e );
+    	} catch ( ContributionResolveException e ) {
+    		
+    	} // end try
+    	
+    	// If we get here, the Spring assembly component type is resolved
+    	componentType.setUnresolved( false );
+    	return componentType;
+    } // end method generateComponentType
+    
+    /*
+     * Determines whether a reference attribute of a Spring property element is resolved either
+     * by a bean in the application context or by an SCA reference element
+     * @param ref - a String containing the name of the reference - may be null
+     * @param beans - a List of SpringBean elements
+     * @param references - a List of SCA reference elements
+     * @return true if the property is not resolved, false if it is resolved
+     */
+    private boolean propertyRefUnresolved( String ref, 
+    									   List<SpringBeanElement> beans, 
+    									   List<SpringSCAReferenceElement> references ) {
+    	boolean unresolved = true;
+    	
+    	if( ref != null ) {
+    		// Scan over the beans looking for a match
+	    	Iterator<SpringBeanElement> itb = beans.iterator();
+    		while( itb.hasNext() ) {
+    			SpringBeanElement beanElement = itb.next();
+    			// Does the bean name match the ref?
+    			if( ref.equals(beanElement.getId()) ) { 
+    				unresolved = false;
+    				break;
+    			} // end if
+    		} // end while
+	    	// Scan over the references looking for a match
+    		if( unresolved ) {
+    			Iterator<SpringSCAReferenceElement> itr = references.iterator();
+    			while( itr.hasNext() ) {
+    				SpringSCAReferenceElement referenceElement = itr.next();
+    				if( ref.equals(referenceElement.getName()) ) {
+    					unresolved = false;
+    					break;
+    				} // end if
+    			} // end while
+    		} // end if
+    	} // end if
+    	
+    	return unresolved;
+    	
+    } // end method propertyRefUnresolved
+    
+    /**
+     * Gets hold of the application-context.xml file as a Spring resource
+     * @param locationAttr - the location attribute from the <implementation.spring../> element
+     * @param cl - the classloader for the Spring implementation
+     */
+    protected Resource getApplicationContextResource( String locationAttr, ClassLoader cl ) 
+    	throws ContributionReadException {
+        File manifestFile = null;
+        File appXmlFile;
+        File locationFile = new File(locationAttr);
+        
+        if (!locationFile.exists()) {
+            // FIXME hack
+            URL url = cl.getResource(locationAttr);
+            if (url != null) {
+                return new UrlResource(url);
+            }
+            throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
+            		+ "unable to find resource file " + locationFile.toString());
+        }
+
+        if (locationFile.isDirectory()) {
+            try {
+                manifestFile = new File(locationFile, "META-INF/MANIFEST.MF");
+                if (manifestFile.exists()) {
+                    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 new UrlResource(appXmlFile.toURL());
+                        }
+                    }
+                }
+                // no manifest-specified Spring context, use default
+                appXmlFile = new File(locationFile, APPLICATION_CONTEXT);
+                if (appXmlFile.exists()) {
+                    return new UrlResource(appXmlFile.toURL());
+                }
+            } catch (IOException e) {
+                throw new ContributionReadException("Error reading manifest " + manifestFile);
+            }
+        } else {
+            try {
+                JarFile jf = new JarFile(locationFile);
+                JarEntry je;
+                Manifest mf = jf.getManifest();
+                if (mf != null) {
+                    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 Resouce type for jars
+                            return new UrlResource(new URL("jar:" + locationFile.toURL() + "!/" + appCtxPath));
+                        }
+                    }
+                }
+                je = jf.getJarEntry(APPLICATION_CONTEXT);
+                if (je != null) {
+                    return new UrlResource(new URL("jar:" + locationFile.toURI().toURL() + "!" + APPLICATION_CONTEXT));
+                }
+            } catch (IOException e) {
+                // bad archive
+                // TODO: create a more appropriate exception type
+                throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
+                		+ " IO exception reading context file.", e);
+            }
+        }
+
+        throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
+        		+ APPLICATION_CONTEXT + "not found");
+    } // end method getApplicationContextResource
+    
+    /**
+     * Creates a Service for the component type based on its name and Java interface
+     */
+    public Service createService( Class<?> interfaze, String name ) 
+    	throws InvalidInterfaceException {
+        Service service = assemblyFactory.createService();
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        service.setInterfaceContract(interfaceContract);
+
+        // Set the name for the service
+        service.setName( name );
+
+        // Set the call interface and, if present, the callback interface
+        JavaInterface callInterface = interfaceIntrospector.introspect(interfaze);
+        service.getInterfaceContract().setInterface(callInterface);
+        if (callInterface.getCallbackClass() != null) {
+            JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+            service.getInterfaceContract().setCallbackInterface(callbackInterface);
+        }
+        return service;
+    } // end method createService
+    
+    /**
+     * Creates a Reference for the component type based on its name and Java interface
+     */
+    private org.apache.tuscany.sca.assembly.Reference createReference( Class<?> interfaze, String name ) 
+    	throws InvalidInterfaceException {
+        org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        reference.setInterfaceContract(interfaceContract);
+        
+        // Set the name of the reference to the supplied name and the multiplicity of the reference
+        // to 1..1 - for Spring implementations, this is the only multiplicity supported
+        reference.setName(name);
+        reference.setMultiplicity(Multiplicity.ONE_ONE);
+        
+        // Set the call interface and, if present, the callback interface
+        JavaInterface callInterface = interfaceIntrospector.introspect( interfaze );
+        reference.getInterfaceContract().setInterface( callInterface );
+        if (callInterface.getCallbackClass() != null) {
+            JavaInterface callbackInterface = 
+            	interfaceIntrospector.introspect(callInterface.getCallbackClass());
+            reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+        }
+    
+        return reference;
+    }
+} // end class SpringXMLComponentTypeLoader
\ No newline at end of file

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringXMLComponentTypeLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/java/org/apache/tuscany/implementation/spring/SpringXMLComponentTypeLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/sca/spring.system.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/sca/spring.system.scdl?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/sca/spring.system.scdl (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/sca/spring.system.scdl Thu May 31 14:51:47 2007
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ -->
+<!--
+    Spring implementation extension configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+           name="org.apache.tuscany.launcher.SpringImplementation"
+			  autowire="true">
+
+   <!-- <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+        <group>org.apache.tuscany.sca.extensions.spring</group>
+        <name>tuscany-spring</name>
+        <version>1.0-incubator-SNAPSHOT</version>
+    </dependency>  -->
+
+    <component name="spring.implementationLoader">
+        <system:implementation.system class="org.apache.tuscany.container.spring.loader.SpringImplementationLoader"/>
+    </component>
+
+    <component name="spring.componentTypeLoader">
+        <system:implementation.system class="org.apache.tuscany.container.spring.loader.SpringXMLComponentTypeLoader"/>
+    </component>
+
+    <component name="spring.componentBuilder">
+        <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringCompositeBuilder"/>
+    </component>
+
+</composite>
\ No newline at end of file

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Thu May 31 14:51:47 2007
@@ -0,0 +1,2 @@
+# Implementation class for the ExtensionActivator for Spring module
+org.apache.tuscany.implementation.spring.SpringModuleActivator
\ No newline at end of file

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.handlers?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.handlers (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.handlers Thu May 31 14:51:47 2007
@@ -0,0 +1,3 @@
+http\://www.springframework.org/schema/sca=org.springframework.sca.config.ScaNamespaceHandler
+
+

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.schemas?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.schemas (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/resources/META-INF/spring.schemas Thu May 31 14:51:47 2007
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/sca/spring-sca.xsd=org/springframework/sca/xml/spring-sca.xsd

Added: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/main/resources/org/springframework/sca/xml/spring-sca.xsd?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/main/resources/org/springframework/sca/xml/spring-sca.xsd (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/main/resources/org/springframework/sca/xml/spring-sca.xsd Thu May 31 14:51:47 2007
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.springframework.org/schema/sca"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            attributeFormDefault="unqualified"
+            elementFormDefault="qualified"
+            targetNamespace="http://www.springframework.org/schema/sca">
+
+    <xsd:element name="composite">
+        <xsd:complexType>
+            <xsd:attribute name="component" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="sca-adapter-class" use="optional">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:element name="reference">
+        <xsd:complexType>
+            <xsd:attribute name="name" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="type" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="default" use="optional">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:element name="property">
+        <xsd:complexType>
+            <xsd:attribute name="id" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="name" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="type" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:element name="service">
+        <xsd:complexType>
+            <xsd:attribute name="name" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="type" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+            <xsd:attribute name="target" use="required">
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:string"/>
+                </xsd:simpleType>
+            </xsd:attribute>
+        </xsd:complexType>
+    </xsd:element>
+
+</xsd:schema>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/AbstractSCATestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/AbstractSCATestCase.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/AbstractSCATestCase.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/AbstractSCATestCase.java Thu May 31 14:51:47 2007
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.implementation.spring.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+    protected SCADomain domain;
+    protected T service;
+
+    protected void setUp() throws Exception {
+        domain = SCADomain.newInstance(getCompositeName());
+        service = (T) domain.getService(getServiceClass(), "ClientComponent");
+    }
+    
+    abstract protected Class getServiceClass();
+
+    protected void tearDown() throws Exception {
+        domain.close();
+    }
+
+    protected String getCompositeName() {
+        String className = this.getClass().getName();
+        String compositeName = className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+        System.out.println( compositeName );
+        return compositeName; 
+    }
+
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/AbstractSCATestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/AbstractSCATestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java Thu May 31 14:51:47 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.implementation.spring.itests.helloworld;
+
+import org.apache.tuscany.implementation.spring.itests.AbstractSCATestCase;
+
+/**
+ * Basic "hello world" style test case for testing Spring component implementation
+ * @author MikeEdwards
+ *
+ */
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+	/**
+	 * Calls the hello world service and checks that it gives the right response...
+	 */
+    public void testCalculator() throws Exception {
+        assertEquals("Hello petra", service.sayHello("petra"));
+    }
+    
+    @Override
+    protected Class<HelloWorld> getServiceClass() {
+        return HelloWorld.class;
+    }
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorld.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorld.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorld.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorld.java Thu May 31 14:51:47 2007
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.implementation.spring.itests.helloworld;
+
+/**
+ * Interface for the "hello world" service - predictably simple with a single operation
+ * "sayHello"
+ * @author MikeEdwards
+ *
+ */
+public interface HelloWorld {
+    
+    public String sayHello(String s);
+
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorld.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorld.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorldProxy.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorldProxy.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorldProxy.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorldProxy.java Thu May 31 14:51:47 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.implementation.spring.itests.helloworld;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface
+ * @author MikeEdwards
+ *
+ */
+public class HelloWorldProxy implements HelloWorld {
+
+    @Reference
+    public HelloWorld delegate;
+    
+    public String sayHello(String s) {
+        return delegate.sayHello(s);
+    }
+
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorldProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/HelloWorldProxy.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java Thu May 31 14:51:47 2007
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.implementation.spring.itests.helloworld;
+
+
+public class SpringHelloWorldTestCase extends AbstractHelloWorldTestCase {
+    // super class does it all getting composite based on this class name
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBean.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBean.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBean.java Thu May 31 14:51:47 2007
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.implementation.spring.itests.mock;
+
+/**
+ * @version $$Rev: 430937 $$ $$Date: 2006-08-12 02:17:56 +0100 (Sat, 12 Aug 2006) $$
+ */
+public interface TestBean {
+    String echo(String msg);
+
+    TestBean getBean();
+
+    void setBean(TestBean bean);
+
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBeanImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBeanImpl.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBeanImpl.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBeanImpl.java Thu May 31 14:51:47 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.implementation.spring.itests.mock;
+
+/**
+ * @version $$Rev: 441406 $$ $$Date: 2006-09-08 08:20:10 +0100 (Fri, 08 Sep 2006) $$
+ */
+public class TestBeanImpl implements TestBean {
+
+    private TestBean bean;
+
+    public TestBeanImpl() {
+    }
+
+    public String echo(String msg) {
+        return msg;
+    }
+
+    public TestBean getBean() {
+        return bean;
+    }
+
+    public void setBean(TestBean bean) {
+        this.bean = bean;
+    }
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBeanImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestBeanImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestReference.java?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestReference.java (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestReference.java Thu May 31 14:51:47 2007
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.implementation.spring.itests.mock;
+
+/**
+ * @version $$Rev: 536115 $$ $$Date: 2007-05-08 09:04:20 +0100 (Tue, 08 May 2007) $$
+ */
+public interface TestReference {
+    String echo(String msg);
+}

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestReference.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/application-context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/application-context.xml?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/application-context.xml (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/application-context.xml Thu May 31 14:51:47 2007
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+    <bean id="testBean" class="org.apache.tuscany.implementation.spring.itests.mock.TestBeanImpl" lazy-init="true">
+        <property name="bean" ref="testReference"/>
+    </bean>
+    <!-- <sca:reference name="testReference" type="org.apache.tuscany.implementation.spring.itests.mock.TestReference"/> -->
+
+</beans>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/application-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/application-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/default.scdl?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/default.scdl (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/default.scdl Thu May 31 14:51:47 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           name="spring.test">
+
+    <component name="Spring">
+        <implementation.spring location="META-INF/sca/application-context.xml">
+            <service name="fooService">
+                <binding.test/>
+                <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+                <reference>testBean</reference>
+            </service>
+            <reference name="testReference">
+                <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+                <binding.test/>
+            </reference>
+        </implementation.spring>
+    </component>
+
+</composite>

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testReferenceContext.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testReferenceContext.xml?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testReferenceContext.xml (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testReferenceContext.xml Thu May 31 14:51:47 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+    <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+        <property name="bean" ref="testReference"/>
+    </bean>
+
+    <sca:reference name="testReference" type="org.apache.tuscany.container.spring.mock.TestBean"/>
+
+</beans>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testReferenceContext.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testReferenceContext.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testServiceContext.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testServiceContext.xml?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testServiceContext.xml (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testServiceContext.xml Thu May 31 14:51:47 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+    <sca:service name="fooService" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
+
+    <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
+
+</beans>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testServiceContext.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/sca/testServiceContext.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/tuscany/xsystem.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/tuscany/xsystem.scdl?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/tuscany/xsystem.scdl (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/META-INF/tuscany/xsystem.scdl Thu May 31 14:51:47 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           name="spring.test">
+ <!--
+    <component name="Spring">
+        <implementation.spring location="META-INF/sca/application-context.xml">
+            <service name="fooService">
+                <binding.test/>
+                <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+                <reference>testBean</reference>
+            </service>
+            <reference name="testReference">
+                <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
+                <binding.test/>
+            </reference>
+        </implementation.spring>
+    </component>  -->
+
+</composite>

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml Thu May 31 14:51:47 2007
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+    <sca:service name="fooBean" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
+
+    <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+    </bean>
+
+</beans>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml Thu May 31 14:51:47 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+    <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+    </bean>
+
+    <sca:service name="fooService" type="org.apache.tuscany.container.spring.mock.TestBean" target="testBean"/>
+
+    <sca:reference name="fooReference" type="org.apache.tuscany.container.spring.mock.TestReference"/>
+
+
+</beans>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorld.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorld.composite?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorld.composite (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringHelloWorld.composite Thu May 31 14:51:47 2007
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           name="SpringHelloWorld">
+
+    <component name="ClientComponent">
+		<implementation.java class="org.apache.tuscany.implementation.spring.itests.helloworld.HelloWorldProxy"/>
+        <reference name="delegate" target="HelloWorldComponent"></reference>
+    </component>
+
+    <component name="HelloWorldComponent">
+        <implementation.spring location="META-INF/sca/application-context.xml"/>
+    </component>
+
+</composite>

Added: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/test.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/implementation-spring2/src/test/resources/test.xml?view=auto&rev=543273
==============================================================================
--- incubator/tuscany/sandbox/implementation-spring2/src/test/resources/test.xml (added)
+++ incubator/tuscany/sandbox/implementation-spring2/src/test/resources/test.xml Thu May 31 14:51:47 2007
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+    <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
+
+</beans>

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/implementation-spring2/src/test/resources/test.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org