Author: rob.stryker(a)jboss.com
Date: 2011-02-22 16:55:30 -0500 (Tue, 22 Feb 2011)
New Revision: 29274
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java
Log:
JBIDE-8450 to branch
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
===================================================================
---
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2011-02-22
21:52:56 UTC (rev 29273)
+++
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2011-02-22
21:55:30 UTC (rev 29274)
@@ -24,6 +24,7 @@
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.internal.Server;
@@ -34,6 +35,7 @@
import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
@@ -52,6 +54,9 @@
public IStatus publishModule(IServer server, String deployRoot, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
+ String name = "Compressing " + module[0].getName(); //$NON-NLS-1$
+ monitor.beginTask(name, 200);
+ monitor.setTaskName(name);
this.deployRoot = deployRoot;
IStatus[] returnStatus;
@@ -87,16 +92,20 @@
}
TrueZipUtil.umount();
- IStatus finalStatus;
+ IStatus finalStatus = null;
if( returnStatus.length > 0 ) {
MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_INC_FAIL,
"Publish Failed for module " + module[0].getName(), null); //$NON-NLS-1$
for( int i = 0; i < returnStatus.length; i++ )
ms.add(returnStatus[i]);
finalStatus = ms;
- } else
- finalStatus = Status.OK_STATUS;
+ } else {
+ finalStatus = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
+ IEventCodes.JST_PUB_FULL_SUCCESS,
+ NLS.bind(Messages.ModulePublished, module[0].getName()), null);
+ }
+ monitor.done();
return finalStatus;
}
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
===================================================================
---
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2011-02-22
21:52:56 UTC (rev 29273)
+++
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2011-02-22
21:55:30 UTC (rev 29274)
@@ -15,7 +15,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
@@ -62,12 +61,14 @@
IProgressMonitor monitor) throws CoreException {
// Build all parts together at once.
// When a call for [ear, childWar] comes in, ignore it.
- if( module.length > 1 ) {
- return Status.OK_STATUS;
- }
+ if( module.length > 1 )
+ return null;
+
IDeployableServer ds = ServerConverter.getDeployableServer(server);
String deployRoot = getDeployRoot(module, ds);
LocalZippedPublisherUtil util = new LocalZippedPublisherUtil();
- return util.publishModule(server, deployRoot, module, publishType, delta, monitor);
+ IStatus s = util.publishModule(server, deployRoot, module, publishType, delta,
monitor);
+ monitor.done();
+ return s;
}
}
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java
===================================================================
---
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java 2011-02-22
21:52:56 UTC (rev 29273)
+++
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java 2011-02-22
21:55:30 UTC (rev 29274)
@@ -12,20 +12,28 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.rse.core.archives;
+import java.util.ArrayList;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.jboss.ide.eclipse.archives.webtools.modules.WTPZippedPublisher;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
@@ -62,12 +70,24 @@
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
- if( module.length > 1 )
- return Status.OK_STATUS;
+ String taskName = "Publishing " + module[0].getName();
+ monitor.beginTask(taskName, 200); //$NON-NLS-1$
+ monitor.setTaskName(taskName);
+ if( module.length > 1 ) {
+ monitor.done();
+ return null;
+ }
// Locally zip it up into the remote tmp folder
- IStatus sup = super.publishModule(method, server, module, publishType, delta,
monitor);
+ IStatus sup = super.publishModule(method, server, module, publishType, delta,
+ AbstractServerToolsPublisher.getSubMon(monitor, 50));
+ if( !sup.isOK() ) {
+ monitor.done();
+ return sup;
+ }
+ monitor.setTaskName("Publishing to remote server (dummy)");
+
// set up needed vars
IDeployableServer server2 = ServerConverter.getDeployableServer(server);
String remoteTempDeployRoot = getDeployRoot(module,
ServerConverter.getDeployableServer(server));
@@ -81,14 +101,28 @@
// Now transfer the file to RSE
IFileService fs = method2.getFileService();
IFileServiceSubSystem system = method2.getFileServiceSubSystem();
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ if( !sup.isOK())
+ results.add(sup);
+
try {
- method2.getFileService().upload(sourcePath.toFile(), destFolder.toString(), name,
true, null, null, new NullProgressMonitor());
- //method2.getFileService().move(tempDestFolder.toString(), name,
destFolder.toString(), name, new NullProgressMonitor());
+ method2.getFileService().upload(sourcePath.toFile(), destFolder.toString(), name,
true, null, null,
+ AbstractServerToolsPublisher.getSubMon(monitor, 150));
} catch( SystemMessageException sme ) {
- // TODO fix or return error
- sme.printStackTrace();
+ IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
sme.getMessage(), sme);
+ results.add(s);
}
+ monitor.done();
+ if( results != null && results.size() > 0 ) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_INC_FAIL,
+ NLS.bind(Messages.IncrementalPublishFail, module[0].getName()), null);
+ IStatus[] results2 = results.toArray(new IStatus[results.size()]);
+ for( int i = 0; i < results.size(); i++ )
+ ms.add(results2[i]);
+ return ms;
+ }
+
return sup;
}
}