blob: 599a1af2920e3e9d1793aae0fdd6d99aa86c10d6 [file] [log] [blame]
Jonathan Hart3d7730a2013-02-22 11:51:17 -08001package net.onrc.onos.registry.controller;
2
3import java.util.HashMap;
4import java.util.List;
5import java.util.Map;
6
7import org.restlet.resource.Get;
8import org.restlet.resource.ServerResource;
Jonathan Hart3d7730a2013-02-22 11:51:17 -08009
10public class SwitchRegistryResource extends ServerResource {
Jonathan Hart3d7730a2013-02-22 11:51:17 -080011
12 @Get("json")
13 public Map<String, List<ControllerRegistryEntry>> getAllControllers(){
14 IControllerRegistryService registry =
15 (IControllerRegistryService) getContext().getAttributes().
16 get(IControllerRegistryService.class.getCanonicalName());
17
18 Map<String, List<ControllerRegistryEntry>> switches = null;
19 switches = registry.getAllSwitches();
20
21 if (switches == null){
22 switches = new HashMap<String, List<ControllerRegistryEntry>>();
23 }
24
Jonathan Hart3d7730a2013-02-22 11:51:17 -080025 return switches;
26 }
27}