From 75c4045c9663debea932437ed12954e74e7e27bd Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 23 Jun 2008 21:21:18 +0000 Subject: Delete obsolete contents git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@670762 13f79535-47bb-0310-9956-ffa450edef68 --- sandbox/rfeng/runtime/embedded/.checkstyle | 24 -- sandbox/rfeng/runtime/embedded/.pmd | 20 -- sandbox/rfeng/runtime/embedded/.ruleset | 190 ----------- sandbox/rfeng/runtime/embedded/LICENSE.txt | 202 ------------ sandbox/rfeng/runtime/embedded/NOTICE.txt | 14 - sandbox/rfeng/runtime/embedded/pom.xml | 47 --- .../java/org/apache/tuscany/api/SCARuntime.java | 249 --------------- .../runtime/embedded/DefaultSCARuntime.java | 75 ----- .../tuscany/runtime/embedded/SimpleRuntime.java | 48 --- .../runtime/embedded/SimpleRuntimeImpl.java | 136 -------- .../runtime/embedded/SimpleRuntimeInfo.java | 56 ---- .../runtime/embedded/SimpleRuntimeInfoImpl.java | 182 ----------- .../src/test/java/calculator/AddService.java | 25 -- .../src/test/java/calculator/AddServiceImpl.java | 30 -- .../src/test/java/calculator/CalculatorClient.java | 51 --- .../test/java/calculator/CalculatorService.java | 35 --- .../java/calculator/CalculatorServiceImpl.java | 70 ----- .../src/test/java/calculator/DivideService.java | 25 -- .../test/java/calculator/DivideServiceImpl.java | 30 -- .../src/test/java/calculator/MultiplyService.java | 25 -- .../test/java/calculator/MultiplyServiceImpl.java | 30 -- .../src/test/java/calculator/SubtractService.java | 25 -- .../test/java/calculator/SubtractServiceImpl.java | 30 -- .../org/apache/tuscany/api/SCARuntimeTestCase.java | 57 ---- .../embedded/SimpleRuntimeImplTestCase.java | 60 ---- .../src/test/resources/application.composite | 46 --- .../embedded/src/test/resources/system.composite | 349 --------------------- 27 files changed, 2131 deletions(-) delete mode 100644 sandbox/rfeng/runtime/embedded/.checkstyle delete mode 100644 sandbox/rfeng/runtime/embedded/.pmd delete mode 100644 sandbox/rfeng/runtime/embedded/.ruleset delete mode 100644 sandbox/rfeng/runtime/embedded/LICENSE.txt delete mode 100644 sandbox/rfeng/runtime/embedded/NOTICE.txt delete mode 100644 sandbox/rfeng/runtime/embedded/pom.xml delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/resources/application.composite delete mode 100644 sandbox/rfeng/runtime/embedded/src/test/resources/system.composite (limited to 'sandbox/rfeng/runtime/embedded') diff --git a/sandbox/rfeng/runtime/embedded/.checkstyle b/sandbox/rfeng/runtime/embedded/.checkstyle deleted file mode 100644 index ea05637a07..0000000000 --- a/sandbox/rfeng/runtime/embedded/.checkstyle +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/sandbox/rfeng/runtime/embedded/.pmd b/sandbox/rfeng/runtime/embedded/.pmd deleted file mode 100644 index 3493a9e386..0000000000 --- a/sandbox/rfeng/runtime/embedded/.pmd +++ /dev/null @@ -1,20 +0,0 @@ - - -truefalse \ No newline at end of file diff --git a/sandbox/rfeng/runtime/embedded/.ruleset b/sandbox/rfeng/runtime/embedded/.ruleset deleted file mode 100644 index a7ff3be272..0000000000 --- a/sandbox/rfeng/runtime/embedded/.ruleset +++ /dev/null @@ -1,190 +0,0 @@ - - - - PMD Plugin preferences rule set - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/runtime/embedded/LICENSE.txt b/sandbox/rfeng/runtime/embedded/LICENSE.txt deleted file mode 100644 index 0084319535..0000000000 --- a/sandbox/rfeng/runtime/embedded/LICENSE.txt +++ /dev/null @@ -1,202 +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, serviceDefinition marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/sandbox/rfeng/runtime/embedded/NOTICE.txt b/sandbox/rfeng/runtime/embedded/NOTICE.txt deleted file mode 100644 index d83ebbe236..0000000000 --- a/sandbox/rfeng/runtime/embedded/NOTICE.txt +++ /dev/null @@ -1,14 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2006 The Apache Software Foundation - -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/rfeng/runtime/embedded/pom.xml b/sandbox/rfeng/runtime/embedded/pom.xml deleted file mode 100644 index a51ff50160..0000000000 --- a/sandbox/rfeng/runtime/embedded/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - org.apache.tuscany.sca - runtime - 2.0-alpha2-incubating-SNAPSHOT - - 4.0.0 - org.apache.tuscany.sca.runtime.embedded - embedded-host - jar - Apache Tuscany Embedded Runtime Host - Host code to support an embedded runtime - - - - org.apache.tuscany.sca.kernel - tuscany-core - 2.0-alpha2-incubating-SNAPSHOT - compile - - - junit - junit - 4.2 - test - - - diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java deleted file mode 100644 index 8fb945a28a..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java +++ /dev/null @@ -1,249 +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.api; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.osoa.sca.ComponentContext; - -/** - * SCARuntime is used to start a Tuscany SCA runtime. - */ -public abstract class SCARuntime { - - private static SCARuntime instance; - - /** - * Read the service name from a configuration file - * - * @param classLoader - * @param name The name of the service class - * @return A class name which extends/implements the service class - * @throws IOException - */ - private static String getServiceName(ClassLoader classLoader, String name) throws IOException { - InputStream is = classLoader.getResourceAsStream("META-INF/services/" + name); - if (is == null) { - return null; - } - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(is)); - while (true) { - String line = reader.readLine(); - if (line == null) { - break; - } else if (!line.startsWith("#")) { - return line.trim(); - } - } - } finally { - if (reader != null) { - reader.close(); - } - } - return null; - } - - /** - * Returns a SCARuntime instance. If the system property - * "org.apache.tuscany.api.SCARuntime" is set, its value is used as the name - * of the implementation class. Otherwise, if the resource - * "META-INF/services/org.apache.tuscany.api.SCARuntime" can be loaded from - * the supplied classloader. Otherwise, it will use - * "org.apache.tuscany.runtime.embedded.DefaultSCARuntime" as the default. - * The named class is loaded from the supplied classloader and instantiated - * using its default (no-arg) constructor. - * - * @return - */ - private static SCARuntime newInstance(final ClassLoader classLoader) { - - try { - final String name = SCARuntime.class.getName(); - String className = AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return System.getProperty(name); - } - }); - - if (className == null) { - className = getServiceName(classLoader, name); - } - if (className == null) { - className = "org.apache.tuscany.runtime.embedded.DefaultSCARuntime"; - } - Class cls = Class.forName(className, true, classLoader); - return (SCARuntime)cls.newInstance(); // NOPMD lresende - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Get an instance of SCA Runtime - * - * @return The instance - */ - public static synchronized SCARuntime getInstance() { // NOPMD - if (instance != null) { - return instance; - } - ClassLoader classLoader = SCARuntime.class.getClassLoader(); - instance = newInstance(classLoader); - return instance; - } - - /** - * Start the Tuscany runtime using default SCDLs - */ - public static void start() { - try { - getInstance().startup(null, null, null, null); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDLs - * - * @param system The URL for the system SCDL - * @param extensions An array of URLs for extensions - * @param application The URL for the application SCDL - */ - public static void start(URL system, URL[] extensions, URL application, String compositePath) { - try { - getInstance().startup(system, extensions, application, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDL - * - * @param application The URL for the application SCDL - */ - public static void start(URL application, String compositePath) { - try { - getInstance().startup(null, null, application, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDL - * - * @param compositePath The path of the application SCDL - */ - public static void start(String compositePath) { - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL applicationURL = cl.getResource(compositePath); - getInstance().startup(null, null, applicationURL, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Start the SCA Runtime with the given SCDL - * - * @param compositePath The path of the system SCDL - * @param compositePath The path of the application SCDL - */ - public static void start(String system, String compositePath) { - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL systemURL = cl.getResource(system); - URL applicationURL = cl.getResource(compositePath); - getInstance().startup(systemURL, null, applicationURL, compositePath); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - - /** - * Get the ComponentContext by name - * - * @param componentName - * @return - */ - public static ComponentContext getComponentContext(String componentName) { - return getInstance().getContext(componentName); - } - - /** - * Get access to a system service - * - * @param serviceName - * @return - */ - protected abstract Object getSystemService(String serviceName); - - /** - * Stop the SCA Runtime - */ - public static void stop() { - try { - getInstance().shutdown(); - } catch (Exception e) { - throw new IllegalStateException(e); - } finally { - instance = null; - } - } - - /** - * Look up the ComponentContext by name - * - * @param componentName - * @return - */ - protected abstract ComponentContext getContext(String componentName); - - /** - * Start up the runtime - * - * @param system The URL of the SCDL for tuscany system composite - * @param extensions The URLs of the SCDLs for tuscany extension composites - * @param application The URL of the SCDL for the application composite - * @param compositePath The path of the application composite relative to - * the application URL - * @throws Exception - */ - protected abstract void startup(URL system, URL[] extensions, URL application, String compositePath) - throws Exception; - - /** - * Shutdown the runtime - * - * @throws Exception - */ - protected abstract void shutdown() throws Exception; -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java deleted file mode 100644 index 1a6ab28cf4..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.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.runtime.embedded; - -import java.net.URI; -import java.net.URL; -import java.util.Arrays; -import java.util.List; - -import org.apache.tuscany.api.SCARuntime; -import org.apache.tuscany.api.TuscanyException; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceUnavailableException; - -/** - * Default implementation of SCARuntime. - * - * @version $Rev$ $Date$ - */ -@SuppressWarnings("deprecation") -public class DefaultSCARuntime extends SCARuntime { - - protected SimpleRuntime runtime; - - protected void startup(URL system, URL[] exts, URL applicationSCDL, String compositePath) throws Exception { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - List extensions = exts == null ? null : Arrays.asList(exts); - URI contributionURI = URI.create("/default"); - SimpleRuntimeInfo runtimeInfo = new SimpleRuntimeInfoImpl(cl, system, extensions, contributionURI, - applicationSCDL, compositePath); - runtime = new SimpleRuntimeImpl(runtimeInfo); - - try { - runtime.start(); - } catch (TuscanyException e) { - throw e; - } - - } - - protected void shutdown() throws Exception { - runtime.destroy(); - } - - @Override - protected ComponentContext getContext(String componentName) { - return runtime.getComponentContext(URI.create(SimpleRuntimeInfo.DEFAULT_COMPOSITE + "/" + componentName)); - } - - @Override - public Object getSystemService(String serviceName) { - try { - return runtime.getSystemService(Object.class, serviceName); - } catch (TargetResolutionException e) { - throw new ServiceUnavailableException(e); - } - } -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java deleted file mode 100644 index 676d42a3af..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntime.java +++ /dev/null @@ -1,48 +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.runtime.embedded; - -import org.apache.tuscany.host.runtime.TuscanyRuntime; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.TargetResolutionException; - -/** - * A simple runtime to host both Tuscany and application code on the same classpath - * - * @version $Rev$ $Date$ - */ -public interface SimpleRuntime extends TuscanyRuntime { - /** - * Start the embedded Tuscany - * @return - * @throws Exception - */ - Component start() throws Exception; - - /** - * Look up system services by name - * @param - * @param type - * @param name - * @return - * @throws TargetResolutionException - */ - T getSystemService(Class type, String name) throws TargetResolutionException; -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java deleted file mode 100644 index 990fa0107f..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java +++ /dev/null @@ -1,136 +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.runtime.embedded; - -import static org.apache.tuscany.runtime.embedded.SimpleRuntimeInfo.DEFAULT_COMPOSITE; - -import java.net.URI; -import java.net.URL; -import java.util.Collection; - -import org.apache.tuscany.api.annotation.LogLevel; -import org.apache.tuscany.core.component.SimpleWorkContext; -import org.apache.tuscany.core.implementation.PojoWorkContextTunnel; -import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation; -import org.apache.tuscany.core.runtime.AbstractRuntime; -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.component.AtomicComponent; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentException; -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.component.TargetResolutionException; -import org.apache.tuscany.spi.component.WorkContext; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeImplementation; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * @version $Rev$ $Date$ - */ -public class SimpleRuntimeImpl extends AbstractRuntime implements SimpleRuntime { - private ScopeContainer container; - - public SimpleRuntimeImpl(SimpleRuntimeInfo runtimeInfo) { - super(SimpleRuntimeInfo.class); - ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader(); - setHostClassLoader(hostClassLoader); - setApplicationScdl(runtimeInfo.getApplicationSCDL()); - setSystemScdl(runtimeInfo.getSystemSCDL()); - setRuntimeInfo(runtimeInfo); - } - - public interface SimpleMonitor { - @LogLevel("SEVERE") - void runError(Exception e); - } - - protected Collection deployExtension(Component parent, - URI name, - URL extensionSCDL, - ClassLoader systemClassLoader) throws LoaderException, - BuilderException, ComponentException, ResolutionException { - - SystemCompositeImplementation impl = new SystemCompositeImplementation(); - impl.setScdlLocation(extensionSCDL); - impl.setClassLoader(systemClassLoader); - ComponentDefinition definition - = new ComponentDefinition(name, impl); - - Collection components = getDeployer().deploy(parent, definition); - for (Component component : components) { - component.start(); - } - return components; - } - - @SuppressWarnings("unchecked") - public Component start() throws Exception { - initialize(); - - ScopeRegistry scopeRegistry = getScopeRegistry(); - container = scopeRegistry.getScopeContainer(Scope.COMPOSITE); - - /* - int i = 0; - for (URL ext : runtimeInfo.getExtensionSCDLs()) { - URI uri = URI.create("/extensions/extension" + (i++)); - deployExtension(null, uri, ext, runtimeInfo.getClassLoader()); - } - */ - - CompositeImplementation impl = new CompositeImplementation(); - impl.setScdlLocation(applicationScdl); - impl.setClassLoader(runtimeInfo.getClassLoader()); - - ComponentDefinition definition - = new ComponentDefinition(DEFAULT_COMPOSITE, impl); - Collection components = getDeployer().deploy(null, definition); - for (Component component : components) { - component.start(); - } - container.startContext(DEFAULT_COMPOSITE, DEFAULT_COMPOSITE); - getWorkContext().setIdentifier(Scope.COMPOSITE, DEFAULT_COMPOSITE); - WorkContext workContext = new SimpleWorkContext(); - workContext.setIdentifier(Scope.COMPOSITE, DEFAULT_COMPOSITE); - PojoWorkContextTunnel.setThreadWorkContext(workContext); - return componentManager.getComponent(definition.getUri()); - } - - @SuppressWarnings("deprecation") - public T getSystemService(Class type, String name) throws TargetResolutionException { - SCAObject child = componentManager.getComponent(URI.create(name)); - if (child == null) { - return null; - } - AtomicComponent service = (AtomicComponent)child; - return type.cast(service.getTargetInstance()); - } - - @Override - public void destroy() { - container.stopContext(DEFAULT_COMPOSITE); - getWorkContext().setIdentifier(Scope.COMPOSITE, null); - super.destroy(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java deleted file mode 100644 index 740c51a3a3..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfo.java +++ /dev/null @@ -1,56 +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.runtime.embedded; - -import java.net.URI; -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.host.RuntimeInfo; -import org.apache.tuscany.spi.bootstrap.ComponentNames; - -/** - * @version $Rev$ $Date$ - */ -public interface SimpleRuntimeInfo extends RuntimeInfo { - URI DEFAULT_COMPOSITE = ComponentNames.TUSCANY_APPLICATION_ROOT.resolve("default"); - - String DEFAULT_SYSTEM_SCDL = "META-INF/tuscany/default-system.composite"; - String SYSTEM_SCDL = "system.composite"; - String EXTENSION_SCDL = "META-INF/sca/extension.composite"; - String SERVICE_SCDL = "META-INF/sca/service.composite"; - String META_APPLICATION_SCDL = "META-INF/sca/application.composite"; - String APPLICATION_SCDL = "application.composite"; - - ClassLoader getClassLoader(); - - String getCompositePath(); - - URL getSystemSCDL(); - - URL getApplicationSCDL(); - - List getExtensionSCDLs(); - - URL getContributionRoot(); - - URI getContributionURI(); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java b/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java deleted file mode 100644 index 6839eefc93..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeInfoImpl.java +++ /dev/null @@ -1,182 +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.runtime.embedded; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; - -import org.apache.tuscany.core.util.FileHelper; -import org.apache.tuscany.host.AbstractRuntimeInfo; - -/** - * @version $Rev$ $Date$ - */ -public class SimpleRuntimeInfoImpl extends AbstractRuntimeInfo implements SimpleRuntimeInfo { - private ClassLoader classLoader; - private String compositePath; - - private List extensions; - private URL applicationSCDL; - private URL systemSCDL; - - private URL contributionURL; - private URI contributionURI; - - /** - * @param classLoader - * @param compositePath - * @param extensions - * @param applicationSCDL - * @param systemSCDL - */ - public SimpleRuntimeInfoImpl(ClassLoader classLoader, - URL systemSCDL, - List extensions, - URI contributionURI, - URL applicationSCDL, - String compositePath) { - this(classLoader, compositePath); - this.extensions = extensions; - this.applicationSCDL = applicationSCDL; - this.systemSCDL = systemSCDL; - this.contributionURI = contributionURI; - } - - public SimpleRuntimeInfoImpl(ClassLoader classLoader, String compositePath) { - // super(domain, applicationRootDirectory, baseUrl, online, runtimeId); - super(URI.create("sca://domain/local"), null, null, false, "simple"); - if (classLoader != null) { - this.classLoader = classLoader; - } else { - classLoader = Thread.currentThread().getContextClassLoader(); - } - this.compositePath = compositePath != null ? compositePath : APPLICATION_SCDL; - getApplicationSCDL(); - this.contributionURI = URI.create("/default"); - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - public String getCompositePath() { - return compositePath; - } - - public final URL getApplicationSCDL() { - if (applicationSCDL == null) { - applicationSCDL = classLoader.getResource(compositePath); - if (applicationSCDL == null) { - applicationSCDL = classLoader.getResource(APPLICATION_SCDL); - if (applicationSCDL == null) { - applicationSCDL = classLoader.getResource(META_APPLICATION_SCDL); - if (applicationSCDL != null) { - compositePath = META_APPLICATION_SCDL; - } - } else { - if (compositePath == null) { - compositePath = APPLICATION_SCDL; - } - } - if (applicationSCDL == null) { - throw new IllegalArgumentException("application SCDL not found: " + APPLICATION_SCDL); - } - } - } - return applicationSCDL; - } - - public URL getContributionRoot() { - if (contributionURL == null) { - contributionURL = getContributionLocation(getApplicationSCDL(), compositePath); - } - return contributionURL; - } - - public List getExtensionSCDLs() { - if (extensions == null) { - try { - List extensionURLs = new ArrayList(); - Enumeration urls = classLoader.getResources(SERVICE_SCDL); - extensionURLs.addAll(Collections.list(urls)); - urls = classLoader.getResources(EXTENSION_SCDL); - extensionURLs.addAll(Collections.list(urls)); - if (extensions != null) { - for (URL ext : extensions) { - if (!extensionURLs.contains(ext)) { - extensionURLs.add(ext); - } - } - } - extensions = extensionURLs; - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - return extensions; - } - - public URL getSystemSCDL() { - if (systemSCDL == null) { - systemSCDL = classLoader.getResource(SYSTEM_SCDL); - if (systemSCDL == null) { - systemSCDL = classLoader.getResource(DEFAULT_SYSTEM_SCDL); - } - } - return systemSCDL; - } - - private static URL getContributionLocation(URL applicationSCDL, String compositePath) { - URL root = null; - // "jar:file://....../something.jar!/a/b/c/app.composite" - try { - String scdlUrl = applicationSCDL.toExternalForm(); - String protocol = applicationSCDL.getProtocol(); - if ("file".equals(protocol)) { - // directory contribution - if (scdlUrl.endsWith(compositePath)) { - String location = scdlUrl.substring(0, scdlUrl.lastIndexOf(compositePath)); - // workaround from evil url/uri form maven - root = FileHelper.toFile(new URL(location)).toURI().toURL(); - } - - } else if ("jar".equals(protocol)) { - // jar contribution - String location = scdlUrl.substring(4, scdlUrl.lastIndexOf("!/")); - // workaround from evil url/uri form maven - root = FileHelper.toFile(new URL(location)).toURI().toURL(); - } - } catch (MalformedURLException mfe) { - throw new IllegalArgumentException(mfe); - } - - return root; - } - - public URI getContributionURI() { - return contributionURI; - } -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java deleted file mode 100644 index 4eeb30a9c2..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddService.java +++ /dev/null @@ -1,25 +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 calculator; - -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java deleted file mode 100644 index 8b6fe066a6..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - return n1 + n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java deleted file mode 100644 index 37231e53fe..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,51 +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 calculator; - -import org.apache.tuscany.api.SCARuntime; -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceReference; - -/** - * @version $Rev$ $Date$ - */ -public class CalculatorClient { - - public CalculatorClient() { - super(); - } - - public static void main(String[] args) { - // Start the embedded SCA runtime - SCARuntime.start(); - - // Look up the ComponentContext by name - ComponentContext context = SCARuntime.getComponentContext("CalculatorServiceComponent"); - ServiceReference self = context.createSelfReference(CalculatorService.class); - CalculatorService calculatorService = self.getService(); - System.out.println("1.0 x 2.0 = " + calculatorService.multiply(1.0, 2.0)); - AddService addService = context.getService(AddService.class, "addService"); - System.out.println("1.0 + 2.0 = " + addService.add(1.0, 2.0)); - - // Stop the SCA embedded runtime - SCARuntime.stop(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +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 calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 3d861f2018..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,70 +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 calculator; - -import org.osoa.sca.annotations.Reference; - - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java deleted file mode 100644 index 131c5a8014..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideService.java +++ /dev/null @@ -1,25 +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 calculator; - -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java deleted file mode 100644 index f7ac0b7287..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java deleted file mode 100644 index a917896aeb..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyService.java +++ /dev/null @@ -1,25 +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 calculator; - -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index b7dca792b2..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java deleted file mode 100644 index e328f024ea..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractService.java +++ /dev/null @@ -1,25 +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 calculator; - -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java b/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 77b128ab8d..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java b/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java deleted file mode 100644 index cacbb7162c..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/api/SCARuntimeTestCase.java +++ /dev/null @@ -1,57 +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.api; - -import junit.framework.TestCase; - -import org.osoa.sca.ComponentContext; -import org.osoa.sca.ServiceReference; - -import calculator.AddService; -import calculator.CalculatorService; - -/** - * @version $Rev$ $Date$ - */ -public class SCARuntimeTestCase extends TestCase { - /** - * @throws java.lang.Exception - */ - protected void setUp() throws Exception { - SCARuntime.start(); - } - - public void testStart() throws Exception { - ComponentContext context = SCARuntime.getComponentContext("CalculatorServiceComponent"); - assertNotNull(context); - ServiceReference self = context.createSelfReference(CalculatorService.class); - assertEquals(2.0, self.getService().multiply(1.0, 2.0)); - AddService service = context.getService(AddService.class, "addService"); - assertEquals(3.0, service.add(1.0, 2.0)); - } - - /** - * @throws java.lang.Exception - */ - protected void tearDown() throws Exception { - SCARuntime.stop(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java b/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java deleted file mode 100644 index 1c4b04600d..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java +++ /dev/null @@ -1,60 +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.runtime.embedded; - -import java.net.URI; - -import junit.framework.TestCase; - -import org.osoa.sca.ComponentContext; - -import calculator.AddService; - -/** - * @version $Rev$ $Date$ - */ -public class SimpleRuntimeImplTestCase extends TestCase { - private SimpleRuntime runtime; - - /** - * @throws java.lang.Exception - */ - protected void setUp() throws Exception { - SimpleRuntimeInfo runtimeInfo = new SimpleRuntimeInfoImpl(getClass().getClassLoader(), "application.composite"); - runtime = new SimpleRuntimeImpl(runtimeInfo); - runtime.start(); - } - - public void testStart() throws Exception { - ComponentContext context = runtime.getComponentContext(URI - .create("sca://root.application/default/CalculatorServiceComponent")); - assertNotNull(context); - AddService service = context.getService(AddService.class, "addService"); - assertEquals(3.0, service.add(1.0, 2.0)); - } - - /** - * @throws java.lang.Exception - */ - protected void tearDown() throws Exception { - runtime.destroy(); - } - -} diff --git a/sandbox/rfeng/runtime/embedded/src/test/resources/application.composite b/sandbox/rfeng/runtime/embedded/src/test/resources/application.composite deleted file mode 100644 index 55d4ca889b..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/resources/application.composite +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/rfeng/runtime/embedded/src/test/resources/system.composite b/sandbox/rfeng/runtime/embedded/src/test/resources/system.composite deleted file mode 100644 index 3974e06dd1..0000000000 --- a/sandbox/rfeng/runtime/embedded/src/test/resources/system.composite +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .m2/repository - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3