You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/01/05 23:40:11 UTC

svn commit: r493216 - in /incubator/tuscany/java/sca/runtime/standalone: ./ assembly/ assembly/src/ assembly/src/main/ launcher/ launcher/src/main/java/org/apache/tuscany/launcher/ launcher/src/main/resources/org/apache/tuscany/launcher/ smoketest/ smo...

Author: jboynes
Date: Fri Jan  5 14:40:09 2007
New Revision: 493216

URL: http://svn.apache.org/viewvc?view=rev&rev=493216
Log:
convert launcher to use a profile
create a separate assembly of the standalone runtime
add a smoketest module to do basic pre-commit testing on the standalone runtime assembly

Added:
    incubator/tuscany/java/sca/runtime/standalone/assembly/   (with props)
    incubator/tuscany/java/sca/runtime/standalone/assembly/LICENSE.txt
      - copied unchanged from r493051, incubator/tuscany/java/sca/runtime/standalone/LICENSE.txt
    incubator/tuscany/java/sca/runtime/standalone/assembly/NOTICE.txt
      - copied unchanged from r493051, incubator/tuscany/java/sca/runtime/standalone/NOTICE.txt
    incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml   (with props)
    incubator/tuscany/java/sca/runtime/standalone/assembly/src/
      - copied from r493051, incubator/tuscany/java/sca/runtime/standalone/src/
    incubator/tuscany/java/sca/runtime/standalone/assembly/src/main/
      - copied from r493212, incubator/tuscany/java/sca/runtime/standalone/src/main/
    incubator/tuscany/java/sca/runtime/standalone/assembly/standalone.xml
      - copied, changed from r493051, incubator/tuscany/java/sca/runtime/standalone/standalone.xml
    incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties   (contents, props changed)
      - copied, changed from r493051, incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncherBooter.properties
    incubator/tuscany/java/sca/runtime/standalone/smoketest/   (with props)
    incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml   (with props)
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java   (with props)
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java   (with props)
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java   (with props)
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java   (with props)
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/
    incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt   (with props)
Removed:
    incubator/tuscany/java/sca/runtime/standalone/LICENSE.txt
    incubator/tuscany/java/sca/runtime/standalone/NOTICE.txt
    incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncherBooter.properties
    incubator/tuscany/java/sca/runtime/standalone/src/
    incubator/tuscany/java/sca/runtime/standalone/standalone.xml
Modified:
    incubator/tuscany/java/sca/runtime/standalone/launcher/pom.xml
    incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
    incubator/tuscany/java/sca/runtime/standalone/pom.xml
    incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java
    incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java
    incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java

