Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | package org.onosproject.ui.impl.topo; |
| 19 | |
| 20 | import org.onosproject.incubator.net.PortStatisticsService; |
| 21 | import org.onosproject.net.device.DeviceService; |
| 22 | import org.onosproject.net.flow.FlowRuleService; |
| 23 | import org.onosproject.net.host.HostService; |
| 24 | import org.onosproject.net.intent.IntentService; |
| 25 | import org.onosproject.net.link.LinkService; |
| 26 | import org.onosproject.net.statistic.StatisticService; |
| 27 | |
| 28 | import static com.google.common.base.Preconditions.checkNotNull; |
| 29 | |
| 30 | /** |
| 31 | * A bundle of services that the topology view requires to get its job done. |
| 32 | */ |
| 33 | public class ServicesBundle { |
| 34 | |
| 35 | private final IntentService intentService; |
| 36 | private final DeviceService deviceService; |
| 37 | private final HostService hostService; |
| 38 | private final LinkService linkService; |
| 39 | private final FlowRuleService flowService; |
| 40 | private final StatisticService flowStatsService; |
| 41 | private final PortStatisticsService portStatsService; |
| 42 | |
| 43 | /** |
| 44 | * Creates the services bundle. |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 45 | * |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 46 | * @param intentService intent service reference |
| 47 | * @param deviceService device service reference |
| 48 | * @param hostService host service reference |
| 49 | * @param linkService link service reference |
| 50 | * @param flowService flow service reference |
| 51 | * @param flowStatsService flow statistics service reference |
| 52 | * @param portStatsService port statistics service reference |
| 53 | */ |
| 54 | public ServicesBundle(IntentService intentService, |
| 55 | DeviceService deviceService, |
| 56 | HostService hostService, |
| 57 | LinkService linkService, |
| 58 | FlowRuleService flowService, |
| 59 | StatisticService flowStatsService, |
| 60 | PortStatisticsService portStatsService) { |
| 61 | this.intentService = checkNotNull(intentService); |
| 62 | this.deviceService = checkNotNull(deviceService); |
| 63 | this.hostService = checkNotNull(hostService); |
| 64 | this.linkService = checkNotNull(linkService); |
| 65 | this.flowService = checkNotNull(flowService); |
| 66 | this.flowStatsService = checkNotNull(flowStatsService); |
| 67 | this.portStatsService = checkNotNull(portStatsService); |
| 68 | } |
| 69 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 70 | /** |
| 71 | * Returns a reference to the intent service. |
| 72 | * |
| 73 | * @return intent service reference |
| 74 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 75 | public IntentService intentService() { |
| 76 | return intentService; |
| 77 | } |
| 78 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 79 | /** |
| 80 | * Returns a reference to the device service. |
| 81 | * |
| 82 | * @return device service reference |
| 83 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 84 | public DeviceService deviceService() { |
| 85 | return deviceService; |
| 86 | } |
| 87 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 88 | /** |
| 89 | * Returns a reference to the host service. |
| 90 | * |
| 91 | * @return host service reference |
| 92 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 93 | public HostService hostService() { |
| 94 | return hostService; |
| 95 | } |
| 96 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 97 | /** |
| 98 | * Returns a reference to the link service. |
| 99 | * |
| 100 | * @return link service reference |
| 101 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 102 | public LinkService linkService() { |
| 103 | return linkService; |
| 104 | } |
| 105 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 106 | /** |
| 107 | * Returns a reference to the flow rule service. |
| 108 | * |
| 109 | * @return flow service reference |
| 110 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 111 | public FlowRuleService flowService() { |
| 112 | return flowService; |
| 113 | } |
| 114 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 115 | /** |
| 116 | * Returns a reference to the flow statistics service. |
| 117 | * |
| 118 | * @return flow statistics service reference |
| 119 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 120 | public StatisticService flowStatsService() { |
| 121 | return flowStatsService; |
| 122 | } |
| 123 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 124 | /** |
| 125 | * Returns a reference to the port statistics service. |
| 126 | * |
| 127 | * @return port statistics service reference |
| 128 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 129 | public PortStatisticsService portStatsService() { |
| 130 | return portStatsService; |
| 131 | } |
| 132 | } |