Author: adietish
Date: 2010-12-14 06:55:56 -0500 (Tue, 14 Dec 2010)
New Revision: 27442
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
Log:
[JBIDE-7889]
* added DeltaCloudInstance#toString to facilitate debugging
* changed DeltaCloudInstance#getActions to return DeltaCloudInstance#Action (and not
strings)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-14 10:55:49
UTC (rev 27441)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-14 11:55:56
UTC (rev 27442)
@@ -1,5 +1,9 @@
2010-12-14 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (toString):
+ [JBIDE-7889] added #toString to facilitate debuggin
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getActions):
+ [JBIDE-7889] changed #getActions to return DeltaCloudInstance#Action (and not strings)
* src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java:
* src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java:
* src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java:
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-12-14
10:55:49 UTC (rev 27441)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-12-14
11:55:56 UTC (rev 27442)
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.core;
+import java.util.ArrayList;
import java.util.List;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
@@ -107,8 +108,12 @@
return instance.getKey();
}
- public List<String> getActions() {
- return instance.getActionNames();
+ public List<Action> getActions() {
+ List<Action> actions = new ArrayList<Action>();
+ for (InstanceAction action : instance.getActions()) {
+ actions.add(Action.valueOf(action.getName()));
+ }
+ return actions;
}
public String getProfileId() {
@@ -168,4 +173,33 @@
}
return client.performInstanceAction(instanceAction);
}
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("DeltaCloudInstance");
+ builder.append(" [");
+ appendActions(builder);
+ builder.append("id: ").append(getId())
+ .append("givenName: ").append(givenName)
+ .append("name: ").append(getName())
+ .append("hostName: ").append(getHostName())
+ .append("imageId: ").append(getImageId())
+ .append("key: ").append(getKey())
+ .append("ownerId: ").append(getOwnerId())
+ .append("profileId: ").append(getProfileId())
+ .append("realmId: ").append(getRealmId())
+ .append("state: ").append(getState());
+ builder.append("]");
+ return builder.toString();
+ }
+
+ private StringBuilder appendActions(StringBuilder builder) {
+ builder.append(" actions: [");
+ for (Action action : getActions()) {
+ builder.append("action: ")
+ .append(action.getName());
+ }
+ builder.append("] ");
+ return builder;
+ }
}
Show replies by date