Class AbstractSchemaContext
- java.lang.Object
-
- org.opendaylight.yangtools.yang.model.util.AbstractSchemaContext
-
- All Implemented Interfaces:
Immutable
,MutationBehaviour<Immutable>
,ActionNodeContainer
,AddedByUsesAware
,AugmentationTarget
,ContainerSchemaNode
,CopyableNode
,DataNodeContainer
,DataSchemaNode
,DocumentedNode
,DocumentedNode.WithStatus
,MustConstraintAware
,NotificationNodeContainer
,SchemaContext
,SchemaNode
,WhenConditionAware
- Direct Known Subclasses:
FilteringSchemaContextProxy
,SimpleSchemaContext
public abstract class AbstractSchemaContext extends Object implements SchemaContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opendaylight.yangtools.yang.model.api.DocumentedNode
DocumentedNode.WithStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected static Comparator<Module>
NAME_REVISION_COMPARATOR
AModule
comparator based onModule.getName()
andModule.getRevision()
, ordering modules lexicographically by their name and then in order of descending revision.protected static Comparator<Module>
REVISION_COMPARATOR
AModule
comparator based onModule.getRevision()
, placing latest revision first.-
Fields inherited from interface org.opendaylight.yangtools.yang.model.api.SchemaContext
NAME
-
-
Constructor Summary
Constructors Constructor Description AbstractSchemaContext()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static TreeSet<Module>
createModuleSet()
Create a TreeSet for containing Modules with the same name, such that the set is ordered byREVISION_COMPARATOR
.Optional<DataSchemaNode>
findDataChildByName(QName name)
Returns the child node corresponding to the specified name.Optional<Module>
findModule(String name, Optional<Revision> revision)
Returns module instance (from the context) with specified name and an optional revision.Optional<Module>
findModule(QNameModule qnameModule)
Returns the module matching specifiedQNameModule
, if present.Set<Module>
findModules(String name)
Returns module instances (from the context) with a concrete name.Set<Module>
findModules(URI namespace)
Returns module instance (from the context) with concrete namespace.Set<AugmentationSchemaNode>
getAvailableAugmentations()
Returns augmentations targeting this element.Set<DataSchemaNode>
getChildNodes()
Returns set of all child nodes defined within this DataNodeContainer.Set<DataSchemaNode>
getDataDefinitions()
Returns data schema node instances which represents direct subnodes (like leaf, leaf-list, list, container) in all YANG modules in the context.Set<ExtensionDefinition>
getExtensions()
Returns extension definition instances which are defined as the direct subelements in all YANG modules in the context.Set<GroupingDefinition>
getGroupings()
Returns set of all groupings defined within this DataNodeContainer.protected abstract Map<QNameModule,Module>
getModuleMap()
Returns the namespace+revision-to-module mapping.protected abstract SetMultimap<URI,Module>
getNamespaceToModules()
Returns the namespace-to-module mapping.protected abstract SetMultimap<String,Module>
getNameToModules()
Returns the module name-to-module mapping.Set<NotificationDefinition>
getNotifications()
Return the set of notifications in this container, keyed by QName.Set<RpcDefinition>
getOperations()
Returns rpc definition instances which are defined as the direct subelements in all YANG modules in the context.SchemaPath
getPath()
Returns the schema path of the instance of the typeSchemaNode
.QName
getQName()
Returns QName of the instance of the typeSchemaNode
.Status
getStatus()
Returns status of the instance of the typeSchemaNode
.Set<TypeDefinition<?>>
getTypeDefinitions()
Returns set of all newly defined types within this DataNodeContainer.List<UnknownSchemaNode>
getUnknownSchemaNodes()
Returns unknown schema nodes which belongs to this instance.Set<UsesNode>
getUses()
Returns grouping nodes used ny this container.boolean
isAddedByUses()
Deprecated.boolean
isAugmenting()
Deprecated.boolean
isConfiguration()
Returnstrue
if the data represents configuration data, otherwise returnsfalse
.boolean
isPresenceContainer()
Returns true if this container is marked as presence.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.DataNodeContainer
findDataChildByName, findDataTreeChild, findDataTreeChild, getDataChildByName
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.api.SchemaContext
findAction, findDataTreeChild, findModule, findModule, findModule, findModule, findModule, findNotification, getActions, getDescription, getModules, getMustConstraints, getReference, getWhenCondition
-
-
-
-
Field Detail
-
REVISION_COMPARATOR
protected static final Comparator<Module> REVISION_COMPARATOR
AModule
comparator based onModule.getRevision()
, placing latest revision first. Note this comparator does not take into account module name and so two modules with different names but same revisions compare as equal.
-
NAME_REVISION_COMPARATOR
protected static final Comparator<Module> NAME_REVISION_COMPARATOR
AModule
comparator based onModule.getName()
andModule.getRevision()
, ordering modules lexicographically by their name and then in order of descending revision. This comparator assumes that the combination of these two attributes is sufficient to be consistent with hashCode/equals.
-
-
Method Detail
-
createModuleSet
protected static final TreeSet<Module> createModuleSet()
Create a TreeSet for containing Modules with the same name, such that the set is ordered byREVISION_COMPARATOR
.- Returns:
- A fresh TreeSet instance.
-
getNamespaceToModules
protected abstract SetMultimap<URI,Module> getNamespaceToModules()
Returns the namespace-to-module mapping.- Returns:
- Map of modules where key is namespace
-
getNameToModules
protected abstract SetMultimap<String,Module> getNameToModules()
Returns the module name-to-module mapping.- Returns:
- Map of modules where key is name of module
-
getModuleMap
protected abstract Map<QNameModule,Module> getModuleMap()
Returns the namespace+revision-to-module mapping.- Returns:
- Map of modules where key is Module's QNameModule.
-
getDataDefinitions
public Set<DataSchemaNode> getDataDefinitions()
Description copied from interface:SchemaContext
Returns data schema node instances which represents direct subnodes (like leaf, leaf-list, list, container) in all YANG modules in the context.- Specified by:
getDataDefinitions
in interfaceSchemaContext
- Returns:
- set of
DataSchemaNode
instances which represents YANG data nodes at the module top level
-
getNotifications
public Set<NotificationDefinition> getNotifications()
Description copied from interface:NotificationNodeContainer
Return the set of notifications in this container, keyed by QName. RFC7950 specifies thatAugmentationSchemaNode
s,GroupingDefinition
s,ListSchemaNode
s andContainerSchemaNode
s can also containNotificationDefinition
s.- Specified by:
getNotifications
in interfaceNotificationNodeContainer
- Returns:
- set of notification nodes
-
getOperations
public Set<RpcDefinition> getOperations()
Description copied from interface:SchemaContext
Returns rpc definition instances which are defined as the direct subelements in all YANG modules in the context.- Specified by:
getOperations
in interfaceSchemaContext
- Returns:
- set of
RpcDefinition
instances which represents nodes defined viarpc
YANG keyword
-
getExtensions
public Set<ExtensionDefinition> getExtensions()
Description copied from interface:SchemaContext
Returns extension definition instances which are defined as the direct subelements in all YANG modules in the context.- Specified by:
getExtensions
in interfaceSchemaContext
- Returns:
- set of
ExtensionDefinition
instances which represents nodes defined viaextension
YANG keyword
-
findModule
public Optional<Module> findModule(String name, Optional<Revision> revision)
Description copied from interface:SchemaContext
Returns module instance (from the context) with specified name and an optional revision.- Specified by:
findModule
in interfaceSchemaContext
- Parameters:
name
- string with the module namerevision
- date of the module revision- Returns:
- module instance which has name and revision the same as are the values specified in parameters
name
andrevision
.
-
findModule
public Optional<Module> findModule(QNameModule qnameModule)
Description copied from interface:SchemaContext
Returns the module matching specifiedQNameModule
, if present.- Specified by:
findModule
in interfaceSchemaContext
- Parameters:
qnameModule
- requested QNameModule- Returns:
- Module, if present.
-
findModules
public Set<Module> findModules(URI namespace)
Description copied from interface:SchemaContext
Returns module instance (from the context) with concrete namespace. Returned Set is required to have its iteration order guarantee that the latest revision is encountered first.- Specified by:
findModules
in interfaceSchemaContext
- Parameters:
namespace
- URI instance with specified namespace- Returns:
- module instance which has namespace equal to the
namespace
ornull
in other cases
-
findModules
public Set<Module> findModules(String name)
Description copied from interface:SchemaContext
Returns module instances (from the context) with a concrete name. Returned Set is required to have its iteration order guarantee that the latest revision is encountered first.- Specified by:
findModules
in interfaceSchemaContext
- Parameters:
name
- string with the module name- Returns:
- set of module instances with specified name.
-
isAugmenting
@Deprecated public boolean isAugmenting()
Deprecated.Description copied from interface:CopyableNode
Returnstrue
if this node was added by augmentation, otherwise returnsfalse
.- Specified by:
isAugmenting
in interfaceCopyableNode
- Returns:
true
if this node was added by augmentation, otherwise returnsfalse
-
isAddedByUses
@Deprecated public boolean isAddedByUses()
Deprecated.Description copied from interface:AddedByUsesAware
Returnstrue
if this node was added by uses statement, otherwise returnsfalse
.- Specified by:
isAddedByUses
in interfaceAddedByUsesAware
- Returns:
true
if this node was added by uses statement, otherwise returnsfalse
-
isConfiguration
public boolean isConfiguration()
Description copied from interface:DataSchemaNode
Returnstrue
if the data represents configuration data, otherwise returnsfalse
.- Specified by:
isConfiguration
in interfaceDataSchemaNode
- Returns:
true
if the data represents configuration data, otherwise returnsfalse
-
getQName
public QName getQName()
Description copied from interface:SchemaNode
Returns QName of the instance of the typeSchemaNode
.- Specified by:
getQName
in interfaceSchemaNode
- Returns:
- QName with the name of the schema node
-
getPath
public SchemaPath getPath()
Description copied from interface:SchemaNode
Returns the schema path of the instance of the typeSchemaNode
.- Specified by:
getPath
in interfaceSchemaNode
- Returns:
- schema path of the schema node
-
getStatus
public Status getStatus()
Description copied from interface:DocumentedNode.WithStatus
Returns status of the instance of the typeSchemaNode
.- Specified by:
getStatus
in interfaceDocumentedNode.WithStatus
- Returns:
- status of this node which represents the argument of the YANG
status
substatement
-
getUnknownSchemaNodes
public List<UnknownSchemaNode> getUnknownSchemaNodes()
Description copied from interface:DocumentedNode
Returns unknown schema nodes which belongs to this instance. Default implementation returns an empty list.- Specified by:
getUnknownSchemaNodes
in interfaceDocumentedNode
- Returns:
- list of unknown schema nodes defined under this node.
-
getTypeDefinitions
public Set<TypeDefinition<?>> getTypeDefinitions()
Description copied from interface:DataNodeContainer
Returns set of all newly defined types within this DataNodeContainer.- Specified by:
getTypeDefinitions
in interfaceDataNodeContainer
- Returns:
- typedef statements in lexicographical order
-
getChildNodes
public Set<DataSchemaNode> getChildNodes()
Description copied from interface:DataNodeContainer
Returns set of all child nodes defined within this DataNodeContainer. Although the return type is a collection, each node is guaranteed to be present at most once.Note that the nodes returned are NOT
data nodes
, but ratherDataSchemaNode
s, henceChoiceSchemaNode
andCaseSchemaNode
are present instead of their children. This is consistent withschema tree
.- Specified by:
getChildNodes
in interfaceDataNodeContainer
- Returns:
- child nodes in lexicographical order
-
getGroupings
public Set<GroupingDefinition> getGroupings()
Description copied from interface:DataNodeContainer
Returns set of all groupings defined within this DataNodeContainer.- Specified by:
getGroupings
in interfaceDataNodeContainer
- Returns:
- grouping statements in lexicographical order
-
findDataChildByName
public Optional<DataSchemaNode> findDataChildByName(QName name)
Description copied from interface:DataNodeContainer
Returns the child node corresponding to the specified name.Note that the nodes searched are NOT
data nodes
, but ratherDataSchemaNode
s, henceChoiceSchemaNode
andCaseSchemaNode
are returned instead of their matching children.- Specified by:
findDataChildByName
in interfaceDataNodeContainer
- Parameters:
name
- QName of child- Returns:
- child node of this DataNodeContainer if child with given name is present, empty otherwise
-
getUses
public Set<UsesNode> getUses()
Description copied from interface:DataNodeContainer
Returns grouping nodes used ny this container.- Specified by:
getUses
in interfaceDataNodeContainer
- Returns:
- Set of all uses nodes defined within this DataNodeContainer
-
isPresenceContainer
public boolean isPresenceContainer()
Description copied from interface:ContainerSchemaNode
Returns true if this container is marked as presence.- Specified by:
isPresenceContainer
in interfaceContainerSchemaNode
- Returns:
- true, if presence of this container has an explicit meaning, false otherwise
-
getAvailableAugmentations
public Set<AugmentationSchemaNode> getAvailableAugmentations()
Description copied from interface:AugmentationTarget
Returns augmentations targeting this element.- Specified by:
getAvailableAugmentations
in interfaceAugmentationTarget
- Returns:
- set of augmentations targeting this element.
-
-