Browse files

Merge pull request #32 from racker/add_toString_methods

Add to string methods
  • Loading branch information...
2 parents d9a251b + d92d39f commit 73be921ab60649bcf9c83ccbcf272df3025645a6 @Kami Kami committed Apr 4, 2013
View
15 ...registry-client/src/main/java/com/rackspacecloud/client/service_registry/HeartBeater.java
@@ -54,6 +54,14 @@ public HeartBeater(AuthClient authClient, String serviceId, String initialToken,
this.heartbeatIntervalMillis = (long)(timeout * 1000L * (timeout < 15 ? 0.6d : 0.9d));
}
+ public String getServiceId() {
+ return this.serviceId;
+ }
+
+ public Integer getHeartbeatTimeout() {
+ return this.heartbeatTimeoutSecs;
+ }
+
private void runInThread() {
ClientResponse response;
String path = String.format("/services/%s/heartbeat", this.serviceId);
@@ -123,4 +131,9 @@ public synchronized void stop() {
this.stopped = true;
hbThread.interrupt();
}
-}
+
+ @Override
+ public String toString() {
+ return String.format("[HeartBeater serviceId=%s, heartbeat_timeout=%s]", this.getServiceId(), this.getHeartbeatTimeout());
+ }
+}
View
5 ...ry-client/src/main/java/com/rackspacecloud/client/service_registry/PaginationOptions.java
@@ -46,4 +46,9 @@ public Integer getLimit() {
public String getMarker() {
return marker;
}
+
+ @Override
+ public String toString() {
+ return String.format("[PaginagionOptions limit=%s, marker=%s]", this.limit, this.marker);
+ }
}
View
9 ...stry-client/src/main/java/com/rackspacecloud/client/service_registry/objects/Account.java
@@ -28,4 +28,13 @@ public Account(String id, Map<String, String> metadata) {
this.id = id;
this.metadata = metadata;
}
+
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("[Account id=%s]", this.getId());
+ }
}
View
5 .../src/main/java/com/rackspacecloud/client/service_registry/objects/ConfigurationValue.java
@@ -33,4 +33,9 @@ public String getId() {
public String getValue() {
return value;
}
+
+ @Override
+ public String toString() {
+ return String.format("[ConfigurationValue id=%s, value=%s]", this.getId(), this.getValue());
+ }
}
View
5 ...gistry-client/src/main/java/com/rackspacecloud/client/service_registry/objects/Event.java
@@ -116,4 +116,9 @@ else if (eventType.equals("service.remove")) {
return new Event(id, timestamp, eventType, payload);
}
+
+ @Override
+ public String toString() {
+ return String.format("[Event id=%s, type=%s, timestamp=%s]", this.getId(), this.getType(), this.getTimestamp());
+ }
}
View
7 ...stry-client/src/main/java/com/rackspacecloud/client/service_registry/objects/Service.java
@@ -67,4 +67,11 @@ private Integer getLastSeen() {
public Map<String, String> getMetadata() {
return metadata;
}
+
+ @Override
+ public String toString() {
+ return String.format("[Service id=%s, last_seen=%s, heartbeat_timeout=%s]",
+ this.getId(), this.getLastSeen(),
+ this.getHeartbeatTimeout());
+ }
}

0 comments on commit 73be921

Please sign in to comment.