Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame^] | 1 | package net.floodlightcontroller.core.web; |
| 2 | |
| 3 | import java.util.Iterator; |
| 4 | |
| 5 | import net.floodlightcontroller.core.internal.TopoSwitchServiceImpl; |
| 6 | |
| 7 | import org.restlet.resource.Get; |
| 8 | import org.restlet.resource.ServerResource; |
| 9 | |
| 10 | public class TopoSwitchesResource extends ServerResource { |
| 11 | |
| 12 | @Get("json") |
| 13 | public Iterator<String> retrieve() { |
| 14 | TopoSwitchServiceImpl impl = new TopoSwitchServiceImpl(); |
| 15 | |
| 16 | String filter = (String) getRequestAttributes().get("filter"); |
| 17 | |
| 18 | if (filter.equals("active")) { |
| 19 | return (Iterator<String>) impl.GetActiveSwitches().iterator(); |
| 20 | } |
| 21 | if (filter.equals("inactive")) { |
| 22 | return (Iterator<String>) impl.GetInactiveSwitches().iterator(); |
| 23 | } |
| 24 | return (Iterator<String>) impl.GetAllSwitches().iterator(); |
| 25 | } |
| 26 | |
| 27 | } |