Yuta HIGUCHI | 2405782 | 2017-08-02 15:03:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | package org.onosproject.config; |
| 17 | |
| 18 | import static org.onosproject.yang.model.RpcOutput.Status.RPC_NODATA; |
| 19 | |
| 20 | import java.util.concurrent.CompletableFuture; |
| 21 | |
| 22 | import org.onosproject.event.ListenerRegistry; |
| 23 | import org.onosproject.yang.model.DataNode; |
| 24 | import org.onosproject.yang.model.ResourceId; |
| 25 | import org.onosproject.yang.model.RpcInput; |
| 26 | import org.onosproject.yang.model.RpcOutput; |
| 27 | |
| 28 | /** |
| 29 | * Adapter for DynamicConfigService. |
| 30 | */ |
| 31 | public class DynamicConfigServiceAdapter |
| 32 | implements DynamicConfigService { |
| 33 | |
| 34 | protected final ListenerRegistry<DynamicConfigEvent, DynamicConfigListener> |
| 35 | listenerRegistry = new ListenerRegistry<>(); |
| 36 | |
| 37 | |
| 38 | |
| 39 | @Override |
| 40 | public void createNode(ResourceId path, DataNode node) { |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public DataNode readNode(ResourceId path, Filter filter) { |
| 45 | return null; |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public Boolean nodeExist(ResourceId path) { |
| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public void updateNode(ResourceId path, DataNode node) { |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public void replaceNode(ResourceId path, DataNode node) { |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public void deleteNode(ResourceId path) { |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public CompletableFuture<RpcOutput> invokeRpc(ResourceId id, |
| 67 | RpcInput input) { |
| 68 | return CompletableFuture.completedFuture(new RpcOutput(RPC_NODATA, null)); |
| 69 | } |
| 70 | |
| 71 | @Override |
Gaurav Agrawal | 142ceb0 | 2018-02-16 12:19:08 +0530 | [diff] [blame] | 72 | public CompletableFuture<RpcOutput> invokeRpc(RpcInput input) { |
| 73 | //TODO: implement me, not sure about purpose of this adapter. |
| 74 | throw new UnsupportedOperationException(); |
| 75 | } |
| 76 | |
| 77 | @Override |
Yuta HIGUCHI | 2405782 | 2017-08-02 15:03:51 -0700 | [diff] [blame] | 78 | public void addListener(DynamicConfigListener listener) { |
| 79 | listenerRegistry.addListener(listener); |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public void removeListener(DynamicConfigListener listener) { |
| 84 | listenerRegistry.removeListener(listener); |
| 85 | } |
| 86 | |
| 87 | } |