Author: adietish
Date: 2011-04-04 05:15:11 -0400 (Mon, 04 Apr 2011)
New Revision: 30264
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
branches/jbosstools-3.2.x/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:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-04-04
09:09:32 UTC (rev 30263)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-04-04
09:15:11 UTC (rev 30264)
@@ -1,5 +1,35 @@
+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
+ (areImagesLoaded):
+ (imagesRepo):
+ (getImages):
+ (getInstances):
+ (instancesLoaded):
+ (getImage):
+ [JBIDE-8102] now loading all images before querying server for a single image
+
+ * src/org/jboss/tools/deltacloud/core/InstanceFilter.java
+ (matches):
+ (aliasRule):
+ (setRules):
+ (toString):
+ (getAliasRule):
+ * src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
+ (ALL_STRING):
+ (getAliasRule):
+ * src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java
+ (getAliasRule):
+ [JBIDE-8187] added capability to filter instance on behalf of alias
+
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
(getActions):
(Action.getByName):
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-04-04
09:09:32 UTC (rev 30263)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-04-04
09:15:11 UTC (rev 30264)
@@ -74,7 +74,8 @@
public DeltaCloud(String name, String url, String username, String password, Driver
driver)
throws DeltaCloudException {
- this(name, url, username, password, driver, IImageFilter.ALL_STRING,
IInstanceFilter.ALL_STRING, new ArrayList<IInstanceAliasMapping>());
+ this(name, url, username, password, driver, IImageFilter.ALL_STRING,
IInstanceFilter.ALL_STRING,
+ new ArrayList<IInstanceAliasMapping>());
}
public DeltaCloud(String name, String url, String username, Driver driver, String
imageFilterRules,
@@ -189,7 +190,32 @@
return driver;
}
+ private void updateDriver() {
+ try {
+ Driver 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 != Driver.UNKNOWN;
}
@@ -328,7 +354,7 @@
if (instance != null) {
while (!pm.isCanceled()) {
Thread.sleep(WAIT_FOR_STATE_DELAY);
- instance = refreshInstance(instance);
+ instance = refreshInstance(instance);
if (stateMatcher.matchesState(instance, instance.getState())
|| instance.getState().equals(DeltaCloudInstance.State.TERMINATED)) {
return instance;
@@ -416,6 +442,7 @@
Image image = client.listImages(id);
deltaCloudImage = DeltaCloudImageFactory.create(image, this);
images.add(deltaCloudImage);
+ updateDriver();
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(MessageFormat.format("Cloud not find image with id
\"{0}\"", id), e);
}
Show replies by date