blob: e1f81100103713dff5700d24f7cabbf0319a807c [file] [log] [blame]
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -08001/*
Brian O'Connor0a4e6742016-09-15 23:03:10 -07002 * Copyright 2016-present Open Networking Laboratory
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -08003 *
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 */
HIGUCHI Yutaf46dc4f2016-05-13 11:24:13 -070016package org.onosproject.net.utils;
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080017
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import java.util.List;
21
22import org.onosproject.net.Device;
23import org.onosproject.net.Device.Type;
24import org.onosproject.net.DeviceId;
25import org.onosproject.net.MastershipRole;
26import org.onosproject.net.Port;
27import org.onosproject.net.PortNumber;
28import org.onosproject.net.device.DeviceListener;
29import org.onosproject.net.device.DeviceService;
30import org.onosproject.net.device.PortStatistics;
31
32import com.google.common.annotations.Beta;
33
34/**
35 * A DeviceService which forwards all its method calls to another DeviceService.
36 */
37@Beta
38public abstract class ForwardingDeviceService implements DeviceService {
39
40 private final DeviceService delegate;
41
42 protected ForwardingDeviceService(DeviceService delegate) {
43 this.delegate = checkNotNull(delegate);
44 }
45
46 protected final DeviceService delegate() {
47 return delegate;
48 }
49
50 @Override
51 public void addListener(DeviceListener listener) {
52 delegate.addListener(listener);
53 }
54
55 @Override
56 public void removeListener(DeviceListener listener) {
57 delegate.removeListener(listener);
58 }
59
60 @Override
61 public int getDeviceCount() {
62 return delegate.getDeviceCount();
63 }
64
65 @Override
66 public Iterable<Device> getDevices() {
67 return delegate.getDevices();
68 }
69
70 @Override
71 public Iterable<Device> getDevices(Type type) {
72 return delegate.getDevices(type);
73 }
74
75 @Override
76 public Iterable<Device> getAvailableDevices() {
77 return delegate.getAvailableDevices();
78 }
79
80 @Override
81 public Iterable<Device> getAvailableDevices(Type type) {
82 return delegate.getAvailableDevices(type);
83 }
84
85 @Override
86 public Device getDevice(DeviceId deviceId) {
87 return delegate.getDevice(deviceId);
88 }
89
90 @Override
91 public MastershipRole getRole(DeviceId deviceId) {
92 return delegate.getRole(deviceId);
93 }
94
95 @Override
96 public List<Port> getPorts(DeviceId deviceId) {
97 return delegate.getPorts(deviceId);
98 }
99
100 @Override
101 public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
102 return delegate.getPortStatistics(deviceId);
103 }
104
105 @Override
106 public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) {
107 return delegate.getPortDeltaStatistics(deviceId);
108 }
109
110 @Override
111 public Port getPort(DeviceId deviceId, PortNumber portNumber) {
112 return delegate.getPort(deviceId, portNumber);
113 }
114
115 @Override
116 public boolean isAvailable(DeviceId deviceId) {
117 return delegate.isAvailable(deviceId);
118 }
119
Yuta HIGUCHI24bc76b2017-03-01 21:09:59 -0800120 @Override
121 public String localStatus(DeviceId deviceId) {
122 return delegate.localStatus(deviceId);
123 }
124
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -0800125}