Author: adietish
Date: 2011-04-01 12:01:07 -0400 (Fri, 01 Apr 2011)
New Revision: 30218
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
[JBIDE-8668] updating driver state on each test if driver is UNKNOWN
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-04-01 15:59:45
UTC (rev 30217)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-04-01 16:01:07
UTC (rev 30218)
@@ -1,3 +1,11 @@
+2011-04-01 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (updateDriver):
+ (isValid):
+ (isKnownDriver):
+ [JBIDE-8668] updating driver state on each test if driver is UNKNOWN
+
2011-03-24 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-04-01
15:59:45 UTC (rev 30217)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-04-01
16:01:07 UTC (rev 30218)
@@ -54,14 +54,14 @@
private String lastImageId = "";
private String lastRealmName = "";
private String lastProfileId = "";
-
+
private DeltaCloudClient client;
private DeltaCloudImagesRepository imagesRepo = new DeltaCloudImagesRepository();
private boolean areImagesLoaded = false;
private DeltaCloudInstancesRepository instancesRepo = new
DeltaCloudInstancesRepository();
private boolean areInstancesLoaded = false;
-
+
private IImageFilter imageFilter;
private IInstanceFilter instanceFilter;
@@ -101,7 +101,7 @@
throws DeltaCloudException {
this.driver = driver;
- boolean nameChanged = updateName(name);
+ boolean nameChanged = updateName(name);
boolean connectionPropertiesChanged = updateConnectionProperties(url, username,
password);
if (nameChanged || connectionPropertiesChanged) {
@@ -189,7 +189,32 @@
return driver;
}
+ private void updateDriver() {
+ try {
+ DeltaCloudDriver driver = getServerDriver(url);
+ this.driver = driver;
+ } catch (DeltaCloudException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * Returns if this cloud points to a known cloud type. The implementation
+ * checks the driver type which will be valid if the url is a valid and
+ * known cloud. The credentials are not checked.
+ *
+ * @return <code>true</code> if this cloud is a known type
+ */
public boolean isValid() {
+ boolean isValid = isKnownDriver();
+ if (!isValid) {
+ updateDriver();
+ isValid = isKnownDriver();
+ }
+ return isValid;
+ }
+
+ protected boolean isKnownDriver() {
return driver != null
&& driver != DeltaCloudDriver.UNKNOWN;
}
@@ -484,8 +509,9 @@
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
firePropertyChange(PROP_INSTANCES, instances, repo.get());
-// int index = repo.indexOf(instance);
-// fireIndexedPropertyChange(PROP_INSTANCES, index, instance, instance);
+ // int index = repo.indexOf(instance);
+ // fireIndexedPropertyChange(PROP_INSTANCES, index, instance,
+ // instance);
}
return result;
} catch (DeltaCloudClientException e) {
Show replies by date