Propchange: incubator/tuscany/java/sca/runtime/standalone/assembly/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jan  5 14:40:09 2007
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml (added)
+++ incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml Fri Jan  5 14:40:09 2007
@@ -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.standalone</groupId>
+        <artifactId>standalone</artifactId>
+        <version>1.0-incubator-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <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>${sca.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
+            <artifactId>standalone-host</artifactId>
+            <version>${sca.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>

Propchange: incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/assembly/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/java/sca/runtime/standalone/assembly/standalone.xml (from r493051, incubator/tuscany/java/sca/runtime/standalone/standalone.xml)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/assembly/standalone.xml?view=diff&rev=493216&p1=incubator/tuscany/java/sca/runtime/standalone/standalone.xml&r1=493051&p2=incubator/tuscany/java/sca/runtime/standalone/assembly/standalone.xml&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/standalone.xml (original)
+++ incubator/tuscany/java/sca/runtime/standalone/assembly/standalone.xml Fri Jan  5 14:40:09 2007
@@ -23,7 +23,6 @@
     <formats>
         <format>zip</format>
         <format>tar.gz</format>
-        <format>dir</format>
     </formats>
 
     <files>
@@ -47,33 +46,43 @@
         </fileSet>
     </fileSets>
 
-    <moduleSets>
-        <!-- moduleSet for executable commands placed in the bin directory -->
-        <moduleSet>
+    <dependencySets>
+        <!-- copy executable commands to the bin directory without version info -->
+        <dependencySet>
             <includes>
                 <include>org.apache.tuscany.sca.runtime.standalone:launcher</include>
             </includes>
-            <binaries>
-                <!-- copy jars to bin directory without dependencies or version information -->
-                <outputDirectory>bin</outputDirectory>
-                <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
-                <unpack>false</unpack>
-                <includeDependencies>false</includeDependencies>
-                <fileMode>775</fileMode>
-            </binaries>
-        </moduleSet>
+            <excludes>
+                <exclude>org.apache.tuscany.sca.runtime.standalone:standalone-api</exclude>
+            </excludes>
+            <outputDirectory>bin</outputDirectory>
+            <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+            <fileMode>755</fileMode>
+        </dependencySet>
 
-        <!-- moduleSet for dependencies used by the executable commands -->
-        <moduleSet>
+        <!-- copy dependencies used by the executable commands to the lib directory -->
+        <dependencySet>
             <includes>
-                <include>org.apache.tuscany.sca.runtime.standalone:launcher</include>
+                <include>org.apache.tuscany.sca.runtime.standalone:standalone-api</include>
+                <include>org.osoa:sca-api-r0.95</include>
+                <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
+                <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+            </includes>
+            <outputDirectory>lib</outputDirectory>
+        </dependencySet>
+
+        <!-- copy boot dependencies to launcher profile -->
+        <dependencySet>
+            <includes>
+                <include>org.apache.tuscany.sca.runtime.standalone:standalone-host</include>
             </includes>
-            <binaries>
-                <outputDirectory>lib</outputDirectory>
-                <unpack>false</unpack>
-                <fileMode>664</fileMode>
-            </binaries>
-        </moduleSet>
-    </moduleSets>
+            <excludes>
+                <exclude>org.apache.tuscany.sca.runtime.standalone:standalone-api</exclude>
+                <exclude>org.apache.tuscany.sca.kernel:tuscany-host-api</exclude>
+                <exclude>junit:junit</exclude>
+            </excludes>
+            <outputDirectory>profiles/launcher/boot</outputDirectory>
+        </dependencySet>
+    </dependencySets>
 </assembly>
 

Modified: incubator/tuscany/java/sca/runtime/standalone/launcher/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/launcher/pom.xml?view=diff&rev=493216&r1=493215&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/launcher/pom.xml (original)
+++ incubator/tuscany/java/sca/runtime/standalone/launcher/pom.xml Fri Jan  5 14:40:09 2007
@@ -34,10 +34,6 @@
     -->
     <dependencies>
         <dependency>
-            <groupId>org.osoa</groupId>
-            <artifactId>sca-api-r0.95</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.tuscany.sca.runtime.standalone</groupId>
             <artifactId>standalone-api</artifactId>
             <version>${sca.version}</version>

Modified: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java?view=diff&rev=493216&r1=493215&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java Fri Jan  5 14:40:09 2007
@@ -18,13 +18,13 @@
  */
 package org.apache.tuscany.launcher;
 
-import java.beans.Beans;
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
@@ -46,61 +46,92 @@
      * 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 == 0) {
             usage();
         }
-        Main booter = new Main();
 
-        File installDir = DirectoryHelper.getInstallDirectory(Main.class);
-        URL baseUrl = installDir.toURI().toURL();
-        File bootDir = getBootDirectory(installDir);
-
-        boolean online = !Boolean.parseBoolean(System.getProperty("offline", Boolean.FALSE.toString()));
-        StandaloneRuntimeInfo runtimeInfo = new StandaloneRuntimeInfoImpl(baseUrl, installDir, installDir, online);
+        StandaloneRuntimeInfo runtimeInfo = createRuntimeInfo();
+        TuscanyRuntime runtime = createRuntime(runtimeInfo);
 
         File applicationJar = new File(args[0]);
         URL applicationURL = applicationJar.toURI().toURL();
         String[] appArgs = new String[args.length - 1];
         System.arraycopy(args, 1, appArgs, 0, appArgs.length);
 
-        ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
-        ClassLoader bootClassLoader = DirectoryHelper.createClassLoader(hostClassLoader, bootDir);
-        ClassLoader applicationClassLoader = new URLClassLoader(new URL[]{applicationURL}, hostClassLoader);
+        ClassLoader applicationClassLoader =
+            new URLClassLoader(new URL[]{applicationURL}, runtime.getHostClassLoader());
 
-        URL systemScdl = booter.getSystemScdl(bootClassLoader);
-        URL applicationScdl = booter.getApplicationScdl(applicationClassLoader);
+        URL applicationScdl = getApplicationScdl(applicationClassLoader);
 
-        String className = System.getProperty("tuscany.launcherClass",
-                                              "org.apache.tuscany.runtime.standalone.host.StandaloneRuntimeImpl");
-        TuscanyRuntime runtime = (TuscanyRuntime) Beans.instantiate(bootClassLoader, className);
-        runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
-        runtime.setSystemScdl(systemScdl);
-        runtime.setHostClassLoader(hostClassLoader);
         runtime.setApplicationName("application");
         runtime.setApplicationScdl(applicationScdl);
         runtime.setApplicationClassLoader(applicationClassLoader);
-        runtime.setRuntimeInfo(runtimeInfo);
         runtime.initialize();
         SCA context = runtime.getContext();
 
         try {
             context.start();
-            booter.runApplication(applicationJar, applicationClassLoader, appArgs);
+            runApplication(applicationJar, applicationClassLoader, appArgs);
         } finally {
             context.stop();
             runtime.destroy();
         }
     }
 
