Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 1 | package net.floodlightcontroller.debugcounter; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.Collection; |
| 5 | import java.util.Collections; |
| 6 | import java.util.HashMap; |
| 7 | import java.util.List; |
| 8 | import java.util.Map; |
| 9 | |
| 10 | import net.floodlightcontroller.core.module.FloodlightModuleContext; |
| 11 | import net.floodlightcontroller.core.module.FloodlightModuleException; |
| 12 | import net.floodlightcontroller.core.module.IFloodlightModule; |
| 13 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 14 | import net.floodlightcontroller.debugcounter.DebugCounter.DebugCounterInfo; |
| 15 | |
| 16 | public class NullDebugCounter implements IFloodlightModule, IDebugCounterService { |
| 17 | |
| 18 | |
| 19 | @Override |
| 20 | public Collection<Class<? extends IFloodlightService>> |
| 21 | getModuleServices() { |
| 22 | Collection<Class<? extends IFloodlightService>> services = |
| 23 | new ArrayList<Class<? extends IFloodlightService>>(1); |
| 24 | services.add(IDebugCounterService.class); |
| 25 | return services; |
| 26 | } |
| 27 | |
| 28 | @Override |
| 29 | public Map<Class<? extends IFloodlightService>, IFloodlightService> |
| 30 | getServiceImpls() { |
| 31 | Map<Class<? extends IFloodlightService>, |
| 32 | IFloodlightService> m = |
| 33 | new HashMap<Class<? extends IFloodlightService>, |
| 34 | IFloodlightService>(); |
| 35 | m.put(IDebugCounterService.class, this); |
| 36 | return m; |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public Collection<Class<? extends IFloodlightService>> |
| 41 | getModuleDependencies() { |
| 42 | return null; |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public void init(FloodlightModuleContext context) |
| 47 | throws FloodlightModuleException { |
| 48 | |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public void startUp(FloodlightModuleContext context) { |
| 53 | |
| 54 | } |
| 55 | |
| 56 | |
| 57 | @Override |
| 58 | public void flushCounters() { |
| 59 | |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public void resetAllCounters() { |
| 64 | |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public void resetAllModuleCounters(String moduleName) { |
| 69 | |
| 70 | } |
| 71 | |
| 72 | |
| 73 | @Override |
| 74 | public void resetCounterHierarchy(String moduleName, String counterHierarchy) { |
| 75 | |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void enableCtrOnDemand(String moduleName, String counterHierarchy) { |
| 80 | |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public void disableCtrOnDemand(String moduleName, String counterHierarchy) { |
| 85 | |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public List<DebugCounterInfo> getCounterHierarchy(String moduleName, |
| 90 | String counterHierarchy) { |
| 91 | return Collections.emptyList(); |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public List<DebugCounterInfo> getAllCounterValues() { |
| 96 | return Collections.emptyList(); |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public List<DebugCounterInfo> getModuleCounterValues(String moduleName) { |
| 101 | return Collections.emptyList(); |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public boolean containsModuleCounterHierarchy(String moduleName, |
| 106 | String counterHierarchy) { |
| 107 | return false; |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public boolean containsModuleName(String moduleName) { |
| 112 | return false; |
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public |
| 117 | IDebugCounter |
| 118 | registerCounter(String moduleName, String counterHierarchy, |
| 119 | String counterDescription, |
| 120 | CounterType counterType, String... metaData) |
| 121 | throws MaxCountersRegistered { |
| 122 | return new NullCounterImpl(); |
| 123 | } |
| 124 | |
| 125 | @Override |
| 126 | public List<String> getModuleList() { |
| 127 | return Collections.emptyList(); |
| 128 | } |
| 129 | |
| 130 | @Override |
| 131 | public List<String> getModuleCounterList(String moduleName) { |
| 132 | return Collections.emptyList(); |
| 133 | } |
| 134 | |
| 135 | public class NullCounterImpl implements IDebugCounter { |
| 136 | |
| 137 | @Override |
| 138 | public void updateCounterWithFlush() { |
| 139 | |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public void updateCounterNoFlush() { |
| 144 | |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | public void updateCounterWithFlush(int incr) { |
| 149 | } |
| 150 | |
| 151 | @Override |
| 152 | public void updateCounterNoFlush(int incr) { |
| 153 | |
| 154 | } |
| 155 | |
| 156 | @Override |
| 157 | public long getCounterValue() { |
| 158 | return -1; |
| 159 | } |
| 160 | |
| 161 | } |
| 162 | |
| 163 | } |