Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.flowcache.web; |
| 2 | |
| 3 | import net.floodlightcontroller.flowcache.IFlowService; |
| 4 | |
| 5 | import org.restlet.resource.Get; |
| 6 | import org.restlet.resource.ServerResource; |
| 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; |
| 9 | |
| 10 | public class AddFlowResource extends ServerResource { |
| 11 | |
| 12 | protected static Logger log = LoggerFactory.getLogger(AddFlowResource.class); |
| 13 | |
| 14 | @Get("json") |
| 15 | public Boolean retrieve() { |
| 16 | Boolean result = false; |
| 17 | |
| 18 | IFlowService flowService = |
| 19 | (IFlowService)getContext().getAttributes(). |
| 20 | get(IFlowService.class.getCanonicalName()); |
| 21 | |
| 22 | if (flowService == null) { |
| 23 | log.debug("ONOS Flow Service not found"); |
| 24 | return result; |
| 25 | } |
| 26 | |
| 27 | // Extract the arguments |
| 28 | String flowPathStr = (String) getRequestAttributes().get("flow"); |
| 29 | log.debug("Add Flow Path: " + flowPathStr); |
| 30 | |
| 31 | // TODO: Implement it. |
| 32 | result = true; |
| 33 | |
| 34 | return result; |
| 35 | } |
| 36 | } |