Author: xcoulon
Date: 2012-05-22 09:30:42 -0400 (Tue, 22 May 2012)
New Revision: 41254
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/OpenShiftSshSessionFactory.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
Log:
Fixed - JBIDE-11810
OpenShift port forwarding exception without ssh key
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java 2012-05-22
13:08:09 UTC (rev 41253)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingAction.java 2012-05-22
13:30:42 UTC (rev 41254)
@@ -26,7 +26,6 @@
if( sel instanceof IApplication) {
IApplication application = (IApplication)sel;
try {
- //TitleD
ApplicationPortForwardingWizard wizard = new
ApplicationPortForwardingWizard(application);
WizardDialog dialog = new
ApplicationPortForwardingWizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setMinimumPageSize(700, 300);
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizard.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizard.java 2012-05-22
13:08:09 UTC (rev 41253)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizard.java 2012-05-22
13:30:42 UTC (rev 41254)
@@ -38,8 +38,4 @@
addPage(new ApplicationPortForwardingWizardPage(wizardModel, this));
}
- public IApplication getApplication() {
- return wizardModel.getApplication();
- }
-
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java 2012-05-22
13:08:09 UTC (rev 41253)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardModel.java 2012-05-22
13:30:42 UTC (rev 41254)
@@ -19,8 +19,11 @@
import org.eclipse.ui.console.MessageConsoleStream;
import org.jboss.tools.common.databinding.ObservablePojo;
import org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
import com.openshift.client.IApplication;
import com.openshift.client.IApplicationPortForwarding;
import com.openshift.client.OpenShiftSSHOperationException;
@@ -203,4 +206,25 @@
}
}
+ /**
+ * @param monitor
+ * @throws OpenShiftSSHOperationException
+ * @throws JSchException
+ */
+ // TODO : move this method into the WizardModel ?
+ void verifyApplicationSSHSession() throws OpenShiftSSHOperationException {
+ final boolean hasSSHSession = getApplication().hasSSHSession();
+ if (!hasSSHSession) {
+ Logger.debug("Opening a new SSH Session for application '" +
getApplication().getName() + "'");
+ try {
+ final Session session = OpenShiftSshSessionFactory.getInstance().createSession(
+ getApplication());
+ getApplication().setSSHSession(session);
+ } catch (JSchException e) {
+ throw new OpenShiftSSHOperationException(e, "Failed to open a new SSH session
for application ''{0}''", getApplication().getName());
+
+ }
+ }
+ }
+
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-05-22
13:08:09 UTC (rev 41253)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/ApplicationPortForwardingWizardPage.java 2012-05-22
13:30:42 UTC (rev 41254)
@@ -33,11 +33,8 @@
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftSshSessionFactory;
import org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
import com.openshift.client.IApplicationPortForwarding;
import com.openshift.client.OpenShiftSSHOperationException;
@@ -166,10 +163,10 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- verifyApplicationSSHSession();
+ wizardModel.verifyApplicationSSHSession();
wizardModel.refreshForwardablePorts();
refreshViewerInput();
- } catch (Exception e) {
+ } catch (OpenShiftSSHOperationException e) {
Logger.error("Failed to refresh list of ports", e);
}
return Status.OK_STATUS;
@@ -191,10 +188,10 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- verifyApplicationSSHSession();
+ wizardModel.verifyApplicationSSHSession();
wizardModel.startPortForwarding();
refreshViewerInput();
- } catch (Exception e) {
+ } catch (OpenShiftSSHOperationException e) {
return OpenShiftUIActivator.createErrorStatus("Failed to start
port-forwarding.", e);
}
@@ -232,10 +229,10 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- verifyApplicationSSHSession();
+ wizardModel.verifyApplicationSSHSession();
wizardModel.stopPortForwarding();
refreshViewerInput();
- } catch (Exception e) {
+ } catch (OpenShiftSSHOperationException e) {
return OpenShiftUIActivator.createErrorStatus("Failed to stop
port-forwarding.", e);
}
return Status.OK_STATUS;
@@ -327,46 +324,34 @@
@Override
protected void onPageActivated(DataBindingContext dbc) {
try {
- WizardUtils.runInWizard(new Job("Retrieving application's forwardable
ports...") {
+ IStatus status = WizardUtils.runInWizard(new Job("Retrieving application's
forwardable ports...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask("Checking Application SSH session...", 1);
- verifyApplicationSSHSession();
+ wizardModel.verifyApplicationSSHSession();
monitor.worked(1);
monitor.beginTask("Retrieving ports...", 1);
wizardModel.loadForwardablePorts();
refreshViewerInput();
monitor.worked(1);
return Status.OK_STATUS;
- } catch (Exception e) {
+ } catch (OpenShiftSSHOperationException e) {
return OpenShiftUIActivator.createErrorStatus(
- "Could not load forwardable ports for application", e);
+ "Could not load forwardable ports for application
''{0}''", e, wizardModel.getApplication().getName());
}
}
}, getContainer(), getDataBindingContext());
+ if(!status.isOK()) {
+ getWizard().getContainer().getShell().close();
+ }
} catch (Exception e) {
// ignore
}
}
- /**
- * @param monitor
- * @throws JSchException
- */
- // TODO : move this method into the WizardModel ?
- private void verifyApplicationSSHSession() throws JSchException {
- final boolean hasSSHSession = wizardModel.getApplication().hasSSHSession();
- if (!hasSSHSession) {
- Logger.debug("Opening a new SSH Session for application '" +
wizardModel.getApplication().getName() + "'");
- final Session session = OpenShiftSshSessionFactory.getInstance().createSession(
- wizardModel.getApplication());
- wizardModel.getApplication().setSSHSession(session);
- }
- }
-
private void refreshViewerInput() {
getShell().getDisplay().syncExec(new Runnable() {
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/OpenShiftSshSessionFactory.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/OpenShiftSshSessionFactory.java 2012-05-22
13:08:09 UTC (rev 41253)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/OpenShiftSshSessionFactory.java 2012-05-22
13:30:42 UTC (rev 41254)
@@ -38,6 +38,7 @@
* @author Xavier Coulon
*
*/
+@SuppressWarnings("restriction")
public class OpenShiftSshSessionFactory extends JschConfigSessionFactory {
private static OpenShiftSshSessionFactory INSTANCE = new OpenShiftSshSessionFactory();
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-22
13:08:09 UTC (rev 41253)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-22
13:30:42 UTC (rev 41254)
@@ -643,12 +643,23 @@
String[] items = newAppCartridgeCombo.getItems();
Arrays.sort(items);
newAppCartridgeCombo.setItems(items);
+ selectJBossAS7();
}
});
}
}.start();
}
}
+
+ private void selectJBossAS7(){
+ String[] items = newAppCartridgeCombo.getItems();
+ for(int index = 0; index < items.length; index++){
+ if("jbossas-7".equals(items[index])){
+ newAppCartridgeCombo.select(index);
+ }
+ }
+ }
+
@Override
protected void onPageWillGetActivated(Direction direction, PageChangingEvent event,
DataBindingContext dbc) {
Show replies by date