Naoki Shiota | 2a35b44 | 2013-11-26 19:17:38 -0800 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.flowprogrammer.web; |
| 2 | |
| 3 | import org.restlet.resource.ServerResource; |
| 4 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; |
| 6 | |
| 7 | import net.floodlightcontroller.core.IFloodlightProviderService; |
| 8 | import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService; |
| 9 | |
| 10 | public class PusherResource extends ServerResource { |
| 11 | protected final static Logger log = LoggerFactory.getLogger(PusherResource.class); |
| 12 | |
| 13 | protected IFloodlightProviderService provider; |
| 14 | protected IFlowPusherService pusher; |
| 15 | |
| 16 | protected boolean init() { |
| 17 | provider = (IFloodlightProviderService) |
| 18 | getContext().getAttributes(). |
| 19 | get(IFloodlightProviderService.class.getCanonicalName()); |
| 20 | if (provider == null) { |
| 21 | log.debug("ONOS FloodlightProvider not found"); |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | pusher = (IFlowPusherService)getContext().getAttributes(). |
| 26 | get(IFlowPusherService.class.getCanonicalName()); |
| 27 | if (pusher == null) { |
| 28 | log.debug("ONOS FlowPusherService not found"); |
| 29 | return false; |
| 30 | } |
| 31 | return true; |
| 32 | } |
| 33 | } |