summaryrefslogtreecommitdiffstats
path: root/sandbox/old/contrib/implementation-spring
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/old/contrib/implementation-spring
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/old/contrib/implementation-spring')
-rw-r--r--sandbox/old/contrib/implementation-spring/container/.ruleset190
-rwxr-xr-xsandbox/old/contrib/implementation-spring/container/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/implementation-spring/container/NOTICE.txt14
-rwxr-xr-xsandbox/old/contrib/implementation-spring/container/README.txt35
-rwxr-xr-xsandbox/old/contrib/implementation-spring/container/pom.xml.off36
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java49
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java51
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java38
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java38
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java38
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java40
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java51
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java311
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java106
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java203
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java128
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java43
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java57
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java91
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java74
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl46
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers3
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas1
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd83
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java52
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java73
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java45
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java151
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java131
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java76
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java57
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java31
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java42
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java8
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml14
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl37
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml15
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml13
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl37
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml14
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml17
-rw-r--r--sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml11
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off58
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java26
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java29
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl30
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java25
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java50
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml11
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl33
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl27
-rw-r--r--sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off74
-rw-r--r--sandbox/old/contrib/implementation-spring/pom.xml.off141
53 files changed, 3256 insertions, 0 deletions
diff --git a/sandbox/old/contrib/implementation-spring/container/.ruleset b/sandbox/old/contrib/implementation-spring/container/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/.ruleset
@@ -0,0 +1,190 @@
+<?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.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/implementation-spring/container/LICENSE.txt b/sandbox/old/contrib/implementation-spring/container/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ 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, serviceDefinition 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.
diff --git a/sandbox/old/contrib/implementation-spring/container/NOTICE.txt b/sandbox/old/contrib/implementation-spring/container/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/implementation-spring/container/README.txt b/sandbox/old/contrib/implementation-spring/container/README.txt
new file mode 100755
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sandbox/old/contrib/implementation-spring/container/pom.xml.off b/sandbox/old/contrib/implementation-spring/container/pom.xml.off
new file mode 100755
index 0000000000..44b68b3d2a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/pom.xml.off
@@ -0,0 +1,36 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-container</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <name>Apache Tuscany Spring Framework Container</name>
+ <description>Container for managing Spring composites</description>
+ <packaging>jar</packaging>
+
+</project>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java
new file mode 100644
index 0000000000..343c76d7a2
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCAApplicationContext.java
@@ -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.container.spring.context;
+
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.core.io.Resource;
+
+/**
+ * An <code>ApplicationContext</code> specialization that registers namespace handlers for SCA elements
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAApplicationContext extends AbstractXmlApplicationContext {
+ public static final String APP_CONTEXT_PROP = "org.springframework.sca.application.context";
+ private Resource appXml;
+
+ public SCAApplicationContext(ApplicationContext parent, Resource appXml) {
+ super(parent);
+ this.appXml = appXml;
+ refresh();
+ }
+
+ protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
+ ClassLoader cl = getClassLoader();
+ beanDefinitionReader.setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(cl));
+ }
+
+ protected Resource[] getConfigResources() {
+ return new Resource[]{appXml};
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java
new file mode 100644
index 0000000000..b524846fc9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/SCANamespaceHandlerResolver.java
@@ -0,0 +1,51 @@
+/*
+ * 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.container.spring.context;
+
+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*/);
+ }
+
+ public NamespaceHandler resolve(String namespaceUri) {
+ if (SCA_NAMESPACE.equals(namespaceUri)) {
+ return handler;
+ }
+ return super.resolve(namespaceUri);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java
new file mode 100644
index 0000000000..5ce7edbc2d
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaNamespaceHandler.java
@@ -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.
+ *
+ * Created on 10-Apr-2006 by Adrian Colyer
+ */
+package org.apache.tuscany.container.spring.context;
+
+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());
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java
new file mode 100644
index 0000000000..d872cefc3a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaReferenceBeanDefinitionParser.java
@@ -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.
+ *
+ * Created on 10-Apr-2006 by Adrian Colyer
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+
+/**
+ * Parser for the &lt;sca:reference&gt; element
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, this is handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java
new file mode 100644
index 0000000000..567904d6cf
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/context/ScaServiceBeanDefinitionParser.java
@@ -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.
+ *
+ * Created on 10-Apr-2006 by Adrian Colyer
+ */
+package org.apache.tuscany.container.spring.context;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+
+/**
+ * Parser for the &lt;sca:service/&gt; element
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java
new file mode 100644
index 0000000000..4aad7cd35c
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/BeanMethodNotFound.java
@@ -0,0 +1,40 @@
+/*
+ * 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.container.spring.impl;
+
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * Thrown when a service contract Operation cannot be mapped to a method on a Spring Bean class
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanMethodNotFound extends TargetInvokerCreationException {
+ private Operation operation;
+
+ public BeanMethodNotFound(Operation operation) {
+ super("Bean method not found");
+ this.operation = operation;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
new file mode 100644
index 0000000000..9647b8857a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
@@ -0,0 +1,51 @@
+/*
+ * 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.container.spring.impl;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.springframework.core.io.Resource;
+
+/**
+ * Creates a {@link org.apache.tuscany.container.spring.impl.SpringCompositeComponent} from an assembly model
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringCompositeBuilder extends ComponentBuilderExtension<SpringImplementation> {
+
+ public Component build(ComponentDefinition<SpringImplementation> componentDefinition, DeploymentContext context)
+ throws BuilderException {
+ URI uri = componentDefinition.getUri();
+ SpringImplementation implementation = componentDefinition.getImplementation();
+ Resource resource = implementation.getApplicationResource();
+ ClassLoader cl = implementation.getClassLoader();
+ return new SpringCompositeComponent(uri, resource, proxyService, null, cl);
+ }
+
+ protected Class<SpringImplementation> getImplementationType() {
+ return SpringImplementation.class;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
new file mode 100644
index 0000000000..d11c3054b7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
@@ -0,0 +1,311 @@
+/*
+ * 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.container.spring.impl;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.extension.CompositeComponentExtension;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.physical.PhysicalWireSourceDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalWireTargetDefinition;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
+
+import org.apache.tuscany.container.spring.context.SCAApplicationContext;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
+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.ConfigurableApplicationContext;
+import org.springframework.context.MessageSourceResolvable;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.core.io.Resource;
+
+/**
+ * A composite implementation responsible for managing Spring application contexts.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringCompositeComponent extends CompositeComponentExtension {
+ private static final String[] EMPTY_ARRAY = new String[0];
+ private AbstractApplicationContext springContext;
+ private Resource resource;
+ private ProxyService proxyService;
+ private ClassLoader loader;
+
+ /**
+ * Creates a new composite
+ *
+ * @param uri the uri of the SCA composite
+ * @param resource a resource pointing to the application context
+ * @param propertyValues the values of this composite's Properties
+ */
+ public SpringCompositeComponent(URI uri,
+ Resource resource,
+ ProxyService proxyService,
+ Map<String, Document> propertyValues,
+ ClassLoader loader) {
+ super(uri);
+ this.resource = resource;
+ this.proxyService = proxyService;
+ this.loader = loader;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ TargetInvoker invoker = super.createTargetInvoker(targetName, operation);
+ if (invoker != null) {
+ return invoker;
+ }
+ // no service found, wire to a bean using the service name as the bean name
+ ServiceContract contract = operation.getServiceContract();
+ Method method;
+ try {
+ method = findMethod(contract.getInterfaceClass(), operation);
+ } catch (NoSuchMethodException e) {
+ throw new BeanMethodNotFound(operation);
+ }
+ return new SpringInvoker(targetName, method, this);
+ }
+
+ public List<Wire> getWires(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachCallbackWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachWires(List<Wire> wires) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ConfigurableApplicationContext getApplicationContext() {
+ return springContext;
+ }
+
+ public void prepare() {
+ // TODO handle only references with a composite binding
+ }
+
+ public void start() {
+ super.start();
+ for (SCAObject child : children.values()) {
+ child.start();
+ }
+ if (springContext == null) {
+ SCAParentApplicationContext scaApplicationContext = new SCAParentApplicationContext();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ // FIXME this is horrible
+ Thread.currentThread().setContextClassLoader(loader);
+ springContext = new SCAApplicationContext(scaApplicationContext, resource);
+ springContext.start();
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+
+ }
+ }
+ }
+
+ public void stop() {
+ super.stop();
+ springContext.stop();
+ }
+
+ public <T> T getBean(Class<T> serviceInterface, String name) {
+ return serviceInterface.cast(springContext.getBean(name));
+ }
+
+ /**
+ * Used in unit testing
+ */
+ void setSpringContext(AbstractApplicationContext springContext) {
+ this.springContext = springContext;
+ }
+
+ /**
+ * TODO remove need for inner class as SCA.getParent() has been removed and no longer clashes with
+ * ApplicaitonContext.getParent
+ */
+ private class SCAParentApplicationContext implements ApplicationContext {
+
+ public Object getBean(String name) throws BeansException {
+ return getBean(name, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getBean(String name, Class requiredType) throws BeansException {
+ SCAObject object = children.get(name); // keep cast due to compiler error
+ if (object == null) {
+ return null;
+ }
+ Class<?> type = null;
+ if (object instanceof Reference) {
+ Reference reference = (Reference) object;
+ Wire wire = null;
+ if (!reference.getReferenceBindings().isEmpty()) {
+ // FIXME JFM provide a better way for the runtime to select the binding as opposed to the first one
+ wire = reference.getReferenceBindings().get(0).getWire();
+ type = wire.getSourceContract().getInterfaceClass();
+ }
+ if (requiredType != null && requiredType.isAssignableFrom(type)) {
+ // need null check since Spring may pass in a null
+ throw new BeanNotOfRequiredTypeException(name, requiredType, type);
+ }
+ return proxyService.createProxy(type, wire);
+ } else if (object instanceof ServiceBinding) {
+ ServiceBinding serviceBinding = (ServiceBinding) object;
+ type = serviceBinding.getWire().getSourceContract().getInterfaceClass();
+ if (requiredType != null && requiredType.isAssignableFrom(type)) {
+ // need null check since Spring may pass in a null
+ throw new BeanNotOfRequiredTypeException(name, requiredType, type);
+ }
+ return proxyService.createProxy(type, serviceBinding.getWire());
+ } else {
+ throw new AssertionError("Illegal object type [" + name + "]");
+ }
+ }
+
+ public boolean containsBean(String name) {
+ return children.get(name) != null;
+ }
+
+ public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
+ return children.get(name) != null;
+ }
+
+ 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 ApplicationContext getParent() {
+ return null;
+ }
+
+ public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
+ return null;
+ }
+
+ public String getDisplayName() {
+ return getUri().toString();
+ }
+
+ 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 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();
+ }
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java
new file mode 100644
index 0000000000..ff0b215f4a
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java
@@ -0,0 +1,106 @@
+/*
+ * 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.container.spring.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import org.springframework.beans.BeansException;
+
+/**
+ * Dispatches to an operation on a Spring bean. Since Spring manages bean lifecycle and scope through resolution in the
+ * target proxy, the invoker can safely cache the target proxy.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringInvoker implements TargetInvoker {
+ private SpringCompositeComponent component;
+ // default to true since Spring handles resolution
+ private boolean cacheable = true;
+ private String beanName;
+ private Method method;
+ // caching is thread-safe since Spring handles resolution
+ private Object bean;
+
+ public SpringInvoker(String beanName, Method method, SpringCompositeComponent component) {
+ this.beanName = beanName;
+ this.method = method;
+ this.component = component;
+ }
+
+ public Object invokeTarget(final Object object, final short sequence) throws InvocationTargetException {
+ if (bean == null) {
+ try {
+ bean = component.getBean(Object.class, beanName);
+ if (bean == null) {
+ throw new InvocationTargetException(new TargetNotFoundException(beanName));
+ }
+ } catch (BeansException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ try {
+ if (object != null && !object.getClass().isArray()) {
+ return method.invoke(bean, object);
+ } else {
+ return method.invoke(bean, (Object[]) object);
+ }
+ } catch (IllegalAccessException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBodyWithFault(e.getCause());
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+
+ public SpringInvoker clone() throws CloneNotSupportedException {
+ SpringInvoker invoker = (SpringInvoker) super.clone();
+ invoker.bean = null;
+ return invoker;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java
new file mode 100644
index 0000000000..150440cdf9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringImplementationLoader.java
@@ -0,0 +1,203 @@
+/*
+ * 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.container.spring.loader;
+
+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 javax.xml.namespace.QName;
+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.osoa.sca.Constants;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.runtime.webapp.WebappRuntimeInfo;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Loader for handling Spring <implementation.spring> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringImplementationLoader extends LoaderExtension<SpringImplementation> {
+ private static final QName IMPLEMENTATION_SPRING = new QName("http://www.osoa.org/xmlns/sca/1.0",
+ "implementation.spring");
+ private static final String APPLICATION_CONTEXT = "applicationContext.xml";
+ private static final QName SERVICE_ELEMENT = new QName(Constants.SCA_NS, "service");
+ private static final QName REFERENCE_ELEMENT = new QName(Constants.SCA_NS, "reference");
+
+ private final RuntimeInfo runtimeInfo;
+
+ public SpringImplementationLoader(@Reference LoaderRegistry registry, @Reference RuntimeInfo runtimeInfo) {
+ super(registry);
+ this.runtimeInfo = runtimeInfo;
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_SPRING;
+ }
+
+ @SuppressWarnings("unchecked")
+ public SpringImplementation load(
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ String locationAttr = reader.getAttributeValue(null, "location");
+ if (locationAttr == null) {
+ throw new MissingResourceException("No location supplied");
+ }
+
+ ClassLoader classLoader = deploymentContext.getClassLoader();
+ SpringImplementation implementation = new SpringImplementation(classLoader);
+ implementation.setApplicationResource(getApplicationContextResource(locationAttr, classLoader));
+ registry.loadComponentType(implementation, deploymentContext);
+ SpringComponentType type = implementation.getComponentType();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (SERVICE_ELEMENT.equals(qname)) {
+ ServiceDefinition service =
+ (ServiceDefinition) registry.load(null, reader, deploymentContext);
+ if (!type.isExposeAllBeans()) {
+ URI name = service.getUri();
+ if (!type.getServiceDeclarations().containsKey(name)) {
+ throw new LoaderException("No service defined in Spring context for ", name.toString());
+ }
+ }
+ type.getDeclaredServices().put(service.getUri(), service);
+ } else if (REFERENCE_ELEMENT.equals(qname)) {
+ ReferenceDefinition reference =
+ (ReferenceDefinition) registry.load(null, reader, deploymentContext);
+ type.getDeclaredReferences().put(reference.getUri(), reference);
+ }
+ break;
+ case END_ELEMENT:
+ if (IMPLEMENTATION_SPRING.equals(reader.getName())) {
+ return implementation;
+ }
+ }
+ }
+ }
+
+ protected Resource getApplicationContextResource(String locationAttr, ClassLoader cl) throws LoaderException {
+ assert runtimeInfo != null;
+ File manifestFile = null;
+ File appXmlFile;
+ File locationFile = new File(locationAttr);
+
+// if (!locationFile.isAbsolute()) {
+// locationFile = new File(runtimeInfo.getApplicationRootDirectory(), locationAttr);
+// }
+ if (!locationFile.exists()) {
+ // FIXME hack
+ URL url;
+ if (runtimeInfo instanceof WebappRuntimeInfo) {
+ try {
+ url = ((WebappRuntimeInfo) runtimeInfo).getServletContext().getResource(locationAttr);
+ } catch (MalformedURLException e) {
+ throw new LoaderException(e);
+ }
+ } else {
+ url = cl.getResource(locationAttr);
+ }
+ if (url != null) {
+ return new UrlResource(url);
+ }
+ throw new MissingResourceException(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 LoaderException("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 MissingResourceException(locationAttr, e);
+ }
+ }
+
+ throw new
+
+ MissingResourceException(APPLICATION_CONTEXT);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java
new file mode 100644
index 0000000000..21fb5b7b5b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/loader/SpringXMLComponentTypeLoader.java
@@ -0,0 +1,128 @@
+/*
+ * 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.container.spring.loader;
+
+import java.io.IOException;
+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.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.Property;
+
+import org.apache.tuscany.container.spring.model.ReferenceDeclaration;
+import org.apache.tuscany.container.spring.model.ServiceDeclaration;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.springframework.core.io.Resource;
+
+/**
+ * Introspects a Spring XML configuration file for its component type information. Other loader implementations may
+ * support alternative Spring configuration mechanisms.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringXMLComponentTypeLoader extends ComponentTypeLoaderExtension<SpringImplementation> {
+ private static final String SCA_NS = "http://www.springframework.org/schema/sca";
+ 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("http://www.springframework.org/schema/beans", "beans");
+
+ public SpringXMLComponentTypeLoader(@Reference LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ @Override
+ protected Class<SpringImplementation> getImplementationClass() {
+ return SpringImplementation.class;
+ }
+
+ public void load(
+ SpringImplementation implementation,
+ DeploymentContext context) throws LoaderException {
+ if (implementation.getComponentType() != null) {
+ // FIXME hack since the builder registry loads the implementation type and the Spring implementation
+ // loader needs to as well. The second call is done by the builder registry and we just ignore it.
+ return;
+ }
+ SpringComponentType<Property<?>> type = new SpringComponentType<Property<?>>();
+ Resource resource = implementation.getApplicationResource();
+ loadFromXML(type, resource, context);
+ implementation.setComponentType(type);
+ }
+
+ private void loadFromXML(SpringComponentType<Property<?>> type, Resource resource, DeploymentContext context)
+ throws LoaderException {
+ XMLStreamReader reader;
+ try {
+ XMLInputFactory factory = context.getXmlFactory();
+ ClassLoader cl = context.getClassLoader();
+ reader = factory.createXMLStreamReader(resource.getInputStream());
+ boolean exposeAllBeans = true;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (SERVICE_ELEMENT.equals(qname)) {
+ exposeAllBeans = false;
+ String name = reader.getAttributeValue(SCA_NS, "name");
+ Class<?> serviceType;
+ try {
+ serviceType = cl.loadClass(reader.getAttributeValue(SCA_NS, "type"));
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException("Error loading service class", name, e);
+ }
+ String target = reader.getAttributeValue(SCA_NS, "target");
+ type.addServiceDeclaration(new ServiceDeclaration(name, serviceType, target));
+ } else if (REFERENCE_ELEMENT.equals(qname)) {
+ String name = reader.getAttributeValue(SCA_NS, "name");
+ Class<?> serviceType;
+ try {
+ serviceType = cl.loadClass(reader.getAttributeValue(SCA_NS, "type"));
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException("Error loading service class", name, e);
+ }
+ type.addReferenceDeclaration(new ReferenceDeclaration(name, serviceType));
+ }
+ break;
+ case END_ELEMENT:
+ if (BEANS_ELEMENT.equals(reader.getName())) {
+ type.setExposeAllBeans(exposeAllBeans);
+ return;
+ }
+ }
+ }
+
+ } catch (IOException e) {
+ throw new LoaderException(e);
+ } catch (XMLStreamException e) {
+ throw new LoaderException(e);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java
new file mode 100644
index 0000000000..b53ddbe18f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ReferenceDeclaration.java
@@ -0,0 +1,43 @@
+/*
+ * 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.container.spring.model;
+
+/**
+ * Represents a <code>sca:reference<code> declaration in an application context. Used as component type metadata for a
+ * Spring composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceDeclaration {
+ private String name;
+ private Class<?> serviceType;
+
+ public ReferenceDeclaration(String name, Class<?> serviceType) {
+ this.name = name;
+ this.serviceType = serviceType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getServiceType() {
+ return serviceType;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java
new file mode 100644
index 0000000000..4872028215
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/ServiceDeclaration.java
@@ -0,0 +1,57 @@
+/*
+ * 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.container.spring.model;
+
+/**
+ * Represents a <code>sca:service<code> declaration in an application context. Used as component type metadata for a
+ * Spring composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceDeclaration {
+ private String name;
+ private Class<?> serviceType;
+ private String target;
+
+ /**
+ * Constructor
+ *
+ * @param name the service name
+ * @param serviceType the service contract type
+ * @param target the name of the target the service is wired to
+ */
+ public ServiceDeclaration(String name, Class<?> serviceType, String target) {
+ this.name = name;
+ this.serviceType = serviceType;
+ this.target = target;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getClazz() {
+ return serviceType;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
new file mode 100644
index 0000000000..e44656046f
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
@@ -0,0 +1,91 @@
+/*
+ * 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.container.spring.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Component type information for a Spring composite component implementation type. A component type is associated with
+ * a Spring application context
+ *
+ * @version $Rev$ $Date$
+ */
+public class SpringComponentType<P extends Property<?>>
+ extends CompositeComponentType<ServiceDefinition, ReferenceDefinition, P> {
+ private Map<String, ServiceDeclaration> serviceDeclarations = new HashMap<String, ServiceDeclaration>();
+ private Map<String, ReferenceDeclaration> referenceDeclarations = new HashMap<String, ReferenceDeclaration>();
+ private boolean exposeAllBeans;
+
+ public SpringComponentType() {
+ }
+
+ /**
+ * Returns true if all beans in the Spring application context may be service targets or false if service types are
+ * defined
+ */
+ public boolean isExposeAllBeans() {
+ return exposeAllBeans;
+ }
+
+ /**
+ * Sets if all beans in the Spring application context may be service targets or false if service types are defined
+ */
+ public void setExposeAllBeans(boolean exposeAllBeans) {
+ this.exposeAllBeans = exposeAllBeans;
+ }
+
+ /**
+ * Returns the service declarations for the composite
+ *
+ * @return Returns the service declarations for the composite
+ */
+ public Map<String, ServiceDeclaration> getServiceDeclarations() {
+ return serviceDeclarations;
+ }
+
+ /**
+ * Adds a service declaration for the composite
+ */
+ public void addServiceDeclaration(ServiceDeclaration declaration) {
+ serviceDeclarations.put(declaration.getName(), declaration);
+ }
+
+ /**
+ * Returns the reference declarations for the composite
+ *
+ * @return Returns the reference declarations for the composite
+ */
+ public Map<String, ReferenceDeclaration> getReferenceDeclarations() {
+ return referenceDeclarations;
+ }
+
+ /**
+ * Adds a service declarations for the composite
+ */
+ public void addReferenceDeclaration(ReferenceDeclaration declaration) {
+ referenceDeclarations.put(declaration.getName(), declaration);
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java
new file mode 100644
index 0000000000..4842e75e0e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java
@@ -0,0 +1,74 @@
+/*
+ * 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.container.spring.model;
+
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Property;
+
+import org.springframework.core.io.Resource;
+
+/**
+ * Represents a composite whose implementation type is a Spring application context.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringImplementation extends Implementation<SpringComponentType<Property<?>>> {
+ private String location;
+ private Resource applicationResource;
+ private ClassLoader classLoader;
+
+ public SpringImplementation(ClassLoader classloader) {
+ this.classLoader = classloader;
+ }
+
+ /**
+ * Returns the classloader of the Spring application context
+ */
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ /**
+ * Returns the path of the Spring application context configuration
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets the path of the Spring application context configuration
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ /**
+ * Returns the Spring configuration resource for the application context
+ */
+ public Resource getApplicationResource() {
+ return applicationResource;
+ }
+
+ /**
+ * Sets the Spring configuration resource for the application context
+ */
+ public void setApplicationResource(Resource applicationXml) {
+ this.applicationResource = applicationXml;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl
new file mode 100644
index 0000000000..0eb781a5f1
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/sca/spring.system.scdl
@@ -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
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000000..689b49e2ae
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1,3 @@
+http\://www.springframework.org/schema/sca=org.springframework.sca.config.ScaNamespaceHandler
+
+
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000000..33f7004be9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/sca/spring-sca.xsd=org/springframework/sca/xml/spring-sca.xsd
diff --git a/sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd b/sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
new file mode 100644
index 0000000000..3e61ee96dc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
new file mode 100644
index 0000000000..13b2c684d7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
@@ -0,0 +1,52 @@
+/*
+ * 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.container.spring;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the SCA extensible schema elements for Spring's XML configuration files
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public class SpringConfigSchemaTestCase extends TestCase {
+
+// private ConfigurableApplicationContext applicationContext;
+//
+// public void setUp() {
+// applicationContext =
+// new ScaApplicationContext(null,
+// new ClassPathResource("org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml"));
+// }
+//
+ public void testSCAService() {
+// ScaServiceExporter service = (ScaServiceExporter) applicationContext.getBean("fooService");
+// // FIXME andyp -- this is not really right.
+//// TestBean service = (TestBean) applicationContext.getBean("fooService");
+//// assertEquals("call me", service.echo("call me"));
+ }
+//
+// public void testSCAReference() {
+// ScaServiceProxyFactoryBean pf = (ScaServiceProxyFactoryBean) applicationContext.getBean("&fooReference");
+// assertEquals("fooReference", pf.getReferenceName());
+// TestReference ref = (TestReference) applicationContext.getBean("fooReference");
+//// assertNotNull(ref);
+// }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
new file mode 100644
index 0000000000..4a73b6628b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
@@ -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.container.spring;
+
+import java.net.URI;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.builder.WiringException;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import org.apache.tuscany.container.spring.mock.TestBeanImpl;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+import org.springframework.context.support.GenericApplicationContext;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+
+public final class SpringTestUtils {
+ private SpringTestUtils() {
+ }
+
+ public static <T> ServiceBinding createService(URI uri, Class<T> serviceInterface)
+ throws InvalidServiceContractException, WiringException {
+ return new ServiceBindingExtension(uri) {
+ public QName getBindingType() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ };
+ }
+
+
+ public static GenericApplicationContext createContext() {
+ GenericApplicationContext ctx = new GenericApplicationContext();
+ BeanDefinition definition = new RootBeanDefinition(TestBeanImpl.class);
+ ctx.registerBeanDefinition("foo", definition);
+ return ctx;
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java
new file mode 100644
index 0000000000..f93957cb8b
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/TestClassResource.java
@@ -0,0 +1,45 @@
+/*
+ * 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.container.spring;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import org.springframework.core.io.AbstractResource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestClassResource extends AbstractResource {
+ private Class<?> clazz;
+ private String fileName;
+
+ public TestClassResource(Class<?> clazz, String fileName) {
+ this.clazz = clazz;
+ this.fileName = fileName;
+ }
+
+ public String getDescription() {
+ return "test resource";
+ }
+
+ public InputStream getInputStream() throws IOException {
+ return clazz.getResourceAsStream(fileName);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java
new file mode 100644
index 0000000000..b1e5733cd8
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceWiringTestCase.java
@@ -0,0 +1,151 @@
+/*
+ * 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.container.spring.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.CallableReference;
+
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.ChainHolder;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
+import org.apache.tuscany.spi.wire.ProxyCreationException;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.Wire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.spring.mock.TestBean;
+import org.easymock.EasyMock;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Verifies wiring from a Spring bean to an SCA composite reference
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ReferenceWiringTestCase extends TestCase {
+
+ public void testInvocation() throws Exception {
+ ClassLoader loader = getClass().getClassLoader();
+ URL url = loader.getResource("META-INF/sca/testReferenceContext.xml");
+ Resource resource = new UrlResource(url);
+ URI uri = URI.create("spring");
+ ProxyService proxyService = new MockProxyService();
+ SpringCompositeComponent parent = new SpringCompositeComponent(uri, resource, proxyService, null, loader);
+ Wire wire = EasyMock.createMock(Wire.class);
+ ServiceContract<?> contract = new ServiceContract(TestBean.class) {
+ };
+ EasyMock.expect(wire.getSourceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ReferenceBinding referenceBinding = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(referenceBinding.getWire()).andStubReturn(wire);
+ referenceBinding.start();
+ EasyMock.replay(referenceBinding);
+
+ URI referenceUri = URI.create("spring#testReference");
+ ReferenceBinding binding = new ReferenceBindingExtension(referenceUri, null){
+
+ public QName getBindingType() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ };
+ binding.setWire(wire);
+ List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ bindings.add(binding);
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.getUri()).andReturn(referenceUri).anyTimes();
+ EasyMock.expect(reference.getReferenceBindings()).andReturn(bindings).atLeastOnce();
+ reference.start();
+ EasyMock.replay(reference);
+ parent.register(reference);
+ parent.start();
+ TestBean bean = parent.getBean(TestBean.class, "testBean");
+ assertNotNull(bean.getBean());
+ EasyMock.verify(reference);
+ }
+
+ private class MockInvocationHandler implements InvocationHandler {
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return null;
+ }
+ }
+
+ private class MockProxyService implements ProxyService {
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException {
+ ClassLoader cl = interfaze.getClassLoader();
+ Class[] interfaces = new Class[]{interfaze};
+ MockInvocationHandler handler = new MockInvocationHandler();
+ return interfaze.cast(Proxy.newProxyInstance(cl, interfaces, handler));
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, ChainHolder> mapping)
+ throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze, List<Wire> wires) throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze) throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean checkCompatibility(ServiceContract<?> source,
+ ServiceContract<?> target,
+ boolean ignoreCallback,
+ boolean silent) throws IncompatibleServiceContractException {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
new file mode 100644
index 0000000000..fb9d107b71
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
@@ -0,0 +1,131 @@
+/*
+ * 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.container.spring.impl;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.easymock.EasyMock;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringCompositeBuilderTestCase extends TestCase {
+
+ /**
+ * Verifies that the builder calls back into the registry to load services and references when no
+ * <code>sca:service</code> tag is specified in the Spring application.xml
+ */
+ public void testImplicitServiceWiring() throws Exception {
+ Service service = EasyMock.createMock(Service.class);
+ // Configure the mock builder registry
+ BuilderRegistry registry = EasyMock.createMock(BuilderRegistry.class);
+ EasyMock.expect(registry.build(
+ EasyMock.isA(ServiceDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andStubReturn(service);
+ EasyMock.replay(registry);
+ SpringCompositeBuilder builder = new SpringCompositeBuilder();
+ builder.setBuilderRegistry(registry);
+ ComponentDefinition<SpringImplementation> definition = createDefinitionWithService();
+ Component component = builder.build(definition, null);
+ assertNotNull(component);
+ EasyMock.verify(registry);
+ }
+
+ /**
+ * Verifies that the builder calls back into the registry to load services and references when no
+ * <code>sca:reference</code> tag is specified in the Spring application.xml
+ */
+ public void testImplicitReferenceWiring() throws Exception {
+ Service service = EasyMock.createMock(Service.class);
+ // Configure the mock builder registry
+ BuilderRegistry registry = EasyMock.createMock(BuilderRegistry.class);
+ EasyMock.expect(registry.build(
+ EasyMock.isA(ServiceDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andStubReturn(service);
+ EasyMock.replay(registry);
+ SpringCompositeBuilder builder = new SpringCompositeBuilder();
+ builder.setBuilderRegistry(registry);
+ ComponentDefinition<SpringImplementation> definition = createDefinitionWithReference();
+ Component component = builder.build(definition, null);
+ assertNotNull(component);
+ EasyMock.verify(registry);
+ }
+
+ protected ComponentDefinition<SpringImplementation> createDefinitionWithService() throws Exception {
+ super.setUp();
+ ClassLoader loader = getClass().getClassLoader();
+ URL url = loader.getResource("META-INF/sca/testServiceContext.xml");
+ Resource resource = new UrlResource(url);
+ SpringComponentType<Property<?>> type = createComponentTypeWithService();
+ SpringImplementation impl = new SpringImplementation(loader);
+ impl.setComponentType(type);
+ URI uri = URI.create("composite");
+ ComponentDefinition<SpringImplementation> definition = new ComponentDefinition<SpringImplementation>(uri, impl);
+ impl.setApplicationResource(resource);
+ return definition;
+ }
+
+ protected ComponentDefinition<SpringImplementation> createDefinitionWithReference() throws Exception {
+ super.setUp();
+ ClassLoader loader = getClass().getClassLoader();
+ URL url = loader.getResource("META-INF/sca/testServiceContext.xml");
+ Resource resource = new UrlResource(url);
+ SpringComponentType<Property<?>> type = createComponentTypeWithReference();
+ SpringImplementation impl = new SpringImplementation(loader);
+ impl.setComponentType(type);
+ URI uri = URI.create("composite");
+ ComponentDefinition<SpringImplementation> definition = new ComponentDefinition<SpringImplementation>(uri, impl);
+ impl.setApplicationResource(resource);
+ return definition;
+ }
+
+ private SpringComponentType<Property<?>> createComponentTypeWithService() {
+ SpringComponentType<Property<?>> componentType = new SpringComponentType<Property<?>>();
+ ServiceDefinition serviceDefinition = new ServiceDefinition();
+ serviceDefinition.setUri(URI.create("fooService"));
+ serviceDefinition.setTarget(URI.create("testBean"));
+ componentType.add(serviceDefinition);
+ return componentType;
+ }
+
+ private SpringComponentType<Property<?>> createComponentTypeWithReference() {
+ SpringComponentType<Property<?>> componentType = new SpringComponentType<Property<?>>();
+ ReferenceDefinition referenceDefinition = new ReferenceDefinition();
+ referenceDefinition.setUri(URI.create("fooReference"));
+ componentType.add(referenceDefinition);
+ return componentType;
+ }
+
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java
new file mode 100644
index 0000000000..d014d99ad7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java
@@ -0,0 +1,76 @@
+/*
+ * 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.container.spring.impl;
+
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+import org.springframework.context.support.AbstractApplicationContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SpringCompositeComponentTestCase extends TestCase {
+ private SpringCompositeComponent component;
+
+ public void testChildStart() throws Exception {
+ AbstractApplicationContext appContext = EasyMock.createNiceMock(AbstractApplicationContext.class);
+ EasyMock.replay(appContext);
+ Service service = EasyMock.createMock(Service.class);
+ URI uri = URI.create("composite#service");
+ EasyMock.expect(service.getUri()).andReturn(uri).atLeastOnce();
+ service.start();
+ EasyMock.replay(service);
+ component.setSpringContext(appContext);
+ component.register(service);
+ component.start();
+ EasyMock.verify(service);
+ }
+
+ public void testTargetInvokerCreation() throws Exception {
+ ServiceContract<Type> contract = new ServiceContract<Type>(Foo.class) {
+ };
+ Operation<Type> operation = new Operation<Type>("operation", null, null, null);
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ operations.put("operation", operation);
+ contract.setOperations(operations);
+ operation.setServiceContract(contract);
+ component.createTargetInvoker("bean", operation);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ URI compositeUri = URI.create("composite");
+ component = new SpringCompositeComponent(compositeUri, null, null, null, null);
+
+ }
+
+ private interface Foo {
+ void operation();
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java
new file mode 100644
index 0000000000..e4a6ad0eb7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * 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.container.spring.impl;
+
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Verifies a simple invocation on a Spring bean
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SpringInvocationTestCase extends TestCase {
+
+ /**
+ * Verifies the invoker can resolve a bean in an application context and call a method l
+ */
+ public void testInvocation() throws Exception {
+ TestBean bean = EasyMock.createMock(TestBean.class);
+ bean.test("bar");
+ EasyMock.expectLastCall();
+ EasyMock.replay(bean);
+ SpringCompositeComponent context = EasyMock.createMock(SpringCompositeComponent.class);
+ EasyMock.expect(context.getBean(Object.class, "foo")).andReturn(bean);
+ EasyMock.replay(context);
+ SpringInvoker invoker = new SpringInvoker("foo", TestBean.class.getMethod("test", String.class), context);
+ Message msg = new MessageImpl();
+ msg.setBody(new String[]{"bar"});
+ invoker.invoke(msg);
+ EasyMock.verify(context);
+ EasyMock.verify(bean);
+ }
+
+
+ private interface TestBean {
+ void test(String msg);
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java
new file mode 100644
index 0000000000..1c768e53cc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java
@@ -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.container.spring.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface TestBean {
+ String echo(String msg);
+
+ TestBean getBean();
+
+ void setBean(TestBean bean);
+
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java
new file mode 100644
index 0000000000..db04d8bcad
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java
@@ -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.container.spring.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+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;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java
new file mode 100644
index 0000000000..73d53bdbb7
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java
@@ -0,0 +1,8 @@
+package org.apache.tuscany.container.spring.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface TestReference {
+ String echo(String msg);
+}
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml
new file mode 100644
index 0000000000..7fa1ff34b0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/application-context.xml
@@ -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.container.spring.mock.TestBeanImpl" lazy-init="true">
+ <property name="bean" ref="testReference"/>
+ </bean>
+ <!-- <sca:reference name="testReference" type="org.apache.tuscany.container.spring.mock.TestReference"/> -->
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..0b2c92c667
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/default.scdl
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml
new file mode 100644
index 0000000000..00cd6fabbc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testReferenceContext.xml
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml
new file mode 100644
index 0000000000..deca82f191
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/sca/testServiceContext.xml
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl
new file mode 100644
index 0000000000..0ef2781492
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/META-INF/tuscany/xsystem.scdl
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
new file mode 100644
index 0000000000..127592c1f0
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
new file mode 100644
index 0000000000..c9a4c7e076
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml b/sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml
new file mode 100644
index 0000000000..00dd841ba3
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/container/src/test/resources/test.xml
@@ -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>
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off b/sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off
new file mode 100644
index 0000000000..f86c9cc409
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/pom.xml.off
@@ -0,0 +1,58 @@
+<?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>
+ <parent>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-integration-test</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.spring.spring-integration-test</groupId>
+ <artifactId>spring-integration-test-core</artifactId>
+ <packaging>jar</packaging>
+ <name>Core Integration Test Suite for the Spring Extension</name>
+ <description>Tests core Spring extension functionality</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <configuration>
+ <systemScdl>file:./src/test/resources/system.scdl</systemScdl>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-container</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java
new file mode 100644
index 0000000000..9d7bf96cbc
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.extensions.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TestBean {
+ String echo(String msg);
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java
new file mode 100644
index 0000000000..4804c1b8b9
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/java/org/apache/tuscany/sca/extensions/spring/TestBeanImpl.java
@@ -0,0 +1,29 @@
+/*
+ * 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.extensions.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestBeanImpl implements TestBean {
+
+ public String echo(String msg) {
+ return msg;
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl
new file mode 100644
index 0000000000..f2aa95de6e
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/main/resources/META-INF/sca/spring.composite.scdl
@@ -0,0 +1,30 @@
+<?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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="SpringSmoketestComposite">
+
+ <component name="SpringComposite">
+ <implementation.spring location="applicationContext.xml"/>
+ </component>
+
+</composite>
+
+
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java
new file mode 100644
index 0000000000..dd485b8923
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponent.java
@@ -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.sca.extensions.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WiringTestComponent {
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java
new file mode 100644
index 0000000000..4a59f03a18
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/java/org/apache/tuscany/sca/extensions/spring/WiringTestComponentImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.extensions.spring;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import junit.framework.TestCase;
+
+/**
+ * Verifies beans contained in a Spring composite are properly wired to as targets.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(WiringTestComponent.class)
+public class WiringTestComponentImpl extends TestCase {
+ private TestBean bean;
+
+ /**
+ * Constructor. Accepts a reference to a Spring Bean
+ *
+ * @param bean the Spring Bean
+ */
+ public WiringTestComponentImpl(@Reference(name = "bean")TestBean bean) {
+ this.bean = bean;
+ }
+
+ /**
+ * Invoke to a target Spring Bean
+ */
+ public void testTargetInvocation() {
+ assertEquals("test", bean.echo("test"));
+ }
+}
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml
new file mode 100644
index 0000000000..6f0f3cfb56
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/applicationContext.xml
@@ -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.sca.extensions.spring.TestBeanImpl"/>
+
+</beans>
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl
new file mode 100644
index 0000000000..c15c7c3579
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/itest.scdl
@@ -0,0 +1,33 @@
+<?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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="SpecTestHarnessComposite"
+ autowire="true">
+
+ <include scdlResource="META-INF/sca/spring.composite.scdl"/>
+
+ <component name="WiringTestComponent">
+ <tuscany:junit class="org.apache.tuscany.sca.extensions.spring.WiringTestComponentImpl"/>
+ <reference name="bean" target="SpringComposite/TestBean"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl
new file mode 100644
index 0000000000..9735a1a228
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/core/src/test/resources/system.scdl
@@ -0,0 +1,27 @@
+<?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"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="SpringCoreIntegrationTestSystemComposite">
+
+ <include name="MavenSystemComposite" scdlResource="META-INF/tuscany/embeddedMaven.scdl"/>
+ <include name="SpringSystemComposite" scdlResource="META-INF/sca/spring.system.scdl"/>
+
+</composite> \ No newline at end of file
diff --git a/sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off b/sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off
new file mode 100644
index 0000000000..96fd51cf07
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/integration-test/pom.xml.off
@@ -0,0 +1,74 @@
+<?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>
+ <parent>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-integration-test</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Spring Integration Tests</name>
+ <description>Integration tests for Spring Integration.</description>
+
+ <properties>
+ <!-- version the Apache Tuscany kernel that the runtimes work with -->
+ <kernelVersion>2.0-alpha2-incubating-SNAPSHOT</kernelVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring-container</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>verify</defaultGoal>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <version>${kernelVersion}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/implementation-spring/pom.xml.off b/sandbox/old/contrib/implementation-spring/pom.xml.off
new file mode 100644
index 0000000000..8b3424ec29
--- /dev/null
+++ b/sandbox/old/contrib/implementation-spring/pom.xml.off
@@ -0,0 +1,141 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>sca</artifactId>
+ <version>1.0-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.spring</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+ <name>Tuscany Spring Extension</name>
+ <modules>
+ <module>container</module>
+ <module>integration-test</module>
+ <!-- <module>samples</module>-->
+ </modules>
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.2</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm-util</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-util</artifactId>
+ <version>2.2.3</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <!-- junit version -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>