summaryrefslogtreecommitdiffstats
path: root/sandbox/old/contrib/runtime-standalone
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/old/contrib/runtime-standalone')
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt163
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off68
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt18
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl168
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl189
-rw-r--r--sandbox/old/contrib/runtime-standalone/assembly/standalone.xml87
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/.ruleset190
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off67
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java98
-rw-r--r--sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties23
-rw-r--r--sandbox/old/contrib/runtime-standalone/pom.xml.off64
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off63
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java108
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off79
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java264
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java49
-rw-r--r--sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java49
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off100
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java26
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java37
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java50
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl33
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java63
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java131
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java33
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java88
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt1
-rw-r--r--sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt1
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off39
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java303
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java44
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java62
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java78
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt202
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt14
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off50
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java64
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java143
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java51
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java193
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java113
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java55
-rw-r--r--sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java37
52 files changed, 4824 insertions, 0 deletions
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt
new file mode 100644
index 0000000000..b18217bd7a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/NOTICE.txt
@@ -0,0 +1,163 @@
+${project.name}
+Copyright (c) 2005 - 2007 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/).
+
+----- NOTICE from LICENSE.txt file for classworlds project --------------------
+* profiles/launcher/boot/classworlds-1.1.jar
+-------------------------------------------------------------------------------
+
+/*
+ $Id$
+
+ Copyright 2002 (C) The Codehaus. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "classworlds" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of The Codehaus. For written permission, please
+ contact bob@codehaus.org.
+
+ 4. Products derived from this Software may not be called "classworlds"
+ nor may "classworlds" appear in their names without prior written
+ permission of The Codehaus. "classworlds" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus.
+ (http://classworlds.codehaus.org/).
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+
+----- NOTICE from LICENSE.txt file in jsch-0.1.24 distribution ----------------
+* profiles/launcher/boot/jsch-0.1.24.jar
+-------------------------------------------------------------------------------
+
+JSch 0.0.* was released under the GNU LGPL license. Later, we have switched
+over to a BSD-style license.
+
+------------------------------------------------------------------------------
+Copyright (c) 2002,2003,2004,2005 Atsuhiko Yamanaka, JCraft,Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----- NOTICE from Codehaus for Plexus Project ---------------------------------
+* profiles/launcher/boot/plexus-container-default-1.0-alpha-9.jar
+* profiles/launcher/boot/plexus-interactivity-api-1.0-alpha-4.jar
+* profiles/launcher/boot/plexus-utils-1.1.jar
+-------------------------------------------------------------------------------
+
+ The MIT License
+
+ Copyright (c) 2004, The Codehaus
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+-----
+
+Some portions of Plexus are also distributed under other BSD-style licenses
+including the Apache License Version 2.0
+
+----- NOTICE from StAX project at http://svn.codehaus.org/stax/trunk/dev/README-API.txt
+* profiles/launcher/boot/stax-api-1.0.1.jar
+-------------------------------------------------------------------------------
+
+These files together comprise the API for JSR 173 (Streaming API for XML Specification), including its API classes and interfaces.
+
+
+The following lists the files in this distribution:
+
+README-API.txt [README file for JSR 173 api bundle.]
+ASF2.0.txt [Apache Software Foundation License 2.0.]
+jsr173_1.0_api.jar [The API classes and interfaces in binary format.]
+jsr173_1.0_src.jar [The API classes and interfaces in source format.]
+
+Your right to use the listed files, whether together or individually, is governed by the Apache Software Foundation License 2.0 included in this bundle.
+
+Please see the javadoc for information on how to get started.
+
+----- NOTICE from wstx-asl-3.2.0.jar ------------------------------------------
+* profiles/launcher/boot/wstx-asl-3.2.0.jar
+-------------------------------------------------------------------------------
+
+This product currently only contains code developed by authors
+of specific components, as identified by the source code files.
+
+Since product implements StAX API, it has dependencies to StAX API
+classes.
+
+For additional credits (generally to people who reported problems)
+see CREDITS file.
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off b/sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off
new file mode 100644
index 0000000000..0e5e3af64d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/pom.xml.off
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>assembly</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Standalone Assembly</name>
+ <description>Module to smoketest the standalone runtime.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>launcher</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>standalone.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt
new file mode 100644
index 0000000000..40d0b7242f
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/README.txt
@@ -0,0 +1,18 @@
+Apache Tuscany Standalone Runtime Distribution
+----------------------------------------------
+
+This distribution provides support for running SCA composites in a
+standalone client environment using a client launcher. To launch
+a composite run:
+
+ $ java -jar bin/launcher.jar <yourComposite> [args ...]
+
+The configuration for the runtime environment used by the launcher is
+defined in the profiles/launcher directory.
+
+Detailed documentation on developing applications using SCA and running
+them on Apache Tuscany can be found on the project website at:
+ http://incubator.apache.org/tuscany/
+
+Alternatively questions can be sent to the mailing list at:
+ mailto:tuscany-user@ws.apache.org
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl
new file mode 100644
index 0000000000..66b3af958c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/admin/system.scdl
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System"
+ autowire="true">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="workContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Scope infrastructure -->
+ <component name="scopeRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.composite">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.CompositeScopeContainer"/>
+ </component>
+
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+<!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+-->
+
+<!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+-->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- Include discovery -->
+ <include name="org.apache.tuscany.service.discovery" scdlResource="org/apache/tuscany/service/discovery/discovery.jxta.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">http://repo1.maven.org/maven2/,http://people.apache.org/repo/m2-snapshot-repository,http://people.apache.org/repo/m2-incubating-repository/,http://people.apache.org/repo/m1-snapshot-repository/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl
new file mode 100644
index 0000000000..852d10a709
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/src/main/assembly/profiles/launcher/system.scdl
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/sca/system/2.0-alpha"
+ name="org.apache.tuscany.launcher.System"
+ autowire="true">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="WorkContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="proxyService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKProxyService"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeContainer"/>
+ </component>
+<!--
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeContainer"/>
+ </component>
+-->
+<!--
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeContainer"/>
+ </component>
+-->
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.core.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include databinding configuration -->
+ <include name="org.apache.tuscany.core.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.core.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.core.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.core.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.core.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.core.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- service for resolving artifacts using Maven repositories -->
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.services.maven.MavenArtifactRepository"/>
+ <property name="remoteRepoUrl">http://repo1.maven.org/maven2/,http://people.apache.org/repo/m2-snapshot-repository,http://people.apache.org/repo/m2-incubating-repository/,http://people.apache.org/repo/m1-snapshot-repository/</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workSchCompositeContextImplTestCaseeduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <!-- component that scans the extension directory -->
+ <component name="directoryScanExtender" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.DirectoryScanExtender"/>
+ <property name="path">extensions</property>
+ </component>
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/>
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <component name="launchedLoader">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedLoader"/>
+ </component>
+
+ <component name="launchedComponentLoader">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentTypeLoader"/>
+ </component>
+
+ <component name="launchedComponentBuilder">
+ <system:implementation.system class="org.apache.tuscany.runtime.standalone.host.implementation.launched.LaunchedComponentBuilder"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="wiringExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+ <component name="loaderExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderExceptionFormatter"/>
+ </component>
+
+ <component name="incompatibleServiceContractExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.wire.IncompatibleServiceContractExceptionFormatter"/>
+ </component>
+
+
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/assembly/standalone.xml b/sandbox/old/contrib/runtime-standalone/assembly/standalone.xml
new file mode 100644
index 0000000000..87745b7021
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/assembly/standalone.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <files>
+ <!-- include legal and other files -->
+ <file>
+ <source>LICENSE.txt</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
+ <file>
+ <source>NOTICE.txt</source>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ </file>
+ </files>
+
+ <fileSets>
+ <!-- include assembly files -->
+ <fileSet>
+ <directory>src/main/assembly</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <!-- copy executable commands to the bin directory without version info -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:launcher</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.tuscany.sca.runtime.standalone:standalone-api</exclude>
+ </excludes>
+ <outputDirectory>bin</outputDirectory>
+ <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+ <fileMode>755</fileMode>
+ </dependencySet>
+
+ <!-- copy dependencies used by the executable commands to the lib directory -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-api</include>
+ <include>org.osoa:sca-api-r1.0</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+ </includes>
+ <outputDirectory>lib</outputDirectory>
+ <outputFileNameMapping>${artifactId}-${baseVersion}.${extension}</outputFileNameMapping>
+ </dependencySet>
+
+ <!-- copy boot dependencies to launcher profile -->
+ <dependencySet>
+ <includes>
+ <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
+ </includes>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ </excludes>
+ <outputDirectory>profiles/launcher/boot</outputDirectory>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/.ruleset b/sandbox/old/contrib/runtime-standalone/launcher/.ruleset
new file mode 100644
index 0000000000..f27a8fe562
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<!--<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>-->
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off b/sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off
new file mode 100644
index 0000000000..50db868b9d
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/pom.xml.off
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>launcher</artifactId>
+ <name>Apache Tuscany SCA Application Launcher</name>
+ <description>Standalone executable jar that can be used to launch a SCA application.</description>
+
+ <!--
+ This library will typically be added to the application's classpath and so should
+ should have as few dependencies as possible and nothing from the Tuscany runtime.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.launcher.Main</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java b/sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
new file mode 100644
index 0000000000..e011c5a3a5
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
@@ -0,0 +1,98 @@
+/*
+ * 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.launcher;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+import org.apache.tuscany.runtime.standalone.DirectoryHelper;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntime;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+
+/**
+ * Main class for launcher runtime environment. <code>
+ * usage: java [jvm-options] -jar launcher.jar <componentURI>
+ * </code>
+ * where the componentURI identifies a component in the assembly that should be
+ * called.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Main {
+
+ /**
+ * Main method.
+ *
+ * @param args the command line args
+ * @throws Throwable if there are problems launching the runtime or
+ * application
+ */
+ public static void main(String[] args) throws Throwable {
+
+ if (args.length < 1) {
+ usage();
+ throw new AssertionError();
+ }
+
+ File applicationFile = new File(args[0]);
+ if (!applicationFile.exists()) {
+ System.err.println(getMessage("org.apache.tuscany.launcher.NoComposite", applicationFile));
+ System.exit(2);
+ }
+
+ String[] appArgs = new String[0];
+ if(args.length > 1) {
+ appArgs = new String[args.length - 1];
+ System.arraycopy(args, 1, appArgs, 0, appArgs.length);
+ }
+
+ StandaloneRuntimeInfo runtimeInfo = DirectoryHelper.createRuntimeInfo("launcher", Main.class);
+ StandaloneRuntime runtime = (StandaloneRuntime)DirectoryHelper.createRuntime(runtimeInfo);
+
+ URL applicationJar = applicationFile.toURL();
+ ClassLoader applicationClassLoader =
+ new URLClassLoader(new URL[] {applicationJar}, runtime.getHostClassLoader());
+ String applicationScdl = System.getProperty("launcher.scdl", "META-INF/sca/default.scdl");
+ URL applicationScdlURL = applicationClassLoader.getResource(applicationScdl);
+ if (applicationScdlURL == null) {
+ System.err.println(getMessage("org.apache.tuscany.launcher.NoApplicationSCDL", applicationScdl));
+ System.exit(2);
+ }
+
+ // boot the runtime
+ runtime.initialize();
+
+ int status = runtime.deployAndRun(applicationScdlURL, applicationClassLoader, appArgs);
+ System.exit(status);
+ }
+
+ private static void usage() {
+ System.err.println(getMessage("org.apache.tuscany.launcher.Usage"));
+ System.exit(1);
+ }
+
+ private static String getMessage(String id, Object... params) {
+ ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());
+ String message = bundle.getString(id);
+ return MessageFormat.format(message, params);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties b/sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
new file mode 100644
index 0000000000..51cdb7087a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
@@ -0,0 +1,23 @@
+# 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.
+#
+# $Rev$ $Date$
+#
+org.apache.tuscany.launcher.Usage=usage: java [jvm-options] -jar launcher.jar <componentJar> [apparg1, apparg2, ...]
+org.apache.tuscany.launcher.NoComponent=No component found with id "{0}"
+org.apache.tuscany.launcher.NoComposite=No composite archive found: {0}
+org.apache.tuscany.launcher.NoApplicationSCDL=No application SCDL found: {0}
diff --git a/sandbox/old/contrib/runtime-standalone/pom.xml.off b/sandbox/old/contrib/runtime-standalone/pom.xml.off
new file mode 100644
index 0000000000..1a38e942cc
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/pom.xml.off
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>runtime</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Standalone SCA Runtime</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>standalone-api</module>
+ <module>launcher</module>
+ <module>standalone-host</module>
+ <module>server.start</module>
+ <module>server.shutdown</module>
+ <module>assembly</module>
+ <module>smoketest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <!-- for the release profile exclude the smoketest -->
+ <id>release</id>
+ <modules>
+ <module>standalone-api</module>
+ <module>launcher</module>
+ <module>standalone-host</module>
+ <module>server.start</module>
+ <module>server.shutdown</module>
+ <module>assembly</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off b/sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off
new file mode 100644
index 0000000000..17eaeaceed
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/pom.xml.off
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>server.shutdown</artifactId>
+ <name>Apache Tuscany Standalone Server Shutdown</name>
+ <description>Standalone executable jar that can be used to shutdown the tuscany server.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.standalone.server.ShutdownServer</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java b/sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java
new file mode 100644
index 0000000000..ada82c4bb3
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.shutdown/src/main/java/org/apache/tuscany/standalone/server/ShutdownServer.java
@@ -0,0 +1,108 @@
+/*
+ * 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.standalone.server;
+
+import java.io.IOException;
+
+import javax.management.JMException;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.rmi.RMIConnector;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ShutdownServer {
+
+ /** Tuscany admin host. */
+ private static final String ADMIN_HOST_PROPERTY = "tuscany.adminHost";
+
+ /** Tuscany admin port. */
+ private static final String ADMIN_PORT_PROPERTY = "tuscany.adminPort";
+
+ /** Default host. */
+ private static final String DEFAULT_ADMIN_HOST = "localhost";
+
+ /** Default port. */
+ private static final int DEFAULT_ADMIN_PORT = 1099;
+
+ /** Host. */
+ private String host = DEFAULT_ADMIN_HOST;
+
+ /** Port. */
+ private int port = DEFAULT_ADMIN_PORT;
+
+ /**
+ *
+ * @param args Commandline arguments.
+ */
+ public static void main(String[] args) throws Exception {
+
+ ShutdownServer shutdownServer = new ShutdownServer();
+ shutdownServer.shutdown();
+
+ }
+
+ /**
+ * Initializes the host and the port.
+ *
+ */
+ private ShutdownServer() {
+
+ if(System.getProperty(ADMIN_HOST_PROPERTY) != null) {
+ host = System.getProperty(ADMIN_HOST_PROPERTY);
+ }
+
+ if(System.getProperty(ADMIN_PORT_PROPERTY) != null) {
+ port = Integer.parseInt(System.getProperty(ADMIN_PORT_PROPERTY));
+ }
+
+ }
+
+ /**
+ * Shuts down the server.
+ * @throws IOException
+ * @throws JMException
+ *
+ */
+ private void shutdown() throws IOException, JMException {
+
+ RMIConnector rmiConnector = null;
+
+ try {
+
+ JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/server");
+ rmiConnector = new RMIConnector(url, null);
+ rmiConnector.connect();
+
+ MBeanServerConnection con = rmiConnector.getMBeanServerConnection();
+ con.invoke(new ObjectName("tuscany:name=tuscanyServer"), "shutdown", null, null);
+
+ } finally {
+ if(rmiConnector != null) {
+ rmiConnector.close();
+ }
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off b/sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off
new file mode 100644
index 0000000000..e9d8cbcdb1
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/pom.xml.off
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>server.start</artifactId>
+ <name>Apache Tuscany Standalone Server Start</name>
+ <description>Standalone executable jar that can be used to start the tuscany server.</description>
+
+ <!--
+ This library will typically be added to the application's classpath and so should
+ should have as few dependencies as possible and nothing from the Tuscany runtime.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.services.management</groupId>
+ <artifactId>management-jmx</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.standalone.server.TuscanyServer</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
new file mode 100644
index 0000000000..de23beb613
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
@@ -0,0 +1,264 @@
+/*
+ * 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.standalone.server;
+
+import java.beans.Beans;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.management.MBeanServer;
+
+import org.apache.tuscany.host.management.ManagementService;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.host.runtime.ShutdownException;
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+import org.apache.tuscany.runtime.standalone.DirectoryHelper;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntime;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfoImpl;
+import org.apache.tuscany.service.management.jmx.JmxManagementService;
+import org.apache.tuscany.service.management.jmx.agent.Agent;
+import org.apache.tuscany.service.management.jmx.agent.RmiAgent;
+
+/**
+ * This class provides the commandline interface for starting the
+ * tuscany standalone server.
+ * <p/>
+ * <p/>
+ * The class boots the tuscany server and also starts a JMX server
+ * and listens for shutdown command. The server itself is available
+ * by the object name <code>tuscany:type=server,name=tuscanyServer
+ * </code>. It also allows a runtime to be booted given a bootpath.
+ * The JMX domain in which the runtime is registered si definied in
+ * the file <code>$bootPath/etc/runtime.properties</code>. The properties
+ * defined are <code>jmx.domain</code> and <code>offline</code>.
+ * </p>
+ * <p/>
+ * <p/>
+ * The install directory can be specified using the system property
+ * <code>tuscany.installDir</code>. If not specified it is asumed to
+ * be the directory from where the JAR file containing the main class
+ * is loaded.
+ * </p>
+ * <p/>
+ * <p/>
+ * The administration port can be specified using the system property
+ * <code>tuscany.adminPort</tuscany>.If not specified the default port
+ * that is used is <code>1099</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyServer implements TuscanyServerMBean {
+
+ /**
+ * Agent
+ */
+ private final Agent agent;
+
+ /**
+ * Install directory
+ */
+ private final File installDirectory;
+
+ /**
+ * Started runtimes.
+ */
+ private final Map<String, TuscanyRuntime> bootedRuntimes = new ConcurrentHashMap<String, TuscanyRuntime>();
+
+ /**
+ * @param args Commandline arguments.
+ */
+ public static void main(String[] args) throws Exception {
+ TuscanyServer server = new TuscanyServer();
+ server.start();
+
+ // Start any runtimes specified in the cli
+ for(String profile : args) {
+ server.startRuntime(profile);
+ }
+ }
+
+ /**
+ * Constructor initializes all the required classloaders.
+ *
+ * @throws MalformedURLException
+ */
+ private TuscanyServer() throws MalformedURLException {
+ installDirectory = DirectoryHelper.getInstallDirectory(TuscanyServer.class);
+ agent = RmiAgent.getInstance();
+ }
+
+ /**
+ * Starts a runtime specified by the bootpath.
+ *
+ * @param profileName Profile for the runtime.
+ */
+ public final void startRuntime(final String profileName) {
+
+ try {
+
+ final File profileDirectory = DirectoryHelper.getProfileDirectory(installDirectory, profileName);
+ final File bootDirectory = DirectoryHelper.getBootDirectory(installDirectory, profileDirectory, null);
+
+ final MBeanServer mBeanServer = agent.getMBeanServer();
+ final StandaloneRuntimeInfo runtimeInfo = createRuntimeInfo(profileName);
+ final ManagementService<?> managementService = new JmxManagementService(mBeanServer, profileName);
+ final TuscanyRuntime<?> runtime = createRuntime(bootDirectory, runtimeInfo);
+ runtime.setManagementService(managementService);
+ runtime.initialize();
+
+ bootedRuntimes.put(profileName, runtime);
+
+ } catch (InitializationException ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (ClassNotFoundException ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ } catch (Throwable ex) {
+ ex.printStackTrace();
+ throw new TuscanyServerException(ex);
+ }
+
+ System.err.println("Started");
+
+ }
+
+ /**
+ * @see org.apache.tuscany.standalone.server.TuscanyServerMBean#shutdownRuntime(java.lang.String)
+ */
+ public final void shutdownRuntime(String bootPath) {
+
+ try {
+ TuscanyRuntime runtime = bootedRuntimes.get(bootPath);
+ if (runtime != null) {
+ runtime.destroy();
+ bootedRuntimes.remove(runtime);
+ runtime = null;
+ }
+ } catch (ShutdownException ex) {
+ throw new TuscanyServerException(ex);
+ }
+
+ }
+
+ /**
+ * Starts the server.
+ */
+ public final void shutdown() {
+
+ for (String bootPath : bootedRuntimes.keySet()) {
+ shutdownRuntime(bootPath);
+ }
+ agent.shutdown();
+ System.err.println("Shutdown");
+ System.exit(0);
+
+ }
+
+ /**
+ * TODO Share this code with launcher.
+ *
+ * Creates the runtime info.
+ *
+ * @param profile profile for which runtime info is created.
+ * @return Runtime info.
+ * @throws IOException If unable to read the runtime properties.
+ * @throws URISyntaxException
+ */
+ private StandaloneRuntimeInfo createRuntimeInfo(String profile) throws IOException, URISyntaxException {
+
+ File profileDir = DirectoryHelper.getProfileDirectory(installDirectory, profile);
+
+ // load properties for this runtime
+ File propFile = new File(profileDir, "etc/runtime.properties");
+ Properties props = DirectoryHelper.loadProperties(propFile, System.getProperties());
+ String domain = props.getProperty("domain");
+
+ // online unless the offline property is set
+ boolean online = !Boolean.parseBoolean(props.getProperty("offline", "false"));
+
+
+ return new StandaloneRuntimeInfoImpl(new URI(domain), profile, installDirectory, profileDir, null, online, props);
+ }
+
+ /**
+ * TODO Share this code with launcher.
+ *
+ * Creates the runtime.
+ *
+ * @param bootDirectory Boot directory for the runtime.
+ * @param runtimeInfo Runtime info.
+ * @return Runtime.
+ */
+ private TuscanyRuntime createRuntime(final File bootDirectory, final StandaloneRuntimeInfo runtimeInfo) throws IOException, ClassNotFoundException {
+
+ final URL profileUrl = runtimeInfo.getProfileDirectory().toURL();
+ final ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
+ final ClassLoader bootClassLoader = DirectoryHelper.createClassLoader(hostClassLoader, bootDirectory);
+
+ final URL systemScdl = getSystemScdl(profileUrl, runtimeInfo);
+ if (systemScdl == null) {
+ throw new TuscanyServerException("Unable to find system scdl");
+ }
+
+ final String className =
+ runtimeInfo.getProperty("tuscany.launcherClass",
+ "org.apache.tuscany.runtime.standalone.host.StandaloneRuntimeImpl");
+ final StandaloneRuntime runtime = (StandaloneRuntime) Beans.instantiate(bootClassLoader, className);
+ runtime.setSystemScdl(systemScdl);
+ runtime.setHostClassLoader(hostClassLoader);
+
+ runtime.setRuntimeInfo(runtimeInfo);
+ return runtime;
+
+ }
+
+ /**
+ * Gets the system SCDL.
+ *
+ * @param bootClassLoader Boot classloader.
+ * @return URL to the system SCDL.
+ * @throws MalformedURLException
+ */
+ private URL getSystemScdl(URL profileUrl, StandaloneRuntimeInfo runtimeInfo) throws MalformedURLException {
+ return new URL(profileUrl, runtimeInfo.getProperty("tuscany.systemSCDL", "system.scdl"));
+ }
+
+ /**
+ * Starts the server and starts the JMX agent.
+ */
+ private void start() {
+ agent.start();
+ agent.register(this, "tuscany:type=server,name=tuscanyServer");
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java
new file mode 100644
index 0000000000..97a81162ee
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerException.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.standalone.server;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Exception thrown by the tuscany server during startup and shutdown.
+ *
+ * @version $Revisiion$ $Date$
+ *
+ */
+
+@SuppressWarnings("serial")
+public class TuscanyServerException extends TuscanyRuntimeException {
+
+ /**
+ * Initializes the cause.
+ * @param cause Root cause of the exception.
+ */
+ public TuscanyServerException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Initializes the message.
+ * @param message Message of the exception.
+ */
+ public TuscanyServerException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java
new file mode 100644
index 0000000000..a3bc6291b2
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServerMBean.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.standalone.server;
+
+/**
+ * Management interface for the tuscany server.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface TuscanyServerMBean {
+
+ /**
+ * Starts a runtime specified by the bootpath.
+ *
+ * @param profileName Profile for the runtime.
+ */
+ public void startRuntime(String profileName);
+
+ /**
+ * Shuts down a runtime specified by the bootpath.
+ *
+ * @param bootPath Bootpath for the runtime.
+ */
+ public void shutdownRuntime(String bootPath);
+
+ /**
+ * Starts the server.
+ *
+ */
+ public void shutdown();
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off b/sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off
new file mode 100644
index 0000000000..5aec4763e3
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/pom.xml.off
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>smoketest</artifactId>
+ <name>Apache Tuscany SCA Standalone Smoketest</name>
+ <description>Module to smoketest the standalone runtime.</description>
+
+ <properties>
+ <tuscany.installDir>${project.build.directory}/assembly</tuscany.installDir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>smoketest</finalName>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>assembly</artifactId>
+ <version>${project.version}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${tuscany.installDir}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/SmokeTest*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java
new file mode 100644
index 0000000000..7d45d73183
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface HelloService {
+ String getGreeting();
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java
new file mode 100644
index 0000000000..a2d367096a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/HelloServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.runtime.standalone.smoketest;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloServiceImpl implements HelloService {
+ private final String greeting;
+
+ public HelloServiceImpl(@Property(name="greeting") String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java
new file mode 100644
index 0000000000..271f9e8273
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Launched.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Launched {
+ private HelloService hello;
+
+ @Reference
+ public void setHello(HelloService hello) {
+ this.hello = hello;
+ }
+
+ public int main(String[] args) throws Exception {
+ if (args.length == 0) {
+ System.out.println("No Args");
+ return 0;
+ }
+ String command = args[0];
+ if ("testReference".equals(command)) {
+ if ("Hello World".equals(hello.getGreeting())) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ return 1;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..ca2ac88a01
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha"
+ name="SmoketestComposite">
+
+ <component name="Main">
+ <tuscany:launched class="org.apache.tuscany.sca.runtime.standalone.smoketest.Launched"/>
+ <reference name="hello" target="Hello"/>
+ </component>
+
+ <component name="Hello">
+ <implementation.java class="org.apache.tuscany.sca.runtime.standalone.smoketest.HelloServiceImpl"/>
+ <property name="greeting">Hello World</property>
+ </component>
+</composite>
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
new file mode 100644
index 0000000000..64d5c02192
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
@@ -0,0 +1,63 @@
+/*
+ * 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.runtime.standalone.smoketest;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.BufferedInputStream;
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class CommandTestCase extends TestCase {
+ protected File buildDir;
+ protected File installDir;
+
+ public void compareOutput(String master, InputStream is) throws Exception {
+ String processText = readStream(is);
+ assertEquals(master, processText);
+ }
+
+ public String loadResource(String resource) throws IOException {
+ InputStream is = getClass().getResourceAsStream(resource);
+ assertNotNull(is);
+ return readStream(is);
+ }
+
+ public String readStream(InputStream is) throws IOException {
+ assertNotNull(is);
+ StringBuilder sb = new StringBuilder();
+ is = new BufferedInputStream(is);
+ int ch;
+ while ((ch = is.read()) != -1) {
+ sb.append((char)ch);
+ }
+ is.close();
+ return sb.toString();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ buildDir = new File(System.getProperty("basedir"), "target");
+ installDir = new File(buildDir, "assembly");
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java
new file mode 100644
index 0000000000..31e697bb23
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/ProcessDrainer.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.runtime.standalone.smoketest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Stream drainer used for draining the out and err streams of an external
+ * process to avoid buffer overflow and deadlock.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class ProcessDrainer {
+
+ // Default time out in seconds
+ private static final int DEFAULT_TIMEOUT = 60;
+
+ // Process whose streams are being drained
+ private Process process;
+
+ // Timeout to wait for the extrenal process to whutdown
+ private int timeout = DEFAULT_TIMEOUT;
+
+ // Executor that is scheduling the draining
+ private ExecutorService executor = Executors.newFixedThreadPool(2);
+
+ /*
+ * Initializes the process to drained.
+ */
+ private ProcessDrainer(Process process) {
+ this.process = process;
+ }
+
+ /*
+ * Initializes the process to drained.
+ */
+ private ProcessDrainer(Process process, int timeout) {
+ this.process = process;
+ this.timeout = timeout;
+ }
+
+ /**
+ * Creates a new instance of the stream drainer for the processed.
+ * @param process Process to be drained.
+ * @return An instance of the stream drainer.
+ */
+ public static ProcessDrainer newInstance(Process process) {
+ return new ProcessDrainer(process);
+ }
+
+ /**
+ * Creates a new instance of the stream drainer for the processed.
+ * @param process Process to be drained.
+ * @param timeout Timeout before which teh drainer stops.
+ * @return An instance of the stream drainer.
+ */
+ public static ProcessDrainer newInstance(Process process, int timeout) {
+ return new ProcessDrainer(process, timeout);
+ }
+
+ /**
+ * Starts draining the stream.
+ */
+ public void drain() {
+
+ executor.execute(new StreamDrainer(process.getErrorStream()));
+ executor.execute(new StreamDrainer(process.getInputStream()));
+
+ executor.shutdown();
+ try {
+ executor.awaitTermination(timeout, TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ return;
+ }
+
+ }
+
+ /*
+ * Scheduled stream drainer.
+ */
+ private class StreamDrainer implements Runnable {
+
+ // Stream to be drained
+ private final InputStream inputStream;
+
+ /*
+ * Initializes the stream to drained.
+ */
+ private StreamDrainer(InputStream inputStream) {
+ this.inputStream = inputStream;
+ }
+
+ /*
+ * Starts draing the stream.
+ */
+ public void run() {
+ try {
+ int count = 0;
+ byte[] buffer = new byte[4096];
+ count = inputStream.read(buffer);
+ while (count != -1) {
+ count = inputStream.read(buffer);
+ }
+ } catch (IOException ex) {
+ }
+ }
+
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
new file mode 100644
index 0000000000..7ac45268ae
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.runtime.standalone.smoketest;
+
+import java.io.File;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SmokeTestAssemblyContent extends CommandTestCase {
+ public void testLegalFilesArePresent() {
+ assertTrue(installDir.exists());
+ assertTrue(installDir.isDirectory());
+ assertTrue(new File(installDir, "LICENSE.txt").exists());
+ assertTrue(new File(installDir, "NOTICE.txt").exists());
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
new file mode 100644
index 0000000000..f3e7c3e40c
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
@@ -0,0 +1,88 @@
+/*
+ * 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.runtime.standalone.smoketest;
+
+import java.io.File;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SmokeTestLauncher extends CommandTestCase {
+ private static final String LF = System.getProperty("line.separator");
+ private File launcher;
+ private File testJar;
+
+ public void testLauncherCommandIsPresent() {
+ assertTrue(launcher.exists());
+ }
+
+ public void testLauncherUsage() throws Exception {
+ ProcessBuilder pb = new ProcessBuilder("java", "-jar", launcher.getAbsolutePath());
+ pb.directory(installDir);
+ Process process = pb.start();
+ try {
+ compareOutput(loadResource("LauncherUsage.txt"), process.getErrorStream());
+ ProcessDrainer drainer = ProcessDrainer.newInstance(process);
+ drainer.drain();
+ process.waitFor();
+ assertEquals(1, process.exitValue());
+ } finally {
+ process.destroy();
+ }
+ }
+
+ public void testLauncherWithNoArgs() throws Exception {
+ ProcessBuilder pb = new ProcessBuilder("java", "-jar", launcher.getAbsolutePath(), testJar.getAbsolutePath());
+ pb.directory(installDir);
+ Process process = pb.start();
+ try {
+ compareOutput("No Args" + LF, process.getInputStream());
+ ProcessDrainer drainer = ProcessDrainer.newInstance(process);
+ drainer.drain();
+ process.waitFor();
+ assertEquals(0, process.exitValue());
+ } finally {
+ process.destroy();
+ }
+ }
+
+ public void testReference() throws Exception {
+ ProcessBuilder pb = new ProcessBuilder("java",
+ "-jar",
+ launcher.getAbsolutePath(),
+ testJar.getAbsolutePath(),
+ "testReference");
+ pb.directory(installDir);
+ Process process = pb.start();
+ try {
+ ProcessDrainer drainer = ProcessDrainer.newInstance(process);
+ drainer.drain();
+ process.waitFor();
+ assertEquals(0, process.exitValue());
+ } finally {
+ process.destroy();
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ launcher = new File(installDir, "bin/launcher.jar");
+ testJar = new File(buildDir, "smoketest.jar");
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt
new file mode 100644
index 0000000000..c77e130b05
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherNoComponent.txt
@@ -0,0 +1 @@
+No component found with id "http://no.such.component"
diff --git a/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt
new file mode 100644
index 0000000000..d2b766f8ae
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt
@@ -0,0 +1 @@
+usage: java [jvm-options] -jar launcher.jar <componentJar> [apparg1, apparg2, ...]
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off b/sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off
new file mode 100644
index 0000000000..fa737b4c07
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/pom.xml.off
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Standalone Runtime</name>
+ <description>Code to run Tuscany in a standalone application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-host-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java
new file mode 100644
index 0000000000..abacda879b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java
@@ -0,0 +1,303 @@
+/*
+ * 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.standalone;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+import java.util.jar.JarFile;
+
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+
+/**
+ * Utility class for installation directory related operations.
+ *
+ * @version $Revision$ $Date$
+ */
+public final class DirectoryHelper {
+
+ /**
+ * Installation directory system property name.
+ */
+ private static final String INSTALL_DIRECTORY_PROPERTY = "tuscany.installDir";
+
+ private DirectoryHelper() {
+ }
+
+ /**
+ * Gets the installation directory based on the location of a class file.
+ * If the system property <code>tuscany.installDir</code> is set then its value is used as the
+ * location of the installation directory. Otherwise, we assume we are running from an
+ * executable jar containing the supplied class and the installation directory is assumed to
+ * be the parent of the directory containing that jar.
+ *
+ * @param clazz the class to use as a way to find the executable jar
+ * @return directory where tuscany standalone server is installed.
+ * @throws IllegalArgumentException if the property is set but its value is not an existing directory
+ * @throws IllegalStateException if the location could not be determined from the location of the class file
+ */
+ public static File getInstallDirectory(Class clazz) throws IllegalStateException, IllegalArgumentException {
+
+ String installDirectoryPath = System.getProperty(INSTALL_DIRECTORY_PROPERTY);
+
+ if (installDirectoryPath != null) {
+ File installDirectory = new File(installDirectoryPath);
+ if (!installDirectory.exists()) {
+ throw new IllegalArgumentException(INSTALL_DIRECTORY_PROPERTY
+ + " property does not refer to an existing directory: " + installDirectory);
+ }
+ return installDirectory;
+ }
+
+ // get the name of the Class's bytecode
+ String name = clazz.getName();
+ int last = name.lastIndexOf('.');
+ if (last != -1) {
+ name = name.substring(last + 1);
+ }
+ name = name + ".class";
+
+ // get location of the bytecode - should be a jar: URL
+ URL url = clazz.getResource(name);
+ if (url == null) {
+ throw new IllegalStateException("Unable to get location of bytecode resource " + name);
+ }
+
+ String jarLocation = url.toString();
+ if (!jarLocation.startsWith("jar:")) {
+ throw new IllegalStateException("Must be run from a jar: " + url);
+ }
+
+ // extract the location of thr jar from the resource URL
+ jarLocation = jarLocation.substring(4, jarLocation.lastIndexOf("!/"));
+ if (!jarLocation.startsWith("file:")) {
+ throw new IllegalStateException("Must be run from a local filesystem: " + jarLocation);
+ }
+
+ File jarFile = new File(URI.create(jarLocation));
+ return jarFile.getParentFile().getParentFile();
+ }
+
+ /**
+ * Get the directory associated with a runtime profile.
+ * If the system property <code>tuscany.profileDir.${profileName}</code> is set then its value
+ * is used as the value for the profile directory. Otherwise, the directory ${installDir}/profiles/${profileName}
+ * is used.
+ *
+ * @param installDir the installation directory
+ * @param profileName tha name of the profile
+ * @return the directory for the the specified profile
+ * @throws FileNotFoundException if the directory does not exist
+ */
+ public static File getProfileDirectory(File installDir, String profileName) throws FileNotFoundException {
+ String propName = "tuscany.profileDir." + profileName;
+ String profilePath = System.getProperty(propName);
+ File profileDir;
+ if (profilePath != null) {
+ profileDir = new File(profilePath);
+ } else {
+ profileDir = new File(new File(installDir, "profiles"), profileName);
+ }
+
+ if (!profileDir.isDirectory()) {
+ throw new FileNotFoundException("Unable to locate profile directory: " + profileDir.toString());
+ }
+ return profileDir;
+ }
+
+ /**
+ * Gets the boot directory where all the boot libraries are stored. This
+ * is expected to be a directory named <code>boot</code> under the install
+ * directory.
+ *
+ * @param installDirectory Tuscany install directory.
+ * @param bootPath Boot path for the runtime.
+ * @return Tuscany boot directory.
+ */
+ public static File getBootDirectory(File installDirectory, String bootPath) {
+
+ File bootDirectory = new File(installDirectory, bootPath);
+ if (!bootDirectory.exists()) {
+ throw new IllegalStateException("Boot directory doesn't exist: " + bootDirectory.getAbsolutePath());
+ }
+ return bootDirectory;
+
+ }
+
+ /**
+ * Gets the boot directory for the specified profile.
+ * If the bootPath is not null then it is used to specify the location of the boot directory
+ * relative to the profile directory. Otherwise, if there is a directory named "boot" relative
+ * to the profile or install directory then it is used.
+ *
+ * @param installDir the installation directory
+ * @param profileDir the profile directory
+ * @param bootPath the path to the boot directory
+ * @return the boot directory
+ * @throws FileNotFoundException if the boot directory does not exist
+ */
+ public static File getBootDirectory(File installDir, File profileDir, String bootPath)
+ throws FileNotFoundException {
+ File bootDir;
+ if (bootPath != null) {
+ bootDir = new File(profileDir, bootPath);
+ } else {
+ bootDir = new File(profileDir, "boot");
+ if (!bootDir.isDirectory()) {
+ bootDir = new File(installDir, "boot");
+ }
+ }
+ if (!bootDir.isDirectory()) {
+ throw new FileNotFoundException("Unable to locate boot directory: " + bootDir);
+ }
+ return bootDir;
+ }
+
+ /**
+ * Create a classloader from all the jar files or subdirectories in a directory.
+ * The classpath for the returned classloader will comprise all jar files and subdirectories
+ * of the supplied directory. Hidden files and those that do not contain a valid manifest will
+ * be silently ignored.
+ *
+ * @param parent the parent for the new classloader
+ * @param directory the directory to scan
+ * @return a classloader whose classpath includes all jar files and subdirectories of the supplied directory
+ */
+ public static ClassLoader createClassLoader(ClassLoader parent, File directory) {
+ File[] jars = directory.listFiles(new FileFilter() {
+ public boolean accept(File file) {
+ if (file.isHidden()) {
+ return false;
+ }
+ if (file.isDirectory()) {
+ return true;
+ }
+ try {
+ JarFile jar = new JarFile(file);
+ return jar.getManifest() != null;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+ });
+
+ URL[] urls = new URL[jars.length];
+ for (int i = 0; i < jars.length; i++) {
+ try {
+ urls[i] = jars[i].toURI().toURL();
+ } catch (MalformedURLException e) {
+ // toURI should have escaped the URL
+ throw new AssertionError();
+ }
+ }
+
+ return new URLClassLoader(urls, parent);
+ }
+
+ /**
+ * Load properties from the specified file.
+ * If the file does not exist then an empty properties object is returned.
+ *
+ * @param propFile the file to load from
+ * @param defaults defaults for the properties
+ * @return a Properties object loaded from the file
+ * @throws IOException if there was a problem loading the properties
+ */
+ public static Properties loadProperties(File propFile, Properties defaults) throws IOException {
+ Properties props = defaults == null ? new Properties() : new Properties(defaults);
+ FileInputStream is;
+ try {
+ is = new FileInputStream(propFile);
+ } catch (FileNotFoundException e) {
+ return props;
+ }
+ try {
+ props.load(is);
+ return props;
+ } finally {
+ is.close();
+ }
+ }
+
+ /**
+ * Convert a File to a URL. Equivalent to file.toURI().toURL()
+ *
+ * @param file the file to convert
+ * @return the URL for the File
+ */
+ public static URL toURL(File file) {
+ try {
+ return file.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // toURI should have escaped this
+ throw new AssertionError();
+ }
+ }
+
+ public static StandaloneRuntimeInfo createRuntimeInfo(String defaultProfile, Class<?> markerClass) throws IOException {
+ // get profile to use, defaulting to "launcher"
+ String profile = System.getProperty("tuscany.profile", defaultProfile);
+
+ File installDir = getInstallDirectory(markerClass);
+ File profileDir = getProfileDirectory(installDir, profile);
+
+ // load properties for this runtime
+ File propFile = new File(profileDir, "etc/runtime.properties");
+ Properties props = loadProperties(propFile, System.getProperties());
+
+ // online unless the offline property is set
+ boolean online = !Boolean.parseBoolean(props.getProperty("offline", "false"));
+
+ return new StandaloneRuntimeInfoImpl(null, profile, installDir, profileDir, null, online, props);
+
+ }
+
+ public static TuscanyRuntime createRuntime(StandaloneRuntimeInfo runtimeInfo) throws Exception {
+ File installDir = runtimeInfo.getInstallDirectory();
+ File profileDir = runtimeInfo.getProfileDirectory();
+ URL profileURL = toURL(profileDir);
+ ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
+
+ // create the classloader for booting the runtime
+ String bootPath = runtimeInfo.getProperty("tuscany.bootDir", null);
+ File bootDir = getBootDirectory(installDir, profileDir, bootPath);
+ ClassLoader bootClassLoader = createClassLoader(hostClassLoader, bootDir);
+
+ // locate the system SCDL
+ URL systemSCDL = new URL(profileURL, runtimeInfo.getProperty("tuscany.systemSCDL", "system.scdl"));
+
+ // locate the implementation
+ String className = runtimeInfo.getProperty("tuscany.runtimeClass",
+ "org.apache.tuscany.runtime.standalone.host.StandaloneRuntimeImpl");
+ Class<?> implClass = Class.forName(className, true, bootClassLoader);
+
+ TuscanyRuntime runtime = (TuscanyRuntime) implClass.newInstance();
+ runtime.setHostClassLoader(hostClassLoader);
+ runtime.setSystemScdl(systemSCDL);
+ runtime.setRuntimeInfo(runtimeInfo);
+ return runtime;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java
new file mode 100644
index 0000000000..0ccb26a7dd
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntime.java
@@ -0,0 +1,44 @@
+/*
+ * 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.standalone;
+
+import java.net.URL;
+
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+
+/**
+ * Extends the tuscany runtime to add the behavious to deploy an
+ * application SCDL.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface StandaloneRuntime extends TuscanyRuntime<StandaloneRuntimeInfo> {
+
+ /**
+ * Deploys the specified application SCDL and runs the lauched component within the deployed composite.
+ *
+ * @param applicationScdl Application SCDL that implements the composite.
+ * @param applicationClassLoader Classloader used to deploy the composite.
+ * @param args Arguments to be passed to the lauched component.
+ * @deprecated This is a hack for deployment and should be removed.
+ */
+ int deployAndRun(URL applicationScdl, ClassLoader applicationClassLoader, String[] args) throws Exception;
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java
new file mode 100644
index 0000000000..8e5e18b198
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java
@@ -0,0 +1,62 @@
+/*
+ * 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.standalone;
+
+import java.io.File;
+import java.net.URI;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface StandaloneRuntimeInfo extends RuntimeInfo {
+
+ URI STANDALONE_COMPONENT_URI = URI.create("sca://StandaloneRuntimeInfo");
+
+ /**
+ * Return the directory where the standalone distribution was installed.
+ *
+ * @return the directory where the standalone distribution was installed
+ */
+ File getInstallDirectory();
+
+ /**
+ * Returns the name of this runtime's profile.
+ *
+ * @return the name of this runtime's profile
+ */
+ String getProfileName();
+
+ /**
+ * Returns the directory containing this runtime's profile.
+ *
+ * @return the directory containing this runtime's profile
+ */
+ File getProfileDirectory();
+
+ /**
+ * Return the value of the named property.
+ *
+ * @param name the name of the property
+ * @param defaultValue default value to return if the property is not defined
+ * @return the value of the named property
+ */
+ String getProperty(String name, String defaultValue);
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java
new file mode 100644
index 0000000000..bf1e92b407
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java
@@ -0,0 +1,78 @@
+/*
+ * 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.standalone;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Properties;
+
+import org.apache.tuscany.host.AbstractRuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StandaloneRuntimeInfoImpl extends AbstractRuntimeInfo implements StandaloneRuntimeInfo {
+ private final String profileName;
+ private final File profileDirectory;
+ private final File installDirectory;
+ private final Properties properties;
+
+ /**
+ * Initializes the base URL, install directory, application root directory and
+ * online mode.
+ *
+ * @param domain the SCA domain this runtime belongs to
+ * @param profileName the runtime's profile name
+ * @param installDirectory directory containing the standalone installation
+ * @param profileDirectory directory containing this runtime's profile
+ * @param applicationRootDirectory Application root directory.
+ * @param online true if this runtime should consider itself online
+ * @param properties properties for this runtime
+ */
+ public StandaloneRuntimeInfoImpl(final URI domain,
+ final String profileName,
+ final File installDirectory,
+ final File profileDirectory,
+ final File applicationRootDirectory,
+ final boolean online,
+ final Properties properties) {
+ super(domain, applicationRootDirectory, DirectoryHelper.toURL(installDirectory), online, profileName);
+ this.profileName = profileName;
+ this.profileDirectory = profileDirectory;
+ this.properties = properties;
+ this.installDirectory = installDirectory;
+
+ }
+
+ public String getProfileName() {
+ return profileName;
+ }
+
+ public File getProfileDirectory() {
+ return profileDirectory;
+ }
+
+ public File getInstallDirectory() {
+ return installDirectory;
+ }
+
+ public String getProperty(String name, String defaultValue) {
+ return properties.getProperty(name, defaultValue);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt b/sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt b/sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off b/sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off
new file mode 100644
index 0000000000..f8ef044ab6
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/pom.xml.off
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>standalone</artifactId>
+ <version>2.0-alpha2-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-host</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Standalone Runtime Host</name>
+ <description>Host code to support a standalone runtime</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+ <artifactId>standalone-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.services</groupId>
+ <artifactId>maven</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java
new file mode 100644
index 0000000000..038df9e3b9
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/DirectoryScanExtender.java
@@ -0,0 +1,64 @@
+/*
+ * 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.standalone.host;
+
+import java.io.File;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.loader.IllegalSCDLNameException;
+import org.apache.tuscany.spi.services.VoidService;
+
+import org.apache.tuscany.core.services.extension.AbstractExtensionDeployer;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+
+/**
+ * Service that extends the runtime by loading composites located in a directory.
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class DirectoryScanExtender extends AbstractExtensionDeployer implements VoidService {
+ private final StandaloneRuntimeInfo runtimeInfo;
+ private final String path;
+
+ public DirectoryScanExtender(@Reference StandaloneRuntimeInfo runtimeInfo,
+ @Property(name = "path")String path) {
+ this.runtimeInfo = runtimeInfo;
+ this.path = path;
+ }
+
+ @Init
+ public void init() throws IllegalSCDLNameException {
+ assert runtimeInfo != null;
+ File extensionDir = new File(runtimeInfo.getInstallDirectory(), path);
+ if (!extensionDir.isDirectory()) {
+ // we don't have an extension directory, there's nothing to do
+ return;
+ }
+
+ File[] files = extensionDir.listFiles();
+ for (File file : files) {
+ deployExtension(file);
+ }
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java
new file mode 100644
index 0000000000..23811743e4
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java
@@ -0,0 +1,143 @@
+/*
+ * 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.standalone.host;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+import org.apache.tuscany.core.implementation.PojoWorkContextTunnel;
+import org.apache.tuscany.core.monitor.JavaLoggingMonitorFactory;
+import org.apache.tuscany.core.runtime.AbstractRuntime;
+import org.apache.tuscany.core.component.SimpleWorkContext;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntime;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.runtime.standalone.host.implementation.launched.Launched;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StandaloneRuntimeImpl extends AbstractRuntime<StandaloneRuntimeInfo> implements StandaloneRuntime {
+ JavaLoggingMonitorFactory monitorFactory;
+ StandaloneMonitor monitor;
+
+ public StandaloneRuntimeImpl() {
+ super(StandaloneRuntimeInfo.class);
+ monitorFactory = new JavaLoggingMonitorFactory();
+ setMonitorFactory(monitorFactory);
+ monitor = monitorFactory.getMonitor(StandaloneMonitor.class);
+ }
+
+ /**
+ * Deploys the specified application SCDL and runs the lauched component within the deployed composite.
+ *
+ * @param applicationScdl Application SCDL that implements the composite.
+ * @param applicationClassLoader Classloader used to deploy the composite.
+ * @param args Arguments to be passed to the lauched component.
+ * @deprecated This is a hack for deployment and should be removed.
+ */
+ public int deployAndRun(URL applicationScdl, ClassLoader applicationClassLoader, String[] args) throws Exception {
+
+ URI compositeUri = new URI("/test/composite");
+ URI compositeBase = new URI("/test/composite/");
+
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(applicationScdl);
+ impl.setClassLoader(applicationClassLoader);
+
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(compositeUri, impl);
+ try {
+ Collection<Component> components = getDeployer().deploy(null, definition);
+ for (Component component : components) {
+ component.start();
+ }
+ ScopeRegistry scopeRegistry = getScopeRegistry();
+ ScopeContainer<URI> container = scopeRegistry.getScopeContainer(Scope.COMPOSITE);
+ container.startContext(compositeUri, compositeUri);
+ getWorkContext().setIdentifier(Scope.COMPOSITE, compositeUri);
+ WorkContext workContext = new SimpleWorkContext();
+ workContext.setIdentifier(Scope.COMPOSITE, compositeUri);
+ PojoWorkContextTunnel.setThreadWorkContext(workContext);
+ try {
+ return run(impl, args, compositeBase, workContext);
+ } finally {
+ container.stopContext(compositeUri);
+ getWorkContext().setIdentifier(Scope.COMPOSITE, null);
+ }
+ } catch (Exception e) {
+ monitor.runError(e);
+ }
+ return -1;
+
+ }
+
+ private int run(CompositeImplementation impl, String[] args, URI compositeUri, WorkContext workContext) throws Exception {
+ CompositeComponentType<?, ?, ?> componentType = impl.getComponentType();
+ Map<String, ComponentDefinition<? extends Implementation<?>>> components = componentType.getComponents();
+ for (Map.Entry<String, ComponentDefinition<? extends Implementation<?>>> entry : components.entrySet()) {
+ String name = entry.getKey();
+ ComponentDefinition<? extends Implementation<?>> launchedDefinition = entry.getValue();
+ Implementation implementation = launchedDefinition.getImplementation();
+ if (implementation.getClass().isAssignableFrom(Launched.class)) {
+ return run(compositeUri.resolve(name), implementation, args, workContext);
+ }
+ }
+ return -1;
+ }
+
+ private int run(URI componentUri, Implementation implementation, String[] args, WorkContext workContext)
+ throws TargetInvokerCreationException, InvocationTargetException {
+ Launched launched = (Launched) implementation;
+ PojoComponentType launchedType = launched.getComponentType();
+ Map services = launchedType.getServices();
+ JavaMappedService testService = (JavaMappedService) services.get("main");
+ Operation<?> operation = testService.getServiceContract().getOperations().get("main");
+ Component component = getComponentManager().getComponent(componentUri);
+ TargetInvoker targetInvoker = component.createTargetInvoker("main", operation);
+ Object result = targetInvoker.invokeTarget(new Object[]{args}, TargetInvoker.NONE, workContext);
+ try {
+ return int.class.cast(result);
+ } catch (ClassCastException e) {
+ return 0;
+ }
+ }
+
+ public interface StandaloneMonitor {
+ @LogLevel("SEVERE")
+ void runError(Exception e);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java
new file mode 100644
index 0000000000..93771ee942
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/Launched.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.runtime.standalone.host.implementation.launched;
+
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Launched extends AtomicImplementation<PojoComponentType> {
+ private String className;
+ private String factoryName;
+
+ public Launched(String className, String factoryName) {
+ this.className = className;
+ this.factoryName = factoryName;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getFactoryName() {
+ return factoryName;
+ }
+
+ public void setFactoryName(String factoryName) {
+ this.factoryName = factoryName;
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java
new file mode 100644
index 0000000000..642076ca29
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentBuilder.java
@@ -0,0 +1,193 @@
+/*
+ * 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.standalone.host.implementation.launched;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.Parameter;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+
+/**
+ * @version $Revsion$ $Date$
+ * <p/>
+ * TODO This is a straight copy from the JUnit component builder
+ */
+public class LaunchedComponentBuilder extends ComponentBuilderExtension<Launched> {
+
+ private ResourceHost host;
+
+ @Reference
+ public void setHost(ResourceHost host) {
+ this.host = host;
+ }
+
+ @Override
+ protected Class<Launched> getImplementationType() {
+ return Launched.class;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Component build(ComponentDefinition<Launched> definition, DeploymentContext deployment)
+ throws BuilderConfigException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ definition.getImplementation().getComponentType();
+ Class<?> implClass = componentType.getImplClass();
+
+ PojoConfiguration configuration = new PojoConfiguration();
+ if (definition.getInitLevel() != null) {
+ configuration.setInitLevel(definition.getInitLevel());
+ } else {
+ configuration.setInitLevel(componentType.getInitLevel());
+ }
+ if (componentType.getMaxAge() > 0) {
+ configuration.setMaxAge(componentType.getMaxAge());
+ } else if (componentType.getMaxIdleTime() > 0) {
+ configuration.setMaxIdleTime(componentType.getMaxIdleTime());
+ }
+ Method initMethod = componentType.getInitMethod();
+ if (initMethod != null) {
+ configuration.setInitInvoker(new MethodEventInvoker(initMethod));
+ }
+ Method destroyMethod = componentType.getDestroyMethod();
+ if (destroyMethod != null) {
+ configuration.setDestroyInvoker(new MethodEventInvoker(destroyMethod));
+ }
+
+ configuration.setProxyService(proxyService);
+ configuration.setWorkContext(workContext);
+ configuration.setImplementationClass(implClass);
+ configuration.setGroupId(deployment.getGroupId());
+
+ // setup property injection sites
+ for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
+ configuration.addPropertySite(property.getName(), property.getMember());
+ }
+
+ // setup reference injection sites
+ for (JavaMappedReference reference : componentType.getReferences().values()) {
+ Member member = reference.getMember();
+ if (member != null) {
+ // could be null if the reference is mapped to a constructor
+ configuration.addReferenceSite(reference.getUri().getFragment(), member);
+ }
+ }
+
+ for (Resource resource : componentType.getResources().values()) {
+ Member member = resource.getMember();
+ if (member != null) {
+ // could be null if the resource is mapped to a constructor
+ configuration.addResourceSite(resource.getName(), member);
+ }
+ }
+
+ // setup constructor injection
+ ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
+ Constructor<?> constr = ctorDef.getConstructor();
+ PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
+ configuration.setInstanceFactory(instanceFactory);
+ configuration.setConstructor(ctorDef);
+ configuration.setName(definition.getUri());
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+
+ // handle properties
+ handleProperties(definition, component);
+
+ // handle resources
+ handleResources(componentType, component);
+
+ handleCallbackSites(componentType, configuration);
+
+ if (componentType.getConversationIDMember() != null) {
+ component.addConversationIDFactory(componentType.getConversationIDMember());
+ }
+
+ return component;
+ }
+
+ private void handleCallbackSites(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ PojoConfiguration configuration) {
+ for (JavaMappedService service : componentType.getServices().values()) {
+ // setup callback injection sites
+ if (service.getCallbackReferenceName() != null) {
+ // Only if there is a callback reference in the service
+ configuration.addCallbackSite(service.getCallbackReferenceName(), service.getCallbackMember());
+ }
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void handleResources(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ JavaAtomicComponent component) {
+
+ for (Resource resource : componentType.getResources().values()) {
+ ObjectFactory<?> objectFactory = resource.getObjectFactory();
+ if (objectFactory != null) {
+ component.addResourceFactory(resource.getName(), objectFactory);
+ } else {
+ String name = resource.getName();
+ boolean optional = resource.isOptional();
+ Class<Object> type = (Class<Object>) resource.getType();
+ ResourceObjectFactory<Object> factory;
+ String mappedName = resource.getMappedName();
+ if (mappedName == null) {
+ // by type
+ factory = new ResourceObjectFactory<Object>(type, optional, host);
+ } else {
+ factory = new ResourceObjectFactory<Object>(type, mappedName, optional, host);
+ }
+ component.addResourceFactory(name, factory);
+ }
+ }
+ }
+
+ private void handleProperties(ComponentDefinition<Launched> definition, JavaAtomicComponent component) {
+ for (PropertyValue<?> property : definition.getPropertyValues().values()) {
+ ObjectFactory<?> factory = property.getValueFactory();
+ if (factory != null) {
+ component.addPropertyFactory(property.getName(), factory);
+ }
+ }
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java
new file mode 100644
index 0000000000..c3575ae95b
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedComponentTypeLoader.java
@@ -0,0 +1,113 @@
+/*
+ * 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.standalone.host.implementation.launched;
+
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class LaunchedComponentTypeLoader extends ComponentTypeLoaderExtension<Launched> {
+ private static final URI SERVICE_NAME = URI.create("#main");
+ private Introspector introspector;
+
+ public LaunchedComponentTypeLoader(@Reference LoaderRegistry loaderRegistry,
+ @Reference IntrospectionRegistry introspector) {
+ super(loaderRegistry);
+ this.introspector = introspector;
+ }
+
+ @Override
+ protected Class<Launched> getImplementationClass() {
+ return Launched.class;
+ }
+
+ public void load(
+ Launched implementation,
+ DeploymentContext deploymentContext) throws LoaderException {
+ String className = implementation.getClassName();
+ Class<?> implClass;
+ try {
+ implClass = deploymentContext.getClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException(className, e);
+ }
+ PojoComponentType componentType = loadByIntrospection(implementation, deploymentContext, implClass);
+ implementation.setComponentType(componentType);
+ }
+
+ protected PojoComponentType loadByIntrospection(
+ Launched implementation,
+ DeploymentContext deploymentContext,
+ Class<?> implClass) throws ProcessingException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>(implClass);
+ introspector.introspect(implClass, componentType, deploymentContext);
+
+ ServiceContract launchedContract = generateContract(implClass);
+ JavaMappedService testService = new JavaMappedService(SERVICE_NAME, launchedContract, false);
+ componentType.add(testService);
+ return componentType;
+ }
+
+ private static final DataType<List<DataType<Type>>> INPUT_TYPE;
+ private static final DataType<Type> OUTPUT_TYPE;
+ private static final List<DataType<Type>> FAULT_TYPE;
+
+ static {
+ List<DataType<Type>> paramDataTypes = new ArrayList<DataType<Type>>();
+ //noinspection unchecked
+ paramDataTypes.add(new DataType(null, String[].class, String[].class));
+ INPUT_TYPE = new DataType<List<DataType<Type>>>("idl:input", Object[].class, paramDataTypes);
+ OUTPUT_TYPE = new DataType<Type>(null, Object.class, Object.class);
+ FAULT_TYPE = Collections.emptyList();
+ }
+
+ protected ServiceContract generateContract(Class<?> implClass) {
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ Operation<Type> operation = new Operation<Type>("main", INPUT_TYPE, OUTPUT_TYPE, FAULT_TYPE);
+ operations.put("main", operation);
+ return new LaunchedServiceContract(operations);
+ }
+
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java
new file mode 100644
index 0000000000..7718e02838
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedLoader.java
@@ -0,0 +1,55 @@
+/*
+ * 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.standalone.host.implementation.launched;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LaunchedLoader extends LoaderExtension<Launched> {
+ private static final QName LAUNCHED = new QName("http://tuscany.apache.org/xmlns/sca/2.0-alpha", "launched");
+
+ public LaunchedLoader(@Reference LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return LAUNCHED;
+ }
+
+ public Launched load(
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ String className = reader.getAttributeValue(null, "class");
+ String factoryName = reader.getAttributeValue(null, "factory");
+ return new Launched(className, factoryName);
+ }
+}
diff --git a/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java
new file mode 100644
index 0000000000..820093917a
--- /dev/null
+++ b/sandbox/old/contrib/runtime-standalone/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/implementation/launched/LaunchedServiceContract.java
@@ -0,0 +1,37 @@
+/*
+ * 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.standalone.host.implementation.launched;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Revison$ $Date$
+ *
+ */
+public class LaunchedServiceContract extends ServiceContract<Type> {
+
+ public LaunchedServiceContract(Map<String, Operation<Type>> operations) {
+ setOperations(operations);
+ }
+}
+