Class YangTextSchemaContextResolver
- java.lang.Object
-
- org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver
-
- All Implemented Interfaces:
AutoCloseable,org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource>
public final class YangTextSchemaContextResolver extends Object implements AutoCloseable, org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static @NonNull YangTextSchemaContextResolvercreate(String name)static @NonNull YangTextSchemaContextResolvercreate(String name, org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory factory)Set<org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier>getAvailableSources()Return the set of sources currently available in this resolved.Optional<? extends org.opendaylight.yangtools.yang.model.api.EffectiveModelContext>getEffectiveModelContext()Try to parse all currently available yang files and build new schema context.Optional<? extends org.opendaylight.yangtools.yang.model.api.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<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource>getSource(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier sourceIdentifier)Collection<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource>getSourceTexts(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier sourceIdentifier)@NonNull YangTextSchemaSourceRegistrationregisterSource(@NonNull URL url)Register a URL containing a YANG text.@NonNull YangTextSchemaSourceRegistrationregisterSource(@NonNull org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource source)Register aYangTextSchemaSource.org.opendaylight.yangtools.yang.model.api.EffectiveModelContexttrySchemaContext()org.opendaylight.yangtools.yang.model.api.EffectiveModelContexttrySchemaContext(org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode statementParserMode)
-
-
-
Method Detail
-
create
public static @NonNull YangTextSchemaContextResolver create(String name)
-
create
public static @NonNull YangTextSchemaContextResolver create(String name, org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory factory)
-
registerSource
public @NonNull YangTextSchemaSourceRegistration registerSource(@NonNull org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource source) throws org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException, IOException, org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException
Register aYangTextSchemaSource.- Parameters:
source- YANG text source- Returns:
- a YangTextSchemaSourceRegistration
- Throws:
org.opendaylight.yangtools.yang.model.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 error
-
registerSource
public @NonNull YangTextSchemaSourceRegistration registerSource(@NonNull URL url) throws org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException, IOException, org.opendaylight.yangtools.yang.model.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.model.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 error
-
getEffectiveModelContext
public Optional<? extends org.opendaylight.yangtools.yang.model.api.EffectiveModelContext> 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 org.opendaylight.yangtools.yang.model.api.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<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource> getSource(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier sourceIdentifier)
- Specified by:
getSourcein interfaceorg.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource>
-
getAvailableSources
public Set<org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier> getAvailableSources()
Return the set of sources currently available in this resolved.- Returns:
- An immutable point-in-time view of available sources.
-
getSourceTexts
@Beta public Collection<org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource> getSourceTexts(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier sourceIdentifier)
-
trySchemaContext
@Beta public org.opendaylight.yangtools.yang.model.api.EffectiveModelContext trySchemaContext() throws org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException- Throws:
org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException
-
trySchemaContext
@Beta public org.opendaylight.yangtools.yang.model.api.EffectiveModelContext trySchemaContext(org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode statementParserMode) throws org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException- Throws:
org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-