blob: 2783a26d21744eddf3cb240fd62e10d996b6f170 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
2* Copyright 2012, Big Switch Networks, Inc.
3* Originally created by David Erickson, Stanford University
4*
5* Licensed under the Apache License, Version 2.0 (the "License"); you may
6* not use this file except in compliance with the License. You may obtain
7* a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14* License for the specific language governing permissions and limitations
15* under the License.
16**/
17
18package net.floodlightcontroller.devicemanager.web;
19
20import java.util.Iterator;
21
22import net.floodlightcontroller.devicemanager.IDevice;
23import net.floodlightcontroller.devicemanager.internal.Device;
24import net.floodlightcontroller.devicemanager.internal.Entity;
25
26import org.restlet.resource.Get;
27
28/**
29 * Resource for querying and displaying internal debug information on
30 * network entities associated with devices
31 */
32public class DeviceEntityResource extends AbstractDeviceResource {
33 @Get("json")
34 public Iterator<Entity[]> getDeviceEntities() {
35 final Iterator<? extends IDevice> devices = super.getDevices();
36 return new Iterator<Entity[]>() {
37
38 @Override
39 public boolean hasNext() {
40 return devices.hasNext();
41 }
42
43 @Override
44 public Entity[] next() {
45 Device d = (Device)devices.next();
46 return d.getEntities();
47 }
48
49 @Override
50 public void remove() {
51 throw new UnsupportedOperationException();
52 }
53 };
54 }
55}