[jbosstools-commits] JBoss Tools SVN: r24032 - in workspace/rstryker/rse/as/plugins: org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules and 9 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Aug 11 04:41:18 EDT 2010
Author: rob.stryker at jboss.com
Date: 2010-08-11 04:41:16 -0400 (Wed, 11 Aug 2010)
New Revision: 24032
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
Removed:
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/rse/core/AbstractJSTPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractServerToolsPublisher.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/RSERemotePublishHandler.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSESingleFilePublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/ui/
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/PackagesPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
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/plugin.xml
Log:
Separating RSE out into new plugins
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-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2010-08-11 08:41:16 UTC (rev 24032)
@@ -95,11 +95,6 @@
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/PackagesPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -12,8 +12,8 @@
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.LocalPublishMethod;
-import org.jboss.ide.eclipse.as.rse.core.AbstractServerToolsPublisher;
public class PackagesPublisher extends AbstractServerToolsPublisher {
public boolean accepts(String method, IServer server, IModule[] module) {
Deleted: 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-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/rse/RSEZippedJSTPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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.rse;
-
-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.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.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.util.ServerConverter;
-import org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod;
-
-/**
- * This class is in charge of RSE zipped publishing for flexible projects.
- * It extends the functionality of the local zipped publishing class
- * by uploading the file after building it in a temporary directory
- */
-public class RSEZippedJSTPublisher extends WTPZippedPublisher {
-
- protected String getPublishMethod() {
- return RSEPublishMethod.RSE_ID;
- }
-
- /**
- * 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 {
-
- // Locally zip it up into the remote tmp folder
- IStatus sup = super.publishModule(method, server, module, publishType, delta, monitor);
-
- // set up needed vars
- IDeployableServer server2 = ServerConverter.getDeployableServer(server);
- String remoteTempDeployRoot = getDeployRoot(module, ServerConverter.getDeployableServer(server));
- RSEPublishMethod method2 = (RSEPublishMethod)method;
- IPath sourcePath = PublishUtil.getDeployPath(module, remoteTempDeployRoot);
- 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();
-
- // Now transfer the file to RSE
- 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();
- }
-
- return sup;
- }
-}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2010-08-11 08:41:16 UTC (rev 24032)
@@ -22,13 +22,7 @@
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.common.frameworks,
org.eclipse.jst.jee,
- org.eclipse.core.commands,
- org.eclipse.rse.core;bundle-version="3.1.100",
- org.eclipse.rse.subsystems.files.core;bundle-version="3.2.0",
- org.eclipse.rse.services;bundle-version="3.2.0",
- org.eclipse.rse.services.files.ftp;bundle-version="3.0.200",
- org.eclipse.rse.services.local;bundle-version="2.1.200",
- org.eclipse.rse.services.ssh;bundle-version="3.0.1"
+ org.eclipse.core.commands
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.core,
org.jboss.ide.eclipse.as.core.extensions.descriptors,
@@ -41,8 +35,7 @@
org.jboss.ide.eclipse.as.core.server.internal,
org.jboss.ide.eclipse.as.core.server.internal.launch,
org.jboss.ide.eclipse.as.core.server.xpl,
- org.jboss.ide.eclipse.as.core.util,
- org.jboss.ide.eclipse.as.rse.core
+ org.jboss.ide.eclipse.as.core.util
Bundle-ClassPath: dom4j-1.6.1.jar,
jaxen-1.1-beta-6.jar,
getopt.jar,
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractJSTPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractJSTPublisher.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractJSTPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.publishers;
+
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+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.util.ServerConverter;
+
+public abstract class AbstractJSTPublisher extends AbstractServerToolsPublisher {
+ public AbstractJSTPublisher() {}
+
+ /**
+ * This abstract publisher is only suitable for non force-zipped deployments
+ */
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( module == null || !method.equals(getTargetedPublishMethodId()))
+ return false;
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ return ds != null
+ && ModuleCoreNature.isFlexibleProject(module[0].getProject())
+ && !ds.zipsWTPDeployments();
+ }
+
+ /**
+ * Get the publish method this publisher is associated with
+ * @return
+ */
+ protected abstract String getTargetedPublishMethodId();
+
+ /**
+ * JST projects require certain children (utility, etc) to be zipped up
+ */
+ @Override
+ protected boolean forceZipModule(IModule[] moduleTree) {
+ return PublishUtil.deployPackaged(moduleTree);
+ }
+}
Added: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java (rev 0)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.publishers;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+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.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+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.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.eclipse.wst.server.core.util.ModuleFile;
+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;
+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.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.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
+
+/**
+ * Class suitable for parsing any properly formed servertools-api module
+ */
+public abstract class AbstractServerToolsPublisher implements IJBossServerPublisher {
+ protected IModuleResourceDelta[] delta;
+ protected IDeployableServer server;
+ protected int publishState = IServer.PUBLISH_STATE_NONE;
+ protected IJBossServerPublishMethod publishMethod;
+
+ public AbstractServerToolsPublisher() {}
+ public abstract boolean accepts(String method, IServer server, IModule[] module);
+
+ public int getPublishState() {
+ return publishState;
+ }
+
+ protected void setPublishState(int state) {
+ this.publishState = state;
+ }
+
+ public IStatus publishModule(IJBossServerPublishMethod method,
+ IServer server, IModule[] module, int publishType,
+ IModuleResourceDelta[] delta, IProgressMonitor monitor)
+ throws CoreException {
+ IStatus status = null;
+ this.server = ServerConverter.getDeployableServer(server);
+ this.delta = delta;
+ this.publishMethod = method;
+
+ boolean deleted = false;
+ for( int i = 0; i < module.length; i++ ) {
+ if( module[i].isExternal() )
+ deleted = true;
+ }
+
+ // Monitor at this point has been begun with 1000 monitor
+ IProgressMonitor subMon = ProgressMonitorUtil.submon(monitor, 1000);
+ if (publishType == REMOVE_PUBLISH ) {
+ status = unpublish(this.server, module, subMon);
+ } else {
+ if( deleted ) {
+ publishState = IServer.PUBLISH_STATE_UNKNOWN;
+ } else {
+ if (publishType == FULL_PUBLISH ) {
+ status = fullPublish(module, module[module.length-1], subMon);
+ } else if (publishType == INCREMENTAL_PUBLISH) {
+ status = incrementalPublish(module, module[module.length-1], subMon);
+ }
+ }
+ }
+ return status;
+ }
+
+ /**
+ * Gets the actual deploy path for this module
+ *
+ * @param moduleTree
+ * @param server
+ * @return
+ */
+ protected IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
+ String folder = PublishUtil.getDeployRootFolder(
+ moduleTree, server,
+ publishMethod.getPublishDefaultRootFolder(server.getServer()),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return PublishUtil.getDeployPath(moduleTree, folder);
+ }
+
+ /**
+ * Finish up the publishing. This may be moving a final zipped entity into the proper
+ * folder or sending it over the wire to a remote machine.
+ *
+ * Subclasses may override
+ *
+ * @param publishType
+ * @param moduleTree
+ * @param server
+ * @param monitor
+ */
+ protected void finishPublish(int publishType, IModule[] moduleTree, IDeployableServer server, IProgressMonitor monitor){}
+
+ private IPublishCopyCallbackHandler getCallbackHandler(IPath path) {
+ return publishMethod.getCallbackHandler(path, server.getServer());
+ }
+
+ /**
+ * For certain module trees, some publishers may want to force a child to be zipped.
+ * For example, JST Publisher may want to force utility project children to be zipped.
+ *
+ * @param moduleTree
+ * @return
+ */
+ protected boolean forceZipModule(IModule[] moduleTree) {
+ return false;
+ }
+
+ protected IStatus canceledStatus() {
+ return new Status(IStatus.CANCEL, JBossServerCorePlugin.PLUGIN_ID, "Publish Canceled"); //$NON-NLS-1$
+ }
+
+ protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Full Publish", 1000); //$NON-NLS-1$
+
+ IPath deployPath = getDeployPath(moduleTree, server);
+ IPublishCopyCallbackHandler callback = getCallbackHandler(deployPath);
+ IModuleResource[] members = PublishUtil.getResources(module, ProgressMonitorUtil.submon(monitor, 200));
+
+ if( monitor.isCanceled())
+ return canceledStatus();
+
+ // First delete it
+ // if the module we're publishing is a project, not a binary, clean it's folder
+ if( !(new Path(module.getName()).segmentCount() > 1 ))
+ callback.deleteResource(new Path("/"), ProgressMonitorUtil.submon(monitor, 100)); //$NON-NLS-1$
+
+ if( monitor.isCanceled())
+ return canceledStatus();
+
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
+
+ boolean isBinaryObject = ServerModelUtilities.isBinaryModule(module);
+ boolean forceZip = forceZipModule(moduleTree);
+
+ if( !forceZip && !isBinaryObject) {
+ PublishCopyUtil util = new PublishCopyUtil(callback);
+ list.addAll(Arrays.asList(util.publishFull(members, ProgressMonitorUtil.submon(monitor, 700))));
+ } else if( isBinaryObject )
+ list.addAll(Arrays.asList(copyBinaryModule(moduleTree, ProgressMonitorUtil.submon(monitor, 700))));
+ else {
+ // A child that must be zipped, forceZip is true
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
+ append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+
+ try {
+ File temp = deployRoot.toFile().createTempFile(module.getName(), ".tmp", deployRoot.toFile()); //$NON-NLS-1$
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ String parentFolder = deployPath.removeLastSegments(1).toString();
+ handler.makeDirectoryIfRequired(new Path(parentFolder), ProgressMonitorUtil.submon(monitor, 200));
+ ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
+ handler.copyFile(mf, deployPath, ProgressMonitorUtil.submon(monitor, 500));
+ } catch( IOException ioe) {
+ list.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe));
+ }
+ }
+
+ monitor.done();
+ if( list.size() > 0 )
+ return createMultiStatus(list, module);
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Incremental Publish", 100); //$NON-NLS-1$
+ IStatus[] results = new IStatus[] {};
+ IPath deployPath = getDeployPath(moduleTree, server);
+ boolean isBinaryObject = ServerModelUtilities.isBinaryModule(module);
+ boolean forceZip = forceZipModule(moduleTree);
+ if( !forceZip && !isBinaryObject) {
+ IPublishCopyCallbackHandler handler = getCallbackHandler(deployPath);
+ results = new PublishCopyUtil(handler).publishDelta(delta, ProgressMonitorUtil.submon(monitor, 100));
+ } else if( delta.length > 0 ) {
+ if( isBinaryObject)
+ results = copyBinaryModule(moduleTree, ProgressMonitorUtil.submon(monitor, 100));
+ else {
+ // forceZip a child module
+ IPath localDeployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
+ append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
+ try {
+ File temp = File.createTempFile(module.getName(), ".tmp", localDeployRoot.toFile()); //$NON-NLS-1$
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile);
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ String parentFolder = deployPath.removeLastSegments(1).toString();
+ handler.makeDirectoryIfRequired(new Path(parentFolder), ProgressMonitorUtil.submon(monitor, 50));
+ ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
+ handler.copyFile(mf, deployPath, ProgressMonitorUtil.submon(monitor, 50));
+ } catch( IOException ioe) {
+ IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe);
+ results = new IStatus[] { s };
+ }
+ }
+ }
+
+ monitor.done();
+ if( results != null && results.length > 0 ) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_INC_FAIL,
+ NLS.bind(Messages.IncrementalPublishFail, module.getName()), null);
+ for( int i = 0; i < results.length; i++ )
+ ms.add(results[i]);
+ return ms;
+ }
+
+ IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS,
+ NLS.bind(Messages.CountModifiedMembers, PublishUtil.countChanges(delta), module.getName()), null);
+ return ret;
+ }
+
+ protected IStatus createMultiStatus(List<IStatus> list, IModule module) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_FAIL,
+ NLS.bind(Messages.FullPublishFail, module.getName()), null);
+ for( int i = 0; i < list.size(); i++ )
+ ms.add(list.get(i));
+ return ms;
+ }
+
+ protected IStatus[] copyBinaryModule(IModule[] moduleTree, IProgressMonitor monitor) {
+ monitor.beginTask("Copy Binary Module", 100); //$NON-NLS-1$
+ try {
+ IPath destinationPath = getDeployPath(moduleTree, server);
+ IModuleResource[] members = PublishUtil.getResources(moduleTree);
+ File source = PublishUtil.getFile(members[0]);
+ if( source != null ) {
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ IPath localFilePath = new Path(source.getAbsolutePath());
+ ModuleFile mf = new ModuleFile(localFilePath.toFile(), localFilePath.lastSegment(), localFilePath);
+ handler.copyFile(mf, destinationPath, new NullProgressMonitor());
+ } else {
+// IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_COPY_BINARY_FAIL,
+// NLS.bind(Messages.CouldNotPublishModule,
+// moduleTree[moduleTree.length-1]), null);
+// return new IStatus[] {s};
+ // TODO
+ }
+ } catch( CoreException ce ) {
+ return new IStatus[] {ce.getStatus()};
+ }
+ monitor.done();
+ return new IStatus[]{Status.OK_STATUS};
+ }
+
+ protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
+ IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Begin Unpublish", 100); //$NON-NLS-1$
+ IPath remotePath = getDeployPath(module, server);
+ IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ handler.deleteResource(remotePath, ProgressMonitorUtil.submon(monitor, 100));
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.publishers;
-import org.jboss.ide.eclipse.as.rse.core.AbstractJSTPublisher;
public class JstPublisher extends AbstractJSTPublisher {
protected String getTargetedPublishMethodId() {
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -13,7 +13,6 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
-import org.jboss.ide.eclipse.as.rse.core.AbstractServerToolsPublisher;
public class SingleFilePublisher extends AbstractServerToolsPublisher {
public boolean accepts(String method, IServer server, IModule[] module) {
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -85,12 +85,16 @@
}
public String getTempDeployFolder() {
- IJBossServerRuntime jbsrt = getRuntime();
- String type = getDeployLocationType();
+ return getTempDeployFolder(this, getDeployLocationType());
+ }
+
+ public static String getTempDeployFolder(JBossServer jbs, String type) {
+ IServer server = jbs.getServer();
+ IJBossServerRuntime jbsrt = getRuntime(server);
if( type.equals(DEPLOY_CUSTOM))
- return ServerUtil.makeGlobal(jbsrt, new Path(getAttribute(TEMP_DEPLOY_DIRECTORY, ""))).toString(); //$NON-NLS-1$
+ return ServerUtil.makeGlobal(jbsrt, new Path(server.getAttribute(TEMP_DEPLOY_DIRECTORY, ""))).toString(); //$NON-NLS-1$
if( type.equals(DEPLOY_METADATA)) {
- return JBossServerCorePlugin.getServerStateLocation(getServer()).
+ return JBossServerCorePlugin.getServerStateLocation(server).
append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
} else if( type.equals(DEPLOY_SERVER)) {
String loc = jbsrt.getConfigLocation();
Deleted: 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-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractJSTPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.rse.core;
-
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-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.util.ServerConverter;
-
-public abstract class AbstractJSTPublisher extends AbstractServerToolsPublisher {
- public AbstractJSTPublisher() {}
-
- /**
- * This abstract publisher is only suitable for non force-zipped deployments
- */
- public boolean accepts(String method, IServer server, IModule[] module) {
- if( module == null || !method.equals(getTargetedPublishMethodId()))
- return false;
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- return ds != null
- && ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && !ds.zipsWTPDeployments();
- }
-
- /**
- * Get the publish method this publisher is associated with
- * @return
- */
- protected abstract String getTargetedPublishMethodId();
-
- /**
- * JST projects require certain children (utility, etc) to be zipped up
- */
- @Override
- protected boolean forceZipModule(IModule[] moduleTree) {
- return PublishUtil.deployPackaged(moduleTree);
- }
-}
Deleted: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractServerToolsPublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractServerToolsPublisher.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/AbstractServerToolsPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.rse.core;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-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.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-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.IModuleResource;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.eclipse.wst.server.core.util.ModuleFile;
-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;
-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.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.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
-
-/**
- * Class suitable for parsing any properly formed servertools-api module
- */
-public abstract class AbstractServerToolsPublisher implements IJBossServerPublisher {
- protected IModuleResourceDelta[] delta;
- protected IDeployableServer server;
- protected int publishState = IServer.PUBLISH_STATE_NONE;
- protected IJBossServerPublishMethod publishMethod;
-
- public AbstractServerToolsPublisher() {}
- public abstract boolean accepts(String method, IServer server, IModule[] module);
-
- public int getPublishState() {
- return publishState;
- }
-
- protected void setPublishState(int state) {
- this.publishState = state;
- }
-
- public IStatus publishModule(IJBossServerPublishMethod method,
- IServer server, IModule[] module, int publishType,
- IModuleResourceDelta[] delta, IProgressMonitor monitor)
- throws CoreException {
- IStatus status = null;
- this.server = ServerConverter.getDeployableServer(server);
- this.delta = delta;
- this.publishMethod = method;
-
- boolean deleted = false;
- for( int i = 0; i < module.length; i++ ) {
- if( module[i].isExternal() )
- deleted = true;
- }
-
- // Monitor at this point has been begun with 1000 monitor
- IProgressMonitor subMon = ProgressMonitorUtil.submon(monitor, 1000);
- if (publishType == REMOVE_PUBLISH ) {
- status = unpublish(this.server, module, subMon);
- } else {
- if( deleted ) {
- publishState = IServer.PUBLISH_STATE_UNKNOWN;
- } else {
- if (publishType == FULL_PUBLISH ) {
- status = fullPublish(module, module[module.length-1], subMon);
- } else if (publishType == INCREMENTAL_PUBLISH) {
- status = incrementalPublish(module, module[module.length-1], subMon);
- }
- }
- }
- return status;
- }
-
- /**
- * Gets the actual deploy path for this module
- *
- * @param moduleTree
- * @param server
- * @return
- */
- protected IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
- String folder = PublishUtil.getDeployRootFolder(
- moduleTree, server,
- publishMethod.getPublishDefaultRootFolder(server.getServer()),
- IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return PublishUtil.getDeployPath(moduleTree, folder);
- }
-
- /**
- * Finish up the publishing. This may be moving a final zipped entity into the proper
- * folder or sending it over the wire to a remote machine.
- *
- * Subclasses may override
- *
- * @param publishType
- * @param moduleTree
- * @param server
- * @param monitor
- */
- protected void finishPublish(int publishType, IModule[] moduleTree, IDeployableServer server, IProgressMonitor monitor){}
-
- private IPublishCopyCallbackHandler getCallbackHandler(IPath path) {
- return publishMethod.getCallbackHandler(path, server.getServer());
- }
-
- /**
- * For certain module trees, some publishers may want to force a child to be zipped.
- * For example, JST Publisher may want to force utility project children to be zipped.
- *
- * @param moduleTree
- * @return
- */
- protected boolean forceZipModule(IModule[] moduleTree) {
- return false;
- }
-
- protected IStatus canceledStatus() {
- return new Status(IStatus.CANCEL, JBossServerCorePlugin.PLUGIN_ID, "Publish Canceled"); //$NON-NLS-1$
- }
-
- protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Full Publish", 1000); //$NON-NLS-1$
-
- IPath deployPath = getDeployPath(moduleTree, server);
- IPublishCopyCallbackHandler callback = getCallbackHandler(deployPath);
- IModuleResource[] members = PublishUtil.getResources(module, ProgressMonitorUtil.submon(monitor, 200));
-
- if( monitor.isCanceled())
- return canceledStatus();
-
- // First delete it
- // if the module we're publishing is a project, not a binary, clean it's folder
- if( !(new Path(module.getName()).segmentCount() > 1 ))
- callback.deleteResource(new Path("/"), ProgressMonitorUtil.submon(monitor, 100)); //$NON-NLS-1$
-
- if( monitor.isCanceled())
- return canceledStatus();
-
- ArrayList<IStatus> list = new ArrayList<IStatus>();
-
- boolean isBinaryObject = ServerModelUtilities.isBinaryModule(module);
- boolean forceZip = forceZipModule(moduleTree);
-
- if( !forceZip && !isBinaryObject) {
- PublishCopyUtil util = new PublishCopyUtil(callback);
- list.addAll(Arrays.asList(util.publishFull(members, ProgressMonitorUtil.submon(monitor, 700))));
- } else if( isBinaryObject )
- list.addAll(Arrays.asList(copyBinaryModule(moduleTree, ProgressMonitorUtil.submon(monitor, 700))));
- else {
- // A child that must be zipped, forceZip is true
- IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
- append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
-
- try {
- File temp = deployRoot.toFile().createTempFile(module.getName(), ".tmp", deployRoot.toFile()); //$NON-NLS-1$
- IPath tempFile = new Path(temp.getAbsolutePath());
- list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
- String parentFolder = deployPath.removeLastSegments(1).toString();
- handler.makeDirectoryIfRequired(new Path(parentFolder), ProgressMonitorUtil.submon(monitor, 200));
- ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
- handler.copyFile(mf, deployPath, ProgressMonitorUtil.submon(monitor, 500));
- } catch( IOException ioe) {
- list.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe));
- }
- }
-
- monitor.done();
- if( list.size() > 0 )
- return createMultiStatus(list, module);
- return Status.OK_STATUS;
- }
-
- protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Incremental Publish", 100); //$NON-NLS-1$
- IStatus[] results = new IStatus[] {};
- IPath deployPath = getDeployPath(moduleTree, server);
- boolean isBinaryObject = ServerModelUtilities.isBinaryModule(module);
- boolean forceZip = forceZipModule(moduleTree);
- if( !forceZip && !isBinaryObject) {
- IPublishCopyCallbackHandler handler = getCallbackHandler(deployPath);
- results = new PublishCopyUtil(handler).publishDelta(delta, ProgressMonitorUtil.submon(monitor, 100));
- } else if( delta.length > 0 ) {
- if( isBinaryObject)
- results = copyBinaryModule(moduleTree, ProgressMonitorUtil.submon(monitor, 100));
- else {
- // forceZip a child module
- IPath localDeployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
- append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute();
- try {
- File temp = File.createTempFile(module.getName(), ".tmp", localDeployRoot.toFile()); //$NON-NLS-1$
- IPath tempFile = new Path(temp.getAbsolutePath());
- PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile);
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
- String parentFolder = deployPath.removeLastSegments(1).toString();
- handler.makeDirectoryIfRequired(new Path(parentFolder), ProgressMonitorUtil.submon(monitor, 50));
- ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
- handler.copyFile(mf, deployPath, ProgressMonitorUtil.submon(monitor, 50));
- } catch( IOException ioe) {
- IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe);
- results = new IStatus[] { s };
- }
- }
- }
-
- monitor.done();
- if( results != null && results.length > 0 ) {
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_INC_FAIL,
- NLS.bind(Messages.IncrementalPublishFail, module.getName()), null);
- for( int i = 0; i < results.length; i++ )
- ms.add(results[i]);
- return ms;
- }
-
- IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS,
- NLS.bind(Messages.CountModifiedMembers, PublishUtil.countChanges(delta), module.getName()), null);
- return ret;
- }
-
- protected IStatus createMultiStatus(List<IStatus> list, IModule module) {
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_FAIL,
- NLS.bind(Messages.FullPublishFail, module.getName()), null);
- for( int i = 0; i < list.size(); i++ )
- ms.add(list.get(i));
- return ms;
- }
-
- protected IStatus[] copyBinaryModule(IModule[] moduleTree, IProgressMonitor monitor) {
- monitor.beginTask("Copy Binary Module", 100); //$NON-NLS-1$
- try {
- IPath destinationPath = getDeployPath(moduleTree, server);
- IModuleResource[] members = PublishUtil.getResources(moduleTree);
- File source = PublishUtil.getFile(members[0]);
- if( source != null ) {
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
- IPath localFilePath = new Path(source.getAbsolutePath());
- ModuleFile mf = new ModuleFile(localFilePath.toFile(), localFilePath.lastSegment(), localFilePath);
- handler.copyFile(mf, destinationPath, new NullProgressMonitor());
- } else {
-// IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_COPY_BINARY_FAIL,
-// NLS.bind(Messages.CouldNotPublishModule,
-// moduleTree[moduleTree.length-1]), null);
-// return new IStatus[] {s};
- // TODO
- }
- } catch( CoreException ce ) {
- return new IStatus[] {ce.getStatus()};
- }
- monitor.done();
- return new IStatus[]{Status.OK_STATUS};
- }
-
- protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
- IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Begin Unpublish", 100); //$NON-NLS-1$
- IPath remotePath = getDeployPath(module, server);
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
- handler.deleteResource(remotePath, ProgressMonitorUtil.submon(monitor, 100));
- monitor.done();
- return Status.OK_STATUS;
- }
-}
Deleted: 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-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEJSTPublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.as.rse.core;
-
-
-public class RSEJSTPublisher extends AbstractJSTPublisher {
-
- @Override
- protected String getTargetedPublishMethodId() {
- return RSEPublishMethod.RSE_ID;
- }
-}
Deleted: 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-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEPublishMethod.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.rse.core;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-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.eclipse.wst.server.core.IServer;
-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.server.internal.JBossServer;
-import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-
-public class RSEPublishMethod extends AbstractPublishMethod {
-
- public static final String RSE_ID = "rse"; //$NON-NLS-1$
-
- private DeployableServerBehavior behaviour;
-
- @Override
- public String getPublishMethodId() {
- return RSE_ID;
- }
-
- private IFileServiceSubSystem fileSubSystem = null;
- private IPath remoteRootFolder;
- private IPath remoteTemporaryFolder;
- public void publishStart(DeployableServerBehavior behaviour,
- IProgressMonitor monitor) throws CoreException {
- this.behaviour = behaviour;
- loadRemoteDeploymentDetails();
- if (fileSubSystem != null && !fileSubSystem.isConnected()) {
- try {
- fileSubSystem.connect(monitor, false);
- } catch (Exception e) {
- }
- }
- super.publishStart(behaviour, monitor);
- }
- public IPath getRemoteRootFolder() {
- return remoteRootFolder;
- }
- public IPath getRemoteTemporaryFolder() {
- return remoteTemporaryFolder;
- }
- public IFileServiceSubSystem getFileServiceSubSystem() {
- return fileSubSystem;
- }
- public IFileService getFileService() {
- return fileSubSystem.getFileService();
- }
-
- public int publishFinish(DeployableServerBehavior behaviour,
- IProgressMonitor monitor) throws CoreException {
- return super.publishFinish(behaviour, monitor);
- }
-
- protected void loadRemoteDeploymentDetails() throws CoreException{
- // TODO obviously fix this
-// String homeDir = RSEUtils.getRSEHomeDir(behaviour.getServer());
-// String conf = RSEUtils.getRSEConfigName(behaviour.getServer());
- String connectionName = RSEUtils.getRSEConnectionName(behaviour.getServer());
-// this.remoteRootFolder = new Path("/home/rob/redhat/deploy"); //$NON-NLS-1$
-// this.remoteTemporaryFolder = new Path("/home/rob/redhat/tmp"); //$NON-NLS-1$
- JBossServer jbs = ServerConverter.getJBossServer(behaviour.getServer());
- this.remoteRootFolder = new Path(RSEUtils.getDeployRootFolder(jbs));
- this.remoteTemporaryFolder = new Path("/home/rob/redhat/tmp"); //$NON-NLS-1$
-
- IHost host = findHost(connectionName);
- if( host != null ) {
- fileSubSystem = findFileTransferSubSystem(host);
- } else {
- // TODO error host not found in RSE
- }
- }
-
- protected IHost findHost(String connectionName) {
- IHost[] allHosts = RSECorePlugin.getTheSystemRegistry().getHosts();
- for( int i = 0; i < allHosts.length; i++ ) {
- if( allHosts[i].getAliasName().equals(connectionName))
- return allHosts[i];
- }
- return null;
- }
-
- /* approved files subsystems *
- ftp.files
- local.files
- ssh.files
- */
- protected static List<String> APPROVED_FILE_SYSTEMS =
- Arrays.asList(new String[]{ "ftp.files", "local.files", "ssh.files"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected IFileServiceSubSystem findFileTransferSubSystem(IHost host) {
- ISubSystem[] systems = RSECorePlugin.getTheSystemRegistry().getSubSystems(host);
- for( int i = 0; i < systems.length; i++ ) {
- if( APPROVED_FILE_SYSTEMS.contains(systems[i].getConfigurationId()))
- return (IFileServiceSubSystem)systems[i];
- }
- 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);
- }
-
-
- public IPublishCopyCallbackHandler getCallbackHandler(IPath path, IServer server) {
- return new RSERemotePublishHandler(path, this);
- }
-
- public String getPublishDefaultRootFolder(IServer server) {
- return getRemoteRootFolder().toString();
- }
-
-}
Deleted: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSERemotePublishHandler.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSERemotePublishHandler.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSERemotePublishHandler.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * 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.as.rse.core;
-
-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.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
-import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
-
-public class RSERemotePublishHandler implements IPublishCopyCallbackHandler {
- protected IPath root;
- protected RSEPublishMethod method;
- private ArrayList<IPath> createdFolders = new ArrayList<IPath>();
- public RSERemotePublishHandler(IPath path, RSEPublishMethod method) {
- this.root = path;
- this.method = method;
- }
- 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 {
- monitor.beginTask("Make directory " + dir.toString(), 100); //$NON-NLS-1$
- if( dir.segmentCount() > 0 )
- makeDirectoryIfRequired(dir.removeLastSegments(1), ProgressMonitorUtil.submon(monitor, 70));
- 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(), ProgressMonitorUtil.submon(monitor, 30));
- } catch( SystemMessageException sme ) {
- System.err.println("failed to make folder " + toMake.toString()); //$NON-NLS-1$
- }
- createdFolders.add(toMake);
- monitor.done();
- return null;
- }
-}
-
Deleted: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSESingleFilePublisher.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSESingleFilePublisher.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSESingleFilePublisher.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.rse.core;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
-
-public class RSESingleFilePublisher extends AbstractServerToolsPublisher {
-
- public boolean accepts(String method, IServer server, IModule[] module) {
- if( RSEPublishMethod.RSE_ID.equals(method)
- && module != null && module.length > 0
- && module[module.length-1] != null
- && module[module.length-1].getModuleType().getId().equals(SingleDeployableFactory.MODULE_TYPE))
- return true;
- return false;
- }
-}
Deleted: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.rse.core;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerAttributes;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
-import org.jboss.ide.eclipse.as.core.util.IConstants;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-
-
-/*
- * Some of this code will need to be abstracted out from JBossServer
- * and turned into a proper API, but in as simple a way as possible
- */
-public class RSEUtils {
- public static final String RSE_SERVER_CONFIG = "org.jboss.ide.eclipse.as.rse.core.RSEServerConfig"; //$NON-NLS-1$
- public static final String RSE_SERVER_HOME_DIR = "org.jboss.ide.eclipse.as.rse.core.RSEServerHomeDir"; //$NON-NLS-1$
- public static final String RSE_SERVER_HOST = "org.jboss.ide.eclipse.as.rse.core.ServerHost"; //$NON-NLS-1$
- public static final String RSE_SERVER_DEFAULT_HOST = "Local"; //$NON-NLS-1$
-
- public static String getRSEConnectionName(IServer server) {
- return server.getAttribute(RSEUtils.RSE_SERVER_HOST, RSE_SERVER_DEFAULT_HOST);
- }
-
- public static String getRSEHomeDir(IServerAttributes server) {
- return server.getAttribute(RSEUtils.RSE_SERVER_HOME_DIR, server.getRuntime().getLocation().toString());
- }
-
- public static String getRSEConfigName(IServerAttributes server) {
- IJBossServerRuntime runtime = ServerConverter.getJBossRuntime(server);
- return server.getAttribute(RSEUtils.RSE_SERVER_CONFIG, runtime.getJBossConfiguration());
- }
-
- public static String getDeployRootFolder(JBossServer server) {
- return getDeployRootFolder(server.getServer(), server.getDeployLocationType());
- }
-
- /* Copied from JBossServer.getDeployFolder(etc) */
- public static String getDeployRootFolder(IServer server, String type) {
- if( type.equals(JBossServer.DEPLOY_CUSTOM)) {
- String val = server.getAttribute(JBossServer.DEPLOY_DIRECTORY, (String)null);
- if( val != null ) {
- IPath val2 = new Path(val);
- return makeGlobal(server, val2).toString();
- }
- // if no value is set, default to metadata
- type = JBossServer.DEPLOY_SERVER;
- }
- // TODO error here, or sensible default?
- if( type.equals(JBossServer.DEPLOY_METADATA)) {
- return JBossServerCorePlugin.getServerStateLocation(server).
- append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
- } else if( type.equals(JBossServer.DEPLOY_SERVER)) {
- String loc = IConstants.SERVER;
- String config = getRSEConfigName(server);
- IPath p = new Path(loc).append(config)
- .append(IJBossServerConstants.DEPLOY);
- return makeGlobal(server, p).toString();
- }
- return null;
- }
-
- public static IPath makeRelative(IServer server, IPath p) {
- if( p.isAbsolute()) {
- if(new Path(getRSEHomeDir(server)).isPrefixOf(p)) {
- int size = new Path(getRSEHomeDir(server)).toOSString().length();
- return new Path(p.toOSString().substring(size)).makeRelative();
- }
- }
- return p;
- }
-
- public static IPath makeGlobal(IServer server, IPath p) {
- if( !p.isAbsolute()) {
- return new Path(getRSEHomeDir(server)).append(p).makeAbsolute();
- }
- return p;
- }
-
-
-}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2010-08-11 08:41:16 UTC (rev 24032)
@@ -1047,27 +1047,4 @@
serverTypes="%AllJBTServerTypes">
</publishMethod>
</extension>
-
-
- <!-- Below here is RSE stuff which can / should be moved if a new plugin is created -->
- <extension
- point="org.jboss.ide.eclipse.as.core.publishMethod">
- <publishMethod
- class="org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod"
- id="rse"
- name="Remote System Deployment"
- serverTypes="%AllJBTServerTypes">
- </publishMethod>
- </extension>
- <extension
- point="org.jboss.ide.eclipse.as.core.publishers">
- <publisher
- class="org.jboss.ide.eclipse.as.rse.core.RSESingleFilePublisher"
- priority="7">
- </publisher>
- <publisher
- class="org.jboss.ide.eclipse.as.rse.core.RSEJSTPublisher"
- priority="5">
- </publisher>
- </extension>
</plugin>
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-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2010-08-11 08:41:16 UTC (rev 24032)
@@ -13,6 +13,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
+import java.util.HashMap;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -61,16 +62,57 @@
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
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.JBossServer;
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.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod;
-import org.jboss.ide.eclipse.as.rse.core.RSEUtils;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.Messages;
public class DeploymentModuleOptionCompositeAssistant implements PropertyChangeListener {
+ public static interface IDeploymentPageCallback {
+ public boolean metadataEnabled();
+ public String getServerLocation(IServerWorkingCopy wc);
+ public String getServerConfigName(IServerWorkingCopy wc);
+ public void propertyChange(PropertyChangeEvent evt, DeploymentModuleOptionCompositeAssistant composite);
+ }
+
+ public static class LocalDeploymentPageCallback implements IDeploymentPageCallback {
+ public boolean metadataEnabled() {
+ return true;
+ }
+
+ @Override
+ public String getServerLocation(IServerWorkingCopy wc) {
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)wc.getRuntime().loadAdapter(IJBossServerRuntime.class, null);
+ return jbsrt.getConfigLocation();
+ }
+
+ @Override
+ public String getServerConfigName(IServerWorkingCopy wc) {
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)wc.getRuntime().loadAdapter(IJBossServerRuntime.class, null);
+ return jbsrt.getJBossConfiguration();
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt,
+ DeploymentModuleOptionCompositeAssistant composite) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ private static HashMap<String, IDeploymentPageCallback> callbackMappings;
+ static {
+ callbackMappings = new HashMap<String, IDeploymentPageCallback>();
+ callbackMappings.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new LocalDeploymentPageCallback());
+ }
+
+ public static void addMapping(String mode, IDeploymentPageCallback callback) {
+ callbackMappings.put(mode, callback);
+ }
+
private ModuleDeploymentPage page;
private DeploymentPreferences preferences;
private TreeViewer viewer;
@@ -88,6 +130,10 @@
currentDeployType = LocalPublishMethod.LOCAL_PUBLISH_METHOD;
}
+ public ModuleDeploymentPage getPage() {
+ return page;
+ }
+
public String getCurrentDeployType() {
return currentDeployType;
}
@@ -115,7 +161,15 @@
private SelectionListener radioListener, zipListener;
private Button zipDeployWTPProjects;
private String lastCustomDeploy, lastCustomTemp;
+
+ public Button getServerRadio() {
+ return serverRadio;
+ }
+ public Button getCurrentSelection() {
+ return currentSelection;
+ }
+
protected Composite createDefaultComposite(Composite parent) {
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
@@ -316,10 +370,13 @@
: serverRadio.getSelection() ? serverRadio : customRadio;
String mode = page.getServer().getAttribute(IDeployableServer.SERVER_MODE, LocalPublishMethod.LOCAL_PUBLISH_METHOD);
- metadataRadio.setEnabled(!mode.equals(RSEPublishMethod.RSE_ID));
-
- String newDir = getHelper().getAttribute(IDeployableServer.DEPLOY_DIRECTORY, "");
- String newTemp = getHelper().getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, "");
+ boolean metaEnabled = callbackMappings.get(mode).metadataEnabled();
+ metadataRadio.setEnabled(metaEnabled);
+ JBossServer jbs = ServerConverter.getJBossServer(page.getServer().getOriginal());
+ String newDir = getHelper().getAttribute(IDeployableServer.DEPLOY_DIRECTORY,
+ jbs == null ? "" : jbs.getDeployFolder(jbs, getDeployType()));
+ String newTemp = getHelper().getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY,
+ jbs == null ? "" : jbs.getTempDeployFolder(jbs, getDeployType()));
deployText.removeModifyListener(deployListener);
deployText.setText(newDir);
deployText.addModifyListener(deployListener);
@@ -333,7 +390,7 @@
tempDeployButton.setEnabled(getDeployType().equals(IDeployableServer.DEPLOY_CUSTOM));
}
- protected void radioSelected(Object c) {
+ public void radioSelected(Object c) {
if (c == currentSelection)
return; // do nothing
page.execute(new RadioClickedCommand((Button)c, currentSelection));
@@ -467,17 +524,12 @@
} else if( newSelection == serverRadio ) {
if( server.getRuntime() != null &&
server.getRuntime().loadAdapter(IJBossServerRuntime.class, null) != null) {
- IJBossServerRuntime jbsrt = (IJBossServerRuntime)getServer().getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
String loc, config;
loc = config = null;
String mode = getHelper().getAttribute(IDeployableServer.SERVER_MODE, LocalPublishMethod.LOCAL_PUBLISH_METHOD);
- if( mode.equals(LocalPublishMethod.LOCAL_PUBLISH_METHOD)){
- loc = jbsrt.getConfigLocation();
- config = jbsrt.getJBossConfiguration();
- } else if( mode.equals(RSEPublishMethod.RSE_ID)) {
- loc = IConstants.SERVER;
- config = RSEUtils.getRSEConfigName(getHelper().getWorkingCopy());
- }
+ IDeploymentPageCallback cb = callbackMappings.get(mode);
+ loc = cb.getServerLocation(page.getServer());
+ config = cb.getServerConfigName(page.getServer());
newDir = new Path(loc)
.append(config)
.append(IJBossServerConstants.DEPLOY).toString();
@@ -706,16 +758,13 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
if( evt.getPropertyName().equals( IDeployableServer.SERVER_MODE)) {
- metadataRadio.setEnabled(evt.getNewValue().equals(LocalPublishMethod.LOCAL_PUBLISH_METHOD));
+ String mode = page.getServer().getAttribute(IDeployableServer.SERVER_MODE, LocalPublishMethod.LOCAL_PUBLISH_METHOD);
+ metadataRadio.setEnabled(callbackMappings.get(mode).metadataEnabled());
String originalDeployLocation = page.getServer().getOriginal().getAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_CUSTOM);
String wcDeployLocation = page.getServer().getAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_CUSTOM);
if(!metadataRadio.isEnabled() && metadataRadio.getSelection()) {
page.execute(new RadioClickedCommand(serverRadio, currentSelection));
}
- } else if( serverRadio.getSelection() && (
- evt.getPropertyName().equals( RSEUtils.RSE_SERVER_CONFIG) ||
- evt.getPropertyName().equals( RSEUtils.RSE_SERVER_HOME_DIR))) {
- page.execute(new RadioClickedCommand(serverRadio, currentSelection));
- }
+ }
}
}
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2010-08-10 18:50:48 UTC (rev 24031)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2010-08-11 08:41:16 UTC (rev 24032)
@@ -585,12 +585,4 @@
typeIds="%AllJBossServerTypes">
</runtimeLocator>
</extension>
- <extension
- point="org.jboss.ide.eclipse.as.ui.DeployMethodUI">
- <ui
- class="org.jboss.tools.as.rse.ui.RSEDeploymentPreferenceUI"
- deployMethodId="rse">
- </ui>
- </extension>
-
</plugin>
More information about the jbosstools-commits
mailing list