tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r609274 - in /incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat: TuscanyContextListener.java TuscanyHost.java
Date Sun, 06 Jan 2008 08:29:38 GMT
Author: antelder
Date: Sun Jan  6 00:29:37 2008
New Revision: 609274

URL: http://svn.apache.org/viewvc?rev=609274&view=rev
Log:
Start tidy up of tomcat deep integration runtime

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=609274&r1=609273&r2=609274&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
Sun Jan  6 00:29:37 2008
@@ -20,24 +20,22 @@
 package org.apache.tuscany.sca.runtime.tomcat;
 
 import java.io.File;
-import java.net.MalformedURLException;
 
 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;
+import org.apache.tuscany.sca.runtime.Launcher;
 
 /**
  */
 public class TuscanyContextListener implements LifecycleListener {
 
-    private SCANode node;
+    private Launcher launcher;
 
-    public TuscanyContextListener(SCANode node) {
-        this.node = node;
+    public TuscanyContextListener(Launcher launcher) {
+        this.launcher = launcher;
     }
 
     public void lifecycleEvent(LifecycleEvent event) {
@@ -52,23 +50,15 @@
     protected void startContext(Context context) {
         StandardContext sc = (StandardContext) context;
         String path = sc.getServletContext().getRealPath("/");
-        System.out.println(path);
         try {
-//            node.stop();
             File f = new File(path + "WEB-INF/classes");
             if (f.exists()) {
-                node.addContribution(path, f.toURL());
+                System.out.println("adding contribution: "+ path);
+                launcher.addContribution(f.toURL());
             }
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        } catch (NodeException e) {
+        } catch (Exception 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=609274&r1=609273&r2=609274&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
Sun Jan  6 00:29:37 2008
@@ -27,14 +27,12 @@
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
-import javax.xml.namespace.QName;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.core.StandardHost;
-import org.apache.tuscany.sca.node.NodeException;
 import org.apache.tuscany.sca.runtime.Launcher;
 
 /**
@@ -59,15 +57,15 @@
     private String contextPath = "/tuscany";
     
     public synchronized void start() throws LifecycleException {
-        startRuntime();
         try {
 
-            launcher.getSCANode().stop();
+            launcher = initTuscany();
+
             super.start();
-            launcher.getSCANode().addToDomainLevelComposite((QName)null);
-            launcher.getSCANode().start();
+            
+            launcher.start();
 
-        } catch (NodeException e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -77,21 +75,7 @@
         stopRuntime();
     }
 
-    private void startRuntime() {
-        System.out.println("XXXXXXXX TomcatHost.startRuntime");
-        
-        addTuscany();
-        
-        launcher = new Launcher(new File(REPO));
-        try {
-            launcher.start();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        
-    }
-
-    private void addTuscany() {
+    private Launcher initTuscany() {
         StandardContext tc = new TuscanyContext();
         tc.setPath(contextPath);
         super.addChild(tc);
@@ -102,6 +86,10 @@
         wrapper.setName("TuscanyServlet");
         tc.addChild(wrapper);
         tc.addServletMapping("/*", "TuscanyServlet", true);
+
+        Launcher launcher = new Launcher(new File(REPO));
+
+        return launcher;
     }
 
     private void stopRuntime() {
@@ -112,12 +100,9 @@
     }
 
     public synchronized void addChild(Container child) {
-        System.out.println("XXXXXXXX TomcatHost.addChild" + child);
         if (!(child instanceof StandardContext)) {
             throw new IllegalArgumentException(sm.getString("tuscanyHost.notContext"));
         }
-        StandardContext ctx = (StandardContext) child;
-        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