Class YangTextSchemaContextResolver
java.lang.Object
org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver
- All Implemented Interfaces:
AutoCloseable,org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<YangTextSource>
public final class YangTextSchemaContextResolver
extends Object
implements AutoCloseable, org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<YangTextSource>
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static @NonNull YangTextSchemaContextResolverstatic @NonNull YangTextSchemaContextResolverReturn the set of sources currently available in this resolved.Optional<? extends EffectiveModelContext>Try to parse all currently available yang files and build new schema context.Optional<? extends EffectiveModelContext>getEffectiveModelContext(org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode statementParserMode) Try to parse all currently available yang files and build new schema context depending on specified parsing mode.@NonNull com.google.common.util.concurrent.FluentFuture<YangTextSource>getSource(SourceIdentifier sourceIdentifier) getSourceTexts(SourceIdentifier sourceIdentifier) @NonNull RegistrationregisterSource(@NonNull URL url) Register a URL containing a YANG text.@NonNull RegistrationregisterSource(@NonNull YangTextSource source) Register aYangTextSource.@NonNull RegistrationregisterSupportedFeatures(QNameModule module, Set<String> features) Register aQNameModuleas a known module namespace with a set of supported features.trySchemaContext(org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode statementParserMode)
-
Method Details
-
create
-
create
public static @NonNull YangTextSchemaContextResolver create(String name, org.opendaylight.yangtools.yang.parser.api.YangParserFactory factory) -
registerSource
public @NonNull Registration registerSource(@NonNull YangTextSource source) throws org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException, IOException, org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException Register aYangTextSource.- Parameters:
source- YANG text source- Returns:
- a
Registration - Throws:
org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException- When the YANG file is syntactically invalidIOException- when the URL is not readableorg.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException- When parsing encounters general errorNullPointerException- ifsourceisnull
-
registerSource
public @NonNull Registration registerSource(@NonNull URL url) throws org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException, IOException, org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException Register a URL containing a YANG text.- Parameters:
url- YANG text source URL- Returns:
- a YangTextSchemaSourceRegistration for this URL
- Throws:
org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException- When the YANG file is syntactically invalidIOException- when the URL is not readableorg.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException- When parsing encounters general errorNullPointerException- ifurlisnull
-
registerSupportedFeatures
Register aQNameModuleas a known module namespace with a set of supported features. Union of these registrations is forwarded toFeatureSetand this is then used ingetEffectiveModelContext()and related methods.- Parameters:
module- Module namespacefeatures- Features supported for that module namespace- Returns:
- a
Registration, useRegistration.close()to revert the effects of this method - Throws:
NullPointerException- if any argument isnull
-
getEffectiveModelContext
Try to parse all currently available yang files and build new schema context.- Returns:
- new schema context iif there is at least 1 yang file registered and new schema context was successfully built.
-
getEffectiveModelContext
public Optional<? extends EffectiveModelContext> getEffectiveModelContext(org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode statementParserMode) Try to parse all currently available yang files and build new schema context depending on specified parsing mode.- Parameters:
statementParserMode- mode of statement parser- Returns:
- new schema context iif there is at least 1 yang file registered and new schema context was successfully built.
-
getSource
public @NonNull com.google.common.util.concurrent.FluentFuture<YangTextSource> getSource(SourceIdentifier sourceIdentifier) - Specified by:
getSourcein interfaceorg.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<YangTextSource>
-
getAvailableSources
Return the set of sources currently available in this resolved.- Returns:
- An immutable point-in-time view of available sources.
-
getSourceTexts
-
trySchemaContext
@Beta public EffectiveModelContext trySchemaContext() throws org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException, ExecutionException- Throws:
org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionExceptionExecutionException
-
trySchemaContext
@Beta public EffectiveModelContext trySchemaContext(org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode statementParserMode) throws org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException, ExecutionException - Throws:
org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionExceptionExecutionException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-