+    static StandaloneRuntimeInfo createRuntimeInfo() throws IOException {
+        // get profile to use, defaulting to "launcher"
+        String profile = System.getProperty("tuscany.profile", "launcher");
+
+        File installDir = DirectoryHelper.getInstallDirectory(Main.class);
+        File profileDir = DirectoryHelper.getProfileDirectory(installDir, profile);
+
+        // load properties for this runtime
+        File propFile = new File(profileDir, "etc/runtime.properties");
+        Properties props = DirectoryHelper.loadProperties(propFile, System.getProperties());
+
+        // online unless the offline property is set
+        boolean online = !Boolean.parseBoolean(props.getProperty("offline", "false"));
+
+        return new StandaloneRuntimeInfoImpl(profile, installDir, profileDir, null, online, props);
+    }
+
+    static TuscanyRuntime createRuntime(StandaloneRuntimeInfo runtimeInfo) throws Exception {
+        File installDir = runtimeInfo.getInstallDirectory();
+        File profileDir = runtimeInfo.getProfileDirectory();
+        URL profileURL = DirectoryHelper.toURL(profileDir);
+        ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
+
+        // create the classloader for booting the runtime
+        String bootPath = runtimeInfo.getProperty("tuscany.bootDir", null);
+        File bootDir = DirectoryHelper.getBootDirectory(installDir, profileDir, bootPath);
+        ClassLoader bootClassLoader = DirectoryHelper.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.setMonitorFactory(runtime.createDefaultMonitorFactory());
+        runtime.setHostClassLoader(hostClassLoader);
+        runtime.setSystemScdl(systemSCDL);
+        runtime.setRuntimeInfo(runtimeInfo);
+        return runtime;
+    }
+
     private static void usage() {
         ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());
         System.err.println(bundle.getString("org.apache.tuscany.launcher.Usage"));
         System.exit(1);
     }
 
-    protected void runApplication(File applicationJar, ClassLoader applicationClassLoader, String[] args)
+    static void runApplication(File applicationJar, ClassLoader applicationClassLoader, String[] args)
         throws Throwable {
 
         Manifest manifest = new JarFile(applicationJar).getManifest();
@@ -125,50 +156,8 @@
         }
     }
 
