gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 1 | /* |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 2 | * Copyright 2019-present Open Networking Foundation |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 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 | package org.onosproject.netconf.ctl.impl; |
| 18 | |
| 19 | import com.google.common.collect.ImmutableList; |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 20 | import org.onosproject.cluster.NodeId; |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.netconf.NetconfProxyMessage; |
| 23 | |
| 24 | import java.util.List; |
| 25 | |
| 26 | /** |
| 27 | * Default implementation of Netconf Proxy Message. |
| 28 | */ |
| 29 | public class DefaultNetconfProxyMessage implements NetconfProxyMessage { |
| 30 | |
| 31 | private final SubjectType subjectType; |
| 32 | private final DeviceId deviceId; |
| 33 | private final List<String> arguments; |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 34 | private final NodeId senderId; |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Create new NetconfProxyMessage with provided informations. |
| 38 | * @param subType Message subject type. |
| 39 | * @param devId Device information that recieve message. |
| 40 | * @param args Messages arguments. |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 41 | * @param nodeId nodeId of sender |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 42 | */ |
| 43 | public DefaultNetconfProxyMessage(SubjectType subType, |
| 44 | DeviceId devId, |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 45 | List<String> args, |
| 46 | NodeId nodeId) { |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 47 | subjectType = subType; |
| 48 | deviceId = devId; |
| 49 | arguments = args; |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 50 | senderId = nodeId; |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 51 | } |
| 52 | |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 53 | |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 54 | @Override |
| 55 | public SubjectType subjectType() { |
| 56 | return subjectType; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public DeviceId deviceId() { |
| 61 | return deviceId; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public List<String> arguments() { |
| 66 | return ImmutableList.copyOf(arguments); |
| 67 | } |
gyewan.an | 3c99ee7 | 2019-02-18 15:53:55 +0900 | [diff] [blame^] | 68 | |
| 69 | @Override |
| 70 | public NodeId senderId() { |
| 71 | return senderId; |
| 72 | } |
gyewan.an | 91d7e7e | 2019-01-17 15:12:48 +0900 | [diff] [blame] | 73 | } |