tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r599801 - in /incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat: TuscanyContextListener.java TuscanyHost.java
Date Fri, 30 Nov 2007 12:39:52 GMT
Author: antelder
Date: Fri Nov 30 04:39:48 2007
New Revision: 599801

URL: http://svn.apache.org/viewvc?rev=599801&view=rev
Log:
Start at adding webapps as contributions with deep integration

Modified:
    incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java
    incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java

Modified: incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java?rev=599801&r1=599800&r2=599801&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java
Fri Nov 30 04:39:48 2007
@@ -19,15 +19,29 @@
 
 package org.apache.tuscany.sca.runtime.tomcat;
 
+import java.io.File;
+import java.net.MalformedURLException;
+
+import javax.xml.namespace.QName;
+
 import org.apache.catalina.Context;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
 import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.core.StandardContext;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
 
 /**
  */
 public class TuscanyContextListener implements LifecycleListener {
 
+    private SCANode node;
+
+    public TuscanyContextListener(SCANode node) {
+        this.node = node;
+    }
+
     public void lifecycleEvent(LifecycleEvent event) {
         String type = event.getType();
         if (Lifecycle.AFTER_START_EVENT.equals(type)) {
@@ -38,6 +52,23 @@
     }
 
     protected void startContext(Context context) {
+        StandardContext sc = (StandardContext) context;
+        String path = sc.getServletContext().getRealPath("/");
+        System.out.println(path);
+        try {
+            node.stop();
+            node.addContribution(path, new File(path).toURL());
+            node.addToDomainLevelComposite((QName)null);
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (NodeException e) {
+            e.printStackTrace();
+        }
+        try {
+            node.start();
+        } catch (NodeException e) {
+            e.printStackTrace();
+        }
     }
 
     protected void stopContext(Context context) {

Modified: incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java?rev=599801&r1=599800&r2=599801&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java
Fri Nov 30 04:39:48 2007
@@ -106,7 +106,7 @@
             throw new IllegalArgumentException(sm.getString("tuscanyHost.notContext"));
         }
         StandardContext ctx = (StandardContext) child;
-        ctx.addLifecycleListener(new TuscanyContextListener());
+        ctx.addLifecycleListener(new TuscanyContextListener(launcher.getSCANode()));
         super.addChild(child);
     }
 



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


Mime
View raw message