You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/08/18 20:26:33 UTC

svn commit: r986837 [2/4] - in /tuscany/sca-java-2.x/trunk: contrib/modules/implementation-spring-stub/ contrib/modules/implementation-spring-stub/META-INF/ contrib/modules/implementation-spring-stub/src/ contrib/modules/implementation-spring-stub/src/...

Copied: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (from r986836, tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.invocation.SpringApplicationContextAccessor)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?p2=tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory&p1=tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.invocation.SpringApplicationContextAccessor&r1=986836&r2=986837&rev=986837&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.invocation.SpringApplicationContextAccessor (original)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory Wed Aug 18 18:26:30 2010
@@ -1,17 +1,20 @@
-# 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. 
-org.apache.tuscany.sca.implementation.spring.webapp.SpringWebApplicationContextAccessor
\ No newline at end of file
+# 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. 
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.spring.provider.stub.SpringImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.spring.SpringImplementation;ranking=50
+

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/LICENSE?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/LICENSE (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/LICENSE Wed Aug 18 18:26:30 2010
@@ -0,0 +1,205 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+
+

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/META-INF/MANIFEST.MF?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/META-INF/MANIFEST.MF (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/META-INF/MANIFEST.MF Wed Aug 18 18:26:30 2010
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+SCA-Version: 1.1
+Bundle-Name: Apache Tuscany SCA Spring Implementation Runtime Model
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Spring Implementation Runtime Model
+Bundle-SymbolicName: org.apache.tuscany.sca.implementation.spring.tie
+Bundle-DocURL: http://www.apache.org/
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Import-Package: org.oasisopen.sca;version="2.0.0",
+ org.oasisopen.sca.annotation;version="2.0.0",
+ org.springframework.beans;version="3.0.2.RELEASE",
+ org.springframework.beans.factory;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.annotation;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.config;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.support;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.xml;version="3.0.2.RELEASE",
+ org.springframework.context;version="3.0.2.RELEASE",
+ org.springframework.context.support;version="3.0.2.RELEASE",
+ org.springframework.core;version="3.0.2.RELEASE",
+ org.springframework.core.io;version="3.0.2.RELEASE",
+ org.springframework.util;version="3.0.2.RELEASE"
+

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/NOTICE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/NOTICE?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/NOTICE (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/NOTICE Wed Aug 18 18:26:30 2010
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/README
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/README?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/README (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/README Wed Aug 18 18:26:30 2010
@@ -0,0 +1,9 @@
+Note that the implementation spring modules have a different structure from other extensions.
+
+The aim is to have the Tuscany runtime embedded in a container with the Tuscany classes hidden
+from user applications and the Spring jar's packaged with the application. That means that the
+Tuscany code has no visibilty of the Spring classes and visa-versa. To implement that the
+implementation-spring module has no dependencies on Spring and the implementation-spring-runtime
+module has no dependencies on Tuscany (other than the sca-api), and reflection is used to call
+methods between the modules.
+

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/pom.xml?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/pom.xml Wed Aug 18 18:26:30 2010
@@ -0,0 +1,70 @@
+<?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.
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>tuscany-implementation-spring-tie</artifactId>
+    <name>Apache Tuscany SCA Spring Implementation Runtime Tie</name>
+
+    <dependencies>
+
+        <!-- **************************************** -->
+        <!-- *                                      * -->
+        <!-- * DONT ADD ANY TUSCANY DEPENDENCIES!!! * -->
+        <!-- *                                      * -->
+        <!-- * See the README for details why not   * -->
+        <!-- *                                      * -->
+        <!-- *                                      * -->
+        <!-- **************************************** -->
+
+        <!-- SCA API dependency -->
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- Spring dependencies... -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>3.0.2.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>3.0.2.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>3.0.2.RELEASE</version>
+        </dependency>
+
+    </dependencies>
+</project>

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,176 @@
+/*
+ * 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.sca.implementation.spring.context.tie;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringBeanElement;
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringConstructorArgElement;
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringElementTie;
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringPropertyElement;
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringSCAPropertyElement;
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringSCAReferenceElement;
+import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringSCAServiceElement;
+import org.springframework.beans.MutablePropertyValues;
+import org.springframework.beans.PropertyValue;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanReference;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.ConstructorArgumentValues;
+import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
+import org.springframework.beans.factory.config.TypedStringValue;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+
+public class SCAGenericApplicationContext extends GenericApplicationContext {
+
+    private ClassLoader classloader = null;
+    private List<SpringSCAPropertyElement> propertyElements = new ArrayList<SpringSCAPropertyElement>();
+    private List<SpringSCAServiceElement> serviceElements = new ArrayList<SpringSCAServiceElement>();
+    private List<SpringSCAReferenceElement> referenceElements = new ArrayList<SpringSCAReferenceElement>();
+    private List<SpringBeanElement> beanElements;
+
+    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);
+    }
+
+    public void addSCAPropertyElement(SpringSCAPropertyElement propertyElement) {
+        propertyElements.add(propertyElement);
+    }
+
+    public void addSCAServiceElement(SpringSCAServiceElement serviceElement) {
+        serviceElements.add(serviceElement);
+    }
+
+    public void addSCAReferenceElement(SpringSCAReferenceElement referenceElement) {
+        referenceElements.add(referenceElement);
+    }
+
+    public synchronized List<SpringBeanElement> getBeanElements() {
+        if (beanElements == null) {
+            beanElements = new ArrayList<SpringBeanElement>();
+            for (String name : getBeanDefinitionNames()) {
+                BeanDefinition def = getBeanDefinition(name);
+                SpringBeanElement beanElement = new SpringBeanElement(name, def.getBeanClassName());
+                beanElements.add(beanElement);
+                beanElement.setAbstractBean(def.isAbstract());
+                beanElement.setFactoryBeanAttribute(def.getFactoryBeanName() != null);
+                beanElement.setFactoryMethodAttribute(def.getFactoryMethodName() != null);
+                beanElement.setParentAttribute(def.getParentName() != null);
+                beanElement.setInnerBean(beanElement.getId() == null);
+
+                ConstructorArgumentValues args = def.getConstructorArgumentValues();
+                for (Map.Entry<Integer, ValueHolder> e: args.getIndexedArgumentValues().entrySet()) {
+                    ValueHolder holder = e.getValue();
+                    SpringConstructorArgElement arg = new SpringConstructorArgElement(holder.getType());
+                    arg.setIndex(e.getKey());
+                    beanElement.addCustructorArgs(arg);
+                }
+
+                MutablePropertyValues values = def.getPropertyValues();
+                for (PropertyValue p : values.getPropertyValueList()) {
+                    SpringPropertyElement propertyElement = new SpringPropertyElement(p.getName());
+                    Object value = p.getValue();
+                    configurePropertyElement(propertyElement, value);
+                    beanElement.getProperties().add(propertyElement);
+                }
+            }
+        }
+        return beanElements;
+    }
+
+    public void configurePropertyElement(SpringPropertyElement propertyElement, Object value) {
+        if (value instanceof BeanReference) {
+            BeanReference beanRef = (BeanReference)value;
+            propertyElement.addRef(beanRef.getBeanName());
+        } else if (value instanceof Collection) {
+            Collection collection = (Collection)value;
+            for (Object item : collection) {
+                configurePropertyElement(propertyElement, item);
+            }
+        } else if (value instanceof TypedStringValue) {
+            TypedStringValue stringValue = (TypedStringValue)value;
+            propertyElement.addValue(stringValue.getValue());
+        } else {
+            if (value != null) {
+                propertyElement.addValue(value.toString());
+            }
+        }
+    }
+
+    public List<SpringSCAPropertyElement> getPropertyElements() {
+        return propertyElements;
+    }
+
+    public List<SpringSCAServiceElement> getServiceElements() {
+        return serviceElements;
+    }
+
+    public List<SpringSCAReferenceElement> getReferenceElements() {
+        return referenceElements;
+    }
+
+    public <T> T[] getElements(Class<T> type) {
+        if (type.getSimpleName().equals(SpringSCAPropertyElement.class.getSimpleName())) {
+            T[] elements = (T[])Array.newInstance(type, getPropertyElements().size());
+            for (int i = 0; i < elements.length; i++) {
+                elements[i] = SpringElementTie.copy(getPropertyElements().get(i), type, type);
+            }
+            return elements;
+        } else if (type.getSimpleName().equals(SpringSCAReferenceElement.class.getSimpleName())) {
+            T[] elements = (T[])Array.newInstance(type, getReferenceElements().size());
+            for (int i = 0; i < elements.length; i++) {
+                elements[i] = SpringElementTie.copy(getReferenceElements().get(i), type, type);
+            }
+            return elements;
+        } else if (type.getSimpleName().equals(SpringSCAServiceElement.class.getSimpleName())) {
+            T[] elements = (T[])Array.newInstance(type, getServiceElements().size());
+            for (int i = 0; i < elements.length; i++) {
+                elements[i] = SpringElementTie.copy(getServiceElements().get(i), type, type);
+            }
+            return elements;
+        } else if (type.getSimpleName().equals(SpringBeanElement.class.getSimpleName())) {
+            T[] elements = (T[])Array.newInstance(type, getBeanElements().size());
+            for (int i = 0; i < elements.length; i++) {
+                elements[i] = SpringElementTie.copy(getBeanElements().get(i), type, type);
+            }
+            return elements;
+        } else {
+            throw new IllegalArgumentException(type + " is not supported");
+        }
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,212 @@
+/*
+ * 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.sca.implementation.spring.context.tie;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.util.Locale;
+import java.util.Map;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.MessageSourceResolvable;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.core.io.Resource;
+
+/**
+ * A Spring ParentApplicationContext for a given Spring Implementation
+ *
+ * The Parent application context is responsible for handling those entities within a Spring
+ * application context that actually belong to SCA rather than to Spring.  The principal things
+ * are Properties and References.  These may be present either through explicit <sca:property/>
+ * and <sca:reference/> elements in the application context or they may be implicit through
+ * unresolved Spring bean <property.../> elements.  In either case, it is the Parent application
+ * context that must provide Spring beans that correspond to the property or reference, as derived
+ * from the SCA composite in which the Spring application context is an implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAParentApplicationContext implements ApplicationContext {
+
+    // The Spring implementation for which this is the parent application context
+    private SpringImplementationStub implementation;
+
+    private static final String[] EMPTY_ARRAY = new String[0];
+
+    public SCAParentApplicationContext(SpringImplementationStub implementation) {
+        this.implementation = implementation;
+    } // end constructor
+
+    public Object getBean(String name) throws BeansException {
+        return getBean(name, (Class)null);
+    }
+
+    /**
+     * Get a Bean for a reference or for a property.
+     *
+     * @param name - the name of the Bean required
+     * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
+     * @return Object - a Bean which matches the requested bean
+     */
+    public Object getBean(String name, Class requiredType) throws BeansException {
+        Object bean = implementation.getBean(name, requiredType);
+        if (bean == null && getParent() != null) {
+            bean = getParent().getBean(name, requiredType);
+        }
+        if (bean == null) {
+            throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name);
+        } else {
+            return bean;
+        }
+    } // end method getBean( String, Class )
+
+    public Object getBean(String name, Object[] args) throws BeansException {
+        return getBean(name, ((Class)null));
+    }
+
+    public <T> T getBean(Class<T> clazz) throws BeansException {
+        return clazz.cast(getBean(clazz.getName(), clazz));
+    }
+
+    public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> clazz) throws BeansException {
+        return null;
+    }
+
+    public <A extends Annotation> A findAnnotationOnBean(String arg0, Class<A> clazz) {
+        return null;
+    }
+
+    public boolean containsBean(String name) {
+        // TODO
+        return false;
+    }
+
+    public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
+        // TODO
+        return false;
+    }
+
+    public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
+        throw new UnsupportedOperationException();
+    }
+
+    public Class getType(String name) throws NoSuchBeanDefinitionException {
+        return null;
+    }
+
+    public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
+        return EMPTY_ARRAY;
+    }
+
+    public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
+        return null;
+    }
+
+    public String getId() {
+        return this.toString();
+    }
+
+    public String getDisplayName() {
+        return implementation.getURI();
+    }
+
+    public long getStartupDate() {
+        return 0;
+    }
+
+    public boolean containsBeanDefinition(String beanName) {
+        return false;
+    }
+
+    public int getBeanDefinitionCount() {
+        return 0;
+    }
+
+    public String[] getBeanDefinitionNames() {
+        return new String[0];
+    }
+
+    public String[] getBeanNamesForType(Class type) {
+        return new String[0];
+    }
+
+    public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) {
+        return new String[0];
+    }
+
+    public Map getBeansOfType(Class type) throws BeansException {
+        return null;
+    }
+
+    public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException {
+        return null;
+    }
+
+    public boolean isPrototype(String theString) {
+        return false;
+    }
+
+    public BeanFactory getParentBeanFactory() {
+        return null;
+    }
+
+    public boolean containsLocalBean(String name) {
+        return false;
+    }
+
+    public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
+        return null;
+    }
+
+    public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
+        return null;
+    }
+
+    public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
+        return null;
+    }
+
+    public void publishEvent(ApplicationEvent event) {
+
+    }
+
+    public Resource[] getResources(String locationPattern) throws IOException {
+        return new Resource[0];
+    }
+
+    public Resource getResource(String location) {
+        return null;
+    }
+
+    public ClassLoader getClassLoader() {
+        // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's
+        // resource loading mechanism is exposed right now.
+        return this.getClass().getClassLoader();
+    }
+
+    @Override
+    public ApplicationContext getParent() {
+        return implementation.getParentApplicationContext();
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,130 @@
+/*
+ * 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.sca.implementation.spring.context.tie;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.spring.processor.tie.ComponentNameAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.tie.ComponentStub;
+import org.apache.tuscany.sca.implementation.spring.processor.tie.ConstructorAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.tie.InitDestroyAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.tie.PropertyAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.tie.PropertyValueStub;
+import org.apache.tuscany.sca.implementation.spring.processor.tie.ReferenceAnnotationProcessor;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * This is the runtime side tie for the corresponding tuscany side stub class.
+ * It enables the Tuscany code to invoke methods on a Spring context without
+ * needing to know about any Spring classes. See the SpringContextStub class
+ * in the implementation-spring module for what the stub does. 
+ */
+public class SpringContextTie {
+
+    private AbstractApplicationContext springContext;
+    private SpringImplementationStub implementation;
+
+    public SpringContextTie(SpringImplementationStub implementation, List<URL> resource) {
+        this.implementation = implementation;
+        SCAParentApplicationContext scaParentContext = new SCAParentApplicationContext(implementation);
+        springContext = createApplicationContext(scaParentContext, resource);
+    }
+    
+    public ApplicationContext getApplicationContext() {
+        return springContext;
+    }
+
+    public void start() {
+        // Do refresh here to ensure that Spring Beans are not touched before the SCA config process is complete...
+        springContext.refresh();
+        springContext.start();
+    }
+
+    public void close() {
+        springContext.close();
+        if (springContext instanceof GenericApplicationContext) {
+            springContext.stop();
+        }
+    }
+
+    /**
+     * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
+     */
+    private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext,
+                                                                List<URL> resources) {
+
+        GenericApplicationContext appCtx =
+            new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader());
+        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
+        
+        // REVIEW: [rfeng] How do we control the schema validation 
+        xmlReader.setValidating(false);
+        
+        for (URL resource : resources) {
+            xmlReader.loadBeanDefinitions(new UrlResource(resource));
+        }
+        xmlReader.setBeanClassLoader(implementation.getClassLoader());
+        includeAnnotationProcessors(appCtx.getBeanFactory());
+        return appCtx;
+
+    }
+
+    public Object getBean(String id) throws BeansException {
+        return springContext.getBean(id);
+    }
+
+    /**
+     * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
+     */
+    private void includeAnnotationProcessors(ConfigurableListableBeanFactory beanFactory) {
+
+        // Processor to deal with @Init and @Destroy SCA Annotations
+        BeanPostProcessor initDestroyProcessor = new InitDestroyAnnotationProcessor();
+        beanFactory.addBeanPostProcessor(initDestroyProcessor);
+
+        // Processor to deal with @Reference SCA Annotations
+        ComponentStub component = new ComponentStub(implementation.getComponentTie());
+        BeanPostProcessor referenceProcessor = new ReferenceAnnotationProcessor(component);
+        beanFactory.addBeanPostProcessor(referenceProcessor);
+
+        // Processor to deal with @Property SCA Annotations
+        PropertyValueStub pvs = new PropertyValueStub(implementation.getPropertyValueTie());
+        BeanPostProcessor propertyProcessor = new PropertyAnnotationProcessor(pvs);
+        beanFactory.addBeanPostProcessor(propertyProcessor);
+
+        // Processor to deal with @ComponentName SCA Annotations
+        BeanPostProcessor componentNameProcessor =
+            new ComponentNameAnnotationProcessor(implementation.getComponentName());
+        beanFactory.addBeanPostProcessor(componentNameProcessor);
+
+        // Processor to deal with @Constructor SCA Annotations
+        BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor();
+        beanFactory.addBeanPostProcessor(constructorProcessor);
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,146 @@
+/*
+ * 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.sca.implementation.spring.context.tie;
+
+import java.lang.reflect.Method;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+
+/**
+ * This is the runtime side stub for the corresponding Tuscany-side stub class.
+ * It enables the Spring code in the runtime module to invoke methods on a
+ * Tuscany SpringImplementation without the Spring runtime module
+ * needing to know about any Tuscany classes. See the SpringImplementationTie class
+ * in the implementation-spring module for what the tie does. 
+ */
+public class SpringImplementationStub {
+
+    Object tie;
+    Method getURI;
+    Method getBean;
+    Method getComponentName;
+    Method getComponentTie;
+    Method getPropertyValueTie;
+    Method getClassLoader;
+    Method getParentApplicationContext;
+
+    public SpringImplementationStub(Object tie) {
+        this.tie = tie;
+        Class<?> tieClass = tie.getClass();
+        try {
+            getURI = tieClass.getMethod("getURI", new Class<?>[] {});
+            getBean = tieClass.getMethod("getBean", new Class<?>[] {String.class, Class.class});
+            getComponentName = tieClass.getMethod("getComponentName");
+            getComponentTie = tieClass.getMethod("getComponentTie");
+            getPropertyValueTie = tieClass.getMethod("getPropertyValueTie");
+            getClassLoader = tieClass.getMethod("getClassLoader");
+            getParentApplicationContext = tieClass.getMethod("getParentApplicationContext");
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public String getURI() {
+        try {
+
+            return (String)getURI.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Get a Bean for a reference or for a property.
+     *
+     * @param name - the name of the Bean required
+     * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
+     * @return Object - a Bean which matches the requested bean
+     */
+    public Object getBean(String name, Class<?> requiredType) throws BeansException {
+        try {
+
+            Object bean = getBean.invoke(tie, new Object[] {name, requiredType});
+//            if (bean == null) {
+//                throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name);
+//            }
+            return bean;
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public String getComponentName() {
+        try {
+
+            return (String)getComponentName.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public Object getComponentTie() {
+        try {
+
+            return getComponentTie.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public Object getPropertyValueTie() {
+        try {
+
+            return getPropertyValueTie.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public ClassLoader getClassLoader() {
+        try {
+
+            return (ClassLoader)getClassLoader.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    
+    /**
+     * Get the parent Spring application context set by the Tuscany runtime
+     * @return
+     */
+    public ApplicationContext getParentApplicationContext() {
+        try {
+
+            return (ApplicationContext)getParentApplicationContext.invoke(tie);
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringBeanElement.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringBeanElement.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringBeanElement.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringBeanElement.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,129 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a <bean> element in a Spring application-context
+ * - this has id and className attributes
+ * - plus zero or more property elements as children
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringBeanElement {
+
+    private String id;
+    private String className = null;
+    private boolean innerBean = false;
+    private boolean abstractBean = false;
+    private boolean parentAttribute = false;
+    private boolean factoryBeanAttribute = false;
+    private boolean factoryMethodAttribute = false;
+
+    private List<SpringPropertyElement> properties = new ArrayList<SpringPropertyElement>();
+    private List<SpringConstructorArgElement> constructorargs = new ArrayList<SpringConstructorArgElement>();
+
+    public SpringBeanElement(String id, String className) {
+        this.id = id;
+        this.className = className;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public List<SpringPropertyElement> getProperties() {
+        return properties;
+    }
+
+    public void addProperty(SpringPropertyElement property) {
+        properties.add(property);
+    }
+
+    public List<SpringConstructorArgElement> getCustructorArgs() {
+        return constructorargs;
+    }
+
+    public void addCustructorArgs(SpringConstructorArgElement args) {
+        constructorargs.add(args);
+    }
+
+    public boolean isInnerBean() {
+        return innerBean;
+    }
+
+    public void setInnerBean(boolean innerBean) {
+        this.innerBean = innerBean;
+    }
+
+    public boolean isAbstractBean() {
+        return abstractBean;
+    }
+
+    public void setAbstractBean(boolean abstractBean) {
+        this.abstractBean = abstractBean;
+    }
+
+    public boolean hasParentAttribute() {
+        return parentAttribute;
+    }
+
+    public void setParentAttribute(boolean parentAttribute) {
+        this.parentAttribute = parentAttribute;
+    }
+
+    public boolean hasFactoryBeanAttribute() {
+        return factoryBeanAttribute;
+    }
+
+    public void setFactoryBeanAttribute(boolean factoryBeanAttribute) {
+        this.factoryBeanAttribute = factoryBeanAttribute;
+    }
+
+    public boolean hasFactoryMethodAttribute() {
+        return factoryMethodAttribute;
+    }
+
+    public void setFactoryMethodAttribute(boolean factoryMethodAttribute) {
+        this.factoryMethodAttribute = factoryMethodAttribute;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("SpringBeanElement [id=").append(id).append(", className=").append(className)
+            .append(", innerBean=").append(innerBean).append(", abstractBean=").append(abstractBean)
+            .append(", parentAttribute=").append(parentAttribute).append(", factoryBeanAttribute=")
+            .append(factoryBeanAttribute).append(", factoryMethodAttribute=").append(factoryMethodAttribute)
+            .append(", properties=").append(properties).append(", constructorargs=").append(constructorargs)
+            .append("]");
+        return builder.toString();
+    }
+
+} // end class SpringBeanElement

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringBeanElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringBeanElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringConstructorArgElement.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringConstructorArgElement.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringConstructorArgElement.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringConstructorArgElement.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a <constructor-arg> element in a Spring application-context
+ * - this has ref attribute
+ * 
+ * @version $Rev$ $Date$
+ */
+public class SpringConstructorArgElement {
+
+    private String type;
+    private int autoIndex = -1;
+    private int index = -1;
+    private List<String> refs = new ArrayList<String>();
+    private List<String> values = new ArrayList<String>();
+
+    public SpringConstructorArgElement(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public List<String> getRefs() {
+        return this.refs;
+    }
+
+    public void addRef(String ref) {
+        this.refs.add(ref);
+    }
+
+    public int getIndex() {
+        return this.index;
+    }
+
+    public void setIndex(int index) {
+        this.index = index;
+    }
+
+    public int getAutoIndex() {
+        return this.autoIndex;
+    }
+
+    public void setAutoIndex(int index) {
+        this.autoIndex = index;
+    }
+
+    public List<String> getValues() {
+        return this.values;
+    }
+
+    public void addValue(String value) {
+        this.values.add(value);
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringConstructorArgElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringConstructorArgElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringElementTie.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringElementTie.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringElementTie.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringElementTie.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * A hacking utility to copy beans field by field between two class loaders
+ */
+public class SpringElementTie {
+    public static <T> T copy(Object source, Class<T> cls, Type genericType) {
+        if (source == null) {
+            return null;
+        }
+        if (cls.isPrimitive()) {
+            return (T)source;
+        }
+        if (Collection.class.isAssignableFrom(cls)) {
+            ParameterizedType pType = (ParameterizedType)genericType;
+            Type itemType = pType.getActualTypeArguments()[0];
+            Collection col = (Collection)source;
+            List target = new ArrayList();
+            for (Object item : col) {
+                target.add(copy(item, (Class<?>)itemType, itemType));
+            }
+            return (T)target;
+        }
+        if (cls.isInstance(source)) {
+            return cls.cast(source);
+        }
+        try {
+            Class<?> sourceClass = source.getClass();
+            T target = cls.newInstance();
+            for (Field sourceField : sourceClass.getDeclaredFields()) {
+                sourceField.setAccessible(true);
+                Field targetField = cls.getDeclaredField(sourceField.getName());
+                targetField.setAccessible(true);
+                Object sourceFieldValue = sourceField.get(source);
+                Object targetFieldValue = copy(sourceFieldValue, targetField.getType(), targetField.getGenericType());
+                targetField.set(target, targetFieldValue);
+            }
+            return target;
+        } catch (Throwable e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringElementTie.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringElementTie.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringPropertyElement.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringPropertyElement.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringPropertyElement.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringPropertyElement.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,68 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a <property> element in a Spring application-context
+ * - this has name and ref attributes
+ * 
+ * @version $Rev$ $Date$
+ */
+public class SpringPropertyElement {
+
+    private String name;
+    private List<String> refs = new ArrayList<String>();
+    private List<String> values = new ArrayList<String>();
+
+    public SpringPropertyElement(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public List<String> getRefs() {
+        return this.refs;
+    }
+
+    public void addRef(String ref) {
+        this.refs.add(ref);
+    }
+
+    public List<String> getValues() {
+        return this.values;
+    }
+
+    public void addValue(String value) {
+        this.values.add(value);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("SpringPropertyElement [name=").append(name).append(", refs=").append(refs).append(", values=")
+            .append(values).append("]");
+        return builder.toString();
+    }
+
+} // end class SpringPropertyElement

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringPropertyElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringPropertyElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAPropertyElement.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAPropertyElement.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAPropertyElement.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAPropertyElement.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+/**
+ * Represents an <sca:property> element in a Spring application-context
+ * - this has name and type attributes
+ * @version $Rev$ $Date$ 
+ */
+public class SpringSCAPropertyElement {
+
+    private String name;
+    private String type;
+
+    public SpringSCAPropertyElement(String name, String type) {
+        this.name = name;
+        this.type = type;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("SpringSCAPropertyElement [name=").append(name).append(", type=").append(type).append("]");
+        return builder.toString();
+    }
+
+} // end class SpringPropertyElement

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAPropertyElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAPropertyElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAReferenceElement.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAReferenceElement.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAReferenceElement.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAReferenceElement.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,73 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+
+/**
+ * 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$ $Date$
+ */
+public class SpringSCAReferenceElement {
+
+    private String name;
+    private String type;
+    private String defaultBean;
+
+    public SpringSCAReferenceElement(String name, String type) {
+        this.name = name;
+        this.type = type;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setDefaultBean(String defaultBean) {
+        this.defaultBean = defaultBean;
+    }
+
+    public String getDefaultBean() {
+        return defaultBean;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("SpringSCAReferenceElement [name=").append(name).append(", type=").append(type)
+            .append(", defaultBean=").append(defaultBean).append("]");
+        return builder.toString();
+    }
+
+
+} // end class SpringSCAReferenceElement

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAReferenceElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAReferenceElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAServiceElement.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAServiceElement.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAServiceElement.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAServiceElement.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,73 @@
+/*
+ * 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.sca.implementation.spring.elements.tie;
+
+
+/**
+ * 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$ $Date$
+ */
+public class SpringSCAServiceElement {
+
+    private String name;
+    private String type;
+    private String target;
+
+
+    public SpringSCAServiceElement(String name, String target) {
+        this.name = name;
+        this.target = target;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setTarget(String target) {
+        this.target = target;
+    }
+
+    public String getTarget() {
+        return target;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("SpringSCAServiceElement [name=").append(name).append(", type=").append(type)
+            .append(", target=").append(target).append("]");
+        return builder.toString();
+    }
+
+} // end class SpringSCAServiceElement

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAServiceElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/elements/tie/SpringSCAServiceElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/SCANamespaceHandlerResolver.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/SCANamespaceHandlerResolver.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/SCANamespaceHandlerResolver.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/SCANamespaceHandlerResolver.java Wed Aug 18 18:26:30 2010
@@ -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.sca.implementation.spring.namespace.tie;
+
+import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
+import org.springframework.beans.factory.xml.NamespaceHandler;
+
+/**
+ * Overrides the default Spring namespace resolver to automatically register
+ * {@link ScaNamespaceHandler} instead of requiring a value to be supplied in a
+ * Spring configuration
+ * 
+ * @version $Rev$ $Date$
+ */
+public class SCANamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
+    private static final String SCA_NAMESPACE = "http://www.springframework.org/schema/sca";
+
+    private ScaNamespaceHandler handler;
+
+    public SCANamespaceHandlerResolver(ClassLoader classLoader) {
+        super(classLoader);
+        handler = new ScaNamespaceHandler(/*componentType*/);
+    }
+
+    public SCANamespaceHandlerResolver(String handlerMappingsLocation, ClassLoader classLoader) {
+        super(classLoader, handlerMappingsLocation);
+        handler = new ScaNamespaceHandler(/*componentType*/);
+    }
+
+    @Override
+    public NamespaceHandler resolve(String namespaceUri) {
+        if (SCA_NAMESPACE.equals(namespaceUri)) {
+            return handler;
+        }
+        return super.resolve(namespaceUri);
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/SCANamespaceHandlerResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/SCANamespaceHandlerResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/ScaNamespaceHandler.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/ScaNamespaceHandler.java?rev=986837&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/ScaNamespaceHandler.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/ScaNamespaceHandler.java Wed Aug 18 18:26:30 2010
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * Licensed 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.sca.implementation.spring.namespace.tie;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+/**
+ * Handler for the &lt;sca:&gt; namespace in an application context
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ScaNamespaceHandler extends NamespaceHandlerSupport {
+
+    public ScaNamespaceHandler() {
+        init();
+    }
+
+    public final void init() {
+        registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
+        registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
+        registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/ScaNamespaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/tie/ScaNamespaceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date