Author: adietish
Date: 2010-12-10 10:41:02 -0500 (Fri, 10 Dec 2010)
New Revision: 27364
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-7863] need to store the password if either connection name, username, pw or url
changes
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-10 15:18:45
UTC (rev 27363)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-10 15:41:02
UTC (rev 27364)
@@ -1,5 +1,7 @@
2010-12-10 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (update):
+ [JBIDE-7863] need to store the password if either connection name, username, pw or url
changes
* src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (notifyCloudRename):
[JBIDE-7856] removed notifyCloudRename since DeltaCloud now notifies about changes in
its properties (images, instances, name)
* src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.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 2010-12-10
15:18:45 UTC (rev 27363)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-10
15:41:02 UTC (rev 27364)
@@ -99,15 +99,29 @@
public void update(String name, String url, String username, String password, String
type)
throws DeltaCloudException {
this.type = type;
- setName(name);
- boolean changed = updateConnectionProperties(url, username, password);
- if (changed) {
- client = createClient(name, url, username, passwordStore.getPassword());
+ boolean nameChanged = updateName(name);
+ boolean connectionPropertiesChanged = updateConnectionProperties(url, username,
password);
+
+ if (nameChanged || connectionPropertiesChanged) {
+ this.passwordStore.update(new DeltaCloudPasswordStorageKey(name, username),
password);
+ }
+
+ if (connectionPropertiesChanged) {
+ client = createClient(name, url, username, password);
loadChildren();
}
}
+
+ private boolean updateName(String name) {
+ if (equals(this.name, name)) {
+ return false;
+ }
+ setName(name);
+ return true;
+ }
+
private boolean updateConnectionProperties(String url, String username, String
password)
throws DeltaCloudException {
boolean changed = false;
@@ -120,9 +134,9 @@
changed = true;
}
if (!equals(this.passwordStore.getPassword(), password)) {
- this.passwordStore.setPassword(password);
changed = true;
}
+
return changed;
}
@@ -173,7 +187,7 @@
this.lastImageId = lastImageId;
}
- protected void setName(String name) {
+ private void setName(String name) {
firePropertyChange(PROP_NAME, this.name, this.name = name);
}
Show replies by date