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 Details

    • create

      public static @NonNull YangTextSchemaContextResolver create(String name)
    • 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 a YangTextSource.
      Parameters:
      source - YANG text source
      Returns:
      a Registration
      Throws:
      org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException - When the YANG file is syntactically invalid
      IOException - when the URL is not readable
      org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException - When parsing encounters general error
      NullPointerException - if source is null
    • 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 invalid
      IOException - when the URL is not readable
      org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException - When parsing encounters general error
      NullPointerException - if url is null
    • registerSupportedFeatures

      public @NonNull Registration registerSupportedFeatures(QNameModule module, Set<String> features)
      Register a QNameModule as a known module namespace with a set of supported features. Union of these registrations is forwarded to FeatureSet and this is then used in getEffectiveModelContext() and related methods.
      Parameters:
      module - Module namespace
      features - Features supported for that module namespace
      Returns:
      a Registration, use Registration.close() to revert the effects of this method
      Throws:
      NullPointerException - if any argument is null
    • getEffectiveModelContext

      public Optional<? extends 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 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:
      getSource in interface org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider<YangTextSource>
    • getAvailableSources

      public Set<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<YangTextSource> getSourceTexts(SourceIdentifier sourceIdentifier)
    • trySchemaContext

      @Beta public EffectiveModelContext trySchemaContext() throws org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException, ExecutionException
      Throws:
      org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException
      ExecutionException
    • 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.SchemaResolutionException
      ExecutionException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable