Author: rob.stryker(a)jboss.com
Date: 2011-06-30 11:47:37 -0400 (Thu, 30 Jun 2011)
New Revision: 32501
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
Log:
JBIDE-7851 - module restart for AS6 and below
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-06-30
15:14:16 UTC (rev 32500)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-06-30
15:47:37 UTC (rev 32501)
@@ -220,7 +220,8 @@
return status;
}
- private Path getRootPath(IPath deployPath) {
+ // TODO consider moving to utility class?
+ public static Path getRootPath(IPath deployPath) {
String root = (deployPath.getDevice() == null ? "" : deployPath.getDevice())
+ "/"; //$NON-NLS-1$//$NON-NLS-2$
return new Path(root);
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2011-06-30
15:14:16 UTC (rev 32500)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2011-06-30
15:47:37 UTC (rev 32501)
@@ -46,16 +46,22 @@
}
- protected IJBossServerPublishMethod method;
+ private IJBossServerPublishMethod method;
protected HashMap<String, Object> publishTaskModel;
protected void publishStart(IProgressMonitor monitor) throws CoreException {
if( method != null )
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"Already publishing")); //$NON-NLS-1$
- method = createPublishMethod();
+ method = getOrCreatePublishMethod();
publishTaskModel = new HashMap<String, Object>();
method.publishStart(this, monitor);
}
+ protected IJBossServerPublishMethod getOrCreatePublishMethod() throws CoreException {
+ if( method == null )
+ method = createPublishMethod();
+ return method;
+ }
+
protected void publishFinish(IProgressMonitor monitor) throws CoreException {
if( method == null )
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"Not publishing")); //$NON-NLS-1$
@@ -81,6 +87,7 @@
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"Not publishing")); //$NON-NLS-1$
int result = method.publishModule(this, kind, deltaKind, module, monitor);
setModulePublishState(module, result);
+ setModuleState(module, IServer.STATE_STARTED );
}
/**
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-06-30
15:14:16 UTC (rev 32500)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-06-30
15:47:37 UTC (rev 32501)
@@ -13,14 +13,25 @@
import java.util.HashMap;
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.Path;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher;
+import org.jboss.ide.eclipse.as.core.publishers.JSTPublisherXMLToucher;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+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.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration;
+import
org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
/**
*
@@ -139,4 +150,28 @@
protected IStatus canChangeState(String launchMode) {
return getDelegate().canChangeState(launchMode);
}
+
+ public boolean canRestartModule(IModule[] module){
+ if( module.length == 1 )
+ return true;
+ return false;
+ }
+
+ public void restartModule(IModule[] module, IProgressMonitor monitor) throws
CoreException {
+ IDeployableServer ds = ServerConverter.getDeployableServer(getServer());
+ if( ds == null )
+ return;
+
+ IJBossServerPublishMethod method = getOrCreatePublishMethod();
+ IPath depPath = PublishUtil.getDeployPath(method, module, ds);
+ if( ServerModelUtilities.isBinaryModule(module[module.length-1]) ||
ds.zipsWTPDeployments()) {
+ // touch the file
+ getOrCreatePublishMethod().getCallbackHandler(depPath.removeLastSegments(1),
getServer()).touchResource(new Path(depPath.lastSegment()));
+ } else {
+ // touch the descriptor
+ IPath deployPath = PublishUtil.getDeployPath(method, module, ds);
+ IPublishCopyCallbackHandler callback =
method.getCallbackHandler(AbstractServerToolsPublisher.getRootPath(deployPath).append(deployPath),
getServer());
+ JSTPublisherXMLToucher.getInstance().touch(deployPath, module[0], callback);
+ }
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-06-30
15:14:16 UTC (rev 32500)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-06-30
15:47:37 UTC (rev 32501)
@@ -104,16 +104,12 @@
* throw e;
* }
*/
- if (method == null)
- throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"Not publishing")); //$NON-NLS-1$
- int result = method.publishModule(this, kind, deltaKind, module, monitor);
+ int result = getOrCreatePublishMethod().publishModule(this, kind, deltaKind, module,
monitor);
setModulePublishState(module, result);
}
@Override
protected void publishFinish(IProgressMonitor monitor) throws CoreException {
- if (method == null)
- throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
"Not publishing")); //$NON-NLS-1$
// Handle the dodeploy
createDoDeployMarkers(monitor);
super.publishFinish(new SubProgressMonitor(monitor, 1));
@@ -236,7 +232,7 @@
}
private void createDoDeployMarker(List<IPath> paths, IProgressMonitor monitor)
throws CoreException {
- DeploymentMarkerUtils.addDoDeployMarker(method, getServer(), paths, monitor);
+ DeploymentMarkerUtils.addDoDeployMarker(getOrCreatePublishMethod(), getServer(), paths,
monitor);
}
}