@NotThreadSafe public abstract class YangSourceContextResolver extends Object
YangSourceContextResolver and its subclasses are responsible for
resolving YangSourceContext based on provided
SchemaSourceProvider and set of modules to process.
YangSourceContext implementators
of this class are required to implement following methods:
getDependencyInfo(SourceIdentifier) - Retrieval of dependency
informationresolveContext() - Main resolution algorithm
resolveContext() to create YangSourceContext:
resolveSource(SourceIdentifier) and
resolveSource(String, Optional) - Tries to resolve state for
supplied model identifier and updates internal state. If state was not
already resolved for identifier it invokes
getDependencyInfo(SourceIdentifier) for particular identifier. This
method is recursively invoked for all dependencies.createSourceContext() - Creates YangSourceContext based
on previous invocations of resolveSource(SourceIdentifier) methods.| Modifier and Type | Class and Description |
|---|---|
static class |
YangSourceContextResolver.ResolutionState
State of source code resolution
|
| Constructor and Description |
|---|
YangSourceContextResolver(org.opendaylight.yangtools.yang.model.util.repo.AdvancedSchemaSourceProvider<InputStream> sourceProvider) |
| Modifier and Type | Method and Description |
|---|---|
protected YangSourceContext |
createSourceContext() |
org.opendaylight.yangtools.yang.model.util.repo.AdvancedSchemaSourceProvider<InputStream> |
getSourceProvider()
Return Source provider against which YANG source context was computed
|
abstract YangSourceContext |
resolveContext()
Resolves
YangSourceContext
Implementators of this method should invoke
resolveSource(SourceIdentifier) for sources which should be
present in YangSourceContext and createSourceContext()
to create resulting YangSourceContext which will contain state
derived by callbacks to getDependencyInfo(SourceIdentifier). |
YangSourceContextResolver.ResolutionState |
resolveSource(org.opendaylight.yangtools.yang.model.util.repo.SourceIdentifier identifier)
Resolves state of source and updates internal state accordingly.
|
YangSourceContextResolver.ResolutionState |
resolveSource(String name,
com.google.common.base.Optional<String> formattedRevision)
Resolves resolution state for provided name and formated revision
This method is shorthand for
resolveSource(SourceIdentifier)
with argument new SourceIdentifier(name, formattedRevision) |
public YangSourceContextResolver(org.opendaylight.yangtools.yang.model.util.repo.AdvancedSchemaSourceProvider<InputStream> sourceProvider)
public abstract YangSourceContext resolveContext()
YangSourceContext
Implementators of this method should invoke
resolveSource(SourceIdentifier) for sources which should be
present in YangSourceContext and createSourceContext()
to create resulting YangSourceContext which will contain state
derived by callbacks to getDependencyInfo(SourceIdentifier).YangSourceContext.public org.opendaylight.yangtools.yang.model.util.repo.AdvancedSchemaSourceProvider<InputStream> getSourceProvider()
public final YangSourceContextResolver.ResolutionState resolveSource(String name, com.google.common.base.Optional<String> formattedRevision)
resolveSource(SourceIdentifier)
with argument new SourceIdentifier(name, formattedRevision)name - Name of YANG modelformattedRevision - revision of YANG modelresolveSource(SourceIdentifier)public final YangSourceContextResolver.ResolutionState resolveSource(org.opendaylight.yangtools.yang.model.util.repo.SourceIdentifier identifier)
Resolves state of source and updates internal state based on resolution.
This method tries to get module dependency info via user implementation
of getDependencyInfo(SourceIdentifier) and then is recursively
called for each announced dependency in
YangModelDependencyInfo.getDependencies().
Resolution state of resolveSource is internally cached and is used in
subsequent resolution of dependent modules and in creation of
YANGSourceContext via createSourceContext().
Possible resolution state for sources are:
YangSourceContextResolver.ResolutionState.EVERYTHING_OK - If sources for module and its
dependencies are availableYangSourceContextResolver.ResolutionState.MISSING_DEPENDENCY - If dependency of source
is missing (call to getDependencyInfo(SourceIdentifier) for
imported / included model returned returned Optional.absent().YangSourceContextResolver.ResolutionState.MISSING_SOURCE - If source is missing. (call
of getDependencyInfo(SourceIdentifier) returned
Optional.absent().YangSourceContextResolver.ResolutionState.OTHER_ERROR - If other runtime error
prevented resolution of informations.getDependencyInfo(SourceIdentifier) contract requires
implementors to return same information during life of this object.identifier - Source Identifierprotected YangSourceContext createSourceContext()
Copyright © 2014. All rights reserved.