Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 3 | * |
Simon Hunt | ed804d5 | 2016-03-30 09:51:40 -0700 | [diff] [blame] | 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 |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 7 | * |
Simon Hunt | ed804d5 | 2016-03-30 09:51:40 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 9 | * |
Simon Hunt | ed804d5 | 2016-03-30 09:51:40 -0700 | [diff] [blame] | 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. |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Simon Hunt | ed804d5 | 2016-03-30 09:51:40 -0700 | [diff] [blame] | 17 | package org.onosproject.ui.impl.topo.util; |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 18 | |
| 19 | import org.onosproject.incubator.net.PortStatisticsService; |
| 20 | import org.onosproject.net.device.DeviceService; |
| 21 | import org.onosproject.net.flow.FlowRuleService; |
| 22 | import org.onosproject.net.host.HostService; |
| 23 | import org.onosproject.net.intent.IntentService; |
| 24 | import org.onosproject.net.link.LinkService; |
| 25 | import org.onosproject.net.statistic.StatisticService; |
| 26 | |
| 27 | import static com.google.common.base.Preconditions.checkNotNull; |
| 28 | |
| 29 | /** |
| 30 | * A bundle of services that the topology view requires to get its job done. |
| 31 | */ |
| 32 | public class ServicesBundle { |
| 33 | |
| 34 | private final IntentService intentService; |
| 35 | private final DeviceService deviceService; |
| 36 | private final HostService hostService; |
| 37 | private final LinkService linkService; |
| 38 | private final FlowRuleService flowService; |
| 39 | private final StatisticService flowStatsService; |
| 40 | private final PortStatisticsService portStatsService; |
| 41 | |
| 42 | /** |
| 43 | * Creates the services bundle. |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 44 | * |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 45 | * @param intentService intent service reference |
| 46 | * @param deviceService device service reference |
| 47 | * @param hostService host service reference |
| 48 | * @param linkService link service reference |
| 49 | * @param flowService flow service reference |
| 50 | * @param flowStatsService flow statistics service reference |
| 51 | * @param portStatsService port statistics service reference |
| 52 | */ |
| 53 | public ServicesBundle(IntentService intentService, |
| 54 | DeviceService deviceService, |
| 55 | HostService hostService, |
| 56 | LinkService linkService, |
| 57 | FlowRuleService flowService, |
| 58 | StatisticService flowStatsService, |
| 59 | PortStatisticsService portStatsService) { |
| 60 | this.intentService = checkNotNull(intentService); |
| 61 | this.deviceService = checkNotNull(deviceService); |
| 62 | this.hostService = checkNotNull(hostService); |
| 63 | this.linkService = checkNotNull(linkService); |
| 64 | this.flowService = checkNotNull(flowService); |
| 65 | this.flowStatsService = checkNotNull(flowStatsService); |
| 66 | this.portStatsService = checkNotNull(portStatsService); |
| 67 | } |
| 68 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 69 | /** |
| 70 | * Returns a reference to the intent service. |
| 71 | * |
| 72 | * @return intent service reference |
| 73 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 74 | public IntentService intentService() { |
| 75 | return intentService; |
| 76 | } |
| 77 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 78 | /** |
| 79 | * Returns a reference to the device service. |
| 80 | * |
| 81 | * @return device service reference |
| 82 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 83 | public DeviceService deviceService() { |
| 84 | return deviceService; |
| 85 | } |
| 86 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 87 | /** |
| 88 | * Returns a reference to the host service. |
| 89 | * |
| 90 | * @return host service reference |
| 91 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 92 | public HostService hostService() { |
| 93 | return hostService; |
| 94 | } |
| 95 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 96 | /** |
| 97 | * Returns a reference to the link service. |
| 98 | * |
| 99 | * @return link service reference |
| 100 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 101 | public LinkService linkService() { |
| 102 | return linkService; |
| 103 | } |
| 104 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 105 | /** |
| 106 | * Returns a reference to the flow rule service. |
| 107 | * |
| 108 | * @return flow service reference |
| 109 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 110 | public FlowRuleService flowService() { |
| 111 | return flowService; |
| 112 | } |
| 113 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 114 | /** |
| 115 | * Returns a reference to the flow statistics service. |
| 116 | * |
| 117 | * @return flow statistics service reference |
| 118 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 119 | public StatisticService flowStatsService() { |
| 120 | return flowStatsService; |
| 121 | } |
| 122 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 123 | /** |
| 124 | * Returns a reference to the port statistics service. |
| 125 | * |
| 126 | * @return port statistics service reference |
| 127 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 128 | public PortStatisticsService portStatsService() { |
| 129 | return portStatsService; |
| 130 | } |
| 131 | } |