Author: jboynes
Date: Wed Mar 1 08:02:34 2006
New Revision: 382067
URL: http://svn.apache.org/viewcvs?rev=382067&view=rev
Log:
need to set TCCL when loading artifacts using SDO
Modified:
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
Modified:
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java?rev=382067&r1=382066&r2=382067&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
(original)
+++
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
Wed Mar 1 08:02:34 2006
@@ -61,23 +61,30 @@
}
private void startContext(Context ctx) {
- ResourceLoader resourceLoader = new
ResourceLoaderImpl(ctx.getLoader().getClassLoader());
- AssemblyModelContext modelContext = new
AssemblyModelContextImpl(modelFactory, modelLoader, systemLoader,
resourceLoader);
- ModuleComponentConfigurationLoader loader = new
ModuleComponentConfigurationLoaderImpl(modelContext);
-
AggregateContext moduleContext;
+
+ ResourceLoader resourceLoader = new
ResourceLoaderImpl(ctx.getLoader().getClassLoader());
+ ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
- // Load the SCDL configuration of the application module
- ModuleComponent moduleComponent =
loader.loadModuleComponent(ctx.getName(), ctx.getPath());
+ AssemblyModelContext modelContext = new
AssemblyModelContextImpl(modelFactory, modelLoader, systemLoader,
resourceLoader);
+ ModuleComponentConfigurationLoader loader = new
ModuleComponentConfigurationLoaderImpl(modelContext);
+
+ try {
+ // Load the SCDL configuration of the application module
+ ModuleComponent moduleComponent =
loader.loadModuleComponent(ctx.getName(), ctx.getPath());
- // Register it under the root application context
- rootContext.registerModelObject(moduleComponent);
- moduleContext =
(AggregateContext)rootContext.getContext(moduleComponent.getName());
-
moduleContext.registerModelObject(moduleComponent.getComponentImplementation());
- } catch (ConfigurationLoadException e) {
- throw new UnsupportedOperationException();
- } catch (ConfigurationException e) {
- throw new UnsupportedOperationException();
+ // Register it under the root application context
+ rootContext.registerModelObject(moduleComponent);
+ moduleContext =
(AggregateContext)rootContext.getContext(moduleComponent.getName());
+
moduleContext.registerModelObject(moduleComponent.getComponentImplementation());
+ } catch (ConfigurationLoadException e) {
+ throw new UnsupportedOperationException();
+ } catch (ConfigurationException e) {
+ throw new UnsupportedOperationException();
+ }
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCl);
}
Valve valve = new TuscanyValve(moduleContext);
Modified:
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java?rev=382067&r1=382066&r2=382067&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
(original)
+++
incubator/tuscany/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java
Wed Mar 1 08:02:34 2006
@@ -25,8 +25,10 @@
import org.apache.catalina.core.StandardServer;
import org.apache.catalina.core.StandardService;
import org.apache.catalina.startup.ContextConfig;
+import org.apache.catalina.Valve;
import org.apache.tuscany.tomcat.TuscanyHost;
+import org.apache.tuscany.tomcat.TuscanyValve;
/**
* @version $Rev$ $Date$
@@ -44,6 +46,14 @@
ctx.setName("test");
ctx.setDocBase(app1.getAbsolutePath());
host.addChild(ctx);
+ boolean found = false;
+ for (Valve valve: ctx.getPipeline().getValves()) {
+ if (valve instanceof TuscanyValve) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue("TuscanyValve not in pipeline", found);
host.removeChild(ctx);
}
@@ -74,8 +84,7 @@
engine.setBaseDir(baseDir.getAbsolutePath());
service.setContainer(engine);
-// host = new TuscanyHost();
- host = new StandardHost();
+ host = new TuscanyHost();
host.setName("localhost");
host.setAppBase(appBase.getAbsolutePath());
engine.addChild(host);