Future<Object> devices = Deserializer.readJsonArrayFromURL("http://" + IP
+ ":" + PORT + "/wm/device/");
JSONArray json = (JSONArray) devices.get(5, TimeUnit.SECONDS);
for (int i = 0; i < json.length(); i++) {
obj = json.getJSONObject(i);
DeviceSummary temp = new DeviceSummary(obj.getJSONArray("mac")
.getString(0));
if (!obj.getJSONArray("ipv4").isNull(0))
temp.setIpv4(obj.getJSONArray("ipv4").getString(0));
if (!obj.getJSONArray("attachmentPoint").isNull(0)) {
temp.setAttachedSwitch(obj.getJSONArray("attachmentPoint")
.getJSONObject(0).getString("switchDPID"));
temp.setSwitchPort(obj.getJSONArray("attachmentPoint")
.getJSONObject(0).getInt("port"));
}
Date d = new Date(obj.getLong("lastSeen"));
temp.setLastSeen(d);
deviceSummaries.add(temp);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();