You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/08/18 00:54:13 UTC
svn commit: r986516 [1/4] - in /tuscany/sca-java-2.x/trunk/contrib/modules:
implementation-spring-runtime/ implementation-spring-runtime/META-INF/
implementation-spring-runtime/src/ implementation-spring-runtime/src/main/
implementation-spring-runtime/...
Author: rfeng
Date: Tue Aug 17 22:54:09 2010
New Revision: 986516
URL: http://svn.apache.org/viewvc?rev=986516&view=rev
Log:
Implementation spring modules supporting the same classloader between Tuscany and Spring
Added:
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/LICENSE
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/MANIFEST.MF (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/NOTICE
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/pom.xml (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/SCANamespaceHandlerResolver.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaNamespaceHandler.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaPropertyBeanDefinitionParser.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaReferenceBeanDefinitionParser.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaServiceBeanDefinitionParser.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentNameAnnotationProcessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ConstructorAnnotationProcessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/InitDestroyAnnotationProcessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/SpringXMLBeanDefinitionLoaderImpl.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/META-INF/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/META-INF/services/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.xml.SpringXMLBeanDefinitionLoader
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.handlers
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.schemas
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/org/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/org/springframework/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/xml/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/xml/spring-sca.xsd (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/sca/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/sca/implementation/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/sca/implementation/spring/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/sca/implementation/spring/runtime/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/sca/implementation/spring/runtime/context/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/test/java/org/apache/tuscany/sca/implementation/spring/runtime/context/BeanLoadTestCase.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/LICENSE
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/META-INF/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/META-INF/MANIFEST.MF (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/NOTICE
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/pom.xml (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanElement.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringConstructorArgElement.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationBuilder.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationConstants.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyElement.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAPropertyElement.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAReferenceElement.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAServiceElement.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanIntrospector.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLBeanDefinitionLoader.java (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/META-INF/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/META-INF/services/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.ImplementationBuilder
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/impl-spring-validation-messages.properties (with props)
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/apache/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/apache/tuscany/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/apache/tuscany/sca/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/apache/tuscany/sca/implementation/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/apache/tuscany/sca/implementation/spring/
tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring/src/main/resources/org/apache/tuscany/sca/implementation/spring/definitions.xml (with props)
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/LICENSE?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/LICENSE (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/LICENSE Tue Aug 17 22:54:09 2010
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/MANIFEST.MF?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/MANIFEST.MF (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/MANIFEST.MF Tue Aug 17 22:54:09 2010
@@ -0,0 +1,63 @@
+Manifest-Version: 1.0
+SCA-Version: 1.1
+Bundle-Name: Apache Tuscany SCA Spring Implementation Runtime Model
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Spring Implementation Runtime Model
+Bundle-SymbolicName: org.apache.tuscany.sca.implementation.spring.runtime
+Bundle-DocURL: http://www.apache.org/
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Import-Package: org.oasisopen.sca;version="2.0.0",
+ org.oasisopen.sca.annotation;version="2.0.0",
+ javax.xml.namespace,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.assembly.builder;version="2.0.0",
+ org.apache.tuscany.sca.assembly.impl;version="2.0.0",
+ org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.context;version="2.0.0",
+ org.apache.tuscany.sca.contribution;version="2.0.0",
+ org.apache.tuscany.sca.contribution.processor;version="2.0.0",
+ org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.core.factory;version="2.0.0",
+ org.apache.tuscany.sca.core.invocation;version="2.0.0",
+ org.apache.tuscany.sca.databinding;version="2.0.0",
+ org.apache.tuscany.sca.databinding.impl;version="2.0.0",
+ org.apache.tuscany.sca.implementation.spring;version="2.0.0",
+ org.apache.tuscany.sca.implementation.spring.xml;version="2.0.0",
+ org.apache.tuscany.sca.implementation.java;version="2.0.0",
+ org.apache.tuscany.sca.implementation.java.injection;version="2.0.0",
+ org.apache.tuscany.sca.implementation.java.introspect;version="2.0.0",
+ org.apache.tuscany.sca.implementation.java.introspect.impl;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.java;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.java.impl;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
+ org.apache.tuscany.sca.invocation;version="2.0.0",
+ org.apache.tuscany.sca.monitor;version="2.0.0",
+ org.apache.tuscany.sca.policy;version="2.0.0",
+ org.apache.tuscany.sca.provider;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.springframework.beans;version="3.0.2.RELEASE",
+ org.springframework.beans.factory;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.annotation;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.config;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.support;version="3.0.2.RELEASE",
+ org.springframework.beans.factory.xml;version="3.0.2.RELEASE",
+ org.springframework.context;version="3.0.2.RELEASE",
+ org.springframework.context.support;version="3.0.2.RELEASE",
+ org.springframework.core;version="3.0.2.RELEASE",
+ org.springframework.core.io;version="3.0.2.RELEASE",
+ org.springframework.util;version="3.0.2.RELEASE"
+Export-Package: org.apache.tuscany.sca.implementation.spring.invocation;version="2.0.0";
+ uses:="org.apache.tuscany.sca.invocation,
+ org.apache.tuscany.sca.runtime,
+ org.apache.tuscany.sca.context,
+ org.apache.tuscany.sca.provider,
+ org.apache.tuscany.sca.implementation.spring,
+ org.apache.tuscany.sca.core,
+ org.apache.tuscany.sca.core.invocation,
+ org.apache.tuscany.sca.interfacedef"
+
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:eol-style = native
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/NOTICE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/NOTICE?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/NOTICE (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/NOTICE Tue Aug 17 22:54:09 2010
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/pom.xml?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/pom.xml Tue Aug 17 22:54:09 2010
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-spring-runtime</artifactId>
+ <name>Apache Tuscany SCA Spring Implementation Runtime Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Spring dependencies... -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>3.0.2.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>3.0.2.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.0.2.RELEASE</version>
+ </dependency>
+
+ </dependencies>
+</project>
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.spring.context;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.spring.SpringBeanElement;
+import org.apache.tuscany.sca.implementation.spring.SpringConstructorArgElement;
+import org.apache.tuscany.sca.implementation.spring.SpringPropertyElement;
+import org.apache.tuscany.sca.implementation.spring.SpringSCAPropertyElement;
+import org.apache.tuscany.sca.implementation.spring.SpringSCAReferenceElement;
+import org.apache.tuscany.sca.implementation.spring.SpringSCAServiceElement;
+import org.springframework.beans.MutablePropertyValues;
+import org.springframework.beans.PropertyValue;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanReference;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.ConstructorArgumentValues;
+import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
+import org.springframework.beans.factory.config.TypedStringValue;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+
+public class SCAGenericApplicationContext extends GenericApplicationContext {
+
+ private ClassLoader classloader = null;
+ private List<SpringSCAPropertyElement> propertyElements = new ArrayList<SpringSCAPropertyElement>();
+ private List<SpringSCAServiceElement> serviceElements = new ArrayList<SpringSCAServiceElement>();
+ private List<SpringSCAReferenceElement> referenceElements = new ArrayList<SpringSCAReferenceElement>();
+ private List<SpringBeanElement> beanElements;
+
+ public SCAGenericApplicationContext(DefaultListableBeanFactory beanFactory,
+ ApplicationContext parent,
+ ClassLoader classloader) {
+ super(beanFactory, parent);
+ this.classloader = classloader;
+ }
+
+ public SCAGenericApplicationContext(ApplicationContext parent, ClassLoader classloader) {
+ super(parent);
+ this.classloader = classloader;
+ }
+
+ @Override
+ protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
+ beanFactory.setBeanClassLoader(classloader);
+ }
+
+ public void addSCAPropertyElement(SpringSCAPropertyElement propertyElement) {
+ propertyElements.add(propertyElement);
+ }
+
+ public void addSCAServiceElement(SpringSCAServiceElement serviceElement) {
+ serviceElements.add(serviceElement);
+ }
+
+ public void addSCAReferenceElement(SpringSCAReferenceElement referenceElement) {
+ referenceElements.add(referenceElement);
+ }
+
+ public synchronized List<SpringBeanElement> getBeanElements() {
+ if (beanElements == null) {
+ beanElements = new ArrayList<SpringBeanElement>();
+ for (String name : getBeanDefinitionNames()) {
+ BeanDefinition def = getBeanDefinition(name);
+ SpringBeanElement beanElement = new SpringBeanElement(name, def.getBeanClassName());
+ beanElements.add(beanElement);
+ beanElement.setAbstractBean(def.isAbstract());
+ beanElement.setFactoryBeanAttribute(def.getFactoryBeanName() != null);
+ beanElement.setFactoryMethodAttribute(def.getFactoryMethodName() != null);
+ beanElement.setParentAttribute(def.getParentName() != null);
+ beanElement.setInnerBean(beanElement.getId() == null);
+
+ ConstructorArgumentValues args = def.getConstructorArgumentValues();
+ for (Map.Entry<Integer, ValueHolder> e: args.getIndexedArgumentValues().entrySet()) {
+ ValueHolder holder = e.getValue();
+ SpringConstructorArgElement arg = new SpringConstructorArgElement(holder.getType());
+ arg.setIndex(e.getKey());
+ beanElement.addCustructorArgs(arg);
+ }
+
+ MutablePropertyValues values = def.getPropertyValues();
+ for (PropertyValue p : values.getPropertyValueList()) {
+ SpringPropertyElement propertyElement = new SpringPropertyElement(p.getName());
+ Object value = p.getValue();
+ configurePropertyElement(propertyElement, value);
+ beanElement.getProperties().add(propertyElement);
+ }
+ }
+ }
+ return beanElements;
+ }
+
+ public void configurePropertyElement(SpringPropertyElement propertyElement, Object value) {
+ if (value instanceof BeanReference) {
+ BeanReference beanRef = (BeanReference)value;
+ propertyElement.addRef(beanRef.getBeanName());
+ } else if (value instanceof Collection) {
+ Collection collection = (Collection)value;
+ for (Object item : collection) {
+ configurePropertyElement(propertyElement, item);
+ }
+ } else if (value instanceof TypedStringValue) {
+ TypedStringValue stringValue = (TypedStringValue)value;
+ propertyElement.addValue(stringValue.getValue());
+ } else {
+ if (value != null) {
+ propertyElement.addValue(value.toString());
+ }
+ }
+ }
+
+ public List<SpringSCAPropertyElement> getPropertyElements() {
+ return propertyElements;
+ }
+
+ public List<SpringSCAServiceElement> getServiceElements() {
+ return serviceElements;
+ }
+
+ public List<SpringSCAReferenceElement> getReferenceElements() {
+ return referenceElements;
+ }
+
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAGenericApplicationContext.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.spring.context;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.spring.invocation.SpringImplementationWrapper;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.MessageSourceResolvable;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.core.io.Resource;
+
+/**
+ * A Spring ParentApplicationContext for a given Spring Implementation
+ *
+ * The Parent application context is responsible for handling those entities within a Spring
+ * application context that actually belong to SCA rather than to Spring. The principal things
+ * are Properties and References. These may be present either through explicit <sca:property/>
+ * and <sca:reference/> elements in the application context or they may be implicit through
+ * unresolved Spring bean <property.../> elements. In either case, it is the Parent application
+ * context that must provide Spring beans that correspond to the property or reference, as derived
+ * from the SCA composite in which the Spring application context is an implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAParentApplicationContext implements ApplicationContext {
+
+ // The Spring implementation for which this is the parent application context
+ private SpringImplementationWrapper implementation;
+
+ private static final String[] EMPTY_ARRAY = new String[0];
+
+ public SCAParentApplicationContext(SpringImplementationWrapper implementation) {
+ this.implementation = implementation;
+ } // end constructor
+
+ public Object getBean(String name) throws BeansException {
+ return getBean(name, (Class)null);
+ }
+
+ /**
+ * Get a Bean for a reference or for a property.
+ *
+ * @param name - the name of the Bean required
+ * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
+ * @return Object - a Bean which matches the requested bean
+ */
+ public Object getBean(String name, Class requiredType) throws BeansException {
+ Object bean = implementation.getBean(name, requiredType);
+ if (bean == null && getParent() != null) {
+ bean = getParent().getBean(name, requiredType);
+ }
+ if (bean == null) {
+ throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name);
+ } else {
+ return bean;
+ }
+ } // end method getBean( String, Class )
+
+ public Object getBean(String name, Object[] args) throws BeansException {
+ return getBean(name, ((Class)null));
+ }
+
+ public <T> T getBean(Class<T> clazz) throws BeansException {
+ return clazz.cast(getBean(clazz.getName(), clazz));
+ }
+
+ public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> clazz) throws BeansException {
+ return null;
+ }
+
+ public <A extends Annotation> A findAnnotationOnBean(String arg0, Class<A> clazz) {
+ return null;
+ }
+
+ public boolean containsBean(String name) {
+ // TODO
+ return false;
+ }
+
+ public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
+ // TODO
+ return false;
+ }
+
+ public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class getType(String name) throws NoSuchBeanDefinitionException {
+ return null;
+ }
+
+ public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
+ return EMPTY_ARRAY;
+ }
+
+ public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
+ return null;
+ }
+
+ public String getId() {
+ return this.toString();
+ }
+
+ public String getDisplayName() {
+ return implementation.getURI();
+ }
+
+ public long getStartupDate() {
+ return 0;
+ }
+
+ public boolean containsBeanDefinition(String beanName) {
+ return false;
+ }
+
+ public int getBeanDefinitionCount() {
+ return 0;
+ }
+
+ public String[] getBeanDefinitionNames() {
+ return new String[0];
+ }
+
+ public String[] getBeanNamesForType(Class type) {
+ return new String[0];
+ }
+
+ public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) {
+ return new String[0];
+ }
+
+ public Map getBeansOfType(Class type) throws BeansException {
+ return null;
+ }
+
+ public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException {
+ return null;
+ }
+
+ public boolean isPrototype(String theString) {
+ return false;
+ }
+
+ public BeanFactory getParentBeanFactory() {
+ return null;
+ }
+
+ public boolean containsLocalBean(String name) {
+ return false;
+ }
+
+ public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
+ return null;
+ }
+
+ public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
+ return null;
+ }
+
+ public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
+ return null;
+ }
+
+ public void publishEvent(ApplicationEvent event) {
+
+ }
+
+ public Resource[] getResources(String locationPattern) throws IOException {
+ return new Resource[0];
+ }
+
+ public Resource getResource(String location) {
+ return null;
+ }
+
+ public ClassLoader getClassLoader() {
+ // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's
+ // resource loading mechanism is exposed right now.
+ return this.getClass().getClassLoader();
+ }
+
+ @Override
+ public ApplicationContext getParent() {
+ return implementation.getParentApplicationContext();
+ }
+
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SCAParentApplicationContext.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.context;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.spring.invocation.ComponentWrapper;
+import org.apache.tuscany.sca.implementation.spring.invocation.PropertyValueWrapper;
+import org.apache.tuscany.sca.implementation.spring.invocation.SpringImplementationWrapper;
+import org.apache.tuscany.sca.implementation.spring.processor.ComponentNameAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.ConstructorAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.InitDestroyAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.PropertyAnnotationProcessor;
+import org.apache.tuscany.sca.implementation.spring.processor.ReferenceAnnotationProcessor;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * This is the runtime side tie for the corresponding tuscany side stub class.
+ * It enables the Tuscany code to invoke methods on a Spring context without
+ * needing to know about any Spring classes. See the SpringContextStub class
+ * in the implementation-spring module for what the stub does.
+ */
+public class SpringContextWrapper {
+
+ private GenericApplicationContext springContext;
+ private SpringImplementationWrapper implementation;
+
+ public SpringContextWrapper(SpringImplementationWrapper implementation, List<URL> resource) {
+ this.implementation = implementation;
+ SCAParentApplicationContext scaParentContext = new SCAParentApplicationContext(implementation);
+ springContext = createApplicationContext(scaParentContext, resource);
+ }
+
+ public ApplicationContext getApplicationContext() {
+ return springContext;
+ }
+
+ public void start() {
+ // Do refresh here to ensure that Spring Beans are not touched before the SCA config process is complete...
+ springContext.refresh();
+ springContext.start();
+ }
+
+ public void close() {
+ springContext.close();
+ if (springContext instanceof GenericApplicationContext) {
+ springContext.stop();
+ }
+ }
+
+ /**
+ * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
+ */
+ private GenericApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext,
+ List<URL> resources) {
+
+ GenericApplicationContext appCtx =
+ new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader());
+ XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
+
+ // REVIEW: [rfeng] How do we control the schema validation
+ xmlReader.setValidating(false);
+
+ for (URL resource : resources) {
+ xmlReader.loadBeanDefinitions(new UrlResource(resource));
+ }
+ xmlReader.setBeanClassLoader(implementation.getClassLoader());
+ includeAnnotationProcessors(appCtx.getBeanFactory());
+ return appCtx;
+
+ }
+
+ public Object getBean(String id) throws BeansException {
+ return springContext.getBean(id);
+ }
+
+ /**
+ * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
+ */
+ private void includeAnnotationProcessors(ConfigurableListableBeanFactory beanFactory) {
+
+ // Processor to deal with @Init and @Destroy SCA Annotations
+ BeanPostProcessor initDestroyProcessor = new InitDestroyAnnotationProcessor();
+ beanFactory.addBeanPostProcessor(initDestroyProcessor);
+
+ // Processor to deal with @Reference SCA Annotations
+ ComponentWrapper component = implementation.getComponentWrapper();
+ BeanPostProcessor referenceProcessor = new ReferenceAnnotationProcessor(component);
+ beanFactory.addBeanPostProcessor(referenceProcessor);
+
+ // Processor to deal with @Property SCA Annotations
+ PropertyValueWrapper pvs = implementation.getPropertyValueWrapper();
+ BeanPostProcessor propertyProcessor = new PropertyAnnotationProcessor(pvs);
+ beanFactory.addBeanPostProcessor(propertyProcessor);
+
+ // Processor to deal with @ComponentName SCA Annotations
+ BeanPostProcessor componentNameProcessor =
+ new ComponentNameAnnotationProcessor(implementation.getComponentName());
+ beanFactory.addBeanPostProcessor(componentNameProcessor);
+
+ // Processor to deal with @Constructor SCA Annotations
+ BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor();
+ beanFactory.addBeanPostProcessor(constructorProcessor);
+ }
+
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/context/SpringContextWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+/**
+ * Wrapper for the Component
+ */
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class ComponentWrapper {
+
+ private RuntimeComponent component;
+
+ public ComponentWrapper(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ public Object getService(Class<?> type, String name) {
+ return component.getComponentContext().getService(type, name);
+ }
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java Tue Aug 17 22:54:09 2010
@@ -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.implementation.spring.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Wrapper for PropertyValue
+ */
+public class PropertyValueWrapper {
+
+ private RuntimeComponent component;
+ private PropertyValueFactory propertyFactory;
+
+ public PropertyValueWrapper(RuntimeComponent component, PropertyValueFactory propertyFactory) {
+ this.component = component;
+ this.propertyFactory = propertyFactory;
+ }
+
+ public Object getPropertyObj(Class<?> type, String name) {
+ List<ComponentProperty> props = component.getProperties();
+ for (ComponentProperty prop : props) {
+ if (prop.getName().equals(name)) {
+ return propertyFactory.createPropertyValue(prop, type);
+ }
+ }
+ return null; // property name not found
+ }
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+/**
+ * A utility to receive the parent Spring application context
+ */
+public interface SpringApplicationContextAccessor {
+ /**
+ * Get the parent Spring application context for the hosting environment. This will be used as the parent
+ * application context for implementation.spring components
+ * @return The parent application context
+ */
+ Object getParentApplicationContext();
+
+ /**
+ * Set the root Spring application context. This is particually useful for Spring web integration where Spring
+ * creates WebApplicationContext and keeps it in the ServletContext
+ * @param parentApplicationContext The parent application context
+ */
+ void setParentApplicationContext(Object parentApplicationContext);
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringApplicationContextAccessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.spring.context.SpringContextWrapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.springframework.context.ApplicationContext;
+
+/**
+ * A provider class for runtime Spring implementation instances
+ * @version $Rev$ $Date$
+ */
+public class SpringImplementationProvider implements ImplementationProvider {
+ private RuntimeComponent component;
+
+ // A Spring application context object
+ private SpringContextWrapper springContext;
+
+ /**
+ * Constructor for the provider - takes a component definition and a Spring implementation
+ * description
+ * @param component - the component in the assembly
+ * @param implementation - the implementation
+ */
+ public SpringImplementationProvider(RuntimeComponent component,
+ SpringImplementationWrapper implementation,
+ ApplicationContext parentApplicationContext,
+ ProxyFactory proxyService,
+ PropertyValueFactory propertyValueObjectFactory) {
+ super();
+ this.component = component;
+
+ springContext = new SpringContextWrapper(implementation, implementation.getResource());
+
+ } // end constructor
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ return new SpringInvoker(component, springContext, service, operation);
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ /**
+ * Start this Spring implementation instance
+ */
+ public void start() {
+ springContext.start();
+ }
+
+ /**
+ * Stop this implementation instance
+ */
+ public void stop() {
+ springContext.close();
+ }
+
+} // end class SpringImplementationProvider
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.springframework.context.ApplicationContext;
+
+/**
+ * ImplementationProviderFactory for Spring implementation type
+ * @version $Rev$ $Date$
+ *
+ */
+public class SpringImplementationProviderFactory implements ImplementationProviderFactory<SpringImplementation> {
+ private ProxyFactory proxyFactory;
+ private PropertyValueFactory propertyFactory;
+ private SpringApplicationContextAccessor contextAccessor;
+
+ /**
+ * Simple constructor
+ *
+ */
+ public SpringImplementationProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ contextAccessor = utilities.getUtility(SpringApplicationContextAccessor.class);
+ proxyFactory = ExtensibleProxyFactory.getInstance(registry);
+ propertyFactory = utilities.getUtility(PropertyValueFactory.class);
+ }
+
+ /**
+ * Returns a SpringImplementationProvider for a given component and Spring implementation
+ * @param component the component for which implementation instances are required
+ * @param implementation the Spring implementation with details of the component
+ * implementation
+ * @return the SpringImplementationProvider for the specified component
+ */
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ SpringImplementation implementation) {
+ ApplicationContext parentApplicationContext =
+ (contextAccessor != null) ? (ApplicationContext)contextAccessor.getParentApplicationContext() : null;
+ SpringImplementationWrapper tie =
+ new SpringImplementationWrapper(implementation, parentApplicationContext, component, propertyFactory);
+ return new SpringImplementationProvider(component, tie, parentApplicationContext, proxyFactory, propertyFactory);
+ }
+
+ /**
+ * Returns the class of the Spring implementation
+ */
+ public Class<SpringImplementation> getModelType() {
+ return SpringImplementation.class;
+ }
+
+} // end class SpringImplementationProviderFactory
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java?rev=986516&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java Tue Aug 17 22:54:09 2010
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.springframework.context.ApplicationContext;
+
+/**
+ * Wrapper for SpringImplementation
+ */
+public class SpringImplementationWrapper {
+
+ private SpringImplementation implementation;
+ private ApplicationContext parentApplicationContext;
+ private RuntimeComponent component;
+ private PropertyValueFactory propertyFactory;
+
+ public SpringImplementationWrapper(SpringImplementation implementation,
+ ApplicationContext parentApplicationContext,
+ RuntimeComponent component,
+ PropertyValueFactory propertyFactory) {
+ this.implementation = implementation;
+ this.component = component;
+ this.propertyFactory = propertyFactory;
+ this.parentApplicationContext = parentApplicationContext;
+ }
+
+ public String getURI() {
+ return implementation.getURI();
+ }
+
+ public List<URL> getResource() {
+ return implementation.getResource();
+ }
+
+ public String getComponentName() {
+ return component.getName();
+ }
+
+ /**
+ * Method to create a Java Bean for a Property value
+ * @param <B> the class type of the Bean
+ * @param requiredType - a Class object for the required type
+ * @param name - the Property name
+ * @return - a Bean of the specified property, with value set
+ */
+ private <B> B getPropertyBean(Class<?> requiredType, String name) {
+ B propertyObject = null;
+ // Get the component's list of properties
+ List<ComponentProperty> props = component.getProperties();
+ for (ComponentProperty prop : props) {
+ if (prop.getName().equals(name)) {
+ // On finding the property, create a factory for it and create a Bean using
+ // the factory
+ propertyObject = (B)propertyFactory.createPropertyValue(prop, requiredType);
+ } // end if
+ } // end for
+
+ return propertyObject;
+ }
+
+ /**
+ * Creates a proxy Bean for a reference
+ * @param <B> the Business interface type for the reference
+ * @param businessInterface - the business interface as a Class
+ * @param referenceName - the name of the Reference
+ * @return an Bean of the type defined by <B>
+ */
+ private <B> B getService(Class<B> businessInterface, String referenceName) {
+ return component.getComponentContext().getService(businessInterface, referenceName);
+ }
+
+ /**
+ * Get a Bean for a reference or for a property.
+ *
+ * @param name - the name of the Bean required
+ * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
+ * @return Object - a Bean which matches the requested bean
+ */
+ public Object getBean(String name, Class<?> requiredType) {
+ // The expectation is that the requested Bean is either a reference or a property
+ // from the Spring context
+ for (Reference reference : implementation.getReferences()) {
+ if (reference.getName().equals(name)) {
+ // Extract the Java interface for the reference (it can't be any other interface type
+ // for a Spring application context)
+ if (requiredType == null) {
+ JavaInterface javaInterface = (JavaInterface)reference.getInterfaceContract().getInterface();
+ requiredType = javaInterface.getJavaClass();
+ }
+ // Create and return the proxy for the reference
+ return getService(requiredType, reference.getName());
+ } // end if
+ } // end for
+
+ // For a property, get the name and the required Java type and create a Bean
+ // of that type with the value inserted.
+ for (Property property : implementation.getProperties()) {
+ if (property.getName().equals(name)) {
+ if (requiredType == null) {
+ // The following code only deals with a subset of types and was superceded
+ // by the information from the implementation (which uses Classes as found
+ // in the Spring implementation itself.
+ //requiredType = JavaXMLMapper.getJavaType( property.getXSDType() );
+ requiredType = implementation.getPropertyClass(name);
+ }
+ return getPropertyBean(requiredType, property.getName());
+ } // end if
+ } // end for
+ // TODO: NoSuchBeanException
+ // throw new RuntimeException("Unable to find Bean with name " + name);
+ return null;
+
+ } // end method getBean( String, Class )
+
+ public ComponentWrapper getComponentWrapper() {
+ return new ComponentWrapper(component);
+ }
+
+ public PropertyValueWrapper getPropertyValueWrapper() {
+ return new PropertyValueWrapper(component, propertyFactory);
+ }
+
+ public ClassLoader getClassLoader() {
+ return implementation.getClassLoader();
+ }
+
+ public ApplicationContext getParentApplicationContext() {
+ return parentApplicationContext;
+ }
+
+}
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date