You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by pt...@apache.org on 2008/02/24 13:20:57 UTC

svn commit: r630616 - in /jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner: containers/jetty/ launcher/ ui/

Author: ptahchiev
Date: Sun Feb 24 04:20:56 2008
New Revision: 630616

URL: http://svn.apache.org/viewvc?rev=630616&view=rev
Log:
added lots of log messages so that to dump the state of the runner plugin.

Modified:
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/containers/jetty/JettyContainerManager.java
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/JettyCactusLaunchConfiguration.java
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/containers/jetty/JettyContainerManager.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/containers/jetty/JettyContainerManager.java?rev=630616&r1=630615&r2=630616&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/containers/jetty/JettyContainerManager.java (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/containers/jetty/JettyContainerManager.java Sun Feb 24 04:20:56 2008
@@ -20,6 +20,7 @@
 package org.apache.cactus.eclipse.runner.containers.jetty;
 
 import java.io.File;
+import java.net.MalformedURLException;
 import java.net.URL;
 
 import org.apache.cactus.eclipse.runner.containers.IContainerManager;
@@ -52,7 +53,7 @@
      * The name of the jspRedirector.jsp file
      */
     private static final String JSPREDIRECTOR_PATH =
-        "./ant/confs/jspRedirector.jsp";
+        "C:/eclipse/plugins/org.apache.cactus.eclipse.runner-1.8.0/lib/confs/jspRedirector.jsp";
 
     /**
      * Directory containg the web application for Jetty
@@ -73,7 +74,7 @@
         }
         catch (CoreException e)
         {
-//
+        	CactusPlugin.log("Failed"+e.getMessage());
         }
     }
 
@@ -82,7 +83,7 @@
      */
     public void tearDown()
     {
-        WarBuilder.delete(jettyWebappDir);
+        //WarBuilder.delete(jettyWebappDir);
     }
 
     /**
@@ -96,8 +97,10 @@
         jettyWebappDir.mkdir();
         copyCactusWebappResources(jettyWebappDir);
         Webapp webapp = WebappPlugin.getWebapp(theJavaProject);
+        CactusPlugin.log("Webapp"+ webapp.toString());
         webapp.init();
         File webappDir = webapp.getAbsoluteDir();
+        CactusPlugin.log("Webapp.dir"+webappDir.getAbsolutePath());
         if (webappDir != null && webappDir.exists())
         {
             copyContents(webappDir, jettyWebappDir);
@@ -118,7 +121,15 @@
         copy.setProject(antProject);
         copy.setTodir(theDir);
         CactusPlugin thePlugin = CactusPlugin.getDefault();
-        URL jspRedirectorURL = thePlugin.find(new Path(JSPREDIRECTOR_PATH));
+        URL jspRedirectorURL = null;
+        try{
+        	jspRedirectorURL = new URL("file://"+JSPREDIRECTOR_PATH);
+        } catch(MalformedURLException mde) {
+            throw CactusPlugin.createCoreException(
+                    "CactusLaunch.message.prepare.error.plugin.file",
+                    " : " + mde.getMessage(),
+                    null);
+        }
         if (jspRedirectorURL == null)
         {
             throw CactusPlugin.createCoreException(
@@ -126,6 +137,7 @@
                 " : " + JSPREDIRECTOR_PATH,
                 null);
         }
+        CactusPlugin.log(jspRedirectorURL.getPath());
         File jspRedirector = new File(jspRedirectorURL.getPath());
         FileSet fileSet = new FileSet();
         fileSet.setFile(jspRedirector);

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java?rev=630616&r1=630615&r2=630616&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java Sun Feb 24 04:20:56 2008
@@ -128,6 +128,7 @@
         // Run the preparation in a new thread so that the UI thread which is
         // the current thread be not blocked by the sleep of
         // IContainerManager.prepare().
+        try {
         new Thread(new Runnable()
         {
             public void run()
@@ -135,12 +136,14 @@
                 try
                 {
                     CactusPlugin.getContainerManager(true).prepare(javaProject);
+                    CactusPlugin.log("Preapred successfully!!!!!!!!!!!!!!!!!!");
                     Display.getDefault().asyncExec(new Runnable()
                     {
                         public void run()
                         {
                             try
                             {
+                            	CactusPlugin.log("After this breaks.");
                                 CactusLaunchConfiguration.super.launch(
                                     cactusConfig,
                                     theMode,
@@ -156,6 +159,15 @@
                                     null);
                                 return;
                             }
+                            catch(Exception ex) {
+                            	CactusPlugin.log("ATTENTION."+ex.getMessage());
+                            	
+                            	CactusPlugin.displayErrorMessage(
+                                        CactusMessages.getString(
+                                "CactusLaunch.message.containerManager.error"),
+                                        ex.getMessage(),
+                                        null);
+                            }
                         }
                     });
                 }
@@ -168,8 +180,24 @@
                         null);
                     return;
                 }
+                catch(Exception ex) {
+                	CactusPlugin.log("ATTENTION1."+ex.getMessage());
+                    CactusPlugin.displayErrorMessage(
+                            CactusMessages.getString(
+                    "CactusLaunch.message.containerManager.error"),
+                            ex.getMessage(),
+                            null);
+                }
             }
         }).start();
+        } catch(Exception ex) {
+        	
+            CactusPlugin.displayErrorMessage(
+                    CactusMessages.getString(
+            "CactusLaunch.message.containerManager.error"),
+                    ex.getMessage(),
+                    null);
+        }
 
 
 
@@ -195,7 +223,8 @@
             }
             catch (CoreException e)
             {
-                // Do nothing
+                CactusPlugin.log(e.getMessage());
+            	// Do nothing
             }
         }
         return result;
@@ -299,6 +328,9 @@
                 e.getMessage(),
                 null);
             return;
+        }
+        catch (Exception ex) {
+        	CactusPlugin.log("Exception tearing down:"+ex.getMessage());
         }
         this.launchEnded = true;
     }

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/JettyCactusLaunchConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/JettyCactusLaunchConfiguration.java?rev=630616&r1=630615&r2=630616&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/JettyCactusLaunchConfiguration.java (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/launcher/JettyCactusLaunchConfiguration.java Sun Feb 24 04:20:56 2008
@@ -21,6 +21,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Vector;
 
@@ -38,6 +39,7 @@
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
 
 /**
  * Provides a launcher to start Cactus tests. This is done by extending
@@ -72,18 +74,26 @@
     protected IClasspathEntry[] getCactusClasspath() throws CoreException
     {
         IClasspathEntry[] cactusClasspath = super.getCactusClasspath();
-        cactusClasspath =
+        try {
+        	cactusClasspath =
                 LibraryHelper.concatenateEntries(
                     cactusClasspath,
                     getJettyClasspath());
+        } catch (MalformedURLException me) {
+        	throw CactusPlugin.createCoreException(
+                    "CactusLaunch.message.prepare.error.plugin.file",
+                    " : " + me.toString(),
+                    null);
+        }
         return cactusClasspath;
     }
 
     /**
      * @return an array of Jar paths needed for Cactus
      * @throws CoreException if a Jar cannot be found
+     * @throws MalformedURLException 
      */
-    private IClasspathEntry[] getJettyClasspath() throws CoreException
+    private IClasspathEntry[] getJettyClasspath() throws CoreException, MalformedURLException
     {
         CactusPlugin thePlugin = CactusPlugin.getDefault();
         //CactusPlugin.log("Just here:"+LibraryHelper.getLibPath().toString());
@@ -159,19 +169,22 @@
      * @param theDescriptor the plug-in descriptor to get libraries from
      * @param thePackagePrefix package prefix used to filter libraries 
      * @return an array of jar paths exposed by the plug-in
+     * @throws MalformedURLException 
      */
     private IClasspathEntry[] getLibrariesPaths(
-        IPluginDescriptor theDescriptor, String thePackagePrefix)
+        IPluginDescriptor theDescriptor, String thePackagePrefix) throws MalformedURLException
     {
     	CactusPlugin.log("PPrefix"+thePackagePrefix);
         Vector result = new Vector();
-        URL root = theDescriptor.getInstallURL();
+        URL root = new URL(("file://"+JavaCore.getClasspathVariable("ECLIPSE_HOME").toFile().toURL().getPath()+theDescriptor.getInstallURL().getPath()).replaceAll("plugin","plugins"));
+        CactusPlugin.log("Root"+root.getPath());
         ILibrary[] libraries = theDescriptor.getRuntimeLibraries();
+        
         for (int i = 0; i < libraries.length; i++)
         {
         	
             ILibrary currentLib = libraries[i];
-            CactusPlugin.log("Current library"+currentLib.getPath().toString());
+            //CactusPlugin.log("Current library "+currentLib.getPath().toString());
             if (thePackagePrefix == null
                 || isContained(thePackagePrefix, currentLib))
             {
@@ -181,6 +194,7 @@
                     result.add(
                         LibraryHelper.getIClasspathEntry(
                             Platform.asLocalURL(url).getPath()));
+                    CactusPlugin.log("Added");
                 }
                 catch (IOException e)
                 {
@@ -202,11 +216,11 @@
     private boolean isContained(String thePackagePrefix, ILibrary theCurrentLib)
     {
         
-    	CactusPlugin.log("Path of the lib:"+theCurrentLib.getPath().toString());
+    	//CactusPlugin.log("Path of the lib:"+theCurrentLib.getPath().toString());
     	
     	String[] prefixes = theCurrentLib.getPackagePrefixes();
         if(prefixes==null || prefixes.length==0) {
-        	CactusPlugin.log("lib: "+theCurrentLib.getPath().toString()+" is not");
+        	//CactusPlugin.log("lib: "+theCurrentLib.getPath().toString()+" is not");
         	return false;
         }
         for (int i = 0; i < prefixes.length; i++)

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java?rev=630616&r1=630615&r2=630616&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java Sun Feb 24 04:20:56 2008
@@ -253,6 +253,7 @@
         }
         if (CactusPreferences.getJetty())
         {
+        	CactusPlugin.log("Using Jetty...");
             containerManager = new JettyContainerManager();
             return containerManager;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org