-    /**
-     * Find the directory containing the bootstrap jars. If the <code>tuscany.bootDir</code> system property is set then
-     * its value is used as the boot directory. Otherwise, we locate a jar file containing this class and return a
-     * "boot" directory that is a sibling to the directory that contains it. This class must be loaded from a jar file
-     * located on the local filesystem.
-     *
-     * @return the directory of the bootstrap jars
-     */
-    protected File findBootDir() {
-        String property = System.getProperty("tuscany.bootDir");
-        if (property != null) {
-            return new File(property);
-        }
-
-        URL url = Main.class.getResource("Main.class");
-        if (!"jar".equals(url.getProtocol())) {
-            throw new IllegalStateException("Must be run from a jar: " + url);
-        }
-        String jarLocation = url.toString();
-        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 new File(jarFile.getParentFile().getParentFile(), "boot");
-    }
-
-    protected URL getSystemScdl(ClassLoader bootClassLoader) {
-        String resource = System.getProperty("tuscany.systemScdlPath", "META-INF/tuscany/system.scdl");
-        return bootClassLoader.getResource(resource);
-    }
-
-    protected URL getApplicationScdl(ClassLoader applicationClassLoader) {
+    static URL getApplicationScdl(ClassLoader applicationClassLoader) {
         String resource = System.getProperty("tuscany.applicationScdlPath", "META-INF/sca/default.scdl");
         return applicationClassLoader.getResource(resource);
-    }
-
-    public static File getBootDirectory(File installDirectory) {
-        // use system property if defined
-        String property = System.getProperty("tuscany.bootDir");
-        if (property != null) {
-            return new File(property);
-        }
-        return new File(installDirectory, "boot");
     }
 }

Copied: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties (from r493051, incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncherBooter.properties)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties?view=diff&rev=493216&p1=incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncherBooter.properties&r1=493051&p2=incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties&r2=493216
==============================================================================
    (empty)

Propchange: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/runtime/standalone/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/pom.xml?view=diff&rev=493216&r1=493215&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/pom.xml (original)
+++ incubator/tuscany/java/sca/runtime/standalone/pom.xml Fri Jan  5 14:40:09 2007
@@ -39,22 +39,7 @@
         <module>server.start</module>
         <module>server.shutdown</module>
         <module>plugin.standalone</module>
+        <module>assembly</module>
+        <module>smoketest</module>
     </modules>
