You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/01/07 13:31:33 UTC
svn commit: r493705 -
/incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
Author: meerajk
Date: Sun Jan 7 04:31:33 2007
New Revision: 493705
URL: http://svn.apache.org/viewvc?view=rev&rev=493705
Log:
Added code to locate the system scdl from the root of the
profile directory.
Modified:
incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
Modified: incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java?view=diff&rev=493705&r1=493704&r2=493705
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java Sun Jan 7 04:31:33 2007
@@ -108,23 +108,7 @@
final MBeanServer mBeanServer = agent.getMBeanServer();
final StandaloneRuntimeInfo runtimeInfo = JmxRuntimeInfoImpl.newInstance(profileName, installDirectory, online, mBeanServer, managementDomain);
- final ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
- final ClassLoader bootClassLoader = DirectoryHelper.createClassLoader(hostClassLoader, bootDirectory);
-
- final URL systemScdl = getSystemScdl(bootClassLoader);
- if (systemScdl == null) {
- throw new TuscanyServerException("Unable to find system scdl");
- }
-
- final String className =
- runtimeInfo.getProperty("tuscany.launcherClass",
- "org.apache.tuscany.runtime.standalone.jmx.JmxRuntimeImpl");
- final TuscanyRuntime runtime = (TuscanyRuntime) Beans.instantiate(bootClassLoader, className);
- runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
- runtime.setSystemScdl(systemScdl);
- runtime.setHostClassLoader(hostClassLoader);
-
- runtime.setRuntimeInfo(runtimeInfo);
+ final TuscanyRuntime runtime = createRuntime(bootDirectory, runtimeInfo);
runtime.initialize();
bootedRuntimes.put(profileName, runtime);
@@ -180,14 +164,45 @@
}
/**
+ * 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.jmx.JmxRuntimeImpl");
+ final TuscanyRuntime runtime = (TuscanyRuntime) Beans.instantiate(bootClassLoader, className);
+ runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
+ 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(ClassLoader bootClassLoader) {
- String resource = System.getProperty("tuscany.systemScdlPath", "META-INF/tuscany/system.scdl");
- return bootClassLoader.getResource(resource);
+ private URL getSystemScdl(URL profileUrl, StandaloneRuntimeInfo runtimeInfo) throws MalformedURLException {
+ return new URL(profileUrl, runtimeInfo.getProperty("tuscany.systemSCDL", "system.scdl"));
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org