Permalink
Browse files

Re-organize classes.

  • Loading branch information...
1 parent 7acdc30 commit 2cb12149fb18eae31acb310b00c56cfa0812d0b5 @Kami Kami committed Feb 24, 2013
Showing with 62 additions and 26 deletions.
  1. +3 −3 src/main/java/com/rackspacecloud/client/service_registry/HeartBeater.java
  2. +3 −3 src/main/java/com/rackspacecloud/client/service_registry/clients/BaseClient.java
  3. +4 −4 src/main/java/com/rackspacecloud/client/service_registry/clients/EventsClient.java
  4. +1 −1 src/main/java/com/rackspacecloud/client/service_registry/events/{ → client}/ClientEvent.java
  5. +1 −1 src/main/java/com/rackspacecloud/client/service_registry/events/{ → client}/ClientEventListener.java
  6. +1 −1 src/main/java/com/rackspacecloud/client/service_registry/events/{ → client}/ClientEventThread.java
  7. +1 −1 src/main/java/com/rackspacecloud/client/service_registry/events/{ → client}/HeartbeatAckEvent.java
  8. +1 −1 src/main/java/com/rackspacecloud/client/service_registry/events/{ → client}/HeartbeatErrorEvent.java
  9. +1 −1 ...in/java/com/rackspacecloud/client/service_registry/events/{ → client}/HeartbeatEventListener.java
  10. +1 −1 ...ain/java/com/rackspacecloud/client/service_registry/events/{ → client}/HeartbeatStoppedEvent.java
  11. +1 −1 src/main/java/com/rackspacecloud/client/service_registry/{rsr_events → events/server}/BaseEvent.java
  12. +1 −1 ...acecloud/client/service_registry/{rsr_events → events/server}/ConfigurationValueRemovedEvent.java
  13. +1 −1 ...acecloud/client/service_registry/{rsr_events → events/server}/ConfigurationValueUpdatedEvent.java
  14. +1 −1 ...ava/com/rackspacecloud/client/service_registry/{rsr_events → events/server}/ServiceJoinEvent.java
  15. +1 −1 .../com/rackspacecloud/client/service_registry/{rsr_events → events/server}/ServiceTimeoutEvent.java
  16. +8 −4 src/main/java/com/rackspacecloud/client/service_registry/objects/EventPayload.java
  17. +32 −0 src/main/java/com/rackspacecloud/client/service_registry/objects/ServicesTimeoutEventPayload.java
@@ -19,9 +19,9 @@
import com.rackspacecloud.client.service_registry.clients.AuthClient;
import com.rackspacecloud.client.service_registry.clients.BaseClient;
-import com.rackspacecloud.client.service_registry.events.HeartbeatAckEvent;
-import com.rackspacecloud.client.service_registry.events.HeartbeatErrorEvent;
-import com.rackspacecloud.client.service_registry.events.HeartbeatStoppedEvent;
+import com.rackspacecloud.client.service_registry.events.client.HeartbeatAckEvent;
+import com.rackspacecloud.client.service_registry.events.client.HeartbeatErrorEvent;
+import com.rackspacecloud.client.service_registry.events.client.HeartbeatStoppedEvent;
import com.rackspacecloud.client.service_registry.objects.HeartbeatToken;
import org.apache.http.client.methods.HttpPost;
import org.slf4j.Logger;
@@ -31,9 +31,9 @@
import com.google.gson.GsonBuilder;
import com.rackspacecloud.client.service_registry.Client;
import com.rackspacecloud.client.service_registry.ClientResponse;
-import com.rackspacecloud.client.service_registry.events.ClientEvent;
-import com.rackspacecloud.client.service_registry.events.ClientEventListener;
-import com.rackspacecloud.client.service_registry.events.ClientEventThread;
+import com.rackspacecloud.client.service_registry.events.client.ClientEvent;
+import com.rackspacecloud.client.service_registry.events.client.ClientEventListener;
+import com.rackspacecloud.client.service_registry.events.client.ClientEventThread;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpRequestBase;
@@ -19,10 +19,10 @@
import com.google.gson.reflect.TypeToken;
import com.rackspacecloud.client.service_registry.objects.*;
-import com.rackspacecloud.client.service_registry.rsr_events.BaseEvent;
-import com.rackspacecloud.client.service_registry.rsr_events.ConfigurationValueRemovedEvent;
-import com.rackspacecloud.client.service_registry.rsr_events.ConfigurationValueUpdatedEvent;
-import com.rackspacecloud.client.service_registry.rsr_events.ServiceJoinEvent;
+import com.rackspacecloud.client.service_registry.events.server.BaseEvent;
+import com.rackspacecloud.client.service_registry.events.server.ConfigurationValueRemovedEvent;
+import com.rackspacecloud.client.service_registry.events.server.ConfigurationValueUpdatedEvent;
+import com.rackspacecloud.client.service_registry.events.server.ServiceJoinEvent;
import org.apache.http.client.methods.HttpGet;
import com.rackspacecloud.client.service_registry.ClientResponse;
import com.rackspacecloud.client.service_registry.containers.EventsContainer;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
import java.util.EventObject;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
import java.util.EventListener;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
import com.rackspacecloud.client.service_registry.ClientResponse;
import com.rackspacecloud.client.service_registry.HeartBeater;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
public class HeartbeatErrorEvent extends ClientEvent {
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
public abstract class HeartbeatEventListener implements ClientEventListener {
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.events;
+package com.rackspacecloud.client.service_registry.events.client;
import com.rackspacecloud.client.service_registry.HeartBeater;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.rsr_events;
+package com.rackspacecloud.client.service_registry.events.server;
public class BaseEvent {
private String id;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.rsr_events;
+package com.rackspacecloud.client.service_registry.events.server;
import com.rackspacecloud.client.service_registry.objects.ConfigurationValue;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.rsr_events;
+package com.rackspacecloud.client.service_registry.events.server;
import com.rackspacecloud.client.service_registry.objects.ConfigurationValue;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.rsr_events;
+package com.rackspacecloud.client.service_registry.events.server;
import com.rackspacecloud.client.service_registry.objects.Service;
@@ -1,4 +1,4 @@
-package com.rackspacecloud.client.service_registry.rsr_events;
+package com.rackspacecloud.client.service_registry.events.server;
import com.rackspacecloud.client.service_registry.objects.Service;
@@ -21,6 +21,7 @@
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -35,11 +36,9 @@ public EventPayload createInstance(Type type) {
@Override
public EventPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
- JsonObject jsonObject;
-
// TODO: This is nasty - propagate type here
- if (json.getClass() == JsonObject.class) {
- jsonObject = json.getAsJsonObject();
+ if (json.getClass().equals(JsonObject.class)) {
+ JsonObject jsonObject = json.getAsJsonObject();
if (jsonObject.has("configuration_value_id")) {
// configuration_value.update, configuration_value.remove
@@ -73,6 +72,11 @@ public EventPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializat
return new ServiceJoinEventPayload(service);
}
}
+ else if (json.getClass().equals(JsonObject.class)) {
+ // services.timeout
+ JsonArray jsonArray = json.getAsJsonArray();
+ ArrayList<Service> services = new ArrayList<Service>();
+ }
return null;
}
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2012 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.rackspacecloud.client.service_registry.objects;
+
+import java.util.List;
+
+public class ServicesTimeoutEventPayload extends EventPayload {
+ private List<Service> services;
+
+ public ServicesTimeoutEventPayload(List<Service> services) {
+ this.services = services;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+}

0 comments on commit 2cb1214

Please sign in to comment.