-
-    <build>
-        <defaultGoal>install</defaultGoal>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <version>2.2-SNAPSHOT</version>
-                <configuration>
-                    <finalName>tuscany-sca-standalone-${sca.version}</finalName>
-                    <descriptors>
-                        <descriptor>standalone.xml</descriptor>
-                    </descriptors>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jan  5 14:40:09 2007
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml (added)
+++ incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml Fri Jan  5 14:40:09 2007
@@ -0,0 +1,99 @@
+<?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.standalone</groupId>
+        <artifactId>standalone</artifactId>
+        <version>1.0-incubator-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <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>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>
+                    <archive>
+                        <manifest>
+                            <mainClass>org.apache.tuscany.sca.runtime.standalone.smoketest.Main</mainClass>
+                        </manifest>
+                    </archive>
+                </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>${sca.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>

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java (added)
+++ incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java Fri Jan  5 14:40:09 2007
@@ -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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Main {
+    public static void main(String[] args) {
+        if (args.length == 0) {
+            System.out.print("No Args");
+            System.out.flush();
+            System.exit(0);
+        }
+        System.exit(10);
+    }
+}

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/main/java/org/apache/tuscany/sca/runtime/standalone/smoketest/Main.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java (added)
+++ incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java Fri Jan  5 14:40:09 2007
@@ -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");
+    }
+}

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/CommandTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java (added)
+++ incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java Fri Jan  5 14:40:09 2007
@@ -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());
+    }
+}

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestAssemblyContent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java (added)
+++ incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java Fri Jan  5 14:40:09 2007
@@ -0,0 +1,65 @@
+/*
+ * 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 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());
+            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", process.getInputStream());
+            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");
+    }
+}

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/java/org/apache/tuscany/sca/runtime/standalone/smoketest/SmokeTestLauncher.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt?view=auto&rev=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt (added)
+++ incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt Fri Jan  5 14:40:09 2007
@@ -0,0 +1 @@
+usage: java [jvm-options] -jar launcher.jar <jar> [args...]

Propchange: incubator/tuscany/java/sca/runtime/standalone/smoketest/src/test/resources/org/apache/tuscany/sca/runtime/standalone/smoketest/LauncherUsage.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java?view=diff&rev=493216&r1=493215&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/DirectoryHelper.java Fri Jan  5 14:40:09 2007
@@ -20,11 +20,14 @@
 
 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;
 
 /**
@@ -71,7 +74,7 @@
         String name = clazz.getName();
         int last = name.lastIndexOf('.');
         if (last != -1) {
-            name = name.substring(last +1);
+            name = name.substring(last + 1);
         }
         name = name + ".class";
 
@@ -97,6 +100,33 @@
     }
 
     /**
+     * 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.profilePath." + 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.
@@ -116,6 +146,35 @@
     }
 
     /**
+     * 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
@@ -154,5 +213,45 @@
         }
 
         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();
+        }
     }
 }

Modified: incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java?view=diff&rev=493216&r1=493215&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfo.java Fri Jan  5 14:40:09 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.runtime.standalone;
 
+import java.io.File;
+
 import org.apache.tuscany.host.RuntimeInfo;
 
 /**
@@ -25,4 +27,27 @@
  */
 public interface StandaloneRuntimeInfo extends RuntimeInfo {
     static String COMPONENT_NAME = "StandaloneRuntimeInfo";
+
+    /**
+     * 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);
 }

Modified: incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java?view=diff&rev=493216&r1=493215&r2=493216
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/standalone-api/src/main/java/org/apache/tuscany/runtime/standalone/StandaloneRuntimeInfoImpl.java Fri Jan  5 14:40:09 2007
@@ -19,7 +19,7 @@
 package org.apache.tuscany.runtime.standalone;
 
 import java.io.File;
-import java.net.URL;
+import java.util.Properties;
 
 import org.apache.tuscany.host.AbstractRuntimeInfo;
 
@@ -27,21 +27,43 @@
  * @version $Rev$ $Date$
  */
 public class StandaloneRuntimeInfoImpl extends AbstractRuntimeInfo implements StandaloneRuntimeInfo {
+    private final String profileName;
+    private final File profileDirectory;
+    private final Properties properties;
 
     /**
      * Initializes the base URL, install directory, application root directory and
      * online mode.
-     * 
-     * @param baseURL Base URL for the runtime.
-     * @param installDirectory Installation directory.
+     *
+     * @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 Online mode.
+     * @param online                   true if this runtime should consider itself online
+     * @param properties               properties for this runtime
      */
-    public StandaloneRuntimeInfoImpl(URL baseURL, 
+    public StandaloneRuntimeInfoImpl(String profileName,
                                      File installDirectory,
+                                     File profileDirectory,
                                      File applicationRootDirectory,
-                                     boolean online) {
-        super(applicationRootDirectory, baseURL, installDirectory, online);
+                                     boolean online,
+                                     Properties properties) {
+        super(applicationRootDirectory, DirectoryHelper.toURL(installDirectory), installDirectory, online);
+        this.profileName = profileName;
+        this.profileDirectory = profileDirectory;
+        this.properties = properties;
+
+    }
+
+    public String getProfileName() {
+        return profileName;
+    }
+
+    public File getProfileDirectory() {
+        return profileDirectory;
+    }
+
+    public String getProperty(String name, String defaultValue) {
+        return properties.getProperty(name, defaultValue);
     }
-    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org