Author: adietish
Date: 2011-02-15 11:00:25 -0500 (Tue, 15 Feb 2011)
New Revision: 29158
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/ConvertRSEToServerWizard.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/wizard/INewInstanceWizardPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
Log:
[JBIDE-8423] not failing with assertion caused exception if no hostname is provided. Just
cancelling job then.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog 2011-02-15
14:57:53 UTC (rev 29157)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog 2011-02-15
16:00:25 UTC (rev 29158)
@@ -1,3 +1,9 @@
+2011-02-15 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java
(runRSEJob):
+ * src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java (createRSEHostName):
+ [JBIDE-8423] not failing with assertion caused exception if no hostname is provided.
Just cancelling job then.
+
2011-02-10 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -73,13 +73,19 @@
return instance.getAlias();
}
- public static String createHostName(DeltaCloudInstance instance) {
- Assert.isLegal(instance != null, "Cannot get hostname: instance is not
defined");
-
- String hostName = instance.getHostName();
- Assert.isTrue(hostName != null && hostName.length() > 0,
- MessageFormat.format("Cannot get host name: not defined for instance {0}",
instance.getName()));
- return hostName;
+ /**
+ * Returns the RSE host name for the given instance. Returns
+ * <code>null</code> if the instance is <code>null</null>.
+ *
+ * @param instance
+ * the instance to use to determine the host name for RSE
+ * @return the hostname
+ */
+ public static String createRSEHostName(DeltaCloudInstance instance) {
+ if (instance == null) {
+ return null;
+ }
+ return instance.getHostName();
}
public static IHost createHost(String username, String connectionName, String hostname,
IRSESystemType systemType,
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -41,7 +41,7 @@
IHost host = RSEUtils.createHost(
DeltaCloudRSEConstants.USERNAME,
connectionName,
- RSEUtils.createHostName(instance),
+ RSEUtils.createRSEHostName(instance),
RSEUtils.getSSHOnlySystemType(),
RSEUtils.getSystemRegistry());
Job connectJob = RSEUtils.connect(connectionName,
RSEUtils.getConnectorService(host));
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/ConvertRSEToServerWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/ConvertRSEToServerWizard.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/ConvertRSEToServerWizard.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -22,7 +22,7 @@
@Override
public boolean performFinish() {
- Job j = page1.getPerformFinishJob(instance);
+ Job j = page1.createPerformFinishJob(instance);
if( j != null ) {
j.schedule();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -56,25 +56,34 @@
}
private IStatus runRSEJob(DeltaCloudInstance instance, IProgressMonitor monitor) throws
CoreException {
- String hostname = RSEUtils.createHostName(instance);
- if (hostname != null && hostname.length() > 0 && isAutoconnect()) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+
+ String hostname = RSEUtils.createRSEHostName(instance);
+ if (hostname == null || hostname.length() <= 0) {
+ return Status.CANCEL_STATUS;
+ }
+
+ if (isAutoconnect()) {
try {
monitor.beginTask(MessageFormat.format("Create RSE to server {0}",
hostname), 100);
String connectionName = RSEUtils.createConnectionName(instance);
IHost host = RSEUtils.createHost(
DeltaCloudRSEConstants.USERNAME,
connectionName,
- RSEUtils.createHostName(instance),
+ RSEUtils.createRSEHostName(instance),
RSEUtils.getSSHOnlySystemType(),
RSEUtils.getSystemRegistry());
if (nextJob2 != null && nextJob2 instanceof CreateServerFromRSEJob) {
((CreateServerFromRSEJob) nextJob2).setHost(host);
}
monitor.worked(10);
- IStatus credentials =
- triggerCredentialsDialog(host, new SubProgressMonitor(monitor, 10));
- if( credentials.isOK())
- return RSEUtils.connect(RSEUtils.getConnectorService(host), CONNECT_TIMEOUT, new
SubProgressMonitor(monitor, 80));
+ IStatus credentials =
+ triggerCredentialsDialog(host, new SubProgressMonitor(monitor, 10));
+ if (credentials.isOK())
+ return RSEUtils.connect(RSEUtils.getConnectorService(host), CONNECT_TIMEOUT,
+ new SubProgressMonitor(monitor, 80));
return credentials;
} catch (Exception e) {
throw new CoreException(
@@ -90,14 +99,14 @@
monitor.setTaskName(MessageFormat.format("Initiating connection to {0}...",
host.getName()));
IRemoteFileSubSystem system = RSEUtils.findRemoteFileSubSystem(host);
system.connect(monitor, true /* force credentials dialog */);
- } catch(Exception e) {
- if( e instanceof OperationCanceledException)
+ } catch (Exception e) {
+ if (e instanceof OperationCanceledException)
return Status.CANCEL_STATUS;
- if( e instanceof SystemOperationFailedException ) {
+ if (e instanceof SystemOperationFailedException) {
Exception f = ((SystemOperationFailedException) e).getRemoteException();
- if( f != null && f instanceof JSchException) {
+ if (f != null && f instanceof JSchException) {
// User selected No on accept hostkey
- if(f.getMessage().contains("reject HostKey:"))
+ if (f.getMessage().contains("reject HostKey:"))
return Status.CANCEL_STATUS;
}
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -340,7 +340,7 @@
localRuntimeCombo.setEnabled(enabled);
}
- public ChainedJob getPerformFinishJob(final DeltaCloudInstance instance) {
+ public ChainedJob createPerformFinishJob(final DeltaCloudInstance instance) {
IEclipsePreferences prefs = new
InstanceScope().getNode(DeltaCloudIntegrationPlugin.PLUGIN_ID);
prefs.putBoolean(CREATE_RSE_PREF_KEY, createRSE.getSelection());
prefs.putBoolean(CREATE_SERVER_PREF_KEY, createServer.getSelection());
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/wizard/INewInstanceWizardPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/wizard/INewInstanceWizardPage.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/wizard/INewInstanceWizardPage.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -21,5 +21,5 @@
public static final String NEW_INSTANCE_FAMILY = "newInstanceFamily";
- public ChainedJob getPerformFinishJob(DeltaCloudInstance addedInstance);
+ public ChainedJob createPerformFinishJob(DeltaCloudInstance addedInstance);
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2011-02-15
14:57:53 UTC (rev 29157)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2011-02-15
16:00:25 UTC (rev 29158)
@@ -135,7 +135,7 @@
ChainedJob last = first;
ChainedJob temp;
for (int i = 0; i < additionalPages.length; i++) {
- temp = additionalPages[i].getPerformFinishJob(instance);
+ temp = additionalPages[i].createPerformFinishJob(instance);
if (temp != null) {
last.setNextJob(temp);
last = temp;