A race condition occurs between ARPHandler and HostTracker if the ARP
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / InstanceIdentifier.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.yang.model.util;
9
10 import java.util.Collections;
11 import java.util.List;
12
13 import org.opendaylight.controller.yang.common.QName;
14 import org.opendaylight.controller.yang.model.api.RevisionAwareXPath;
15 import org.opendaylight.controller.yang.model.api.SchemaPath;
16 import org.opendaylight.controller.yang.model.api.Status;
17 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
18 import org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition;
19
20 /**
21  * The <code>default</code> implementation of Instance Identifier Type
22  * Definition interface.
23  *
24  * @see InstanceIdentifierTypeDefinition
25  */
26 public final class InstanceIdentifier implements InstanceIdentifierTypeDefinition {
27     private static final QName name = BaseTypes.constructQName("instance-identifier");
28     private static final String description = "The instance-identifier built-in type is used to "
29             + "uniquely identify a particular instance node in the data tree.";
30     private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.13";
31
32     private final transient SchemaPath path;
33     private final RevisionAwareXPath xpath;
34     private final String units = "";
35     private final InstanceIdentifierTypeDefinition baseType;
36     private boolean requireInstance = true;
37
38     public InstanceIdentifier(final SchemaPath path, final RevisionAwareXPath xpath) {
39         super();
40         this.path = path;
41         this.xpath = xpath;
42         this.baseType = this;
43     }
44
45     public InstanceIdentifier(final SchemaPath path, final RevisionAwareXPath xpath, final boolean requireInstance) {
46         super();
47         this.path = path;
48         this.xpath = xpath;
49         this.requireInstance = requireInstance;
50         this.baseType = this;
51     }
52
53     /*
54      * (non-Javadoc)
55      *
56      * @see
57      * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
58      */
59     @Override
60     public InstanceIdentifierTypeDefinition getBaseType() {
61         return baseType;
62     }
63
64     /*
65      * (non-Javadoc)
66      *
67      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
68      */
69     @Override
70     public String getUnits() {
71         return units;
72     }
73
74     /*
75      * (non-Javadoc)
76      *
77      * @see
78      * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
79      * ()
80      */
81     @Override
82     public Object getDefaultValue() {
83         return xpath;
84     }
85
86     /*
87      * (non-Javadoc)
88      *
89      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
90      */
91     @Override
92     public QName getQName() {
93         return name;
94     }
95
96     /*
97      * (non-Javadoc)
98      *
99      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
100      */
101     @Override
102     public SchemaPath getPath() {
103         return path;
104     }
105
106     /*
107      * (non-Javadoc)
108      *
109      * @see
110      * org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
111      */
112     @Override
113     public String getDescription() {
114         return description;
115     }
116
117     /*
118      * (non-Javadoc)
119      *
120      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
121      */
122     @Override
123     public String getReference() {
124         return reference;
125     }
126
127     /*
128      * (non-Javadoc)
129      *
130      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
131      */
132     @Override
133     public Status getStatus() {
134         return Status.CURRENT;
135     }
136
137     /*
138      * (non-Javadoc)
139      *
140      * @see
141      * org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes
142      * ()
143      */
144     @Override
145     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
146         return Collections.emptyList();
147     }
148
149     /*
150      * (non-Javadoc)
151      *
152      * @see org.opendaylight.controller.yang.model.api.type.
153      * InstanceIdentifierTypeDefinition# getPathStatement()
154      */
155     @Override
156     public RevisionAwareXPath getPathStatement() {
157         return xpath;
158     }
159
160     /*
161      * (non-Javadoc)
162      *
163      * @see org.opendaylight.controller.yang.model.api.type.
164      * InstanceIdentifierTypeDefinition# requireInstance()
165      */
166     @Override
167     public boolean requireInstance() {
168         return requireInstance;
169     }
170
171 }