From 61ffc336fddd9f743542986ce5c628154c6e995c Mon Sep 17 00:00:00 2001 From: Jozef Gloncak Date: Fri, 23 Aug 2013 14:36:41 +0200 Subject: [PATCH] Comments added to a source codes. The missing comments in the interfaces of project yang-model-api were added. Signed-off-by: Jozef Gloncak --- .../yangtools/yang/model/api/ChoiceNode.java | 23 +- .../yang/model/api/ConstraintDefinition.java | 105 ++++-- .../model/api/ConstraintMetaDefinition.java | 66 +++- .../yang/model/api/DataSchemaNode.java | 96 ++--- .../yang/model/api/ExtensionDefinition.java | 94 ++--- .../yang/model/api/LeafListSchemaNode.java | 60 ++-- .../yang/model/api/LeafSchemaNode.java | 79 +++-- .../yangtools/yang/model/api/Module.java | 333 +++++++++++++----- .../yang/model/api/MustDefinition.java | 41 ++- .../yang/model/api/RevisionAwareXPath.java | 64 ++-- .../yang/model/api/SchemaContext.java | 70 +++- .../yangtools/yang/model/api/SchemaNode.java | 115 +++--- .../yangtools/yang/model/api/SchemaPath.java | 191 ++++++---- .../yang/model/api/TypeDefinition.java | 76 +++- .../yang/model/api/UnknownSchemaNode.java | 25 +- .../yangtools/yang/model/api/UsesNode.java | 112 +++--- .../model/api/type/BitsTypeDefinition.java | 23 +- .../model/api/type/BooleanTypeDefinition.java | 9 +- .../model/api/type/DecimalTypeDefinition.java | 16 +- .../model/api/type/EnumTypeDefinition.java | 22 +- .../api/type/IdentityTypeDefinition.java | 12 +- .../api/type/IdentityrefTypeDefinition.java | 45 ++- .../InstanceIdentifierTypeDefinition.java | 22 +- .../model/api/type/PatternConstraint.java | 11 + .../model/api/type/StringTypeDefinition.java | 22 +- .../model/api/type/UnionTypeDefinition.java | 14 +- .../type/UnsignedIntegerTypeDefinition.java | 17 +- .../parser/builder/impl/ChoiceBuilder.java | 6 +- 28 files changed, 1213 insertions(+), 556 deletions(-) diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ChoiceNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ChoiceNode.java index ac658a57fc..cae5136a40 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ChoiceNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ChoiceNode.java @@ -18,11 +18,18 @@ import org.opendaylight.yangtools.yang.common.QName; public interface ChoiceNode extends DataSchemaNode, AugmentationTarget { /** - * @return ChoiceCaseNode objects defined in this node + * Returns cases of choice. + * + * @return set of ChoiceCaseNode objects defined in this node which + * represents set of arguments of the YANG case + * substatement of the choice statement */ Set getCases(); /** + * + * Returns the concrete case according to specified Q name. + * * @param name * QName of seeked Choice Case Node * @return child case node of this Choice if child with given name is @@ -31,13 +38,23 @@ public interface ChoiceNode extends DataSchemaNode, AugmentationTarget { ChoiceCaseNode getCaseNodeByName(QName name); /** + * Returns the concrete case according to specified name. + * * @param name * name of seeked child as String - * @return child case node (or local name of case node) of this Choice if child with given name is - * present, null otherwise + * @return child case node (or local name of case node) of this Choice if + * child with given name is present, null otherwise */ ChoiceCaseNode getCaseNodeByName(String name); + /** + * + * Returns name of case which is in the choice specified as default + * + * @return string with the name of case which is specified in the argument + * of the YANG default substatement of + * choice statement. + */ String getDefaultCase(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintDefinition.java index 349a2ba1e6..c201545d8c 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintDefinition.java @@ -1,23 +1,82 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -import java.util.Set; - -public interface ConstraintDefinition { - - RevisionAwareXPath getWhenCondition(); - - Set getMustConstraints(); - - boolean isMandatory(); - - Integer getMinElements(); - - Integer getMaxElements(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +import java.util.Set; + +/** + * Contains method which returns various data constraints for some YANG element + * (e.g. min or max number of elements). Not all constraints are allowed for all + * YANG element therefore if the constraint doesn't have sense for some element + * then the method returns null value. + */ +public interface ConstraintDefinition { + + /** + * Specifies the condition when the data node which contains + * when YANG substatement has to be present. If XPath + * expression is evaluated as true then the data node has to be present. + * + * @return XPath expression. + */ + RevisionAwareXPath getWhenCondition(); + + /** + * Specifies the rules which the node which contains must YANG + * substatement has to match. + * + * + * @return set of MustDefinition (XPath) instances which + * represents the concrete data constraints + */ + Set getMustConstraints(); + + /** + * Expreses if the presence of the data element for which this constraint is + * specified is|isn't required. + * + * Contains the value of the mandatory YANG substatement. + * + * It is used with YANG statements leaf, choice, anyxml, deviate. + * + * @return boolean value: + *
    + *
  • true - if mandatory YANG keyword argument = + * true
  • + *
  • false - if mandatory YANG keyword argument = + * false
  • + *
+ */ + boolean isMandatory(); + + /** + * Returns the minimum required number of data elements for node where this + * constraint is specified. + * + * The returning value equals to value of the argument of the + * min-elements YANG substatement. + * + * It is used with YANG statements leaf-list, list, deviate. + * + * @return integer with minimal number of elements + */ + Integer getMinElements(); + + /** + * Returns the maximum admissible number of data elements for node where + * this constraint is specified. + * + * The returning value equals to value of the argument of the + * max-elements YANG substatement. + * + * It is used with YANG statements leaf-list, list, deviate. + * + * @return integer with maximum number of elements + */ + Integer getMaxElements(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintMetaDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintMetaDefinition.java index 060fe2b089..ea2f7d3e68 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintMetaDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ConstraintMetaDefinition.java @@ -1,19 +1,47 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -public interface ConstraintMetaDefinition { - - String getDescription(); - - String getErrorAppTag(); - - String getErrorMessage(); - - String getReference(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * Contains methods which retrive values for description, error message, error + * app tag and reference (to other document). + * + */ +public interface ConstraintMetaDefinition { + + /** + * Returns the value of the argument of YANG description + * keyword. + * + * @return string with the description + */ + String getDescription(); + + /** + * Returns the value of the argument of YANG error-app-tag + * keyword. + * + * @return string with the application tag + */ + String getErrorAppTag(); + + /** + * Returns the value of the argument of YANG error-message + * keyword. + * + * @return string with the error message + */ + String getErrorMessage(); + + /** + * Returns the value of the argument of YANG reference keyword. + * + * @return string with reference to some other document + */ + String getReference(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DataSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DataSchemaNode.java index 7e9b1e8a87..892a725225 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DataSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DataSchemaNode.java @@ -1,45 +1,51 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -public interface DataSchemaNode extends SchemaNode { - - /** - * Returns true if the data node was added by augmentation, - * otherwise returns false - * - * @return true if the data node was added by augmentation, - * otherwise returns false - */ - boolean isAugmenting(); - - /** - * Returns true if the data node was added by uses statement, - * otherwise returns false - * - * @return true if the data node was added by uses statement, - * otherwise returns false - */ - boolean isAddedByUses(); - - /** - * Returns true if the data represents configuration data, - * otherwise returns false - * - * @return true if the data represents configuration data, - * otherwise returns false - */ - boolean isConfiguration(); - - /** - * Returns the constraints associated with Data Schema Node - * - * @return the constraints associated with Data Schema Node - */ - ConstraintDefinition getConstraints(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * + * Contains the method which are used for getting metadata from the schema nodes + * which contains data. + * + */ +public interface DataSchemaNode extends SchemaNode { + + /** + * Returns true if the data node was added by augmentation, + * otherwise returns false + * + * @return true if the data node was added by augmentation, + * otherwise returns false + */ + boolean isAugmenting(); + + /** + * Returns true if the data node was added by uses statement, + * otherwise returns false + * + * @return true if the data node was added by uses statement, + * otherwise returns false + */ + boolean isAddedByUses(); + + /** + * Returns true if the data represents configuration data, + * otherwise returns false + * + * @return true if the data represents configuration data, + * otherwise returns false + */ + boolean isConfiguration(); + + /** + * Returns the constraints associated with Data Schema Node + * + * @return the constraints associated with Data Schema Node + */ + ConstraintDefinition getConstraints(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ExtensionDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ExtensionDefinition.java index 2317011b8a..c65200c7e8 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ExtensionDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ExtensionDefinition.java @@ -1,44 +1,50 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -public interface ExtensionDefinition extends SchemaNode { - - /** - * Returns the String that is the name of argument to the - * Keyword. If no argument statement is present the method will return - * null
- * The argument statement is defined in [RFC-6020] The - * argument Statement - * - * @return the String that is the name of argument to the - * Keyword. If no argument statement is present the method will - * return null - */ - public String getArgument(); - - /** - * This statement indicates if the argument is mapped to an XML element in - * YIN or to an XML attribute.
- * By contract if implementation of ExtensionDefinition does not specify the - * yin-element statement the return value is by default set to - * false - * - *
- *
- * For more specific definition please look into [RFC-6020] - * The yin-element Statement - * - * @return true if the argument is mapped to an XML element in - * YIN or returns false if the argument is mapped to an - * XML attribute. - */ - public boolean isYinElement(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * + * Contains the methods for getting the data which are part of the YANG + * extensoion statement. + * + */ +public interface ExtensionDefinition extends SchemaNode { + + /** + * Returns the String that is the name of argument to the + * Keyword. If no argument statement is present the method will return + * null
+ * The argument statement is defined in [RFC-6020] The + * argument Statement + * + * @return the String that is the name of argument to the + * Keyword. If no argument statement is present the method will + * return null + */ + public String getArgument(); + + /** + * This statement indicates if the argument is mapped to an XML element in + * YIN or to an XML attribute.
+ * By contract if implementation of ExtensionDefinition does not specify the + * yin-element statement the return value is by default set to + * false + * + *
+ *
+ * For more specific definition please look into [RFC-6020] + * The yin-element Statement + * + * @return true if the argument is mapped to an XML element in + * YIN or returns false if the argument is mapped to an + * XML attribute. + */ + public boolean isYinElement(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java index 58f81d920e..b6c2a6ec42 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java @@ -1,26 +1,34 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -/** - * Interface describing YANG 'leaf-list' statement. - */ -public interface LeafListSchemaNode extends DataSchemaNode { - - TypeDefinition> getType(); - - /** - * YANG 'ordered-by' statement. It defines whether the order of entries - * within this leaf-list are determined by the user or the system. If not - * present, default is false. - * - * @return true if ordered-by argument is "user", false otherwise - */ - boolean isUserOrdered(); - -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * Interface describing YANG 'leaf-list' statement. + */ +public interface LeafListSchemaNode extends DataSchemaNode { + + /** + * Returns type of the instance which implements DataSchemaNode + * . + * + * @return type definition of leaf-list schema node which represents the + * value of the argument of the YANG type substatement + * of the leaf-list statement + */ + TypeDefinition> getType(); + + /** + * YANG 'ordered-by' statement. It defines whether the order of entries + * within this leaf-list are determined by the user or the system. If not + * present, default is false. + * + * @return true if ordered-by argument is "user", false otherwise + */ + boolean isUserOrdered(); + +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java index db930d2182..37b2ef0744 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java @@ -1,27 +1,52 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -/** - * Interface describing YANG 'leaf' statement. - *

- * The 'leaf' statement is used to define a leaf node in the schema tree. - *

- */ -public interface LeafSchemaNode extends DataSchemaNode { - - /** - * @return type of this leaf - */ - TypeDefinition getType(); - - String getDefault(); - - String getUnits(); - -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * Interface describing YANG leaf statement. The interface contains + * the methods for getting the following data (substatements of + * leaf statement) + *
    + *
  • type
  • + *
  • default
  • + *
  • units
  • + *
+ *

+ * The 'leaf' statement is used to define a leaf node in the schema tree. + *

+ */ +public interface LeafSchemaNode extends DataSchemaNode { + + /** + * Returns the YANG type of the instance of the type + * LeafSchemaNode. + * + * @return type definition which represents the value of the YANG + * type substatement for leaf statement + */ + TypeDefinition getType(); + + /** + * Returns the default value of YANG leaf. + * + * @return string with the value of the argument of YANG + * default substatement of the leaf + * statement + */ + String getDefault(); + + /** + * Returns the units in which are the values of the leaf + * presented. + * + * @return string with the value of the argument of YANG units + * substatement of the leaf statement + */ + String getUnits(); + +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java index b1b03a4dd8..837f1718db 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java @@ -1,93 +1,240 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -import java.net.URI; -import java.util.Date; -import java.util.List; -import java.util.Set; - -public interface Module extends DataNodeContainer { - - URI getNamespace(); - - String getName(); - - Date getRevision(); - - String getPrefix(); - - String getYangVersion(); - - String getDescription(); - - String getReference(); - - String getOrganization(); - - String getContact(); - - Set getImports(); - - /** - * Returns feature statements defined in module. - * - * @return feature statements in lexicographical order - */ - Set getFeatures(); - - /** - * Returns notification statements defined in module. - * - * @return notification statements in lexicographical order - */ - Set getNotifications(); - - /** - * Returns augment statements defined in module. - * - * @return augment statements - */ - Set getAugmentations(); - - /** - * Returns rpc statements defined in module. - * - * @return rpc statements in lexicographical order - */ - Set getRpcs(); - - /** - * Returns deviation statements defined in module. - * - * @return deviation statements - */ - Set getDeviations(); - - /** - * Returns identity statements defined in module. - * - * @return identity statements in lexicographical order - */ - Set getIdentities(); - - /** - * Returns extension statements defined in module. - * - * @return extension statements in lexicographical order - */ - List getExtensionSchemaNodes(); - - /** - * Returns unknown nodes defined in module. - * - * @return unknown nodes in lexicographical order - */ - List getUnknownSchemaNodes(); - -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +import java.net.URI; +import java.util.Date; +import java.util.List; +import java.util.Set; + +/** + * This interface contains the methods for getting the data from the YANG + * module.
+ *
+ * Example of YANG module
+ * {@link #getName() module} module_name{
+   {@link #getYangVersion() yang-version} "1";

+ +   {@link #getNamespace() namespace} "urn:module:namespace";
+   {@link #getPrefix() prefix} "prefix";

+ +   {@link #getDescription() description} "description test";
+   {@link #getReference() reference} "reference test";

+ +   {@link #getOrganization() organization} "John Doe, john.doe@email.com";
+   {@link #getContact() contact} "http://www.opendaylight.org/";

+ +   {@link #getFeatures() feature} feature-test{
+      description "description of some feature";
+   }
+ +   {@link #getNotifications() notification} notification-test;
+   {@link #getRpcs() rpc} rpc-test;
+ +   {@link #getIdentities() identity} identity-test;
+   {@link #getExtensionSchemaNodes() extension} extension-test;
+ + +   {@link #getRevision() revision} 2011-08-27 {
+ +   {@link #getImports() import} other_module {
+     prefix "other_module_prefix"
+     revision-date 2011-08-27
+   }

+ +   container cont {
+   }
+ +   {@link #getAugmentations() augment} "/cont" { ;
+   }
+ } + +
+ */ + +public interface Module extends DataNodeContainer { + + /** + * Returns the namespace of the module which is specified as argument of + * YANG {@link Module namespace} + * keyword. + * + * @return URI format of the namespace of the module + */ + URI getNamespace(); + + /** + * Returns the name of the module which is specified as argument of YANG + * {@link Module module} keyword + * + * @return string with the name of the module + */ + String getName(); + + /** + * Returns the revision date for the module. + * + * @return date of the module revision which is specified as argument of + * YANG {@link Module revison} + * keyword + */ + Date getRevision(); + + /** + * Returns the prefix of the module + * + * @return string with the module prefix which is specified as argument of + * YANG {@link Module prefix} + * keyword + */ + String getPrefix(); + + /** + * Returns the YANG version. + * + * Default value is 1. + * + * @return string with the module YANG version which is specified as + * argument of YANG {@link Module yang-version} keyword + */ + String getYangVersion(); + + /** + * Returns the module description. + * + * @return string with the module description which is specified as argument + * of YANG {@link Module description} keyword + */ + String getDescription(); + + /** + * Returns the module reference. + * + * @return string with the module reference which is specified as argument + * of YANG {@link Module reference} keyword + */ + String getReference(); + + /** + * Returns the module organization. + * + * @return string with the name of the organization specified in the module + * as the argument of YANG {@link Module organization} keyword + */ + String getOrganization(); + + /** + * Returns the module contact. + * + * The contact represents the person or persons to whom technical queries + * concerning this module should be sent, such as their name, postal + * address, telephone number, and electronic mail address. + * + * @return string with the contact data specified in the module as the + * argument of YANG {@link Module contact} keyword + */ + String getContact(); + + /** + * Returns imports which represents YANG modules which are imported to this + * module via import statement. + * + * @return set of module imports which are specified in the module as the + * argument of YANG {@link Module import} keywords. + */ + Set getImports(); + + /** + * Returns FeatureDefinition instances which contain data from + * feature statements defined in the module. + * + * The feature is used to define a mechanism by which portions of the schema + * are marked as conditional. + * + * @return feature statements in lexicographical order which are specified + * in the module as the argument of YANG {@link Module feature} keywords. + */ + Set getFeatures(); + + /** + * Returns NotificationDefinition instances which contain data + * from notification statements defined in the module. + * + * @return notification statements in lexicographical order which are + * specified in the module as the argument of YANG {@link Module + * notification} keywords. + */ + Set getNotifications(); + + /** + * Returns AugmentationSchema instances which contain data from + * augment statements defined in the module. + * + * @return set of the augmentation schema instances which are specified in + * the module as YANG {@link Module augment} keyword and are + * lexicographicaly ordered + */ + Set getAugmentations(); + + /** + * Returns RpcDefinition instances which contain data from + * rpc statements defined in the module. + * + * @return set of the rpc definition instances which are specified in the + * module as YANG {@link Module rpc} keywords and are lexicographicaly + * ordered + */ + Set getRpcs(); + + /** + * Returns Deviation instances which contain data from + * deviation statements defined in the module. + * + * @return set of the deviation instances + */ + Set getDeviations(); + + /** + * Returns IdentitySchemaNode instances which contain data from + * identity statements defined in the module. + * + * @return set of identity schema node instances which are specified in the + * module as YANG {@link Module identity} keywords and are + * lexicographicaly ordered + */ + Set getIdentities(); + + /** + * Returns ExtensionDefinition instances which contain data + * from extension statements defined in the module. + * + * @return set of extension definition instances which are specified in the + * module as YANG {@link Module extension} keyword and are + * lexicographicaly ordered + */ + List getExtensionSchemaNodes(); + + /** + * Returns unknown nodes defined in module. + * + * @return unknown nodes in lexicographical order + */ + List getUnknownSchemaNodes(); + +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/MustDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/MustDefinition.java index c6b9b22386..c725d3c546 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/MustDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/MustDefinition.java @@ -1,13 +1,28 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -public interface MustDefinition extends ConstraintMetaDefinition { - - RevisionAwareXPath getXpath(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * + * Contains methods for accessing constraint declaration for valid data in form + * of XPath expressions.
+ *
+ * YANG example:
+ * must "ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)"; + *
+ */ +public interface MustDefinition extends ConstraintMetaDefinition { + + /** + * Returns XPath expression which contains constraint. + * + * @return XPath expression which represents the value of the argument of + * the must YANG substatement + */ + RevisionAwareXPath getXpath(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/RevisionAwareXPath.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/RevisionAwareXPath.java index 6a98cd0012..95d46ac8b2 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/RevisionAwareXPath.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/RevisionAwareXPath.java @@ -1,28 +1,36 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -public interface RevisionAwareXPath { - - - /** - * Returns true if the XPapth starts in root of Yang model, otherwise returns false. - * - * @return true if the XPapth starts in root of Yang model, otherwise returns false - */ - public boolean isAbsolute(); - - /** - * Returns the XPath formatted string as is defined in model. - *
- * For example: /prefix:container/prefix:container::cond[when()=foo]/prefix:leaf - * - * @return the XPath formatted string as is defined in model. - */ - public String toString(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * + * Contains methods for getting data (concrete XPath) and metadata (is XPath + * absolute) from XPath instance. + * + * + */ +public interface RevisionAwareXPath { + + /** + * Returns true if the XPapth starts in root of Yang model, + * otherwise returns false. + * + * @return true if the XPapth starts in root of Yang model, + * otherwise returns false + */ + public boolean isAbsolute(); + + /** + * Returns the XPath formatted string as is defined in model.
+ * For example: + * /prefix:container/prefix:container::cond[when()=foo]/prefix:leaf + * + * @return the XPath formatted string as is defined in model. + */ + public String toString(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaContext.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaContext.java index a40bf2bd0a..1555bbb38f 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaContext.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaContext.java @@ -11,24 +11,82 @@ import java.net.URI; import java.util.Date; import java.util.Set; - - /** - * + * The interface contains the methods for manipulating all the top level context + * data (data from all red modules) like YANG notifications, extensions, + * operations... */ public interface SchemaContext { + /** + * Returns data schema node instances which represents direct subnodes (like + * leaf, leaf-list, list, container) in all YANG modules in the context. + * + * @return set of DataSchemaNode instances which represents + * YANG data nodes at the module top level + */ Set getDataDefinitions(); + /** + * Returns modules which are part of the schema context. + * + * @return set of the modules which belong to the schema context + */ Set getModules(); + /** + * + * Returns notification definition instances which are defined as the direct + * subelements in all YANG modules in the context. + * + * @return set of NotificationDefinition instances which + * represents nodes defined via notification YANG + * keyword + */ Set getNotifications(); + /** + * Returns rpc definition instances which are defined as the direct + * subelements in all YANG modules in the context. + * + * @return set of RpcDefinition instances which represents + * nodes defined via rpc YANG keyword + */ Set getOperations(); - + + /** + * Returns extencion definition instances which are defined as the direct + * subelements in all YANG modules in the context + * + * @return set of ExtensionDefinition instances which + * represents nodes defined via extension YANG keyword + */ Set getExtensions(); - + + /** + * Returns module instance (from the context) with concrete name and + * revision date. + * + * @param name + * string with the module name + * @param revision + * date of the module revision + * @return module instance which has name and revision (if specified) the + * same as are the values specified in parameters name + * and revision. In other cases the null + * value is returned. + * + */ Module findModuleByName(final String name, final Date revision); - + + /** + * + * Returns module instance (from the context) with concrete namespace. + * + * @param namespace + * URI instance with specified namespace + * @return module instance which has namespace equal to the + * namespace or null in other cases + */ Module findModuleByNamespace(final URI namespace); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaNode.java index 53c025c6e5..84dc24a0b4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaNode.java @@ -1,44 +1,71 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -import java.util.List; - -import org.opendaylight.yangtools.yang.common.QName; - -/** - * SchemaNode represents a node in schema tree. - */ -public interface SchemaNode { - - public QName getQName(); - - public SchemaPath getPath(); - - /** - * @return textual description of this node. - */ - public String getDescription(); - - /** - * @return textual cross-reference to an external document that provides - * additional information relevant to this node. - */ - public String getReference(); - - /** - * @return actual status of this node. - */ - public Status getStatus(); - - /** - * @return collection of all unknown nodes defined under this schema node. - */ - public List getUnknownSchemaNodes(); - -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +import java.util.List; + +import org.opendaylight.yangtools.yang.common.QName; + +/** + * SchemaNode represents a node in schema tree. + */ +public interface SchemaNode { + + /** + * Returns QName of the instance of the type SchemaNode. + * + * @return QName with the name of the schema node + */ + public QName getQName(); + + /** + * Returns the schema path of the instance of the type + * SchemaNode SchemaNode. + * + * @return schema path of the schema node + */ + public SchemaPath getPath(); + + /** + * Returns description of the instance of the type SchemaNode + * + * @return string with textual description the node which represents the + * argument of the YANG description substatement + */ + public String getDescription(); + + /** + * Returns reference of the instance of the type SchemaNode + * + * The reference refers to external document that provides additional + * information relevant for the instance of this type. + * + * @return string with the reference to some external document which + * represents the argument of the YANG reference + * substatement + */ + public String getReference(); + + /** + * Returns status of the instance of the type SchemaNode + * + * @return status of this node which represents the argument of the YANG + * status substatement + */ + public Status getStatus(); + + /** + * + * Returns unknown schema nodes which belongs to this instance of the type + * SchemaNode. + * + * @return list of unknown schema nodes defined under this schema node. + */ + public List getUnknownSchemaNodes(); + +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaPath.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaPath.java index 6bcb009afe..325b0c2c0a 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaPath.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaPath.java @@ -1,78 +1,113 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opendaylight.yangtools.yang.common.QName; - -public class SchemaPath { - - final List path; - final boolean absolute; - - public SchemaPath(final List path, boolean absolute) { - this.path = Collections.unmodifiableList(new ArrayList(path)); - this.absolute = absolute; - } - - public List getPath() { - return path; - } - - public boolean isAbsolute() { - return absolute; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (absolute ? 1231 : 1237); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SchemaPath other = (SchemaPath) obj; - if (absolute != other.absolute) { - return false; - } - if (path == null) { - if (other.path != null) { - return false; - } - } else if (!path.equals(other.path)) { - return false; - } - return true; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("SchemaPath [path="); - builder.append(path); - builder.append(", absolute="); - builder.append(absolute); - builder.append("]"); - return builder.toString(); - } -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.opendaylight.yangtools.yang.common.QName; + +/** + * + * Represents unique path to the every node inside the module. + * + */ +public class SchemaPath { + + /** + * List of QName instances which represents complete path to the node. + */ + final List path; + + /** + * Boolean value which represents type of schema path (relative or + * absolute). + */ + final boolean absolute; + + /** + * Constructs new instance of this class with the concrete path. + * + * @param path + * list of QName instances which specifies exact path to the + * module node + * @param absolute + * boolean value which specifies if the path is absolute or + * relative + */ + public SchemaPath(final List path, boolean absolute) { + this.path = Collections.unmodifiableList(new ArrayList(path)); + this.absolute = absolute; + } + + /** + * Returns the complete path to schema node. + * + * @return list of QName instances which represents complete + * path to schema node + */ + public List getPath() { + return path; + } + + /** + * Describes whether schema path is|isn't absolute. + * + * @return boolean value which is true if schema path is + * absolute. + */ + public boolean isAbsolute() { + return absolute; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (absolute ? 1231 : 1237); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SchemaPath other = (SchemaPath) obj; + if (absolute != other.absolute) { + return false; + } + if (path == null) { + if (other.path != null) { + return false; + } + } else if (!path.equals(other.path)) { + return false; + } + return true; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("SchemaPath [path="); + builder.append(path); + builder.append(", absolute="); + builder.append(absolute); + builder.append("]"); + return builder.toString(); + } +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypeDefinition.java index 4ff709e1e4..6e75e98c8e 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypeDefinition.java @@ -1,18 +1,58 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - - -public interface TypeDefinition> extends SchemaNode { - - T getBaseType(); - - String getUnits(); - - Object getDefaultValue(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +/** + * + * YANG statement typedef contains also substatements + *
    + *
  • default - default value which is compatible with + * type,
  • + *
  • type - base type from which is typedef derived, + *
  • + *
  • units - textual information about units associated with this + * type.
  • + *
+ * This interface contains the methods for getting the values of the arguments + * of substatements mentioned above. + * + * @param + * type of the base type (YANG type substatement) which + * is included in the instance of this type + */ +public interface TypeDefinition> extends SchemaNode { + + /** + * Returns the base type which represents the value of the argument of the + * type substatement of the YANG typedef + * statement. + * + * @return value of <T> type which represents the base + * type of instance of the TypeDefinition type + */ + T getBaseType(); + + /** + * Returns the unit which represents the value of the argument of the + * units substatement of the YANG typedef + * statement. + * + * @return string with units in which is type measured + */ + String getUnits(); + + /** + * Returns the default value which represents the value of the argument of + * the default substatement of the YANG typedef + * statement. + * + * @return instance of Object type which contains default value + * for typedef + */ + Object getDefaultValue(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UnknownSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UnknownSchemaNode.java index e7f5d224b1..e9cb93c8bd 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UnknownSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UnknownSchemaNode.java @@ -9,17 +9,40 @@ package org.opendaylight.yangtools.yang.model.api; import org.opendaylight.yangtools.yang.common.QName; +/** + * + * Contains the methods for getting the details about the unknown node. + * + */ public interface UnknownSchemaNode extends SchemaNode { + /** + * Returns QName instance with the name of the unknown node. + * + * @return QName with name the name of the unknown node. + */ QName getNodeType(); + /** + * Returns name of the unknown node. + * + * @return string with the name of unknown node. + */ String getNodeParameter(); + /** + * + * Describes whether the node was added through uses YANG + * keyword. + * + * @return boolean value which is true if the node is added by + * uses YANG keyword + */ boolean isAddedByUses(); /** * Get extension definition which identifies this node - * + * * @return extension definition if exists, null otherwise */ ExtensionDefinition getExtensionDefinition(); diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UsesNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UsesNode.java index b1ec2578f6..ae9aabae2b 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UsesNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UsesNode.java @@ -1,51 +1,61 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api; - -import java.util.Map; -import java.util.Set; - -public interface UsesNode { - - /** - * @return path to 'grouping' on which this 'uses' statement points - */ - SchemaPath getGroupingPath(); - - /** - * @return Set of augment statements defined under this uses node - */ - Set getAugmentations(); - - /** - * Returns true if the data node was added by augmentation, - * otherwise returns false - * - * @return true if the data node was added by augmentation, - * otherwise returns false - */ - boolean isAugmenting(); - - /** - * Returns true if the data node was added by uses statement, - * otherwise returns false - * - * @return true if the data node was added by uses statement, - * otherwise returns false - */ - boolean isAddedByUses(); - - /** - * Some of the properties of each node in the grouping can be refined with - * the "refine" statement. - * - * @return Map, where key is schema path of refined node and value is - * refined node - */ - Map getRefines(); -} +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api; + +import java.util.Map; +import java.util.Set; + +/** + * Contains the methods for getting data and checking properties of the YANG + * uses substatement. + * + */ +public interface UsesNode { + + /** + * Returns the schema path to used grouping. + * + * @return schema path to 'grouping' on which this 'uses' statement points + */ + SchemaPath getGroupingPath(); + + /** + * + * Returns agumentations which were specified in this uses node. + * + * @return Set of augment statements defined under this uses node + */ + Set getAugmentations(); + + /** + * Returns true if the data node was added by augmentation, + * otherwise returns false + * + * @return true if the data node was added by augmentation, + * otherwise returns false + */ + boolean isAugmenting(); + + /** + * Returns true if the data node was added by uses statement, + * otherwise returns false + * + * @return true if the data node was added by uses statement, + * otherwise returns false + */ + boolean isAddedByUses(); + + /** + * Some of the properties of each node in the grouping can be refined with + * the "refine" statement. + * + * @return Map, where key is schema path of refined node and value is + * refined node + */ + Map getRefines(); +} diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BitsTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BitsTypeDefinition.java index 115ab13557..2a0fb506b3 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BitsTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BitsTypeDefinition.java @@ -12,19 +12,40 @@ import java.util.List; import org.opendaylight.yangtools.yang.model.api.SchemaNode; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; +/** + * + * Makes is possible to access to the individual bits values of this type. + * + */ public interface BitsTypeDefinition extends TypeDefinition { + /** + * Returns all bit values. + * + * @return list of Bit type instastances with data about all + * individual bits of bits YANG built-in type + */ public List getBits(); + /** + * + * Contains the methods for accessing the data about the individual bit of + * bits YANG type. + */ interface Bit extends SchemaNode { /** * The position value MUST be in the range 0 to 4294967295, and it MUST * be unique within the bits type. - * + * * @return The position value of bit in range from 0 to 4294967295. */ public Long getPosition(); + /** + * Returns the name of the concrete bit. + * + * @return string with the name of the concrete bit + */ public String getName(); } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BooleanTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BooleanTypeDefinition.java index d64d9da753..84cb4c5a06 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BooleanTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BooleanTypeDefinition.java @@ -9,7 +9,12 @@ package org.opendaylight.yangtools.yang.model.api.type; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -public interface BooleanTypeDefinition extends - TypeDefinition { +/** + * + * Marker interface which marks that type definition represents the built-in + * YANG boolean type. + * + */ +public interface BooleanTypeDefinition extends TypeDefinition { } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/DecimalTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/DecimalTypeDefinition.java index 7e2692939e..e3ace5d6e1 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/DecimalTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/DecimalTypeDefinition.java @@ -11,19 +11,31 @@ import java.util.List; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; +/** + * Contains methods for getting data from the YANG type + * substatement for decimal64 built-in type. + * + */ public interface DecimalTypeDefinition extends TypeDefinition { + /** + * Returns range constraints for instance of this type. + * + * @return list of range constraints which are specified as the argument of + * the range which is substatement of the + * type statement + */ List getRangeStatements(); /** * Returns integer between 1 and 18 inclusively.
*
- * + * * The "fraction-digits" statement controls the size of the minimum * difference between values of a decimal64 type, by restricting the value * space to numbers that are expressible as "i x 10^-n" where n is the * fraction-digits argument. - * + * * @return number of fraction digits */ Integer getFractionDigits(); diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/EnumTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/EnumTypeDefinition.java index c52523f145..64a3fd2ac5 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/EnumTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/EnumTypeDefinition.java @@ -12,15 +12,33 @@ import java.util.List; import org.opendaylight.yangtools.yang.model.api.SchemaNode; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; +/** + * + * Makes is possible to access to the individual enumeration values of this + * type. + * + */ public interface EnumTypeDefinition extends TypeDefinition { + /** + * Returns all enumeration values. + * + * @return list of EnumPair type instastances which contain the + * data about all individual enumeration pairs of + * enumeration YANG built-in type + */ List getValues(); + /** + * + * Contains the methods for accessing the data about the concrete + * enumeration item which represents enum YANG type. + */ interface EnumPair extends SchemaNode { /** * The name to specify each assigned name of an enumeration type. - * + * * @return name of each assigned name of an enumeration type. */ public String getName(); @@ -30,7 +48,7 @@ public interface EnumTypeDefinition extends TypeDefinition { * integer value with the assigned name for the enum. This integer value * MUST be in the range -2147483648 to 2147483647, and it MUST be unique * within the enumeration type. - * + * * @return integer value assigned to enumeration */ public Integer getValue(); diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityTypeDefinition.java index 26551ad995..c5647b7835 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityTypeDefinition.java @@ -10,8 +10,16 @@ package org.opendaylight.yangtools.yang.model.api.type; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -public interface IdentityTypeDefinition extends - TypeDefinition { +/** + * + * Contains the method for getting the details about YANG identity. + */ +public interface IdentityTypeDefinition extends TypeDefinition { + /** + * Returns the name of the YANG identity + * + * @return QName of the YANG identity + */ public QName getIdentityName(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityrefTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityrefTypeDefinition.java index 27c9ac175e..4631e1db01 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityrefTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityrefTypeDefinition.java @@ -1,18 +1,29 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yangtools.yang.model.api.type; - -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.model.api.TypeDefinition; - -public interface IdentityrefTypeDefinition extends - TypeDefinition { - - public QName getIdentity(); - +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.yangtools.yang.model.api.type; + +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.model.api.TypeDefinition; + +/** + * + * Contains method for getting data from identityref built-in YANG + * type. + * + */ +public interface IdentityrefTypeDefinition extends TypeDefinition { + + /** + * Returns QName of the identity to which the instance of this type refers. + * + * @return QName of referenced identity which is specified with the + * identity YANG statement + */ + public QName getIdentity(); + } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/InstanceIdentifierTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/InstanceIdentifierTypeDefinition.java index 8d0b64b527..3b5f5e0d3f 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/InstanceIdentifierTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/InstanceIdentifierTypeDefinition.java @@ -10,10 +10,28 @@ package org.opendaylight.yangtools.yang.model.api.type; import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -public interface InstanceIdentifierTypeDefinition extends - TypeDefinition { +/** + * + * Contains methods for getting data from the instance-identifier + * YANG built-in type. + */ +public interface InstanceIdentifierTypeDefinition extends TypeDefinition { + /** + * Returns XPath for instance of + * InstanceIdentifierTypeDefinition. + * + * @return instance of type RevisionAwareXPath + */ public RevisionAwareXPath getPathStatement(); + /** + * Returns true|false which represents argument of + * require-instance statement. This statement is the + * substatement of the type statement. + * + * @return boolean value which is true if the require-instance + * statement is true and vice versa + */ public boolean requireInstance(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/PatternConstraint.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/PatternConstraint.java index d793b24ee0..aab99fd794 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/PatternConstraint.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/PatternConstraint.java @@ -9,7 +9,18 @@ package org.opendaylight.yangtools.yang.model.api.type; import org.opendaylight.yangtools.yang.model.api.ConstraintMetaDefinition; +/** + * Contains the method for getting the data from the YANG pattern + * which is substatement of type statement. + * + */ public interface PatternConstraint extends ConstraintMetaDefinition { + /** + * Returns a regular expression (pattern). + * + * @return string with regular expression which is equal to the argument of + * the YANG pattern substatement + */ public String getRegularExpression(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/StringTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/StringTypeDefinition.java index c12499eb6b..e1bf21ada4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/StringTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/StringTypeDefinition.java @@ -11,10 +11,28 @@ import java.util.List; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -public interface StringTypeDefinition extends - TypeDefinition { +/** + * + * Contains method for getting data from the string YANG built-in + * type. + */ +public interface StringTypeDefinition extends TypeDefinition { + /** + * Returns length constraint specified in the string. + * + * @return list of length constraint which are specified in the + * lenght substatement of the type + * statement + */ List getLengthStatements(); + /** + * Returns patterns specified in the string. + * + * @return list of pattern constraints which are specified in the + * pattern substatement of the type + * statement + */ List getPatterns(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnionTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnionTypeDefinition.java index 98f5eac4a8..04903c0b03 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnionTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnionTypeDefinition.java @@ -11,8 +11,18 @@ import java.util.List; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -public interface UnionTypeDefinition extends - TypeDefinition { +/** + * Contains the method which access union item in the union type. + * + */ +public interface UnionTypeDefinition extends TypeDefinition { + /** + * Returns type definitions which represent the values of the arguments for + * all YANG type substatement in the main union + * statement. + * + * @return list of the type definition which contains the union items. + */ public List> getTypes(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnsignedIntegerTypeDefinition.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnsignedIntegerTypeDefinition.java index d40fe0c159..34315b1e83 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnsignedIntegerTypeDefinition.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnsignedIntegerTypeDefinition.java @@ -11,8 +11,21 @@ import java.util.List; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -public interface UnsignedIntegerTypeDefinition extends - TypeDefinition { +/** + * + * Contains the method for getting detail data about unsigned integer. + * + * Specifically it is the method for getting the range value. + * + */ +public interface UnsignedIntegerTypeDefinition extends TypeDefinition { + /** + * Returns range data of the instance of the type + * UnsignedIntegerTypeDefinition. + * + * @return list of RangeConstraint which represents the YANG + * range substatement arguments. + */ List getRangeStatements(); } diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java index 7ec499534c..05095fe936 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java @@ -109,7 +109,7 @@ public final class ChoiceBuilder extends AbstractSchemaNodeBuilder implements Da /** * Get case by name. - * + * * @param caseName * name of case to search * @return case with given name if present, null otherwise @@ -125,10 +125,10 @@ public final class ChoiceBuilder extends AbstractSchemaNodeBuilder implements Da /** * Add case node to this choice. - * + * * If node is not declared with 'case' keyword, create new case builder and * make this node child of newly created case. - * + * * @param caseNode * case node */ -- 2.36.6