Author: rob.stryker(a)jboss.com
Date: 2010-07-20 07:27:20 -0400 (Tue, 20 Jul 2010)
New Revision: 23588
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
Log:
Primarily added RSE jst zipped publisher
cleanup to some api's
Removal of some references to hardcoded local deployment method
JBIDE-6580
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2010-07-20
11:27:20 UTC (rev 23588)
@@ -95,6 +95,11 @@
priority="2"
zipDelegate="true">
</publisher>
+ <publisher
+
class="org.jboss.ide.eclipse.archives.webtools.modules.rse.RSEZippedJSTPublisher"
+ priority="3"
+ zipDelegate="true">
+ </publisher>
</extension>
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * TODO: Logging and Progress Monitors
+ ******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.modules;
import org.eclipse.core.runtime.CoreException;
@@ -16,36 +28,45 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-public class WTPZippedPublisher extends PublishUtil implements IJBossServerPublisher {
+public class WTPZippedPublisher implements IJBossServerPublisher {
private int moduleState = IServer.PUBLISH_STATE_NONE;
public boolean accepts(String method, IServer server, IModule[] module) {
IDeployableServer ds = ServerConverter.getDeployableServer(server);
IModule lastMod = (module == null || module.length == 0 ) ? null : module[module.length
-1];
- if( LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method) && lastMod == null)
+ if( getPublishMethod().equals(method) && lastMod == null)
return true;
- return LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method)
+ return getPublishMethod().equals(method)
&& ModuleCoreNature.isFlexibleProject(lastMod.getProject())
&& ds != null && ds.zipsWTPDeployments();
}
+
+ protected String getPublishMethod() {
+ return LocalPublishMethod.LOCAL_PUBLISH_METHOD;
+ }
public int getPublishState() {
return moduleState;
}
+ protected String getDeployRoot(IModule[] module, IDeployableServer ds) {
+ String deployRoot = PublishUtil.getDeployRootFolder(
+ module, ds, ds.getDeployFolder(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return deployRoot;
+ }
+
public IStatus publishModule(
IJBossServerPublishMethod method,
IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
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;
}
-
IDeployableServer ds = ServerConverter.getDeployableServer(server);
- String deployRoot = PublishUtil.getDeployRootFolder(
- module, ds, ds.getDeployFolder(),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
-
+ String deployRoot = getDeployRoot(module, ds);
LocalZippedPublisherUtil util = new LocalZippedPublisherUtil();
return util.publishModule(server, deployRoot, module, publishType, delta, monitor);
}
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -12,123 +12,64 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.modules.rse;
-import java.io.File;
-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.Status;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.IModuleFile;
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.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
-import
org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
-import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.LocalCopyCallback;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.rse.core.AbstractJSTPublisher;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod;
-public class RSEZippedJSTPublisher extends AbstractJSTPublisher {
+public class RSEZippedJSTPublisher extends WTPZippedPublisher {
- private RSEPublishMethod method;
-
- @Override
- protected String getTargetedPublishMethodId() {
+ protected String getPublishMethod() {
return RSEPublishMethod.RSE_ID;
}
-
- @Override
- protected boolean zipSettingsMatch() {
- // TODO handle this
- return true;
+
+ /**
+ * Here we put the deployment first in a temporary remote deploy folder
+ * Then during the publishModule call, we'll also upload it to remote machine
+ */
+ protected String getDeployRoot(IModule[] module, IDeployableServer ds) {
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(ds.getServer()).
+ append(IJBossServerConstants.TEMP_REMOTE_DEPLOY).makeAbsolute();
+ deployRoot.toFile().mkdirs();
+ return deployRoot.toString();
}
@Override
- public IStatus publishModule(IJBossServerPublishMethod method,
- IServer server, IModule[] module, int publishType,
- IModuleResourceDelta[] delta, IProgressMonitor monitor)
- throws CoreException {
- this.method = (RSEPublishMethod)method;
- return super.publishModule(method, server, module, publishType, delta, monitor);
- }
-
- @Override
- protected IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
- String folder = PublishUtil.getDeployRootFolder(
- moduleTree, server,
- method.getRemoteRootFolder().toString(),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return PublishUtil.getDeployPath(moduleTree, folder);
- }
-
- @Override
- protected IPublishCopyCallbackHandler getCallbackHandler(IPath path, IServer server,
- IJBossServerPublishMethod method) {
- IPath tempRoot = JBossServerCorePlugin.getServerStateLocation(server)
- .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
- IPath remoteRoot = JBossServerCorePlugin.getServerStateLocation(server)
- .append(IJBossServerConstants.TEMP_REMOTE_DEPLOY).makeAbsolute();
- return new LocalCopyCallback(server, remoteRoot, tempRoot);
- }
-
- protected class RSERemotePublishHandler implements IPublishCopyCallbackHandler {
- public IPath root;
- private ArrayList<IPath> createdFolders = new ArrayList<IPath>();
- public RSERemotePublishHandler(IPath path) {
- this.root = path;
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+ IStatus sup = super.publishModule(method, server, module, publishType, delta,
monitor);
+ IDeployableServer server2 = ServerConverter.getDeployableServer(server);
+ String depRoot = getDeployRoot(module, ServerConverter.getDeployableServer(server));
+ RSEPublishMethod method2 = (RSEPublishMethod)method;
+ IPath sourcePath = PublishUtil.getDeployPath(module, depRoot);
+ IModule lastMod = module[module.length-1];
+ IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(lastMod, server2,
method2.getRemoteRootFolder());
+ IPath tempDestFolder = RSEPublishMethod.findModuleFolderWithDefault(lastMod, server2,
method2.getRemoteTemporaryFolder());
+ String name = sourcePath.lastSegment();
+ try {
+ method2.getFileService().upload(sourcePath.toFile(), tempDestFolder.toString(), name,
true, null, null, new NullProgressMonitor());
+ method2.getFileService().move(tempDestFolder.toString(), name, destFolder.toString(),
name, new NullProgressMonitor());
+ } catch( SystemMessageException sme ) {
+ // TODO fix or return error
+ sme.printStackTrace();
}
- public IStatus[] copyFile(IModuleFile mf, IPath path,
- IProgressMonitor monitor) throws CoreException {
- File file = PublishUtil.getFile(mf);
- IPath remotePath = root.append(path);
- try {
- method.getFileService().upload(file, remotePath.removeLastSegments(1).toString(),
- remotePath.lastSegment(), true, null, null, monitor);
- } catch( SystemMessageException sme ) {
- System.err.println("failed to copy to " + remotePath.toString());
//$NON-NLS-1$
- }
- return null;
- }
- public IStatus[] deleteResource(IPath path, IProgressMonitor monitor)
- throws CoreException {
- IPath remotePath = root.append(path);
- try {
- method.getFileService().delete(remotePath.removeLastSegments(1).toString(),
remotePath.lastSegment(), monitor);
- } catch( SystemMessageException sme ) {
- System.err.println("failed to delete " + remotePath.toString());
//$NON-NLS-1$
- }
- return null;
- }
-
- public IStatus[] makeDirectoryIfRequired(IPath dir,
- IProgressMonitor monitor) throws CoreException {
- if( dir.segmentCount() > 0 )
- makeDirectoryIfRequired(dir.removeLastSegments(1), monitor);
- IPath toMake = root.append(dir);
- if( createdFolders.contains(toMake))
- return new IStatus[]{Status.OK_STATUS};
- try {
- method.getFileService().createFolder(toMake.removeLastSegments(1).toString(),
toMake.lastSegment(), monitor);
- } catch( SystemMessageException sme ) {
- System.err.println("failed to make folder " + toMake.toString());
//$NON-NLS-1$
- }
- createdFolders.add(toMake);
- return null;
- }
+ return sup;
}
-
- @Override
- protected void finishPublish(int publishType, IModule[] moduleTree,
- IDeployableServer server, IProgressMonitor monitor) {
- // do nothing
- }
}
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -150,7 +150,8 @@
PublisherWrapper wrapper;
while(i.hasNext()) {
wrapper = i.next();
- if( wrapper.publisher.accepts(deployMethod, server, module))
+ IJBossServerPublisher publisher = wrapper.publisher;
+ if( publisher.accepts(deployMethod, server, module))
return wrapper.getNewInstance();
}
return null;
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -36,6 +36,7 @@
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import
org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
@@ -83,7 +84,9 @@
public static String getDeployRootFolder(IModule[] moduleTree,
IDeployableServer server, String defaultFolder, String moduleProperty) {
- return getDeployRootFolder(moduleTree, LocalPublishMethod.LOCAL_PUBLISH_METHOD, server,
defaultFolder, moduleProperty);
+ IJBossServerPublishMethodType type =
DeploymentPreferenceLoader.getCurrentDeploymentMethodType(server.getServer());
+ return getDeployRootFolder(moduleTree, type.getId(),
+ server, defaultFolder, moduleProperty);
}
public static String getDeployRootFolder(IModule[] moduleTree, String publishMethod,
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -38,9 +38,11 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
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.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
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;
public abstract class AbstractJSTPublisher implements IJBossServerPublisher {
@@ -58,7 +60,7 @@
IDeployableServer ds = ServerConverter.getDeployableServer(server);
boolean shouldAccept = ds != null
&& ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && zipSettingsMatch();
+ && zipSettingsMatch(server);
return shouldAccept;
}
@@ -139,9 +141,22 @@
/**
* Check whether the current zip settings for the publish method
* match with what this publisher expects.
+ * @param the server
* @return
*/
- protected abstract boolean zipSettingsMatch();
+ protected boolean zipSettingsMatch(IServer server) {
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean settingZips = ds.zipsWTPDeployments();
+ return requiresZips() == settingZips;
+ }
+
+ /**
+ * Check whether the current publisher requires the zip flag
+ *
+ * @param the server
+ * @return
+ */
+ protected abstract boolean requiresZips();
private IPublishCopyCallbackHandler getCallbackHandler(IPath path) {
return getCallbackHandler(path, server.getServer(), publishMethod);
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -28,8 +28,11 @@
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.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class RSEJSTPublisher extends AbstractJSTPublisher {
@@ -39,13 +42,17 @@
protected String getTargetedPublishMethodId() {
return RSEPublishMethod.RSE_ID;
}
-
+
+ /*
+ * This publisher does not handle zipped deployments
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.as.rse.core.AbstractJSTPublisher#requiresZips()
+ */
@Override
- protected boolean zipSettingsMatch() {
- // TODO handle this
+ protected boolean requiresZips() {
return false;
}
-
+
@Override
public IStatus publishModule(IJBossServerPublishMethod method,
IServer server, IModule[] module, int publishType,
@@ -122,4 +129,6 @@
IDeployableServer server, IProgressMonitor monitor) {
// do nothing
}
+
+
}
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -22,8 +22,12 @@
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
+import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.as.core.publishers.AbstractPublishMethod;
+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.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
public class RSEPublishMethod extends AbstractPublishMethod {
@@ -103,5 +107,13 @@
}
return null;
}
+
+ public static IPath findModuleFolderWithDefault(IModule module, IDeployableServer
server, IPath startingPath) {
+ IModule[] moduleTree = new IModule[]{module};
+ String folder = PublishUtil.getDeployRootFolder(
+ moduleTree, server, startingPath.toString(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return PublishUtil.getDeployPath(moduleTree, folder).removeLastSegments(1);
+ }
}
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/SingleFileRSEPublisher.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -76,26 +76,13 @@
return status;
}
- protected IPath findModuleFolderWithDefault(IModule module, IDeployableServer server,
IPath startingPath) {
- IModule[] moduleTree = new IModule[]{module};
- String folder = PublishUtil.getDeployRootFolder(
- moduleTree, server, startingPath.toString(),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return PublishUtil.getDeployPath(moduleTree, folder).removeLastSegments(1);
- }
- protected IPath findDestinationFolder(IModule module, IDeployableServer server) {
- return findModuleFolderWithDefault(module, server, method.getRemoteRootFolder());
- }
- protected IPath findTempDestinationFolder(IModule module, IDeployableServer server) {
- return findModuleFolderWithDefault(module, server, method.getRemoteTemporaryFolder());
- }
protected IStatus publish(IDeployableServer server, IModule module, boolean
updateTimestamp, IProgressMonitor monitor) throws CoreException {
SingleDeployableModuleDelegate delegate =
(SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class,
new NullProgressMonitor());
if( delegate != null ) {
IPath sourcePath = delegate.getGlobalSourcePath();
- IPath destFolder = findDestinationFolder(module, server);
- IPath tempDestFolder = findTempDestinationFolder(module, server);
+ IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(module, server,
method.getRemoteRootFolder());
+ IPath tempDestFolder = RSEPublishMethod.findModuleFolderWithDefault(module, server,
method.getRemoteTemporaryFolder());
String name = sourcePath.lastSegment();
try {
@@ -122,7 +109,7 @@
SingleDeployableModuleDelegate delegate =
(SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class,
new NullProgressMonitor());
if( delegate != null ) {
IPath sourcePath = delegate.getGlobalSourcePath();
- IPath destFolder = findDestinationFolder(module, server);
+ IPath destFolder = RSEPublishMethod.findModuleFolderWithDefault(module, server,
method.getRemoteRootFolder());
String name = sourcePath.lastSegment();
try {
method.getFileService().delete(destFolder.toString(), name, new
NullProgressMonitor());
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -56,11 +56,13 @@
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import
org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
import
org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -287,7 +289,7 @@
zipDeployWTPProjects = toolkit.createButton(composite,
Messages.EditorZipDeployments, SWT.CHECK);
- boolean zippedPublisherAvailable = isLocalZippedPublisherAvailable();
+ boolean zippedPublisherAvailable = isZippedPublisherAvailable();
boolean value = getServer().zipsWTPDeployments();
zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
@@ -315,11 +317,19 @@
return section;
}
- protected boolean isLocalZippedPublisherAvailable() {
+ protected boolean isZippedPublisherAvailable() {
+ /*
+ * Maybe use IJBossServerPublishMethodType type =
DeploymentPreferenceLoader.getCurrentDeploymentMethodType(getServer());
+ * But this class has no reference to the server, and it also might not want to go by
stored data,
+ * but rather the combo in the ModuleDeploymentPage somehow?
+ */
+
+ // String method =
DeploymentPreferenceLoader.getCurrentDeploymentMethodType(getServer()).getId();
+ String method = LocalPublishMethod.LOCAL_PUBLISH_METHOD;
IJBossServerPublisher[] publishers =
ExtensionManager.getDefault().getZippedPublishers();
for( int i = 0; i < publishers.length; i++ ) {
- if( publishers[i].accepts(LocalPublishMethod.LOCAL_PUBLISH_METHOD,
getServer().getServer(), null))
+ if( publishers[i].accepts(method, getServer().getServer(), null))
return true;
}
return false;
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2010-07-20
11:07:29 UTC (rev 23587)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2010-07-20
11:27:20 UTC (rev 23588)
@@ -31,7 +31,9 @@
import org.jboss.ide.eclipse.as.core.publishers.JstPublisher;
import org.jboss.ide.eclipse.as.core.publishers.SingleFilePublisher;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.ModuleUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
@@ -195,8 +197,10 @@
private IPath getDeployPath() {
ModuleServer ms = selection[0];
IModule[] module = ms.module;
+ IJBossServerPublishMethodType type =
+ DeploymentPreferenceLoader.getCurrentDeploymentMethodType(ms.server);
IJBossServerPublisher publisher = ExtensionManager.getDefault()
- .getPublisher(ms.getServer(), module, "local");
+ .getPublisher(ms.getServer(), module, type.getId());
IPath path = null;
IDeployableServer deployableServer = ServerConverter
.getDeployableServer(ms.server);