Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [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.yangutils.datamodel; |
| 18 | |
| 19 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 20 | import org.onosproject.yangutils.parser.Parsable; |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.utils.YangConstructType; |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * Reference:RFC 6020. |
| 25 | * The "namespace" statement defines the XML namespace that all |
| 26 | * identifiers defined by the module are qualified by, with the |
| 27 | * exception of data node identifiers defined inside a grouping. |
| 28 | * The argument to the "namespace" statement is the URI of the |
| 29 | * namespace. |
| 30 | */ |
| 31 | |
| 32 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 33 | * Represents name space to be used for the XML data tree. |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 34 | */ |
| 35 | public class YangNameSpace implements Parsable { |
| 36 | |
| 37 | private String uri; |
| 38 | |
| 39 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 40 | * Creats a YANG name space object. |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 41 | */ |
| 42 | public YangNameSpace() { |
| 43 | } |
| 44 | |
| 45 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 46 | * Returns the name space URI. |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 47 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 48 | * @return the URI |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 49 | */ |
| 50 | public String getUri() { |
| 51 | return uri; |
| 52 | } |
| 53 | |
| 54 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 55 | * Sets the name space URI. |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 56 | * |
| 57 | * @param uri the URI to set |
| 58 | */ |
| 59 | public void setUri(String uri) { |
| 60 | this.uri = uri; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Returns the type of the parsed data. |
| 65 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 66 | * @return returns NAMESPACE_DATA |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 67 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 68 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 69 | public YangConstructType getYangConstructType() { |
| 70 | return YangConstructType.NAMESPACE_DATA; |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 74 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 75 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 76 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 77 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 78 | @Override |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 79 | public void validateDataOnEntry() throws DataModelException { |
| 80 | // TODO auto-generated method stub, to be implemented by parser |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 84 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 85 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 86 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 87 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 88 | @Override |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 89 | public void validateDataOnExit() throws DataModelException { |
| 90 | // TODO auto-generated method stub, to be implemented by parser |
Vinod Kumar S | ae41bea | 2016-02-09 20:02:43 +0530 | [diff] [blame] | 91 | } |
| 92 | } |