From 3b7a9c51b93925c567b6b84450410b2737cc565e Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 16 Feb 2012 15:41:20 +0000 Subject: Delete old RC tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1245037 13f79535-47bb-0310-9956-ffa450edef68 --- .../modules/implementation-spring-stub/LICENSE | 205 --------------------- .../META-INF/MANIFEST.MF | 26 --- .../modules/implementation-spring-stub/NOTICE | 6 - .../modules/implementation-spring-stub/README | 9 - .../modules/implementation-spring-stub/pom.xml | 56 ------ .../stub/SpringXMLBeanDefinitionLoaderStub.java | 92 --------- .../spring/provider/stub/ComponentTie.java | 41 ----- .../spring/provider/stub/PropertyValueTie.java | 53 ------ .../stub/SpringApplicationContextAccessor.java | 39 ---- .../spring/provider/stub/SpringContextStub.java | 142 -------------- .../stub/SpringImplementationProvider.java | 80 -------- .../stub/SpringImplementationProviderFactory.java | 75 -------- .../provider/stub/SpringImplementationTie.java | 156 ---------------- .../provider/stub/SpringInvocationException.java | 40 ---- .../spring/provider/stub/SpringInvoker.java | 125 ------------- ...tation.spring.xml.SpringXMLBeanDefinitionLoader | 17 -- ...cany.sca.provider.ImplementationProviderFactory | 20 -- 17 files changed, 1182 deletions(-) delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/LICENSE delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/META-INF/MANIFEST.MF delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/NOTICE delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/README delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/pom.xml delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/stub/SpringXMLBeanDefinitionLoaderStub.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/ComponentTie.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/PropertyValueTie.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringApplicationContextAccessor.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringContextStub.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProvider.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProviderFactory.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationTie.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvocationException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvoker.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.xml.SpringXMLBeanDefinitionLoader delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (limited to 'sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub') diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/LICENSE b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/LICENSE deleted file mode 100644 index 6e529a25c4..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - 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. - - - diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/META-INF/MANIFEST.MF b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/META-INF/MANIFEST.MF deleted file mode 100644 index b2b2091437..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/META-INF/MANIFEST.MF +++ /dev/null @@ -1,26 +0,0 @@ -Manifest-Version: 1.0 -SCA-Version: 1.1 -Bundle-Name: Apache Tuscany SCA Spring Implementation 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 Model -Import-Package: org.apache.tuscany.sca.assembly;version="2.0.0", - org.apache.tuscany.sca.assembly.impl;version="2.0.0", - org.apache.tuscany.sca.context;version="2.0.0", - org.apache.tuscany.sca.contribution.processor;version="2.0.0", - org.apache.tuscany.sca.core;version="2.0.0", - org.apache.tuscany.sca.core.invocation;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.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.invocation;version="2.0.0", - org.apache.tuscany.sca.provider;version="2.0.0", - org.apache.tuscany.sca.runtime;version="2.0.0", - org.oasisopen.sca;version="2.0.0" -Bundle-SymbolicName: org.apache.tuscany.sca.implementation.spring.stub -Bundle-DocURL: http://www.apache.org/ -Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/NOTICE b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/NOTICE deleted file mode 100644 index 1325efd8bf..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/README b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/README deleted file mode 100644 index e1b1f98fe0..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/README +++ /dev/null @@ -1,9 +0,0 @@ -Note that the implementation spring modules have a different structure from other extensions. - -The aim is to have the Tuscany runtime embedded in a container with the Tuscany classes hidden -from user applications and the Spring jar's packaged with the application. That means that the -Tuscany code has no visibilty of the Spring classes and visa-versa. To implement that the -implementation-spring module has no dependencies on Spring and the implementation-spring-runtime -module has no dependencies on Tuscany (other than the sca-api), and reflection is used to call -methods between the modules. - diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/pom.xml b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/pom.xml deleted file mode 100644 index 91d18af7f3..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-modules - 2.0-Beta1 - ../pom.xml - - tuscany-implementation-spring-stub - Apache Tuscany SCA Spring Implementation Runtime Stub - - - - - - - - - - - - - - - org.apache.tuscany.sca - tuscany-implementation-spring - 2.0-Beta1 - - - - org.apache.tuscany.sca - tuscany-core - 2.0-Beta1 - - - - diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/stub/SpringXMLBeanDefinitionLoaderStub.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/stub/SpringXMLBeanDefinitionLoaderStub.java deleted file mode 100644 index f34dfb8ceb..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/stub/SpringXMLBeanDefinitionLoaderStub.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.processor.stub; - -import java.lang.reflect.Method; -import java.net.URL; -import java.util.Arrays; -import java.util.List; - -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.implementation.spring.SpringBeanElement; -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.apache.tuscany.sca.implementation.spring.xml.SpringXMLBeanDefinitionLoader; -import org.oasisopen.sca.ServiceRuntimeException; - -/** - * This is the Tuscany side stub for the corresponding runtime tie class. - * It enables the Tuscany code to invoke methods on a Spring context without - * needing to know about any Spring classes. See the SpringContextTie class - * in the implementation-spring-runtime module for what the tie does. - */ -public class SpringXMLBeanDefinitionLoaderStub implements SpringXMLBeanDefinitionLoader { - private final static String TIE = "org.apache.tuscany.sca.implementation.spring.processor.tie.SpringXMLLoaderTie"; - - private static Method createApplicationContext; - - public SpringXMLBeanDefinitionLoaderStub() throws Exception { - synchronized (SpringXMLBeanDefinitionLoaderStub.class) { - if (createApplicationContext == null) { - Class tieClass = Class.forName(TIE, false, Thread.currentThread().getContextClassLoader()); - createApplicationContext = - tieClass.getMethod("createApplicationContext", Object.class, ClassLoader.class, List.class); - } - } - } - - public Object createApplicationContext(Object scaParentContext, ClassLoader classLoader, List resources) - throws Exception { - return createApplicationContext.invoke(null, scaParentContext, classLoader, resources); - } - - public Object load(List resources, - List serviceElements, - List referenceElements, - List propertyElements, - List beanElements, - ProcessorContext context) { - try { - Object appContext = - createApplicationContext(null, Thread.currentThread().getContextClassLoader(), resources); - Class cls = appContext.getClass(); - Method method = cls.getMethod("getElements", Class.class); - SpringSCAServiceElement[] serviceArray = - (SpringSCAServiceElement[])method.invoke(appContext, SpringSCAServiceElement.class); - serviceElements.addAll(Arrays.asList(serviceArray)); - - SpringSCAReferenceElement[] referenceArray = - (SpringSCAReferenceElement[])method.invoke(appContext, SpringSCAReferenceElement.class); - referenceElements.addAll(Arrays.asList(referenceArray)); - - SpringSCAPropertyElement[] propertyArray = - (SpringSCAPropertyElement[])method.invoke(appContext, SpringSCAPropertyElement.class); - propertyElements.addAll(Arrays.asList(propertyArray)); - - SpringBeanElement[] beanArray = (SpringBeanElement[])method.invoke(appContext, SpringBeanElement.class); - beanElements.addAll(Arrays.asList(beanArray)); - - return appContext; - } catch (Throwable e) { - throw new ServiceRuntimeException(e); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/ComponentTie.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/ComponentTie.java deleted file mode 100644 index 882aa587e5..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/ComponentTie.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.provider.stub; - -/** - * This is the Tuscany side tie for the corresponding Spring runtime 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 ComponentStub class - * in the implementation-spring-runtime module for what the stub does. - */ -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -public class ComponentTie { - - private RuntimeComponent component; - - public ComponentTie(RuntimeComponent component) { - this.component = component; - } - - public Object getService(Class type, String name) { - return component.getComponentContext().getService(type, name); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/PropertyValueTie.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/PropertyValueTie.java deleted file mode 100644 index 5e0c5263c2..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/PropertyValueTie.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.provider.stub; - -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; - -/** - * This is the Tuscany side tie for the corresponding Spring runtime 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 PropertyValueStub class - * in the implementation-spring-runtime module for what the stub does. - */ -public class PropertyValueTie { - - private RuntimeComponent component; - private PropertyValueFactory propertyFactory; - - public PropertyValueTie(RuntimeComponent component, PropertyValueFactory propertyFactory) { - this.component = component; - this.propertyFactory = propertyFactory; - } - - public Object getPropertyObj(Class type, String name) { - List props = component.getProperties(); - for (ComponentProperty prop : props) { - if (prop.getName().equals(name)) { - return propertyFactory.createPropertyValue(prop, type); - } - } - return null; // property name not found - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringApplicationContextAccessor.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringApplicationContextAccessor.java deleted file mode 100644 index 84a65bcf17..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringApplicationContextAccessor.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.stub; - -/** - * 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); -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringContextStub.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringContextStub.java deleted file mode 100644 index 062da4b2d2..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringContextStub.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.provider.stub; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -import org.apache.tuscany.sca.context.PropertyValueFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.implementation.spring.SpringImplementation; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * This is the Tuscany side stub for the corresponding runtime tie class. - * It enables the Tuscany code to invoke methods on a Spring context without - * needing to know about any Spring classes. See the SpringContextTie class - * in the implementation-spring-runtime module for what the tie does. - */ -public class SpringContextStub { - - private static final String SPRING_IMPLEMENTATION_STUB = - "org.apache.tuscany.sca.implementation.spring.context.tie.SpringImplementationStub"; - private static final String SPRING_CONTEXT_TIE = - "org.apache.tuscany.sca.implementation.spring.context.tie.SpringContextTie"; - private Object tie; - private Method startMethod; - private Method closeMethod; - private Method getBeanMethod; - - public SpringContextStub(RuntimeComponent component, - SpringImplementation implementation, - Object parentApplicationContext, - ProxyFactory proxyService, - PropertyValueFactory propertyValueObjectFactory) { - - initTie(component, implementation, parentApplicationContext, propertyValueObjectFactory); - - } - - private void initTie(RuntimeComponent component, - SpringImplementation implementation, - Object parentApplicationContext, - PropertyValueFactory propertyValueObjectFactory) { - - // TODO: what class loader to use? - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - - try { - - Class stubClass = Class.forName(SPRING_IMPLEMENTATION_STUB, true, cl); - Constructor stubConstructor = stubClass.getConstructor(new Class[] {Object.class}); - Object stub = - stubConstructor.newInstance(new SpringImplementationTie(implementation, parentApplicationContext, - component, propertyValueObjectFactory)); - - Class tieClass = Class.forName(SPRING_CONTEXT_TIE, true, cl); - Constructor tieConstructor = tieClass.getConstructor(new Class[] {stubClass, List.class}); - this.tie = tieConstructor.newInstance(stub, implementation.getResource()); - - this.startMethod = tieClass.getMethod("start"); - this.closeMethod = tieClass.getMethod("close"); - this.getBeanMethod = tieClass.getMethod("getBean", String.class); - - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } catch (SecurityException e) { - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public void start() { - try { - startMethod.invoke(tie); - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public void close() { - try { - closeMethod.invoke(tie); - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public Object getBean(String id) throws SpringInvocationException { - try { - - return getBeanMethod.invoke(tie, id); - - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProvider.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProvider.java deleted file mode 100644 index e0207b9f12..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProvider.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.provider.stub; - -import org.apache.tuscany.sca.context.PropertyValueFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.implementation.spring.SpringImplementation; -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; - -/** - * 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 SpringContextStub 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, - SpringImplementation implementation, - Object parentApplicationContext, - ProxyFactory proxyService, - PropertyValueFactory propertyValueObjectFactory) { - super(); - this.component = component; - - springContext = new SpringContextStub(component, implementation, parentApplicationContext, proxyService, propertyValueObjectFactory); - - } // 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 diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProviderFactory.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProviderFactory.java deleted file mode 100644 index d402ff2eb6..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationProviderFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.provider.stub; - -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; - -/** - * ImplementationProviderFactory for Spring implementation type - * @version $Rev$ $Date$ - * - */ -public class SpringImplementationProviderFactory implements ImplementationProviderFactory { - 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) { - Object parentApplicationContext = - (contextAccessor != null) ? contextAccessor.getParentApplicationContext() : null; - return new SpringImplementationProvider(component, implementation, parentApplicationContext, proxyFactory, - propertyFactory); - } - - /** - * Returns the class of the Spring implementation - */ - public Class getModelType() { - return SpringImplementation.class; - } - -} // end class SpringImplementationProviderFactory diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationTie.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationTie.java deleted file mode 100644 index fc75faed21..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringImplementationTie.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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.provider.stub; - -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; - -/** - * This is the Tuscany side tie for the corresponding runtime stub class. - * It enables the Sping code in the runtime module to invoke methods on a - * Tuscany SpringImplementation without the Spring runtime module - * needing to know about any Tuscany classes. See the SpringImplementationStub class - * in the implementation-spring-runtime module for what the stub does. - */ -public class SpringImplementationTie { - - private SpringImplementation implementation; - private Object parentApplicationContext; - private RuntimeComponent component; - private PropertyValueFactory propertyFactory; - - public SpringImplementationTie(SpringImplementation implementation, - Object parentApplicationContext, - RuntimeComponent component, - PropertyValueFactory propertyFactory) { - this.implementation = implementation; - this.component = component; - this.propertyFactory = propertyFactory; - this.parentApplicationContext = parentApplicationContext; - } - - public String getURI() { - return implementation.getURI(); - } - - public String getComponentName() { - return component.getName(); - } - - /** - * Method to create a Java Bean for a Property value - * @param 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 getPropertyBean(Class requiredType, String name) { - B propertyObject = null; - // Get the component's list of properties - List 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 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 - */ - private B getService(Class 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 Object getComponentTie() { - return new ComponentTie(component); - } - - public Object getPropertyValueTie() { - return new PropertyValueTie(component, propertyFactory); - } - - public ClassLoader getClassLoader() { - return implementation.getClassLoader(); - } - - public Object getParentApplicationContext() { - return parentApplicationContext; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvocationException.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvocationException.java deleted file mode 100644 index 909a640563..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvocationException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.provider.stub; - -/** - * @version $Rev$ $Date$ - */ -public class SpringInvocationException extends Exception { - - private static final long serialVersionUID = -1157790036638157513L; - - public SpringInvocationException(String msg) { - super(msg); - } - - public SpringInvocationException(Throwable e) { - super(e); - } - - public SpringInvocationException(String msg, Throwable e) { - super(msg, e); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvoker.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvoker.java deleted file mode 100644 index 7d73eb5e6a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/java/org/apache/tuscany/sca/implementation/spring/provider/stub/SpringInvoker.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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.provider.stub; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.implementation.spring.SpringBeanElement; -import org.apache.tuscany.sca.implementation.spring.SpringImplementation; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * Initial implementation of a Spring bean invoker - * @version $Rev$ $Date$ - */ -public class SpringInvoker implements Invoker { - - private Method theMethod = null; - private Object bean; - private SpringBeanElement beanElement; - private boolean badInvoker = false; - - private SpringContextStub springContext; - private Operation operation; - - /** - * SpringInvoker constructor - * @param component - the Spring component to invoke - * @param service - the service to invoke - * @param operation - the operation to invoke - */ - public SpringInvoker(RuntimeComponent component, - SpringContextStub springContext, - RuntimeComponentService service, - Operation operation) { - - this.springContext = springContext; - this.operation = operation; - - // From the component and the service, identify the Spring Bean which is the target - SpringImplementation theImplementation = (SpringImplementation)component.getImplementation(); - beanElement = theImplementation.getBeanFromService(service.getService()); - - if (beanElement == null) { - badInvoker = true; - return; - } - - } // end constructor SpringInvoker - - // Lazy-load the method to avoid timing problems with the Spring Context - private void setupMethod() throws SpringInvocationException { - try { - bean = springContext.getBean(beanElement.getId()); - Class beanClass = bean.getClass(); - theMethod = JavaInterfaceUtil.findMethod(beanClass, operation); - //System.out.println("SpringInvoker - found method " + theMethod.getName() ); - } catch (NoSuchMethodException e) { - throw new SpringInvocationException(e); - } - } - - private Object doInvoke(Object payload) throws SpringInvocationException { - if (theMethod == null) - setupMethod(); - - if (badInvoker) - throw new SpringInvocationException("Spring invoker incorrectly configured"); - // Invoke the method on the Spring bean using the payload, returning the results - try { - Object ret; - - if (payload != null && !payload.getClass().isArray()) { - ret = theMethod.invoke(bean, payload); - } else { - ret = theMethod.invoke(bean, (Object[])payload); - } - return ret; - } catch (InvocationTargetException e) { - throw new SpringInvocationException("Spring invoker invoke method '" + theMethod.getName() + "' error.", - e.getCause()); - } catch (Exception e) { - throw new SpringInvocationException("Spring invoker invoke method '" + theMethod.getName() + "' error.", e); - } - - } // end method doInvoke - - /** - * @param msg the message to invoke on the target bean - */ - public Message invoke(Message msg) { - try { - Object resp = doInvoke(msg.getBody()); - msg.setBody(resp); - } catch (SpringInvocationException e) { - msg.setFaultBody(e.getCause()); - } catch (Throwable e) { - msg.setFaultBody(e); - } - //System.out.println("Spring Invoker - invoke called"); - return msg; - } // end method invoke - -} // end class SpringInvoker diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.xml.SpringXMLBeanDefinitionLoader b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.xml.SpringXMLBeanDefinitionLoader deleted file mode 100644 index 0a46baa13b..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.xml.SpringXMLBeanDefinitionLoader +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -org.apache.tuscany.sca.implementation.spring.processor.stub.SpringXMLBeanDefinitionLoaderStub;ranking=50 \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index e037ea60f5..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/implementation-spring-stub/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the implementation extension -org.apache.tuscany.sca.implementation.spring.provider.stub.SpringImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.spring.SpringImplementation;ranking=50 - -- cgit v1.2.3