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 2006/08/17 09:37:58 UTC
svn commit: r432173 - in /incubator/tuscany/java/sca:
core/src/main/java/org/apache/tuscany/core/launcher/
host-api/src/main/java/org/apache/tuscany/host/
Author: jboynes
Date: Thu Aug 17 00:37:54 2006
New Revision: 432173
URL: http://svn.apache.org/viewvc?rev=432173&view=rev
Log:
refactor calls to LauncherImpl.bootRuntime() to use the version from the host-api interface
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncherImpl.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java
incubator/tuscany/java/sca/host-api/src/main/java/org/apache/tuscany/host/Launcher.java
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java?rev=432173&r1=432172&r2=432173&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java Thu Aug 17 00:37:54 2006
@@ -38,6 +38,7 @@
import org.apache.tuscany.host.MonitorFactory;
import org.apache.tuscany.host.Launcher;
import org.apache.tuscany.spi.services.info.RuntimeInfo;
+import org.apache.tuscany.api.TuscanyException;
/**
* Basic launcher implementation.
@@ -65,48 +66,12 @@
private CompositeComponent<?> composite;
- public void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitorFactory) {
- // FIXME implement
- throw new UnsupportedOperationException();
- }
-
- public CompositeContext bootApplication(URL applicationScdl, ClassLoader applicationClassLoader) {
- // FIXME implement
- throw new UnsupportedOperationException();
- }
-
- /**
- * Returns the classloader for application classes.
- *
- * @return the classloader for application classes
- */
- public ClassLoader getApplicationLoader() {
- return applicationLoader;
- }
-
- /**
- * Set the classloader to be used for application classes. You should almost always supply your own application
- * classloader, based on the hosting environment that the runtime is embedded in.
- *
- * @param applicationLoader the classloader to be used for application classes
- */
- public void setApplicationLoader(ClassLoader applicationLoader) {
- this.applicationLoader = applicationLoader;
- }
-
- /**
- * Boots the runtime defined by the specified SCDL.
- *
- * @param systemScdl a resource path to the SCDL defining the system.
- * @return a CompositeComponent for the newly booted runtime system
- * @throws LoaderException
- */
- public CompositeComponent<?> bootRuntime(URL systemScdl, MonitorFactory monitor) throws LoaderException {
+ public void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitor)
+ throws TuscanyException {
if (systemScdl == null) {
throw new LoaderException("Null system SCDL URL");
}
- ClassLoader systemClassLoader = getClass().getClassLoader();
XMLInputFactory xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", systemClassLoader);
Bootstrapper bootstrapper = new DefaultBootstrapper(monitor, xmlFactory);
Deployer bootDeployer = bootstrapper.createDeployer();
@@ -135,7 +100,6 @@
composite.start();
deployer = (Deployer) composite.getChild("deployer").getServiceInstance();
- return composite;
}
/**
@@ -153,6 +117,44 @@
}
}
+ public CompositeContext bootApplication(URL applicationScdl, ClassLoader applicationLoader) {
+ // FIXME implement
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the classloader for application classes.
+ *
+ * @return the classloader for application classes
+ */
+ public ClassLoader getApplicationLoader() {
+ return applicationLoader;
+ }
+
+ /**
+ * Set the classloader to be used for application classes. You should almost always supply your own application
+ * classloader, based on the hosting environment that the runtime is embedded in.
+ *
+ * @param applicationLoader the classloader to be used for application classes
+ */
+ public void setApplicationLoader(ClassLoader applicationLoader) {
+ this.applicationLoader = applicationLoader;
+ }
+
+ /**
+ * Boots the runtime defined by the specified SCDL.
+ *
+ * @param systemScdl a resource path to the SCDL defining the system.
+ * @return a CompositeComponent for the newly booted runtime system
+ * @throws LoaderException
+ */
+ @Deprecated
+ public CompositeComponent<?> bootRuntime(URL systemScdl, MonitorFactory monitor) throws TuscanyException {
+ ClassLoader systemClassLoader = getClass().getClassLoader();
+ bootRuntime(systemScdl, systemClassLoader, monitor);
+ return composite;
+ }
+
/**
* Boots the application defined by the specified SCDL.
*
@@ -162,11 +164,13 @@
* @throws LoaderException
* @see METAINF_APPLICATION_SCDL_PATH
*/
- public CompositeComponent<?> bootApplication(String name, URL appScdl) throws LoaderException {
+ @Deprecated
+ public CompositeComponent<?> bootApplication(String name, URL appScdl) throws TuscanyException {
+ ClassLoader applicationLoader = getApplicationLoader();
+
if (appScdl == null) {
throw new LoaderException("No application scdl found");
}
- ClassLoader applicationLoader = getApplicationLoader();
// create a ComponentDefinition to represent the component we are going to deploy
CompositeImplementation impl = new CompositeImplementation();
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncherImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncherImpl.java?rev=432173&r1=432172&r2=432173&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncherImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncherImpl.java Thu Aug 17 00:37:54 2006
@@ -135,8 +135,9 @@
try {
parseArguments(args);
// need to use the classloader as the path does not start with a '/'
- URL scdl = getClass().getClassLoader().getResource(METAINF_SYSTEM_SCDL_PATH);
- bootRuntime(scdl, new NullMonitorFactory());
+ ClassLoader systemClassLoader = getClass().getClassLoader();
+ URL scdl = systemClassLoader.getResource(METAINF_SYSTEM_SCDL_PATH);
+ bootRuntime(scdl, systemClassLoader, new NullMonitorFactory());
URL appScdl = getApplicationLoader().getResource(METAINF_APPLICATION_SCDL_PATH);
CompositeComponent application = bootApplication("application", appScdl);
application.start();
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java?rev=432173&r1=432172&r2=432173&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java Thu Aug 17 00:37:54 2006
@@ -102,7 +102,8 @@
LauncherImpl launcher = new LauncherImpl();
// Current thread context classloader should be the webapp classloader
- launcher.setApplicationLoader(Thread.currentThread().getContextClassLoader());
+ ClassLoader webappClassLoader = Thread.currentThread().getContextClassLoader();
+ launcher.setApplicationLoader(webappClassLoader);
CompositeComponent<?> component;
CompositeContextImpl context;
Modified: incubator/tuscany/java/sca/host-api/src/main/java/org/apache/tuscany/host/Launcher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/host-api/src/main/java/org/apache/tuscany/host/Launcher.java?rev=432173&r1=432172&r2=432173&view=diff
==============================================================================
--- incubator/tuscany/java/sca/host-api/src/main/java/org/apache/tuscany/host/Launcher.java (original)
+++ incubator/tuscany/java/sca/host-api/src/main/java/org/apache/tuscany/host/Launcher.java Thu Aug 17 00:37:54 2006
@@ -22,11 +22,14 @@
import org.osoa.sca.CompositeContext;
+import org.apache.tuscany.api.TuscanyException;
+
/**
* @version $Rev$ $Date$
*/
public interface Launcher {
- void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitorFactory);
+ void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitorFactory)
+ throws TuscanyException;
void shutdownRuntime();
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org