geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r475352 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core: Activator.java GeronimoServerBehaviourDelegate.java internal/Trace.java
Date Wed, 15 Nov 2006 18:42:26 GMT
Author: sppatel
Date: Wed Nov 15 10:42:26 2006
New Revision: 475352

URL: http://svn.apache.org/viewvc?view=rev&rev=475352
Log:
fix dup redeploy's if root module and child modules both have deltas

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Trace.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java?view=diff&rev=475352&r1=475351&r2=475352
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java
Wed Nov 15 10:42:26 2006
@@ -55,6 +55,7 @@
 	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
 	 */
 	public void stop(BundleContext context) throws Exception {
+		//TODO Stop all update server state tasks
 		ModuleArtifactMapper.getInstance().save();
 		super.stop(context);
 		plugin = null;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?view=diff&rev=475352&r1=475351&r2=475352
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
Wed Nov 15 10:42:26 2006
@@ -194,6 +194,8 @@
 	 * Override this method to be able to process in-place shared lib entries and restart the
shared lib configuration for all projects prior
 	 * to publishing each IModule.
 	 * 
+	 * This overridden method also fixes WTP Bugzilla 123676 to prevent duplicate repdeloys
if both parent and child modules have deltas.
+	 * 
 	 * (non-Javadoc)
 	 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModules(int, java.util.List,
java.util.List, org.eclipse.core.runtime.MultiStatus, org.eclipse.core.runtime.IProgressMonitor)
 	 */
@@ -211,7 +213,34 @@
 			status = updateSharedLib(toProcess, ProgressUtil.getSubMonitorFor(monitor, 1000));
 		}
 		if(status.isOK()) {
-			super.publishModules(kind, modules, deltaKind, multi, monitor);
+			if (modules == null)
+				return;
+			
+			int size = modules.size();
+			if (size == 0)
+				return;
+			
+			if (monitor.isCanceled())
+				return;
+			
+			List rootModulesPublished = new ArrayList();
+			for (int i = 0; i < size; i++) {
+				IModule[] module = (IModule[]) modules.get(i);
+				int moduleDeltaKind = ((Integer)deltaKind.get(i)).intValue();
+				//has this root of this module been published already?
+				if(!rootModulesPublished.contains(module[0])) {
+					status = publishModule(kind, module, moduleDeltaKind, ProgressUtil.getSubMonitorFor(monitor,
3000));
+					if (status != null && !status.isOK())
+						multi.add(status);
+					//cache published root modules to comapre against to prevent dup redeploys
+					if(moduleDeltaKind != NO_CHANGE) {
+						rootModulesPublished.add(module[0]);
+					}
+				} else {
+					setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
+					Trace.trace(Trace.INFO, "root module for " + Arrays.asList(module).toString() + " already
published.  Skipping.");
+				}	
+			}
 		} else {
 			multi.add(status);
 		}
@@ -226,7 +255,7 @@
 	 */
 	public void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor)
throws CoreException {
 
-		Trace.trace(Trace.INFO, ">> publishModule(), deltaKind = " + deltaKindToString(deltaKind));
+		Trace.trace(Trace.INFO, ">> publishModule(), deltaKind = " + deltaKindToString(deltaKind),
true);
 		Trace.trace(Trace.INFO, Arrays.asList(module).toString());
 		_monitor = monitor;
 
@@ -235,7 +264,6 @@
 			if (module.length == 1 && (deltaKind == ADDED || deltaKind == REMOVED || deltaKind
== NO_CHANGE)) {
 				invokeCommand(deltaKind, module[0]);
 			} else if (deltaKind == CHANGED) {
-				// TODO This case is flawed due to WTP Bugzilla 123676
 				invokeCommand(deltaKind, module[0]);
 			} 
 		} finally {
@@ -519,7 +547,7 @@
 			doAdded(module, null);
 		}
 		
-		Trace.trace(Trace.INFO, "<< doNoChange()" + module.toString());
+		Trace.trace(Trace.INFO, "<< doNoChange() " + module.toString());
 	}
 
 	protected void doRestart(IModule module) throws Exception {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Trace.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Trace.java?view=diff&rev=475352&r1=475351&r2=475352
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Trace.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/internal/Trace.java
Wed Nov 15 10:42:26 2006
@@ -56,23 +56,25 @@
 	 *            a message
 	 */
 	public static void trace(byte level, String s) {
-		trace(level, s, null);
+		trace(level, s, null, false);
 	}
-
-	/**
-	 * Trace the given message and exception.
-	 * 
-	 * @param level
-	 *            the trace level
-	 * @param s
-	 *            a message
-	 * @param t
-	 *            a throwable
-	 */
+	
+	public static void trace(byte level, String s, boolean newLine) {
+		trace(level, s, null, newLine);
+	}
+	
 	public static void trace(byte level, String s, Throwable t) {
+		trace(level, s, null, false);
+	}
+
+	public static void trace(byte level, String s, Throwable t, boolean newLine) {
 		if (Activator.getDefault() == null || !Activator.getDefault().isDebugging())
 			return;
-
+		
+		if(newLine) {
+			System.out.println();
+		}
+		
 		System.out.println(Activator.PLUGIN_ID + ":  " + s);
 		if (t != null)
 			t.printStackTrace();



Mime
View raw message