JBoss Tools SVN: r21671 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ssh: src and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-04-25 18:36:20 -0400 (Sun, 25 Apr 2010)
New Revision: 21671
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
Log:
undo bad commit in r21670
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh)
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.ide.eclipse.as.ssh.Messages"; //$NON-NLS-1$
-
- public static String browse;
- public static String UserLabel;
- public static String PassLabel;
- public static String DeployRootFolder;
- public static String HostsLabel;
- public static String EditorZipDeployments;
- public static String EditorSetDeployCommandLabel;
- public static String SCPDeploymentSectionTitle;
- public static String SCPDeploymentDescription;
- public static String EditorSetUserCommandLabel;
- public static String EditorSetPasswordCommandLabel;
- public static String SCPServerDescription;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
- private Messages() {
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.ide.eclipse.as.ssh.Messages"; //$NON-NLS-1$
+
+ public static String browse;
+ public static String UserLabel;
+ public static String PassLabel;
+ public static String DeployRootFolder;
+ public static String HostsLabel;
+ public static String EditorZipDeployments;
+ public static String EditorSetDeployCommandLabel;
+ public static String SCPDeploymentSectionTitle;
+ public static String SCPDeploymentDescription;
+ public static String EditorSetUserCommandLabel;
+ public static String EditorSetPasswordCommandLabel;
+ public static String SCPServerDescription;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+ private Messages() {
+ }
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,12 +0,0 @@
-browse=Browse...
-UserLabel=Username
-PassLabel=Password
-HostsLabel=SSH Hosts File
-DeployRootFolder=Deployment Folder
-EditorZipDeployments=Deploy projects as compressed archives
-EditorSetUserCommandLabel=Set Username
-EditorSetPasswordCommandLabel=Set Password
-EditorSetDeployCommandLabel=Set Remote Deployment Folder
-SCPDeploymentSectionTitle=SCP Deployment
-SCPDeploymentDescription=Deploy your modules via SCP file transfer
-SCPServerDescription=A server which allows remote deployment via SCP
\ No newline at end of file
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,12 @@
+browse=Browse...
+UserLabel=Username
+PassLabel=Password
+HostsLabel=SSH Hosts File
+DeployRootFolder=Deployment Folder
+EditorZipDeployments=Deploy projects as compressed archives
+EditorSetUserCommandLabel=Set Username
+EditorSetPasswordCommandLabel=Set Password
+EditorSetDeployCommandLabel=Set Remote Deployment Folder
+SCPDeploymentSectionTitle=SCP Deployment
+SCPDeploymentDescription=Deploy your modules via SCP file transfer
+SCPServerDescription=A server which allows remote deployment via SCP
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class SSHDeploymentPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.ssh";
-
- // The shared instance
- private static SSHDeploymentPlugin plugin;
-
- /**
- * The constructor
- */
- public SSHDeploymentPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static SSHDeploymentPlugin getDefault() {
- return plugin;
- }
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SSHDeploymentPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.ssh";
+
+ // The shared instance
+ private static SSHDeploymentPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public SSHDeploymentPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static SSHDeploymentPlugin getDefault() {
+ return plugin;
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server)
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-public interface ISSHDeploymentConstants {
- public static final String HOSTS_FILE = "org.jboss.ide.eclipse.as.ssh.server.hostsFile"; //$NON-NLS-1$
- public static final String DEPLOY_DIRECTORY = "org.jboss.ide.eclipse.as.ssh.server.deployDirectory"; //$NON-NLS-1$
- public static final String USERNAME = "org.jboss.ide.eclipse.as.ssh.server.username"; //$NON-NLS-1$
- public static final String PASSWORD = "org.jboss.ide.eclipse.as.ssh.server.password"; //$NON-NLS-1$
- public static final String ZIP_DEPLOYMENTS_PREF = "org.jboss.ide.eclipse.as.ssh.server.zipDeploymentsPreference"; //$NON-NLS-1$
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+public interface ISSHDeploymentConstants {
+ public static final String HOSTS_FILE = "org.jboss.ide.eclipse.as.ssh.server.hostsFile"; //$NON-NLS-1$
+ public static final String DEPLOY_DIRECTORY = "org.jboss.ide.eclipse.as.ssh.server.deployDirectory"; //$NON-NLS-1$
+ public static final String USERNAME = "org.jboss.ide.eclipse.as.ssh.server.username"; //$NON-NLS-1$
+ public static final String PASSWORD = "org.jboss.ide.eclipse.as.ssh.server.password"; //$NON-NLS-1$
+ public static final String ZIP_DEPLOYMENTS_PREF = "org.jboss.ide.eclipse.as.ssh.server.zipDeploymentsPreference"; //$NON-NLS-1$
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,149 +0,0 @@
-package org.jboss.ide.eclipse.as.ssh.server;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-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.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
-import org.jboss.ide.eclipse.archives.webtools.Messages;
-import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory;
-import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.PackagedModuleDelegate;
-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.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.ssh.server.SSHPublisher.SSHCopyCallback;
-import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
-
-public class SSHPackagesPublisher implements IJBossServerPublisher {
-
- protected IDeployableServer server;
- protected IModuleResourceDelta[] delta;
- protected ArrayList<IStatus> statuses = new ArrayList<IStatus>();
- protected SSHPublishMethod method;
- public SSHPackagesPublisher() {
- }
-
- public int getPublishState() {
- return IServer.PUBLISH_STATE_NONE;
- }
-
- public boolean accepts(String method, IServer server, IModule[] module) {
- if( SSHPublishMethod.SSH_PUBLISH_METHOD.equals(method) && module != null && module.length > 0
- && PackageModuleFactory.MODULE_TYPE.equals(module[0].getModuleType().getId()))
- return true;
- return false;
- }
- public IStatus publishModule(
- IJBossServerPublishMethod method,
- IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta,
- IProgressMonitor monitor)
- throws CoreException {
- this.method = (SSHPublishMethod)method;
- this.server = ServerConverter.getDeployableServer(server);
- this.delta = delta;
- IModule module2 = module[0];
-
- try {
- // if it's being removed
- if( publishType == REMOVE_PUBLISH ) {
- statuses.addAll(Arrays.asList(removeModule(module2, monitor)));
- } else if( publishType == FULL_PUBLISH ) {
- statuses.addAll(Arrays.asList(publishModule(module2, false, monitor)));
- } else if( publishType == INCREMENTAL_PUBLISH ) {
- statuses.addAll(Arrays.asList(publishModule(module2, true, monitor)));
- }
- }catch(Exception e) {
- e.printStackTrace();
- IStatus status = new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID,
- NLS.bind(Messages.ErrorDuringPublish, module2.getName()), e);
- return status;
- }
-
- if( statuses.size() > 0 ) {
- MultiStatus ms = new MultiStatus(IntegrationPlugin.PLUGIN_ID, IStatus.ERROR,
- NLS.bind(Messages.ErrorDuringPublish, module2.getName()), null);
- for( int i = 0; i < statuses.size(); i++ ) {
- ms.add(statuses.get(i));
- }
- return ms;
- }
-
- IStatus ret = new Status(IStatus.OK, IntegrationPlugin.PLUGIN_ID,
- NLS.bind(Messages.PublishSuccessful, module2.getName()));
- return ret;
- }
-
- protected IStatus[] removeModule(IModule module, IProgressMonitor monitor) {
- IArchive pack = getPackage(module);
- // remove all of the deployed items
- if( pack != null ) {
- IPath sourcePath = pack.getArchiveFilePath();
- String deployFolder = getRemoteDeployFolder(server.getServer());
- String deployFile = new Path(deployFolder).append(sourcePath.lastSegment()).toString();
- try {
- SSHZippedJSTPublisher.launchRemoveCommand(method.getSession(), deployFile, monitor);
- } catch( CoreException ce ) {
- return new IStatus[] { ce.getStatus() };
- }
- }
- return new IStatus[] { }; // nothing to report
- }
-
-
-
- protected IStatus[] publishModule(IModule module, boolean incremental, IProgressMonitor monitor) {
- IArchive pack = getPackage(module);
- IPath sourcePath = pack.getArchiveFilePath();
- String remoteContainer = getRemoteDeployFolder(server.getServer());
- IPath remoteRoot = new Path(remoteContainer).append(sourcePath.lastSegment());
-
- try {
- if( !pack.isExploded() ) {
- // copy the output file
- SSHZippedJSTPublisher.launchCommand(method.getSession(), "rm -rf " + remoteRoot.toString(), monitor);
- SSHZippedJSTPublisher.launchCopyCommand(method.getSession(), sourcePath.toOSString(), remoteRoot.toString(), monitor);
- } else {
- if( incremental ) {
- SSHCopyCallback callback = new SSHCopyCallback(remoteRoot, method);
- PublishCopyUtil util = new PublishCopyUtil(callback);
- return util.publishDelta(delta, monitor);
- } else {
- SSHZippedJSTPublisher.launchCommand(method.getSession(), "rm -rf " + remoteRoot.toString(), monitor);
- IModuleResource[] members = PublishUtil.getResources(module);
- SSHCopyCallback callback = new SSHCopyCallback(remoteRoot, method);
- PublishCopyUtil util = new PublishCopyUtil(callback);
- return util.publishFull(members, monitor);
- }
- }
- } catch( CoreException ce ) {
- return new IStatus[] { ce.getStatus() };
- }
- return new IStatus[] { };
- }
-
- protected IArchive getPackage(IModule module) {
- PackagedModuleDelegate delegate = (PackagedModuleDelegate)module.loadAdapter(PackagedModuleDelegate.class, new NullProgressMonitor());
- return delegate == null ? null : delegate.getPackage();
- }
- protected String getRemoteDeployFolder(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
- }
-}
\ No newline at end of file
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPackagesPublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,149 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+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.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
+import org.jboss.ide.eclipse.archives.webtools.Messages;
+import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory;
+import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.PackagedModuleDelegate;
+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.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ssh.server.SSHPublisher.SSHCopyCallback;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+
+public class SSHPackagesPublisher implements IJBossServerPublisher {
+
+ protected IDeployableServer server;
+ protected IModuleResourceDelta[] delta;
+ protected ArrayList<IStatus> statuses = new ArrayList<IStatus>();
+ protected SSHPublishMethod method;
+ public SSHPackagesPublisher() {
+ }
+
+ public int getPublishState() {
+ return IServer.PUBLISH_STATE_NONE;
+ }
+
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( SSHPublishMethod.SSH_PUBLISH_METHOD.equals(method) && module != null && module.length > 0
+ && PackageModuleFactory.MODULE_TYPE.equals(module[0].getModuleType().getId()))
+ return true;
+ return false;
+ }
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor)
+ throws CoreException {
+ this.method = (SSHPublishMethod)method;
+ this.server = ServerConverter.getDeployableServer(server);
+ this.delta = delta;
+ IModule module2 = module[0];
+
+ try {
+ // if it's being removed
+ if( publishType == REMOVE_PUBLISH ) {
+ statuses.addAll(Arrays.asList(removeModule(module2, monitor)));
+ } else if( publishType == FULL_PUBLISH ) {
+ statuses.addAll(Arrays.asList(publishModule(module2, false, monitor)));
+ } else if( publishType == INCREMENTAL_PUBLISH ) {
+ statuses.addAll(Arrays.asList(publishModule(module2, true, monitor)));
+ }
+ }catch(Exception e) {
+ e.printStackTrace();
+ IStatus status = new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID,
+ NLS.bind(Messages.ErrorDuringPublish, module2.getName()), e);
+ return status;
+ }
+
+ if( statuses.size() > 0 ) {
+ MultiStatus ms = new MultiStatus(IntegrationPlugin.PLUGIN_ID, IStatus.ERROR,
+ NLS.bind(Messages.ErrorDuringPublish, module2.getName()), null);
+ for( int i = 0; i < statuses.size(); i++ ) {
+ ms.add(statuses.get(i));
+ }
+ return ms;
+ }
+
+ IStatus ret = new Status(IStatus.OK, IntegrationPlugin.PLUGIN_ID,
+ NLS.bind(Messages.PublishSuccessful, module2.getName()));
+ return ret;
+ }
+
+ protected IStatus[] removeModule(IModule module, IProgressMonitor monitor) {
+ IArchive pack = getPackage(module);
+ // remove all of the deployed items
+ if( pack != null ) {
+ IPath sourcePath = pack.getArchiveFilePath();
+ String deployFolder = getRemoteDeployFolder(server.getServer());
+ String deployFile = new Path(deployFolder).append(sourcePath.lastSegment()).toString();
+ try {
+ SSHZippedJSTPublisher.launchRemoveCommand(method.getSession(), deployFile, monitor);
+ } catch( CoreException ce ) {
+ return new IStatus[] { ce.getStatus() };
+ }
+ }
+ return new IStatus[] { }; // nothing to report
+ }
+
+
+
+ protected IStatus[] publishModule(IModule module, boolean incremental, IProgressMonitor monitor) {
+ IArchive pack = getPackage(module);
+ IPath sourcePath = pack.getArchiveFilePath();
+ String remoteContainer = getRemoteDeployFolder(server.getServer());
+ IPath remoteRoot = new Path(remoteContainer).append(sourcePath.lastSegment());
+
+ try {
+ if( !pack.isExploded() ) {
+ // copy the output file
+ SSHZippedJSTPublisher.launchCommand(method.getSession(), "rm -rf " + remoteRoot.toString(), monitor);
+ SSHZippedJSTPublisher.launchCopyCommand(method.getSession(), sourcePath.toOSString(), remoteRoot.toString(), monitor);
+ } else {
+ if( incremental ) {
+ SSHCopyCallback callback = new SSHCopyCallback(remoteRoot, method);
+ PublishCopyUtil util = new PublishCopyUtil(callback);
+ return util.publishDelta(delta, monitor);
+ } else {
+ SSHZippedJSTPublisher.launchCommand(method.getSession(), "rm -rf " + remoteRoot.toString(), monitor);
+ IModuleResource[] members = PublishUtil.getResources(module);
+ SSHCopyCallback callback = new SSHCopyCallback(remoteRoot, method);
+ PublishCopyUtil util = new PublishCopyUtil(callback);
+ return util.publishFull(members, monitor);
+ }
+ }
+ } catch( CoreException ce ) {
+ return new IStatus[] { ce.getStatus() };
+ }
+ return new IStatus[] { };
+ }
+
+ protected IArchive getPackage(IModule module) {
+ PackagedModuleDelegate delegate = (PackagedModuleDelegate)module.loadAdapter(PackagedModuleDelegate.class, new NullProgressMonitor());
+ return delegate == null ? null : delegate.getPackage();
+ }
+ protected String getRemoteDeployFolder(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
+ }
+}
\ No newline at end of file
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jsch.internal.core.JSchCorePlugin;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
-
-public class SSHPublishUtil {
- public static boolean getZipsSSHDeployments(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
- }
- public static String getDeployDir(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, "/home");
- }
-
- public static String getUser(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.USERNAME, "username");
- }
-
- public static String getPass(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.PASSWORD, "password");
- }
-
- public static String getHostsFile(IServer server) {
- Preferences jschPrefs = JSchCorePlugin.getPlugin().getPluginPreferences();
- String sshHome = jschPrefs.getDefaultString(org.eclipse.jsch.internal.core.IConstants.KEY_SSH2HOME);
- sshHome += Path.SEPARATOR + "known_hosts";
- return ((Server)server).getAttribute(ISSHDeploymentConstants.HOSTS_FILE,
- sshHome);
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jsch.internal.core.JSchCorePlugin;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+
+public class SSHPublishUtil {
+ public static boolean getZipsSSHDeployments(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
+ }
+ public static String getDeployDir(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, "/home");
+ }
+
+ public static String getUser(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.USERNAME, "username");
+ }
+
+ public static String getPass(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.PASSWORD, "password");
+ }
+
+ public static String getHostsFile(IServer server) {
+ Preferences jschPrefs = JSchCorePlugin.getPlugin().getPluginPreferences();
+ String sshHome = jschPrefs.getDefaultString(org.eclipse.jsch.internal.core.IConstants.KEY_SSH2HOME);
+ sshHome += Path.SEPARATOR + "known_hosts";
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.HOSTS_FILE,
+ sshHome);
+ }
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-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.componentcore.ModuleCoreNature;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-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.server.xpl.PublishCopyUtil.LocalCopyCallback;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
-import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
-
-import com.jcraft.jsch.Session;
-
-public class SSHPublisher implements IJBossServerPublisher {
- protected IModuleResourceDelta[] delta;
- protected IDeployableServer server;
- protected int publishState = IServer.PUBLISH_STATE_NONE;
- protected SSHPublishMethod publishMethod;
-
- public SSHPublisher() {}
-
- public boolean accepts(String method, IServer server, IModule[] module) {
- if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
- return false;
- if( module == null )
- return true;
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- boolean shouldAccept = ds != null
- && ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && !SSHPublishUtil.getZipsSSHDeployments(server);
- return shouldAccept;
- }
-
- public int getPublishState() {
- return publishState;
- }
-
- 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 = (SSHPublishMethod)method;
-
- boolean deleted = false;
- for( int i = 0; i < module.length; i++ ) {
- if( module[i].isExternal() )
- deleted = true;
- }
-
- if (publishType == REMOVE_PUBLISH ) {
- status = unpublish(this.server, module, monitor);
- } else {
- if( deleted ) {
- publishState = IServer.PUBLISH_STATE_UNKNOWN;
- } else {
- if (publishType == FULL_PUBLISH ) {
- status = fullPublish(module, module[module.length-1], monitor);
- } else if (publishType == INCREMENTAL_PUBLISH) {
- status = incrementalPublish(module, module[module.length-1], monitor);
- }
- }
- }
- return status;
- }
-
- protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
- IPath remoteDeployPath = getDeployPath(moduleTree, server);
- IModuleResource[] members = PublishUtil.getResources(module);
-
- // 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 ))
- SSHZippedJSTPublisher.launchCommand(publishMethod.getSession(), "rm -rf " + remoteDeployPath.toString(), monitor);
-
- ArrayList<IStatus> list = new ArrayList<IStatus>();
-
- if( !PublishUtil.deployPackaged(moduleTree) && !PublishUtil.isBinaryObject(moduleTree)) {
- SSHCopyCallback callback = new SSHCopyCallback(remoteDeployPath, publishMethod);
- PublishCopyUtil util = new PublishCopyUtil(callback);
- list.addAll(Arrays.asList(util.publishFull(members, monitor)));
- }
- else if( PublishUtil.isBinaryObject(moduleTree))
- list.addAll(Arrays.asList(copyBinaryModule(moduleTree, monitor)));
- else {
- IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
- append(IJBossServerConstants.DEPLOY).makeAbsolute();
- try {
- File temp = deployRoot.toFile().createTempFile(module.getName(), ".tmp", deployRoot.toFile());
- IPath tempFile = new Path(temp.getAbsolutePath());
- list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
- mkdirAndCopy(publishMethod.getSession(), tempFile.toString(), remoteDeployPath.toString());
- } catch( IOException ioe) {
- list.add(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, ioe.getMessage(), ioe));
- }
- }
-
- if( list.size() > 0 )
- return createMultiStatus(list, module);
- return Status.OK_STATUS;
- }
-
- protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
- IStatus[] results = new IStatus[] {};
- IPath remoteDeployPath = getDeployPath(moduleTree, server);
- if( !PublishUtil.deployPackaged(moduleTree) && !PublishUtil.isBinaryObject(moduleTree)) {
- SSHCopyCallback handler = new SSHCopyCallback(remoteDeployPath, publishMethod);
- results = new PublishCopyUtil(handler).publishDelta(delta, monitor);
- } else if( delta.length > 0 ) {
- if( PublishUtil.isBinaryObject(moduleTree))
- results = copyBinaryModule(moduleTree, monitor);
- else {
- IPath localDeployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
- append(IJBossServerConstants.DEPLOY).makeAbsolute();
- try {
- File temp = localDeployRoot.toFile().createTempFile(module.getName(), ".tmp", localDeployRoot.toFile());
- IPath tempFile = new Path(temp.getAbsolutePath());
- PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile);
- mkdirAndCopy(publishMethod.getSession(), tempFile.toString(), remoteDeployPath.toString());
- } catch( IOException ioe) {
- IStatus s = new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, ioe.getMessage(), ioe);
- results = new IStatus[] { s };
- }
- }
- }
-
- 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) {
- try {
- IPath remoteDeployPath = getDeployPath(moduleTree, server);
- IModuleResource[] members = PublishUtil.getResources(moduleTree);
- File source = PublishUtil.getFile(members[0]);
- if( source != null ) {
- SSHZippedJSTPublisher.launchCopyCommand(publishMethod.getSession(), source.toString(), remoteDeployPath.toString(), monitor);
- } 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()};
- }
- return new IStatus[]{Status.OK_STATUS};
- }
-
- protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
- IProgressMonitor monitor) throws CoreException {
- IPath remotePath = getDeployPath(module, server);
- SSHZippedJSTPublisher.launchCommand(publishMethod.getSession(), "rm -rf " + remotePath.toString(), monitor);
- return Status.OK_STATUS;
- }
-
- public static IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
- return PublishUtil.getDeployPath(moduleTree, getRemoteDeployFolder(server.getServer()));
- }
-
- public static String getRemoteDeployFolder(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
- }
-
- public static void mkdirAndCopy(Session session, String localFile, String remoteFile) throws CoreException {
- String parentFolder = new Path(remoteFile).removeLastSegments(1).toString();
- SSHZippedJSTPublisher.launchCommand(session, "mkdir -p " + parentFolder, new NullProgressMonitor());
- SSHZippedJSTPublisher.launchCopyCommand(session, localFile, remoteFile, new NullProgressMonitor());
- }
-
- public static class SSHCopyCallback implements IPublishCopyCallbackHandler {
-
- private IPath root;
- private SSHPublishMethod method;
- public SSHCopyCallback(IPath deployRoot, SSHPublishMethod method) {
- this.root = deployRoot;
- this.method = method;
- }
-
- public IStatus[] copyFile(IModuleFile mf, IPath path,
- IProgressMonitor monitor) throws CoreException {
- File sourceFile = PublishUtil.getFile(mf);
- IPath destination = root.append(path);
- mkdirAndCopy(method.getSession(), sourceFile.getAbsolutePath(), destination.toString());
- return new IStatus[]{};
- }
-
- public IStatus[] deleteResource(IPath path, IProgressMonitor monitor) {
- IPath remotePath = root.append(path);
- try {
- SSHZippedJSTPublisher.launchCommand(method.getSession(), "rm -rf " + remotePath.toString(), monitor);
- } catch( CoreException ce ) {
- return new IStatus[]{ce.getStatus()};
- }
- return new IStatus[] {};
- }
-
- public IStatus[] makeDirectoryIfRequired(IPath dir, IProgressMonitor monitor) {
- IPath remotePath = root.append(dir);
- try {
- SSHZippedJSTPublisher.launchCommand(method.getSession(), "mkdir -p " + remotePath.toString(), monitor);
- } catch( CoreException ce ) {
- return new IStatus[]{ce.getStatus()};
- }
- return new IStatus[] {};
- }
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+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.componentcore.ModuleCoreNature;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+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.server.xpl.PublishCopyUtil.LocalCopyCallback;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+
+import com.jcraft.jsch.Session;
+
+public class SSHPublisher implements IJBossServerPublisher {
+ protected IModuleResourceDelta[] delta;
+ protected IDeployableServer server;
+ protected int publishState = IServer.PUBLISH_STATE_NONE;
+ protected SSHPublishMethod publishMethod;
+
+ public SSHPublisher() {}
+
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
+ return false;
+ if( module == null )
+ return true;
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean shouldAccept = ds != null
+ && ModuleCoreNature.isFlexibleProject(module[0].getProject())
+ && !SSHPublishUtil.getZipsSSHDeployments(server);
+ return shouldAccept;
+ }
+
+ public int getPublishState() {
+ return publishState;
+ }
+
+ 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 = (SSHPublishMethod)method;
+
+ boolean deleted = false;
+ for( int i = 0; i < module.length; i++ ) {
+ if( module[i].isExternal() )
+ deleted = true;
+ }
+
+ if (publishType == REMOVE_PUBLISH ) {
+ status = unpublish(this.server, module, monitor);
+ } else {
+ if( deleted ) {
+ publishState = IServer.PUBLISH_STATE_UNKNOWN;
+ } else {
+ if (publishType == FULL_PUBLISH ) {
+ status = fullPublish(module, module[module.length-1], monitor);
+ } else if (publishType == INCREMENTAL_PUBLISH) {
+ status = incrementalPublish(module, module[module.length-1], monitor);
+ }
+ }
+ }
+ return status;
+ }
+
+ protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
+ IPath remoteDeployPath = getDeployPath(moduleTree, server);
+ IModuleResource[] members = PublishUtil.getResources(module);
+
+ // 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 ))
+ SSHZippedJSTPublisher.launchCommand(publishMethod.getSession(), "rm -rf " + remoteDeployPath.toString(), monitor);
+
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
+
+ if( !PublishUtil.deployPackaged(moduleTree) && !PublishUtil.isBinaryObject(moduleTree)) {
+ SSHCopyCallback callback = new SSHCopyCallback(remoteDeployPath, publishMethod);
+ PublishCopyUtil util = new PublishCopyUtil(callback);
+ list.addAll(Arrays.asList(util.publishFull(members, monitor)));
+ }
+ else if( PublishUtil.isBinaryObject(moduleTree))
+ list.addAll(Arrays.asList(copyBinaryModule(moduleTree, monitor)));
+ else {
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
+ append(IJBossServerConstants.DEPLOY).makeAbsolute();
+ try {
+ File temp = deployRoot.toFile().createTempFile(module.getName(), ".tmp", deployRoot.toFile());
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
+ mkdirAndCopy(publishMethod.getSession(), tempFile.toString(), remoteDeployPath.toString());
+ } catch( IOException ioe) {
+ list.add(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, ioe.getMessage(), ioe));
+ }
+ }
+
+ if( list.size() > 0 )
+ return createMultiStatus(list, module);
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
+ IStatus[] results = new IStatus[] {};
+ IPath remoteDeployPath = getDeployPath(moduleTree, server);
+ if( !PublishUtil.deployPackaged(moduleTree) && !PublishUtil.isBinaryObject(moduleTree)) {
+ SSHCopyCallback handler = new SSHCopyCallback(remoteDeployPath, publishMethod);
+ results = new PublishCopyUtil(handler).publishDelta(delta, monitor);
+ } else if( delta.length > 0 ) {
+ if( PublishUtil.isBinaryObject(moduleTree))
+ results = copyBinaryModule(moduleTree, monitor);
+ else {
+ IPath localDeployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
+ append(IJBossServerConstants.DEPLOY).makeAbsolute();
+ try {
+ File temp = localDeployRoot.toFile().createTempFile(module.getName(), ".tmp", localDeployRoot.toFile());
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile);
+ mkdirAndCopy(publishMethod.getSession(), tempFile.toString(), remoteDeployPath.toString());
+ } catch( IOException ioe) {
+ IStatus s = new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, ioe.getMessage(), ioe);
+ results = new IStatus[] { s };
+ }
+ }
+ }
+
+ 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) {
+ try {
+ IPath remoteDeployPath = getDeployPath(moduleTree, server);
+ IModuleResource[] members = PublishUtil.getResources(moduleTree);
+ File source = PublishUtil.getFile(members[0]);
+ if( source != null ) {
+ SSHZippedJSTPublisher.launchCopyCommand(publishMethod.getSession(), source.toString(), remoteDeployPath.toString(), monitor);
+ } 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()};
+ }
+ return new IStatus[]{Status.OK_STATUS};
+ }
+
+ protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
+ IProgressMonitor monitor) throws CoreException {
+ IPath remotePath = getDeployPath(module, server);
+ SSHZippedJSTPublisher.launchCommand(publishMethod.getSession(), "rm -rf " + remotePath.toString(), monitor);
+ return Status.OK_STATUS;
+ }
+
+ public static IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
+ return PublishUtil.getDeployPath(moduleTree, getRemoteDeployFolder(server.getServer()));
+ }
+
+ public static String getRemoteDeployFolder(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
+ }
+
+ public static void mkdirAndCopy(Session session, String localFile, String remoteFile) throws CoreException {
+ String parentFolder = new Path(remoteFile).removeLastSegments(1).toString();
+ SSHZippedJSTPublisher.launchCommand(session, "mkdir -p " + parentFolder, new NullProgressMonitor());
+ SSHZippedJSTPublisher.launchCopyCommand(session, localFile, remoteFile, new NullProgressMonitor());
+ }
+
+ public static class SSHCopyCallback implements IPublishCopyCallbackHandler {
+
+ private IPath root;
+ private SSHPublishMethod method;
+ public SSHCopyCallback(IPath deployRoot, SSHPublishMethod method) {
+ this.root = deployRoot;
+ this.method = method;
+ }
+
+ public IStatus[] copyFile(IModuleFile mf, IPath path,
+ IProgressMonitor monitor) throws CoreException {
+ File sourceFile = PublishUtil.getFile(mf);
+ IPath destination = root.append(path);
+ mkdirAndCopy(method.getSession(), sourceFile.getAbsolutePath(), destination.toString());
+ return new IStatus[]{};
+ }
+
+ public IStatus[] deleteResource(IPath path, IProgressMonitor monitor) {
+ IPath remotePath = root.append(path);
+ try {
+ SSHZippedJSTPublisher.launchCommand(method.getSession(), "rm -rf " + remotePath.toString(), monitor);
+ } catch( CoreException ce ) {
+ return new IStatus[]{ce.getStatus()};
+ }
+ return new IStatus[] {};
+ }
+
+ public IStatus[] makeDirectoryIfRequired(IPath dir, IProgressMonitor monitor) {
+ IPath remotePath = root.append(dir);
+ try {
+ SSHZippedJSTPublisher.launchCommand(method.getSession(), "mkdir -p " + remotePath.toString(), monitor);
+ } catch( CoreException ce ) {
+ return new IStatus[]{ce.getStatus()};
+ }
+ return new IStatus[] {};
+ }
+ }
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
-import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UserInfo;
-
-public class SSHServerBehaviourDelegate extends DeployableServerBehavior {
-
- public SSHServerBehaviourDelegate() {
- super();
- }
-
- @Override
- public void stop(boolean force) {
- setServerState(IServer.STATE_STOPPED);
- }
-
- protected IJBossServerPublishMethod createPublishMethod() {
- return new SSHPublishMethod(); // TODO FIX THIS in superclass
- }
-
- public class SSHPublishMethod extends LocalPublishMethod {
- public static final String SSH_PUBLISH_METHOD = "ssh"; //$NON-NLS-1$
-
- @Override
- public String getPublishMethodId() {
- return SSH_PUBLISH_METHOD;
- }
-
- private Session session;
- public Session getSession() {
- return session;
- }
-
- @Override
- public void publishStart(DeployableServerBehavior behaviour,
- IProgressMonitor monitor) throws CoreException {
-
- try {
- ServerUserInfo info = new ServerUserInfo(getServer());
- JSch jsch = new JSch();
- session = jsch.getSession(info.getUser(), behaviour.getServer().getHost(), 22);
- jsch.setKnownHosts(info.getHostsFile());
- session.setUserInfo(info);
- session.connect();
- } catch( JSchException jsche) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, "Remote Authentication Error", jsche));
- }
- }
-
- @Override
- public int publishFinish(DeployableServerBehavior behaviour,
- IProgressMonitor monitor) throws CoreException {
- int ret = super.publishFinish(behaviour, monitor);
- if( session != null )
- session.disconnect();
- session = null;
- return ret;
- }
- }
-
-
- public static class ServerUserInfo implements UserInfo {
- private String user;
- private String password;
- private String hostsFile;
- public ServerUserInfo(IServer server) {
- IServer tmp = ServerCore.findServer(server.getId());
- String tmp_pass = SSHPublishUtil.getPass(tmp);
- user = SSHPublishUtil.getUser(server);
- password = SSHPublishUtil.getPass(server);
- hostsFile = SSHPublishUtil.getHostsFile(server);
- }
- public String getPassword() {
- return password;
- }
-
- public String getUser() {
- return user;
- }
-
- public String getHostsFile() {
- return hostsFile;
- }
-
- public String getPassphrase() {
- return null;
- }
-
- public boolean promptPassphrase(String message) {
- return true;
- }
-
- public boolean promptPassword(String message) {
- return true;
- }
-
- public void showMessage(String message) {
- // TODO eh?
- }
-
- public boolean promptYesNo(String message) {
- // TODO Auto-generated method stub
- return false;
- }
- }
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.UserInfo;
+
+public class SSHServerBehaviourDelegate extends DeployableServerBehavior {
+
+ public SSHServerBehaviourDelegate() {
+ super();
+ }
+
+ @Override
+ public void stop(boolean force) {
+ setServerState(IServer.STATE_STOPPED);
+ }
+
+ protected IJBossServerPublishMethod createPublishMethod() {
+ return new SSHPublishMethod(); // TODO FIX THIS in superclass
+ }
+
+ public class SSHPublishMethod extends LocalPublishMethod {
+ public static final String SSH_PUBLISH_METHOD = "ssh"; //$NON-NLS-1$
+
+ @Override
+ public String getPublishMethodId() {
+ return SSH_PUBLISH_METHOD;
+ }
+
+ private Session session;
+ public Session getSession() {
+ return session;
+ }
+
+ @Override
+ public void publishStart(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+
+ try {
+ ServerUserInfo info = new ServerUserInfo(getServer());
+ JSch jsch = new JSch();
+ session = jsch.getSession(info.getUser(), behaviour.getServer().getHost(), 22);
+ jsch.setKnownHosts(info.getHostsFile());
+ session.setUserInfo(info);
+ session.connect();
+ } catch( JSchException jsche) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, "Remote Authentication Error", jsche));
+ }
+ }
+
+ @Override
+ public int publishFinish(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+ int ret = super.publishFinish(behaviour, monitor);
+ if( session != null )
+ session.disconnect();
+ session = null;
+ return ret;
+ }
+ }
+
+
+ public static class ServerUserInfo implements UserInfo {
+ private String user;
+ private String password;
+ private String hostsFile;
+ public ServerUserInfo(IServer server) {
+ IServer tmp = ServerCore.findServer(server.getId());
+ String tmp_pass = SSHPublishUtil.getPass(tmp);
+ user = SSHPublishUtil.getUser(server);
+ password = SSHPublishUtil.getPass(server);
+ hostsFile = SSHPublishUtil.getHostsFile(server);
+ }
+ public String getPassword() {
+ return password;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getHostsFile() {
+ return hostsFile;
+ }
+
+ public String getPassphrase() {
+ return null;
+ }
+
+ public boolean promptPassphrase(String message) {
+ return true;
+ }
+
+ public boolean promptPassword(String message) {
+ return true;
+ }
+
+ public void showMessage(String message) {
+ // TODO eh?
+ }
+
+ public boolean promptYesNo(String message) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ }
+
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
-
-public class SSHServerDelegate extends DeployableServer {
-
- public SSHServerDelegate() {
- super();
- }
-
- public IJBossServerRuntime getRuntime() {
- return null;
- }
-
- public String getUsername() {
- return getAttribute(ISSHDeploymentConstants.USERNAME, (String)null);
- }
- public String getPassword() {
- return getAttribute(ISSHDeploymentConstants.PASSWORD, (String)null);
- }
- public String getHostsFile() {
- return getAttribute(ISSHDeploymentConstants.HOSTS_FILE, (String)null);
- }
- public String getDeployFolder() {
- return getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
- }
-
- public void setUsername(String user) {
- setAttribute(ISSHDeploymentConstants.USERNAME, user);
- }
- public void setPassword(String pass) {
- setAttribute(ISSHDeploymentConstants.PASSWORD, pass);
- }
- public void setHostsFile(String file) {
- setAttribute(ISSHDeploymentConstants.HOSTS_FILE, file);
- }
- public void setDeployFolder(String folder) {
- setAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, folder);
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
+
+public class SSHServerDelegate extends DeployableServer {
+
+ public SSHServerDelegate() {
+ super();
+ }
+
+ public IJBossServerRuntime getRuntime() {
+ return null;
+ }
+
+ public String getUsername() {
+ return getAttribute(ISSHDeploymentConstants.USERNAME, (String)null);
+ }
+ public String getPassword() {
+ return getAttribute(ISSHDeploymentConstants.PASSWORD, (String)null);
+ }
+ public String getHostsFile() {
+ return getAttribute(ISSHDeploymentConstants.HOSTS_FILE, (String)null);
+ }
+ public String getDeployFolder() {
+ return getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
+ }
+
+ public void setUsername(String user) {
+ setAttribute(ISSHDeploymentConstants.USERNAME, user);
+ }
+ public void setPassword(String pass) {
+ setAttribute(ISSHDeploymentConstants.PASSWORD, pass);
+ }
+ public void setHostsFile(String file) {
+ setAttribute(ISSHDeploymentConstants.HOSTS_FILE, file);
+ }
+ public void setDeployFolder(String folder) {
+ setAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, folder);
+ }
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-import org.eclipse.wst.server.core.model.RuntimeDelegate;
-
-public class SSHServerRuntime extends RuntimeDelegate {
-
- public SSHServerRuntime() {
- super();
- }
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
+
+public class SSHServerRuntime extends RuntimeDelegate {
+
+ public SSHServerRuntime() {
+ super();
+ }
+
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-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.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-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.modules.SingleDeployableFactory;
-import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
-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.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
-
-public class SSHSingleFilePublisher implements IJBossServerPublisher {
-
- public SSHSingleFilePublisher() {
- }
-
- public boolean accepts(String method, IServer server, IModule[] module) {
- if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
- return false;
- if( module == null )
- return true;
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- boolean shouldAccept = ds != null
- && module.length == 1
- && module[0].getModuleType().getId().equals(SingleDeployableFactory.MODULE_TYPE);
- return shouldAccept;
- }
-
- public int getPublishState() {
- return IServer.PUBLISH_STATE_NONE;
- }
-
- private IDeployableServer server;
- private SSHPublishMethod publishMethod;
- private int publishState = IServer.PUBLISH_STATE_NONE;
- public IStatus publishModule(IJBossServerPublishMethod method,
- IServer server, IModule[] module, int publishType,
- IModuleResourceDelta[] delta, IProgressMonitor monitor)
- throws CoreException {
- this.server = ServerConverter.getDeployableServer(server);
- this.publishMethod = (SSHPublishMethod)method;
- IModule module2 = module[0];
-
- IStatus status = null;
- if(publishType == REMOVE_PUBLISH){
- status = unpublish(this.server, module2, monitor);
- } else if( publishType == FULL_PUBLISH || publishType == INCREMENTAL_PUBLISH){
- // if there's no change, do nothing. Otherwise, on change or add, re-publish
- status = publish(this.server, module2, monitor);
- }
- return status;
- }
-
- protected IStatus publish(IDeployableServer server, IModule module, IProgressMonitor monitor) {
- SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
- if( delegate != null ) {
- IPath sourcePath = delegate.getGlobalSourcePath();
- String destFolder = SSHPublisher.getRemoteDeployFolder(server.getServer());
- IPath destFile = new Path(destFolder).append(sourcePath.lastSegment());
- try {
- SSHPublisher.mkdirAndCopy(publishMethod.getSession(), sourcePath.toOSString(), destFile.toString());
- } catch( CoreException ce ) {
- return ce.getStatus();
- }
- } else {
- // error can't do nuffin, should never happen
- publishState = IServer.PUBLISH_STATE_UNKNOWN;
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus unpublish(IDeployableServer server, IModule module, IProgressMonitor monitor) throws CoreException {
- SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
- if( delegate != null ) {
- IPath sourcePath = delegate.getGlobalSourcePath();
- String destFolder = SSHPublisher.getRemoteDeployFolder(server.getServer());
- IPath destFile = new Path(destFolder).append(sourcePath.lastSegment());
- SSHZippedJSTPublisher.launchCommand(publishMethod.getSession(), "rm -rf " + destFile.toString(), monitor);
- } else {
- // deleted module. o noes. Ignore it.
- publishState = IServer.PUBLISH_STATE_UNKNOWN;
- Status status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_MNF,
- NLS.bind(Messages.DeleteModuleFail, module.getName()), null);
- return status;
- }
- Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_SUCCESS,
- NLS.bind(Messages.ModuleDeleted, module.getName()), null);
- return status;
- }
-
-
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHSingleFilePublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+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.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+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.modules.SingleDeployableFactory;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
+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.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+
+public class SSHSingleFilePublisher implements IJBossServerPublisher {
+
+ public SSHSingleFilePublisher() {
+ }
+
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
+ return false;
+ if( module == null )
+ return true;
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean shouldAccept = ds != null
+ && module.length == 1
+ && module[0].getModuleType().getId().equals(SingleDeployableFactory.MODULE_TYPE);
+ return shouldAccept;
+ }
+
+ public int getPublishState() {
+ return IServer.PUBLISH_STATE_NONE;
+ }
+
+ private IDeployableServer server;
+ private SSHPublishMethod publishMethod;
+ private int publishState = IServer.PUBLISH_STATE_NONE;
+ public IStatus publishModule(IJBossServerPublishMethod method,
+ IServer server, IModule[] module, int publishType,
+ IModuleResourceDelta[] delta, IProgressMonitor monitor)
+ throws CoreException {
+ this.server = ServerConverter.getDeployableServer(server);
+ this.publishMethod = (SSHPublishMethod)method;
+ IModule module2 = module[0];
+
+ IStatus status = null;
+ if(publishType == REMOVE_PUBLISH){
+ status = unpublish(this.server, module2, monitor);
+ } else if( publishType == FULL_PUBLISH || publishType == INCREMENTAL_PUBLISH){
+ // if there's no change, do nothing. Otherwise, on change or add, re-publish
+ status = publish(this.server, module2, monitor);
+ }
+ return status;
+ }
+
+ protected IStatus publish(IDeployableServer server, IModule module, IProgressMonitor monitor) {
+ SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
+ if( delegate != null ) {
+ IPath sourcePath = delegate.getGlobalSourcePath();
+ String destFolder = SSHPublisher.getRemoteDeployFolder(server.getServer());
+ IPath destFile = new Path(destFolder).append(sourcePath.lastSegment());
+ try {
+ SSHPublisher.mkdirAndCopy(publishMethod.getSession(), sourcePath.toOSString(), destFile.toString());
+ } catch( CoreException ce ) {
+ return ce.getStatus();
+ }
+ } else {
+ // error can't do nuffin, should never happen
+ publishState = IServer.PUBLISH_STATE_UNKNOWN;
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus unpublish(IDeployableServer server, IModule module, IProgressMonitor monitor) throws CoreException {
+ SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
+ if( delegate != null ) {
+ IPath sourcePath = delegate.getGlobalSourcePath();
+ String destFolder = SSHPublisher.getRemoteDeployFolder(server.getServer());
+ IPath destFile = new Path(destFolder).append(sourcePath.lastSegment());
+ SSHZippedJSTPublisher.launchCommand(publishMethod.getSession(), "rm -rf " + destFile.toString(), monitor);
+ } else {
+ // deleted module. o noes. Ignore it.
+ publishState = IServer.PUBLISH_STATE_UNKNOWN;
+ Status status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_MNF,
+ NLS.bind(Messages.DeleteModuleFail, module.getName()), null);
+ return status;
+ }
+ Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_SUCCESS,
+ NLS.bind(Messages.ModuleDeleted, module.getName()), null);
+ return status;
+ }
+
+
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.server;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.jboss.ide.eclipse.archives.webtools.modules.LocalZippedPublisherUtil;
-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.extensions.events.ServerLogger;
-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.util.ServerConverter;
-import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
-import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
-
-import com.jcraft.jsch.Channel;
-import com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
-
-public class SSHZippedJSTPublisher implements IJBossServerPublisher {
-
- public SSHZippedJSTPublisher() {
- }
-
- public boolean accepts(String method, IServer server, IModule[] module) {
- if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
- return false;
- if( module == null )
- return true;
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- boolean shouldAccept = ds != null
- && ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && SSHPublishUtil.getZipsSSHDeployments(server);
- return shouldAccept;
- }
-
- public int getPublishState() {
- return IServer.PUBLISH_STATE_NONE;
- }
-
- public IStatus publishModule(
- IJBossServerPublishMethod method,
- IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta,
- IProgressMonitor monitor) throws CoreException {
- // Let the local zipped publisher do the work in a local / metadata folder
- IStatus returnStatus = null;
- SSHPublishMethod method2 = (SSHPublishMethod)method;
- IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server).
- append(IJBossServerConstants.DEPLOY).makeAbsolute();
-
- LocalZippedPublisherUtil localDelegate = new LocalZippedPublisherUtil();
- IStatus localCopyStatus = localDelegate.publishModule(server,
- deployRoot.toOSString(), module, publishType, delta, monitor);
- IPath outputFilepath = localDelegate.getOutputFilePath(module);
-
- String deployFolder = getRemoteDeployFolder(server);
- String deployFile = new Path(deployFolder).append(outputFilepath.lastSegment()).toString();
-
- // Am I a removal? If yes, remove me, and return
- if( publishType == IJBossServerPublisher.REMOVE_PUBLISH) {
- launchRemoveCommand(method2.getSession(), deployFile, monitor);
- } else {
- launchCopyCommand(method2.getSession(),
- outputFilepath.toString(), deployFile, monitor);
- }
- return null;
- }
-
- protected String getRemoteDeployFolder(IServer server) {
- return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
- }
-
- public static void launchRemoveCommand(Session session, String remoteLocation, IProgressMonitor monitor) throws CoreException {
- String command = "rm " + remoteLocation;
- launchCommand(session, command, monitor);
- }
-
- public static void launchCommand(Session session, String command, IProgressMonitor monitor) throws CoreException {
- launchThreadedCommand(session, command, monitor);
- }
-
- protected static void launchThreadedCommand(final Session session, final String command, final IProgressMonitor monitor) throws CoreException {
- // thread and watch the monitor for cancelations and interrupt the thread
- LaunchRunnable r = new LaunchRunnable() { public void run() throws CoreException {
- launchCommandNoThread(session, command, monitor);
- } };
- launchThreadedCommand(r, monitor);
- }
-
- protected static void launchCommandNoThread(Session session, String command, IProgressMonitor monitor) throws CoreException {
- Channel channel = null;
- try {
- channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- channel.connect();
- while(!channel.isClosed()) {
- try {Thread.sleep(300);} catch(InterruptedException ie) {}
- }
- } catch( JSchException jsche ) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error executing command: " + command, null));
- } finally {
- channel.disconnect();
- }
- }
-
- public static class LaunchRunnable {
- public void run() throws CoreException {
- }
- }
-
- public static void launchCopyCommand(final Session session, final String localFile,
- final String remoteFile, final IProgressMonitor monitor) throws CoreException {
- // thread and watch the monitor for cancelations and interrupt the thread
- LaunchRunnable r = new LaunchRunnable() { public void run() throws CoreException {
- launchCopyCommandImpl(session, localFile, remoteFile, monitor);
- } };
- launchThreadedCommand(r, monitor);
- }
-
- protected static void launchThreadedCommand(final LaunchRunnable runnable, IProgressMonitor monitor) throws CoreException {
- final Exception[] e = new Exception[1];
- e[0] = null;
- final Object waitObject = new Object();
- final Boolean[] subtaskComplete = new Boolean[1];
- subtaskComplete[0] = new Boolean(false);
- Thread t = new Thread() {
- public void run() {
- Exception exception = null;
- try {
- runnable.run();
- } catch( Exception ex ) {
- exception = ex;
- }
- synchronized(waitObject) {
- e[0] = exception;
- subtaskComplete[0] = new Boolean(true);
- waitObject.notifyAll();
- }
- }
- };
- t.start();
- while(t.isAlive() && !monitor.isCanceled() ) {
- synchronized(waitObject) {
- if( subtaskComplete[0].booleanValue() )
- break;
- try {
- waitObject.wait(500);
- } catch(InterruptedException ie) {}
- }
- }
- synchronized(waitObject) {
- if( !subtaskComplete[0].booleanValue()) {
- t.interrupt();
- IStatus status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.ISTATUS_CODE_ERROR, "SSH command canceled", e[0]);
- CoreException ce = new CoreException(status);
- throw ce;
- }
- if( e[0] != null ) {
- IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.ISTATUS_CODE_ERROR, "Error running remote command", e[0]);
- CoreException ce = new CoreException(status);
- throw ce;
- }
-
- }
- }
-
- protected static void launchCopyCommandImpl(Session session, String localFile, String remoteFile, IProgressMonitor monitor) throws CoreException {
- Channel channel = null;
- OutputStream out = null;
- try {
- // exec 'scp -t rfile' remotely
- String command = "scp -p -t " + remoteFile;
- channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- // get I/O streams for remote scp
- out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
- channel.connect();
- if (checkAck(in) != 0) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, null));
- }
-
- // send "C0644 filesize filename", where filename should not include
- // '/'
- long filesize = (new File(localFile)).length();
- command = "C0644 " + filesize + " ";
- if (localFile.lastIndexOf('/') > 0) {
- command += localFile.substring(localFile.lastIndexOf('/') + 1);
- } else {
- command += localFile;
- }
- command += "\n";
- out.write(command.getBytes());
- out.flush();
- if (checkAck(in) != 0) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, null));
- }
-
- // send a content of lfile
- FileInputStream fis = new FileInputStream(localFile);
- byte[] buf = new byte[1024];
- while (true) {
- int len = fis.read(buf, 0, buf.length);
- if (len <= 0)
- break;
- out.write(buf, 0, len); // out.flush();
- }
- fis.close();
- fis = null;
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- if (checkAck(in) != 0) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, null));
- }
-
- } catch( JSchException jsche ) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, jsche));
- } catch( IOException ioe) {
- throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, ioe));
- } finally {
- if( channel != null )
- channel.disconnect();
- if( out != null ) {
- try {
- out.close();
- } catch(IOException ioe) {}
- }
- }
- }
-
- static int checkAck(InputStream in) throws IOException {
- int b = in.read();
- // b may be 0 for success,
- // 1 for error,
- // 2 for fatal error,
- // -1
- if (b == 0)
- return b;
- if (b == -1)
- return b;
-
- if (b == 1 || b == 2) {
- StringBuffer sb = new StringBuffer();
- int c;
- do {
- c = in.read();
- sb.append((char) c);
- } while (c != '\n');
-// if (b == 1) { // error
-// System.out.print(sb.toString());
-// }
-// if (b == 2) { // fatal error
-// System.out.print(sb.toString());
-// }
- }
- return b;
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,291 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.server;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.archives.webtools.modules.LocalZippedPublisherUtil;
+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.extensions.events.ServerLogger;
+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.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
+public class SSHZippedJSTPublisher implements IJBossServerPublisher {
+
+ public SSHZippedJSTPublisher() {
+ }
+
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
+ return false;
+ if( module == null )
+ return true;
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean shouldAccept = ds != null
+ && ModuleCoreNature.isFlexibleProject(module[0].getProject())
+ && SSHPublishUtil.getZipsSSHDeployments(server);
+ return shouldAccept;
+ }
+
+ public int getPublishState() {
+ return IServer.PUBLISH_STATE_NONE;
+ }
+
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+ // Let the local zipped publisher do the work in a local / metadata folder
+ IStatus returnStatus = null;
+ SSHPublishMethod method2 = (SSHPublishMethod)method;
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server).
+ append(IJBossServerConstants.DEPLOY).makeAbsolute();
+
+ LocalZippedPublisherUtil localDelegate = new LocalZippedPublisherUtil();
+ IStatus localCopyStatus = localDelegate.publishModule(server,
+ deployRoot.toOSString(), module, publishType, delta, monitor);
+ IPath outputFilepath = localDelegate.getOutputFilePath(module);
+
+ String deployFolder = getRemoteDeployFolder(server);
+ String deployFile = new Path(deployFolder).append(outputFilepath.lastSegment()).toString();
+
+ // Am I a removal? If yes, remove me, and return
+ if( publishType == IJBossServerPublisher.REMOVE_PUBLISH) {
+ launchRemoveCommand(method2.getSession(), deployFile, monitor);
+ } else {
+ launchCopyCommand(method2.getSession(),
+ outputFilepath.toString(), deployFile, monitor);
+ }
+ return null;
+ }
+
+ protected String getRemoteDeployFolder(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
+ }
+
+ public static void launchRemoveCommand(Session session, String remoteLocation, IProgressMonitor monitor) throws CoreException {
+ String command = "rm " + remoteLocation;
+ launchCommand(session, command, monitor);
+ }
+
+ public static void launchCommand(Session session, String command, IProgressMonitor monitor) throws CoreException {
+ launchThreadedCommand(session, command, monitor);
+ }
+
+ protected static void launchThreadedCommand(final Session session, final String command, final IProgressMonitor monitor) throws CoreException {
+ // thread and watch the monitor for cancelations and interrupt the thread
+ LaunchRunnable r = new LaunchRunnable() { public void run() throws CoreException {
+ launchCommandNoThread(session, command, monitor);
+ } };
+ launchThreadedCommand(r, monitor);
+ }
+
+ protected static void launchCommandNoThread(Session session, String command, IProgressMonitor monitor) throws CoreException {
+ Channel channel = null;
+ try {
+ channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ channel.connect();
+ while(!channel.isClosed()) {
+ try {Thread.sleep(300);} catch(InterruptedException ie) {}
+ }
+ } catch( JSchException jsche ) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error executing command: " + command, null));
+ } finally {
+ channel.disconnect();
+ }
+ }
+
+ public static class LaunchRunnable {
+ public void run() throws CoreException {
+ }
+ }
+
+ public static void launchCopyCommand(final Session session, final String localFile,
+ final String remoteFile, final IProgressMonitor monitor) throws CoreException {
+ // thread and watch the monitor for cancelations and interrupt the thread
+ LaunchRunnable r = new LaunchRunnable() { public void run() throws CoreException {
+ launchCopyCommandImpl(session, localFile, remoteFile, monitor);
+ } };
+ launchThreadedCommand(r, monitor);
+ }
+
+ protected static void launchThreadedCommand(final LaunchRunnable runnable, IProgressMonitor monitor) throws CoreException {
+ final Exception[] e = new Exception[1];
+ e[0] = null;
+ final Object waitObject = new Object();
+ final Boolean[] subtaskComplete = new Boolean[1];
+ subtaskComplete[0] = new Boolean(false);
+ Thread t = new Thread() {
+ public void run() {
+ Exception exception = null;
+ try {
+ runnable.run();
+ } catch( Exception ex ) {
+ exception = ex;
+ }
+ synchronized(waitObject) {
+ e[0] = exception;
+ subtaskComplete[0] = new Boolean(true);
+ waitObject.notifyAll();
+ }
+ }
+ };
+ t.start();
+ while(t.isAlive() && !monitor.isCanceled() ) {
+ synchronized(waitObject) {
+ if( subtaskComplete[0].booleanValue() )
+ break;
+ try {
+ waitObject.wait(500);
+ } catch(InterruptedException ie) {}
+ }
+ }
+ synchronized(waitObject) {
+ if( !subtaskComplete[0].booleanValue()) {
+ t.interrupt();
+ IStatus status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.ISTATUS_CODE_ERROR, "SSH command canceled", e[0]);
+ CoreException ce = new CoreException(status);
+ throw ce;
+ }
+ if( e[0] != null ) {
+ IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.ISTATUS_CODE_ERROR, "Error running remote command", e[0]);
+ CoreException ce = new CoreException(status);
+ throw ce;
+ }
+
+ }
+ }
+
+ protected static void launchCopyCommandImpl(Session session, String localFile, String remoteFile, IProgressMonitor monitor) throws CoreException {
+ Channel channel = null;
+ OutputStream out = null;
+ try {
+ // exec 'scp -t rfile' remotely
+ String command = "scp -p -t " + remoteFile;
+ channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ // get I/O streams for remote scp
+ out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+ channel.connect();
+ if (checkAck(in) != 0) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, null));
+ }
+
+ // send "C0644 filesize filename", where filename should not include
+ // '/'
+ long filesize = (new File(localFile)).length();
+ command = "C0644 " + filesize + " ";
+ if (localFile.lastIndexOf('/') > 0) {
+ command += localFile.substring(localFile.lastIndexOf('/') + 1);
+ } else {
+ command += localFile;
+ }
+ command += "\n";
+ out.write(command.getBytes());
+ out.flush();
+ if (checkAck(in) != 0) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, null));
+ }
+
+ // send a content of lfile
+ FileInputStream fis = new FileInputStream(localFile);
+ byte[] buf = new byte[1024];
+ while (true) {
+ int len = fis.read(buf, 0, buf.length);
+ if (len <= 0)
+ break;
+ out.write(buf, 0, len); // out.flush();
+ }
+ fis.close();
+ fis = null;
+ // send '\0'
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+ if (checkAck(in) != 0) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, null));
+ }
+
+ } catch( JSchException jsche ) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, jsche));
+ } catch( IOException ioe) {
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, IEventCodes.SSH_PUBLISHING_ROOT_CODE, "Error transfering file: " + localFile, ioe));
+ } finally {
+ if( channel != null )
+ channel.disconnect();
+ if( out != null ) {
+ try {
+ out.close();
+ } catch(IOException ioe) {}
+ }
+ }
+ }
+
+ static int checkAck(InputStream in) throws IOException {
+ int b = in.read();
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+ // -1
+ if (b == 0)
+ return b;
+ if (b == -1)
+ return b;
+
+ if (b == 1 || b == 2) {
+ StringBuffer sb = new StringBuffer();
+ int c;
+ do {
+ c = in.read();
+ sb.append((char) c);
+ } while (c != '\n');
+// if (b == 1) { // error
+// System.out.print(sb.toString());
+// }
+// if (b == 2) { // fatal error
+// System.out.print(sb.toString());
+// }
+ }
+ return b;
+ }
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui)
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor)
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.ui.editor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
-import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
-
-public class DeploymentPage extends ModuleDeploymentPage {
- protected IDeploymentEditorTab[] createTabs(FormToolkit toolkit, TabFolder tabFolder) {
- TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
- IDeploymentEditorTab tab = new SSHDeploymentModuleTab();
- tabItem.setText(tab.getTabName());
- tab.setDeploymentPage(this);
- tab.setDeploymentPrefs(preferences);
- tabItem.setControl(tab.createControl(tabFolder));
- toolkit.adapt((Composite)tabItem.getControl());
-
- return new IDeploymentEditorTab[] { tab };
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.ui.editor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
+import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
+
+public class DeploymentPage extends ModuleDeploymentPage {
+ protected IDeploymentEditorTab[] createTabs(FormToolkit toolkit, TabFolder tabFolder) {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
+ IDeploymentEditorTab tab = new SSHDeploymentModuleTab();
+ tabItem.setText(tab.getTabName());
+ tab.setDeploymentPage(this);
+ tab.setDeploymentPrefs(preferences);
+ tabItem.setControl(tab.createControl(tabFolder));
+ toolkit.adapt((Composite)tabItem.getControl());
+
+ return new IDeploymentEditorTab[] { tab };
+ }
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ssh.ui.editor;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.wst.server.ui.internal.command.ServerCommand;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
-import org.jboss.ide.eclipse.as.ssh.Messages;
-import org.jboss.ide.eclipse.as.ssh.server.ISSHDeploymentConstants;
-import org.jboss.ide.eclipse.as.ssh.server.SSHPublishUtil;
-import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
-import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
-import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
-
-public class SSHDeploymentModuleTab implements IDeploymentEditorTab {
- private ModuleDeploymentPage page;
-
- public SSHDeploymentModuleTab() {
- }
-
- public String getTabName() {
- return Messages.SCPDeploymentSectionTitle;
- }
-
- public void setDeploymentPage(ModuleDeploymentPage page) {
- this.page = page;
- }
-
- public void setDeploymentPrefs(DeploymentPreferences prefs) {
- // DO Nothing
- }
-
- public Control createControl(Composite parent) {
- Composite random = new Composite(parent, SWT.NONE);
- GridData randomData = new GridData(GridData.FILL_BOTH);
- random.setLayoutData(randomData);
- random.setLayout(new FormLayout());
-
- Composite defaultComposite = createDefaultComposite(random);
- FormData fd = new FormData();
- fd.left = new FormAttachment(0, 5);
- fd.top = new FormAttachment(0, 5);
- fd.right = new FormAttachment(100, -5);
- defaultComposite.setLayoutData(fd);
- return random;
- }
-
- private Text userText, passText, deployText, hostsFileText;
- private ModifyListener userListener, passListener, deployListener, hostsListener;
- private Button zipDeployWTPProjects, browseHostsFileButton;
- private SelectionListener zipListener, browseHostsButtonListener;
-
- protected Composite createDefaultComposite(Composite parent) {
-
- FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-
- Section section = toolkit.createSection(parent,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
- | ExpandableComposite.TITLE_BAR);
- section.setText(Messages.SCPDeploymentSectionTitle);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
-
- composite.setLayout(new FormLayout());
-
- Label descriptionLabel = toolkit.createLabel(composite,
- Messages.SCPDeploymentDescription);
- FormData descriptionLabelData = new FormData();
- descriptionLabelData.left = new FormAttachment(0, 5);
- descriptionLabelData.top = new FormAttachment(0, 5);
- descriptionLabel.setLayoutData(descriptionLabelData);
-
- Control top = descriptionLabel;
- Composite inner = toolkit.createComposite(composite);
- inner.setLayout(new GridLayout(3, false));
-
- FormData innerData = new FormData();
- innerData.top = new FormAttachment(descriptionLabel, 5);
- innerData.left = new FormAttachment(0, 5);
- innerData.right = new FormAttachment(100, -5);
- inner.setLayoutData(innerData);
- top = inner;
-
- GridData textData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1);
- textData.widthHint = 300;
-
- Label label = toolkit.createLabel(inner,
- Messages.DeployRootFolder);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- deployText = toolkit.createText(inner, SSHPublishUtil.getDeployDir(page.getServer().getOriginal()), SWT.BORDER);
- deployListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.execute(new SetDeployDirCommand());
- }
- };
- deployText.addModifyListener(deployListener);
- deployText.setEnabled(true);
- deployText.setLayoutData(textData);
-
- Label userLabel = toolkit.createLabel(inner,
- Messages.UserLabel);
- userLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- userText = toolkit.createText(inner, SSHPublishUtil.getUser(page.getServer().getOriginal()), SWT.BORDER);
- userListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.execute(new SetUserCommand());
- }
- };
- userText.addModifyListener(userListener);
- userText.setEnabled(true);
- userText.setLayoutData(textData);
-
-
- Label passLabel = toolkit.createLabel(inner,
- Messages.PassLabel);
- passLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- passText = toolkit.createText(inner, SSHPublishUtil.getPass(page.getServer().getOriginal()), SWT.BORDER);
- passListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.execute(new SetPasswordCommand());
- }
- };
- passText.addModifyListener(passListener);
- passText.setEnabled(true);
- passText.setLayoutData(textData);
-
- Label hostsLabel = toolkit.createLabel(inner,
- Messages.HostsLabel);
- hostsLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- Composite hostsFileComposite = new Composite(inner, SWT.NONE);
- hostsFileComposite.setLayoutData(textData);
- hostsFileComposite.setLayout(new GridLayout(2,false));
-
- hostsFileText = toolkit.createText(hostsFileComposite, SSHPublishUtil.getHostsFile(page.getServer().getOriginal()), SWT.BORDER);
- hostsListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- page.execute(new SetHostsFileCommand());
- }
- };
- hostsFileText.addModifyListener(hostsListener);
- hostsFileText.setEnabled(true);
- GridData hostsFileData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- hostsFileData.widthHint = 200;
- hostsFileData.grabExcessHorizontalSpace = true;
- hostsFileText.setLayoutData(hostsFileData);
-
- browseHostsFileButton = toolkit.createButton(hostsFileComposite, Messages.browse, SWT.PUSH);
- browseHostsButtonListener = new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- browseForHostsSelected();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
- browseHostsFileButton.addSelectionListener(browseHostsButtonListener);
-
- zipDeployWTPProjects = toolkit.createButton(composite,
- Messages.EditorZipDeployments, SWT.CHECK);
- boolean zippedPublisherAvailable = isSSHZippedPublisherAvailable();
- boolean value = getZipsSSHDeployments();
- zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
- zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
-
- FormData zipButtonData = new FormData();
- zipButtonData.right = new FormAttachment(100, -5);
- zipButtonData.left = new FormAttachment(0, 5);
- zipButtonData.top = new FormAttachment(top, 5);
- zipDeployWTPProjects.setLayoutData(zipButtonData);
-
- zipListener = new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- page.execute(new SetZipCommand());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- };
- zipDeployWTPProjects.addSelectionListener(zipListener);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- page.getSaveStatus();
- return section;
- }
-
- protected boolean isSSHZippedPublisherAvailable() {
- IJBossServerPublisher[] publishers =
- ExtensionManager.getDefault().getZippedPublishers();
- for( int i = 0; i < publishers.length; i++ ) {
- if( publishers[i].accepts(SSHPublishMethod.SSH_PUBLISH_METHOD, getServer().getServer(), null))
- return true;
- }
- return false;
- }
-
- protected void browseForHostsSelected() {
- FileDialog d = new FileDialog(new Shell());
- d.setFilterPath(page.makeGlobal(hostsFileText.getText()));
- String x = d.open();
- if (x != null) {
- hostsFileText.setText(x);
- }
- }
-
- protected ServerAttributeHelper getHelper() {
- return new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
- }
-
- public class SetPropertyCommand extends ServerCommand {
- protected String oldDir;
- protected String newDir;
- protected Text text;
- protected ModifyListener listener;
- protected String attribute;
- public SetPropertyCommand(String label, Text text, ModifyListener listener, String attribute) {
- super(page.getServer(), label);
- this.text = text;
- this.newDir = text.getText();
- this.listener = listener;
- this.attribute = attribute;
- this.oldDir = getHelper().getAttribute(attribute, ""); //$NON-NLS-1$
- }
- public void execute() {
- getHelper().setAttribute(attribute, newDir);
- page.getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- getHelper().setAttribute(attribute, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- page.getSaveStatus();
- }
- }
-
- public class SetDeployDirCommand extends SetPropertyCommand {
- public SetDeployDirCommand() {
- super(Messages.EditorSetDeployCommandLabel, deployText,
- deployListener, ISSHDeploymentConstants.DEPLOY_DIRECTORY);
- }
- }
-
- public class SetUserCommand extends SetPropertyCommand {
- public SetUserCommand() {
- super(Messages.EditorSetUserCommandLabel, userText,
- userListener, ISSHDeploymentConstants.USERNAME);
- }
- }
-
- public class SetPasswordCommand extends SetPropertyCommand {
- public SetPasswordCommand() {
- super(Messages.EditorSetPasswordCommandLabel, passText,
- passListener, ISSHDeploymentConstants.PASSWORD);
- }
- }
-
- public class SetHostsFileCommand extends SetPropertyCommand {
- public SetHostsFileCommand() {
- super(Messages.EditorSetPasswordCommandLabel, hostsFileText,
- hostsListener, ISSHDeploymentConstants.HOSTS_FILE);
- }
- }
-
- public class SetZipCommand extends ServerCommand {
- boolean oldVal;
- boolean newVal;
- public SetZipCommand() {
- super(page.getServer(), Messages.EditorZipDeployments);
- oldVal = getHelper().getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
- newVal = zipDeployWTPProjects.getSelection();
- }
- public void execute() {
- getHelper().setAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, newVal);
- page.getSaveStatus();
- }
- public void undo() {
- zipDeployWTPProjects.removeSelectionListener(zipListener);
- zipDeployWTPProjects.setSelection(oldVal);
- getHelper().setAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, oldVal);
- zipDeployWTPProjects.addSelectionListener(zipListener);
- page.getSaveStatus();
- }
- }
-
-
-
- private boolean getZipsSSHDeployments() {
- return getHelper().getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
- }
-
- private IDeployableServer getServer() {
- return (IDeployableServer) page.getServer().loadAdapter(
- IDeployableServer.class, new NullProgressMonitor());
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,331 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ssh.ui.editor;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.ssh.Messages;
+import org.jboss.ide.eclipse.as.ssh.server.ISSHDeploymentConstants;
+import org.jboss.ide.eclipse.as.ssh.server.SSHPublishUtil;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
+import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
+
+public class SSHDeploymentModuleTab implements IDeploymentEditorTab {
+ private ModuleDeploymentPage page;
+
+ public SSHDeploymentModuleTab() {
+ }
+
+ public String getTabName() {
+ return Messages.SCPDeploymentSectionTitle;
+ }
+
+ public void setDeploymentPage(ModuleDeploymentPage page) {
+ this.page = page;
+ }
+
+ public void setDeploymentPrefs(DeploymentPreferences prefs) {
+ // DO Nothing
+ }
+
+ public Control createControl(Composite parent) {
+ Composite random = new Composite(parent, SWT.NONE);
+ GridData randomData = new GridData(GridData.FILL_BOTH);
+ random.setLayoutData(randomData);
+ random.setLayout(new FormLayout());
+
+ Composite defaultComposite = createDefaultComposite(random);
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(0, 5);
+ fd.right = new FormAttachment(100, -5);
+ defaultComposite.setLayoutData(fd);
+ return random;
+ }
+
+ private Text userText, passText, deployText, hostsFileText;
+ private ModifyListener userListener, passListener, deployListener, hostsListener;
+ private Button zipDeployWTPProjects, browseHostsFileButton;
+ private SelectionListener zipListener, browseHostsButtonListener;
+
+ protected Composite createDefaultComposite(Composite parent) {
+
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR);
+ section.setText(Messages.SCPDeploymentSectionTitle);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new FormLayout());
+
+ Label descriptionLabel = toolkit.createLabel(composite,
+ Messages.SCPDeploymentDescription);
+ FormData descriptionLabelData = new FormData();
+ descriptionLabelData.left = new FormAttachment(0, 5);
+ descriptionLabelData.top = new FormAttachment(0, 5);
+ descriptionLabel.setLayoutData(descriptionLabelData);
+
+ Control top = descriptionLabel;
+ Composite inner = toolkit.createComposite(composite);
+ inner.setLayout(new GridLayout(3, false));
+
+ FormData innerData = new FormData();
+ innerData.top = new FormAttachment(descriptionLabel, 5);
+ innerData.left = new FormAttachment(0, 5);
+ innerData.right = new FormAttachment(100, -5);
+ inner.setLayoutData(innerData);
+ top = inner;
+
+ GridData textData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1);
+ textData.widthHint = 300;
+
+ Label label = toolkit.createLabel(inner,
+ Messages.DeployRootFolder);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ deployText = toolkit.createText(inner, SSHPublishUtil.getDeployDir(page.getServer().getOriginal()), SWT.BORDER);
+ deployListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetDeployDirCommand());
+ }
+ };
+ deployText.addModifyListener(deployListener);
+ deployText.setEnabled(true);
+ deployText.setLayoutData(textData);
+
+ Label userLabel = toolkit.createLabel(inner,
+ Messages.UserLabel);
+ userLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ userText = toolkit.createText(inner, SSHPublishUtil.getUser(page.getServer().getOriginal()), SWT.BORDER);
+ userListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetUserCommand());
+ }
+ };
+ userText.addModifyListener(userListener);
+ userText.setEnabled(true);
+ userText.setLayoutData(textData);
+
+
+ Label passLabel = toolkit.createLabel(inner,
+ Messages.PassLabel);
+ passLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ passText = toolkit.createText(inner, SSHPublishUtil.getPass(page.getServer().getOriginal()), SWT.BORDER);
+ passListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetPasswordCommand());
+ }
+ };
+ passText.addModifyListener(passListener);
+ passText.setEnabled(true);
+ passText.setLayoutData(textData);
+
+ Label hostsLabel = toolkit.createLabel(inner,
+ Messages.HostsLabel);
+ hostsLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ Composite hostsFileComposite = new Composite(inner, SWT.NONE);
+ hostsFileComposite.setLayoutData(textData);
+ hostsFileComposite.setLayout(new GridLayout(2,false));
+
+ hostsFileText = toolkit.createText(hostsFileComposite, SSHPublishUtil.getHostsFile(page.getServer().getOriginal()), SWT.BORDER);
+ hostsListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetHostsFileCommand());
+ }
+ };
+ hostsFileText.addModifyListener(hostsListener);
+ hostsFileText.setEnabled(true);
+ GridData hostsFileData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
+ hostsFileData.widthHint = 200;
+ hostsFileData.grabExcessHorizontalSpace = true;
+ hostsFileText.setLayoutData(hostsFileData);
+
+ browseHostsFileButton = toolkit.createButton(hostsFileComposite, Messages.browse, SWT.PUSH);
+ browseHostsButtonListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ browseForHostsSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ };
+ browseHostsFileButton.addSelectionListener(browseHostsButtonListener);
+
+ zipDeployWTPProjects = toolkit.createButton(composite,
+ Messages.EditorZipDeployments, SWT.CHECK);
+ boolean zippedPublisherAvailable = isSSHZippedPublisherAvailable();
+ boolean value = getZipsSSHDeployments();
+ zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
+ zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
+
+ FormData zipButtonData = new FormData();
+ zipButtonData.right = new FormAttachment(100, -5);
+ zipButtonData.left = new FormAttachment(0, 5);
+ zipButtonData.top = new FormAttachment(top, 5);
+ zipDeployWTPProjects.setLayoutData(zipButtonData);
+
+ zipListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ page.execute(new SetZipCommand());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ };
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ page.getSaveStatus();
+ return section;
+ }
+
+ protected boolean isSSHZippedPublisherAvailable() {
+ IJBossServerPublisher[] publishers =
+ ExtensionManager.getDefault().getZippedPublishers();
+ for( int i = 0; i < publishers.length; i++ ) {
+ if( publishers[i].accepts(SSHPublishMethod.SSH_PUBLISH_METHOD, getServer().getServer(), null))
+ return true;
+ }
+ return false;
+ }
+
+ protected void browseForHostsSelected() {
+ FileDialog d = new FileDialog(new Shell());
+ d.setFilterPath(page.makeGlobal(hostsFileText.getText()));
+ String x = d.open();
+ if (x != null) {
+ hostsFileText.setText(x);
+ }
+ }
+
+ protected ServerAttributeHelper getHelper() {
+ return new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
+ }
+
+ public class SetPropertyCommand extends ServerCommand {
+ protected String oldDir;
+ protected String newDir;
+ protected Text text;
+ protected ModifyListener listener;
+ protected String attribute;
+ public SetPropertyCommand(String label, Text text, ModifyListener listener, String attribute) {
+ super(page.getServer(), label);
+ this.text = text;
+ this.newDir = text.getText();
+ this.listener = listener;
+ this.attribute = attribute;
+ this.oldDir = getHelper().getAttribute(attribute, ""); //$NON-NLS-1$
+ }
+ public void execute() {
+ getHelper().setAttribute(attribute, newDir);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ getHelper().setAttribute(attribute, oldDir);
+ text.setText(oldDir);
+ text.addModifyListener(listener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class SetDeployDirCommand extends SetPropertyCommand {
+ public SetDeployDirCommand() {
+ super(Messages.EditorSetDeployCommandLabel, deployText,
+ deployListener, ISSHDeploymentConstants.DEPLOY_DIRECTORY);
+ }
+ }
+
+ public class SetUserCommand extends SetPropertyCommand {
+ public SetUserCommand() {
+ super(Messages.EditorSetUserCommandLabel, userText,
+ userListener, ISSHDeploymentConstants.USERNAME);
+ }
+ }
+
+ public class SetPasswordCommand extends SetPropertyCommand {
+ public SetPasswordCommand() {
+ super(Messages.EditorSetPasswordCommandLabel, passText,
+ passListener, ISSHDeploymentConstants.PASSWORD);
+ }
+ }
+
+ public class SetHostsFileCommand extends SetPropertyCommand {
+ public SetHostsFileCommand() {
+ super(Messages.EditorSetPasswordCommandLabel, hostsFileText,
+ hostsListener, ISSHDeploymentConstants.HOSTS_FILE);
+ }
+ }
+
+ public class SetZipCommand extends ServerCommand {
+ boolean oldVal;
+ boolean newVal;
+ public SetZipCommand() {
+ super(page.getServer(), Messages.EditorZipDeployments);
+ oldVal = getHelper().getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
+ newVal = zipDeployWTPProjects.getSelection();
+ }
+ public void execute() {
+ getHelper().setAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, newVal);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ zipDeployWTPProjects.removeSelectionListener(zipListener);
+ zipDeployWTPProjects.setSelection(oldVal);
+ getHelper().setAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, oldVal);
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+ page.getSaveStatus();
+ }
+ }
+
+
+
+ private boolean getZipsSSHDeployments() {
+ return getHelper().getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
+ }
+
+ private IDeployableServer getServer() {
+ return (IDeployableServer) page.getServer().loadAdapter(
+ IDeployableServer.class, new NullProgressMonitor());
+ }
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard)
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-04-24 22:30:15 UTC (rev 21669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -1,139 +0,0 @@
-package org.jboss.ide.eclipse.as.ssh.ui.wizard;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidateBMPBean;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.jboss.ide.eclipse.as.core.util.ServerUtil;
-import org.jboss.ide.eclipse.as.ssh.Messages;
-import org.jboss.ide.eclipse.as.ssh.server.SSHServerDelegate;
-
-public class SCPServerWizardFragment extends WizardFragment {
- private IWizardHandle handle;
- private Text userText, passText, deployText;
- private ModifyListener listener;
- private SelectionListener browseHostsButtonListener;
- private String user, pass, deploy;
-
- public SCPServerWizardFragment() {
- super();
- }
-
- public Composite createComposite(Composite parent, IWizardHandle handle) {
- this.handle = handle;
- handle.setDescription(Messages.SCPServerDescription);
- handle.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_NEW_SERVER));
-
- Composite main = new Composite(parent, SWT.NONE);
- main.setLayout(new FormLayout());
- addWidgets(main);
- validate();
- return main;
- }
-
- protected void addWidgets(Composite composite) {
- composite.setLayout(new FormLayout());
-
- Composite inner = new Composite(composite, SWT.NONE);
- inner.setLayout(new GridLayout(3, false));
-
- FormData innerData = new FormData();
- innerData.top = new FormAttachment(0, 5);
- innerData.left = new FormAttachment(0, 5);
- innerData.right = new FormAttachment(100, -5);
- inner.setLayoutData(innerData);
-
- GridData textData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1);
- textData.widthHint = 300;
-
- Label label = new Label(inner, SWT.NONE);
- label.setText(Messages.DeployRootFolder);
- deployText = new Text(inner, SWT.BORDER);
- deployText.setText("/home/rob/deployFolder");
- listener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateValues();
- }
- };
- deployText.addModifyListener(listener);
- deployText.setEnabled(true);
- deployText.setLayoutData(textData);
-
- Label userLabel = new Label(inner, SWT.NONE);
- userLabel.setText(Messages.UserLabel);
- userText = new Text(inner, SWT.BORDER);
- userText.setText("username");
- userText.addModifyListener(listener);
- userText.setEnabled(true);
- userText.setLayoutData(textData);
-
-
- Label passLabel = new Label(inner, SWT.NONE);
- passLabel.setText(Messages.PassLabel);
- passText = new Text(inner, SWT.BORDER);
- passText.setText("password");
- passText.addModifyListener(listener);
- passText.setEnabled(true);
- passText.setLayoutData(textData);
- }
-
-
- protected void updateValues() {
- user = userText.getText();
- pass = passText.getText();
- deploy = deployText.getText();
- validate();
- }
-
- public void enter() {
- }
- public void exit() {
- }
- public boolean hasComposite() {
- return true;
- }
-
- protected void validate() {
- handle.setMessage(null, IMessageProvider.NONE);
- handle.update();
- }
-
- public boolean isComplete() {
- return handle.getMessageType() == IMessageProvider.NONE;
- }
-
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- IServerWorkingCopy serverWC = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
- SSHServerDelegate server = (SSHServerDelegate)serverWC.loadAdapter(SSHServerDelegate.class, new NullProgressMonitor());
- server.setUsername(user); //$NON-NLS-1$
- server.setPassword(pass); //$NON-NLS-1$
- server.setHostsFile(null);
- server.setDeployFolder(deploy);
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java (from rev 21669, trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-04-25 22:36:20 UTC (rev 21671)
@@ -0,0 +1,139 @@
+package org.jboss.ide.eclipse.as.ssh.ui.wizard;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidateBMPBean;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.ui.internal.ImageResource;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+import org.jboss.ide.eclipse.as.ssh.Messages;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerDelegate;
+
+public class SCPServerWizardFragment extends WizardFragment {
+ private IWizardHandle handle;
+ private Text userText, passText, deployText;
+ private ModifyListener listener;
+ private SelectionListener browseHostsButtonListener;
+ private String user, pass, deploy;
+
+ public SCPServerWizardFragment() {
+ super();
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setDescription(Messages.SCPServerDescription);
+ handle.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_NEW_SERVER));
+
+ Composite main = new Composite(parent, SWT.NONE);
+ main.setLayout(new FormLayout());
+ addWidgets(main);
+ validate();
+ return main;
+ }
+
+ protected void addWidgets(Composite composite) {
+ composite.setLayout(new FormLayout());
+
+ Composite inner = new Composite(composite, SWT.NONE);
+ inner.setLayout(new GridLayout(3, false));
+
+ FormData innerData = new FormData();
+ innerData.top = new FormAttachment(0, 5);
+ innerData.left = new FormAttachment(0, 5);
+ innerData.right = new FormAttachment(100, -5);
+ inner.setLayoutData(innerData);
+
+ GridData textData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1);
+ textData.widthHint = 300;
+
+ Label label = new Label(inner, SWT.NONE);
+ label.setText(Messages.DeployRootFolder);
+ deployText = new Text(inner, SWT.BORDER);
+ deployText.setText("/home/rob/deployFolder");
+ listener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ updateValues();
+ }
+ };
+ deployText.addModifyListener(listener);
+ deployText.setEnabled(true);
+ deployText.setLayoutData(textData);
+
+ Label userLabel = new Label(inner, SWT.NONE);
+ userLabel.setText(Messages.UserLabel);
+ userText = new Text(inner, SWT.BORDER);
+ userText.setText("username");
+ userText.addModifyListener(listener);
+ userText.setEnabled(true);
+ userText.setLayoutData(textData);
+
+
+ Label passLabel = new Label(inner, SWT.NONE);
+ passLabel.setText(Messages.PassLabel);
+ passText = new Text(inner, SWT.BORDER);
+ passText.setText("password");
+ passText.addModifyListener(listener);
+ passText.setEnabled(true);
+ passText.setLayoutData(textData);
+ }
+
+
+ protected void updateValues() {
+ user = userText.getText();
+ pass = passText.getText();
+ deploy = deployText.getText();
+ validate();
+ }
+
+ public void enter() {
+ }
+ public void exit() {
+ }
+ public boolean hasComposite() {
+ return true;
+ }
+
+ protected void validate() {
+ handle.setMessage(null, IMessageProvider.NONE);
+ handle.update();
+ }
+
+ public boolean isComplete() {
+ return handle.getMessageType() == IMessageProvider.NONE;
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IServerWorkingCopy serverWC = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
+ SSHServerDelegate server = (SSHServerDelegate)serverWC.loadAdapter(SSHServerDelegate.class, new NullProgressMonitor());
+ server.setUsername(user); //$NON-NLS-1$
+ server.setPassword(pass); //$NON-NLS-1$
+ server.setHostsFile(null);
+ server.setDeployFolder(deploy);
+ }
+}
14 years, 8 months
JBoss Tools SVN: r21669 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-24 18:30:15 -0400 (Sat, 24 Apr 2010)
New Revision: 21669
Modified:
branches/modular_build/build/build.xml
Log:
remove -B -fae; add into job
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-24 22:28:33 UTC (rev 21668)
+++ branches/modular_build/build/build.xml 2010-04-24 22:30:15 UTC (rev 21669)
@@ -298,7 +298,7 @@
<env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m" />
<!-- more debug output with <env key="MAVEN_OPTS" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
<!-- <arg line="-o -Dmaven.test.skip" /> -->
- <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository -B -fae clean install" />
+ <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository clean install" />
</exec>
</sequential>
</for>
14 years, 8 months
JBoss Tools SVN: r21668 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-24 18:28:33 -0400 (Sat, 24 Apr 2010)
New Revision: 21668
Modified:
branches/modular_build/build/build.xml
Log:
enable verbose for <info> to see why it's failing
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-24 22:16:26 UTC (rev 21667)
+++ branches/modular_build/build/build.xml 2010-04-24 22:28:33 UTC (rev 21668)
@@ -178,7 +178,7 @@
<!-- Store svn info so we can compare it later and thus not need to update or checkout every time -->
<svn javahl="false" svnkit="true" failonerror="false">
- <info target="${WORKINGDIR}/@{COMPONENT}" propprefix="svn.info.@{COMPONENT}" />
+ <info target="${WORKINGDIR}/@{COMPONENT}" propprefix="svn.info.@{COMPONENT}" verbose="true" />
</svn>
<if>
<isset property="svn.info.(a){COMPONENT}.rev" />
@@ -214,6 +214,7 @@
<svn javahl="false" svnkit="true" failonerror="false">
<info target="${WORKINGDIR}/@{COMPONENT}"
propprefix="svn.info.(a){COMPONENT}.check"
+ verbose="true"
/>
</svn>
<if>
14 years, 8 months
JBoss Tools SVN: r21667 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-24 18:16:26 -0400 (Sat, 24 Apr 2010)
New Revision: 21667
Modified:
branches/modular_build/build/build.xml
Log:
add debugging
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-24 22:13:22 UTC (rev 21666)
+++ branches/modular_build/build/build.xml 2010-04-24 22:16:26 UTC (rev 21667)
@@ -197,6 +197,7 @@
">
<sequential>
<!-- TODO: add timestamps / elapsed time -->
+ <echo level="info">Fetch @{COMPONENT} sources into ${WORKINGDIR}/</echo>
<if>
<not>
<available file="${WORKINGDIR}/@{COMPONENT}" type="dir" />
14 years, 8 months
JBoss Tools SVN: r21666 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-24 18:13:22 -0400 (Sat, 24 Apr 2010)
New Revision: 21666
Modified:
branches/modular_build/build/build.xml
Log:
move svn.info-*.txt files into / so they're not slave-specific
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-24 21:48:02 UTC (rev 21665)
+++ branches/modular_build/build/build.xml 2010-04-24 22:13:22 UTC (rev 21666)
@@ -183,7 +183,7 @@
<if>
<isset property="svn.info.(a){COMPONENT}.rev" />
<then>
- <echo file="svn.info-(a){COMPONENT}.txt">svn.info.(a){COMPONENT}.rev = ${svn.info.(a){COMPONENT}.rev}
+ <echo file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt">svn.info.(a){COMPONENT}.rev = ${svn.info.(a){COMPONENT}.rev}
</echo>
</then>
</if>
@@ -196,6 +196,7 @@
<for param="COMPONENT" list="${COMPONENTS}" delimiter=",
">
<sequential>
+ <!-- TODO: add timestamps / elapsed time -->
<if>
<not>
<available file="${WORKINGDIR}/@{COMPONENT}" type="dir" />
@@ -205,9 +206,9 @@
</then>
<else>
<if>
- <available file="svn.info-(a){COMPONENT}.txt" type="file" />
+ <available file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt" type="file" />
<then>
- <property file="svn.info-(a){COMPONENT}.txt" />
+ <property file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt" />
<!-- check svn info; if new version found, svn up -->
<svn javahl="false" svnkit="true" failonerror="false">
<info target="${WORKINGDIR}/@{COMPONENT}"
@@ -278,6 +279,7 @@
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
+ <!-- TODO: add timestamps / elapsed time -->
<!-- If poms already exist, DO NOT OVERWRITE unless overwrite.existing.pom.xml=true -->
<ant antfile="genpom.xml" target="run" dir="${WORKINGDIR}">
<property name="COMPONENT" value="@{COMPONENT}" />
@@ -458,13 +460,13 @@
">
<sequential>
<delete dir="@{expected.dir}" includeemptydirs="true" />
- <delete file="svn.info-(a){expected.dir}.txt" />
+ <delete file="${WORKINGDIR}/svn.info-(a){expected.dir}.txt" />
</sequential>
</for>
<for param="expected.file" list="${get.sources.expected.files}" delimiter=",
">
<sequential>
- <delete file="@{expected.file}" />
+ <delete file="${WORKINGDIR}/(a){expected.file}" />
</sequential>
</for>
@@ -509,8 +511,8 @@
<echo level="info">
3/6: Test update</echo>
- <delete file="svn.info-tests.txt" />
- <delete file="svn.info-xulrunner.txt" />
+ <delete file="${WORKINGDIR}/svn.info-tests.txt" />
+ <delete file="${WORKINGDIR}/svn.info-xulrunner.txt" />
<antcall target="get.sources" />
<for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
">
14 years, 8 months
JBoss Tools SVN: r21665 - branches/jbosstools-3.1.x/cdi/tests/org.jboss.tools.cdi.text.ext.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-24 17:48:02 -0400 (Sat, 24 Apr 2010)
New Revision: 21665
Modified:
branches/jbosstools-3.1.x/cdi/tests/org.jboss.tools.cdi.text.ext.test/META-INF/MANIFEST.MF
Log:
remove version range
Modified: branches/jbosstools-3.1.x/cdi/tests/org.jboss.tools.cdi.text.ext.test/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.1.x/cdi/tests/org.jboss.tools.cdi.text.ext.test/META-INF/MANIFEST.MF 2010-04-24 11:19:31 UTC (rev 21664)
+++ branches/jbosstools-3.1.x/cdi/tests/org.jboss.tools.cdi.text.ext.test/META-INF/MANIFEST.MF 2010-04-24 21:48:02 UTC (rev 21665)
@@ -14,7 +14,7 @@
org.jboss.tools.common.text.ext;bundle-version="2.0.0",
org.jboss.tools.tests;bundle-version="2.0.0",
org.eclipse.core.runtime;bundle-version="3.5.0",
- org.jboss.tools.cdi.text.ext;bundle-version="2.0.0",
+ org.jboss.tools.cdi.text.ext,
org.eclipse.jdt.ui;bundle-version="3.5.0",
org.eclipse.core.commands;bundle-version="3.5.0",
org.jboss.tools.cdi.core.test;bundle-version="1.0.0"
14 years, 8 months
JBoss Tools SVN: r21664 - trunk.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-04-24 07:19:31 -0400 (Sat, 24 Apr 2010)
New Revision: 21664
Modified:
trunk/
Log:
Removed merge tracking for "svnmerge" for
https://svn.jboss.org/repos/jbosstools/branches/jbosstools-2.1.x
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-blocked
- /branches/jbosstools-2.1.x:8001,8030
Name: svnmerge-integrated
- /branches/modular_build:1-21059 /branches/jbosstools-2.1.x:1-7998,8009-8012,8078-8079
+ /branches/modular_build:1-21059
14 years, 8 months