Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net; |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.net.provider.ProviderId; |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * Base implementation of a network model entity. |
| 22 | */ |
tom | 5a9383a | 2014-10-02 07:33:52 -0700 | [diff] [blame] | 23 | public abstract class AbstractModel extends AbstractAnnotated implements Provided { |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 24 | |
| 25 | private final ProviderId providerId; |
| 26 | |
tom | c649132 | 2014-09-19 15:27:40 -0700 | [diff] [blame] | 27 | // For serialization |
| 28 | public AbstractModel() { |
| 29 | providerId = null; |
| 30 | } |
| 31 | |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 32 | /** |
tom | 27ae0e6 | 2014-10-01 20:35:01 -0700 | [diff] [blame] | 33 | * Creates a model entity attributed to the specified provider and |
| 34 | * optionally annotated. |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 35 | * |
tom | 27ae0e6 | 2014-10-01 20:35:01 -0700 | [diff] [blame] | 36 | * @param providerId identity of the provider |
| 37 | * @param annotations optional key/value annotations |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 38 | */ |
tom | f5d85d4 | 2014-10-02 05:27:56 -0700 | [diff] [blame] | 39 | protected AbstractModel(ProviderId providerId, Annotations... annotations) { |
tom | 27ae0e6 | 2014-10-01 20:35:01 -0700 | [diff] [blame] | 40 | super(annotations); |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 41 | this.providerId = providerId; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public ProviderId providerId() { |
| 46 | return providerId; |
| 47 | } |
| 48 | |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 49 | } |