[jbosstools-commits] JBoss Tools SVN: r22905 - in branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: server/xpl and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jun 21 02:44:19 EDT 2010


Author: rob.stryker at jboss.com
Date: 2010-06-21 02:44:19 -0400 (Mon, 21 Jun 2010)
New Revision: 22905

Modified:
   branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
   branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
Log:
JBDS-1103 - branch

Modified: branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java	2010-06-21 06:27:48 UTC (rev 22904)
+++ branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java	2010-06-21 06:44:19 UTC (rev 22905)
@@ -124,16 +124,9 @@
 		else
 			list.addAll(Arrays.asList(packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath)));
 		
-		// adjust timestamps
-		FileFilter filter = new FileFilter() {
-			public boolean accept(File pathname) {
-				if( pathname.getAbsolutePath().toLowerCase().endsWith(IConstants.EXT_XML))
-					return true;
-				return false;
-			}
-		};
-		FileUtil.touch(filter, deployPath.toFile(), true);
 
+		touchXMLFiles(deployPath);
+
 		if( list.size() > 0 ) {
 			MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_FAIL, 
 					NLS.bind(Messages.FullPublishFail, module.getName()), null);
@@ -142,20 +135,31 @@
 			return ms;
 		}
 
-		
 		publishState = IServer.PUBLISH_STATE_NONE;
-		
 		IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS, 
 				NLS.bind(Messages.CountModifiedMembers, countMembers(module), module.getName()), null);
 		return ret;
 	}
+	
+	private void touchXMLFiles(IPath deployPath) {
+		// adjust timestamps
+		FileFilter filter = new FileFilter() {
+			public boolean accept(File pathname) {
+				if( pathname.getAbsolutePath().toLowerCase().endsWith(IConstants.EXT_XML))
+					return true;
+				return false;
+			}
+		};
+		FileUtil.touch(filter, deployPath.toFile(), true);
+	}
 
 	protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
 		IStatus[] results = new IStatus[] {};
 		IPath deployPath = getDeployPath(moduleTree, server);
 		IPath tempDeployPath = getTempDeployFolder(moduleTree, server);
+		LocalCopyCallback handler = null;
 		if( !deployPackaged(moduleTree) && !isBinaryObject(moduleTree)) {
-			LocalCopyCallback handler = new LocalCopyCallback(server.getServer(), deployPath, tempDeployPath);
+			handler = new LocalCopyCallback(server.getServer(), deployPath, tempDeployPath);
 			results = new PublishCopyUtil(handler).publishDelta(delta, monitor);
 		} else if( delta.length > 0 ) {
 			if( isBinaryObject(moduleTree))
@@ -170,6 +174,10 @@
 				ms.add(results[i]);
 			return ms;
 		}
+		
+		if( handler != null && handler.shouldRestartModule() )
+			touchXMLFiles(deployPath);
+
 		IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS, 
 				NLS.bind(Messages.CountModifiedMembers, countChanges(delta), module.getName()), null);
 		return ret;

Modified: branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
===================================================================
--- branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java	2010-06-21 06:27:48 UTC (rev 22904)
+++ branches/jbosstools-3.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java	2010-06-21 06:44:19 UTC (rev 22905)
@@ -101,6 +101,8 @@
 		private static final File tempDir = ServerPlugin.getInstance().getStateLocation().toFile();
 		private static final String TEMPFILE_PREFIX = "tmp"; //$NON-NLS-1$
 
+		private boolean shouldRestartModule = false;
+		
 		private IServer server;
 		private IPath deployRootFolder;
 		private IPath tmpDeployRootFolder;
@@ -110,8 +112,18 @@
 			this.tmpDeployRootFolder = temporaryFolder;
 		}
 		
+		public boolean shouldRestartModule() {
+			return shouldRestartModule;
+		}
+		
+		private void checkRestartModule(File file) {
+			if( file.getName().toLowerCase().endsWith(".jar")) //$NON-NLS-1$
+				shouldRestartModule = true;
+		}
+		
 		public IStatus[] copyFile(IModuleFile mf, IPath relativePath, IProgressMonitor monitor) throws CoreException {
 			File file = PublishUtil.getFile(mf);
+			checkRestartModule(file);
 			if( file != null ) {
 				InputStream in = null;
 				try {



More information about the jbosstools-commits mailing list